






















@@ -1,7 +1,16 @@
1-import { describe, expect, it } from "vitest";
1+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
22import { collectWhatsAppStatusIssues } from "./status-issues.js";
3344describe("collectWhatsAppStatusIssues", () => {
5+beforeEach(() => {
6+vi.stubEnv("OPENCLAW_CONTAINER_HINT", "");
7+vi.stubEnv("OPENCLAW_PROFILE", "");
8+});
9+10+afterEach(() => {
11+vi.unstubAllEnvs();
12+});
13+514it("reports unlinked enabled accounts", () => {
615const issues = collectWhatsAppStatusIssues([
716{
@@ -12,11 +21,13 @@ describe("collectWhatsAppStatusIssues", () => {
1221]);
13221423expect(issues).toEqual([
15-expect.objectContaining({
24+{
1625channel: "whatsapp",
1726accountId: "default",
1827kind: "auth",
19-}),
28+message: "Not linked (no WhatsApp Web session).",
29+fix: "Run: openclaw channels login (scan QR on the gateway host).",
30+},
2031]);
2132});
2233@@ -30,12 +41,13 @@ describe("collectWhatsAppStatusIssues", () => {
3041]);
31423243expect(issues).toEqual([
33-expect.objectContaining({
44+{
3445channel: "whatsapp",
3546accountId: "default",
3647kind: "auth",
3748message: "Auth state is still stabilizing.",
38-}),
49+fix: "Wait a moment for queued credential writes to finish, then retry the command or rerun health.",
50+},
3951]);
4052});
4153@@ -53,12 +65,13 @@ describe("collectWhatsAppStatusIssues", () => {
5365]);
54665567expect(issues).toEqual([
56-expect.objectContaining({
68+{
5769channel: "whatsapp",
5870accountId: "work",
5971kind: "runtime",
6072message: "Linked but disconnected (reconnectAttempts=2): socket closed",
61-}),
73+fix: "Run: openclaw doctor (or restart the gateway). If it persists, relink via channels login and check logs.",
74+},
6275]);
6376});
6477@@ -76,12 +89,13 @@ describe("collectWhatsAppStatusIssues", () => {
7689]);
77907891expect(issues).toEqual([
79-expect.objectContaining({
92+{
8093channel: "whatsapp",
8194accountId: "default",
8295kind: "runtime",
83-message: expect.stringContaining("Linked but stale"),
84-}),
96+message: "Linked but stale (last inbound 2m ago).",
97+fix: "Run: openclaw doctor (or restart the gateway). If it persists, relink via channels login and check logs.",
98+},
8599]);
86100});
87101@@ -104,13 +118,14 @@ describe("collectWhatsAppStatusIssues", () => {
104118]);
105119106120expect(issues).toEqual([
107-expect.objectContaining({
121+{
108122channel: "whatsapp",
109123accountId: "default",
110124kind: "runtime",
111125message:
112126"Linked but recently reconnected (reconnectAttempts=3): status=408 Request Time-out Connection was lost",
113-}),
127+fix: "Watch: openclaw logs --follow and run openclaw channels status --probe if disconnects continue. If it keeps flapping, restart the gateway or relink via channels login.",
128+},
114129]);
115130});
116131此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。