fix(whatsapp): delay running status until startup setup · openclaw/openclaw@59fb685
vincentkoc
·
2026-06-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -140,6 +140,26 @@ describe("web auto-reply connection", () => {
|
140 | 140 | expect(formatEnvelopeTimestamp(d, " America/Los_Angeles ")).toBe("Tue 2024-12-31 16:00:00 PST"); |
141 | 141 | }); |
142 | 142 | |
| 143 | +it("does not publish running status when config loading fails", async () => { |
| 144 | +setLoadConfigMock(() => { |
| 145 | +throw new Error("config snapshot failed"); |
| 146 | +}); |
| 147 | + |
| 148 | +const statuses: Array<{ running?: boolean }> = []; |
| 149 | +const listenerFactory = vi.fn(async () => createMockWebListener()); |
| 150 | +const { run } = startWebAutoReplyMonitor({ |
| 151 | +monitorWebChannelFn: monitorWebChannel as never, |
| 152 | + listenerFactory, |
| 153 | +sleep: vi.fn(async () => {}), |
| 154 | +statusSink: (next) => statuses.push({ ...next }), |
| 155 | +}); |
| 156 | + |
| 157 | +await expect(run).rejects.toThrow("config snapshot failed"); |
| 158 | + |
| 159 | +expect(listenerFactory).not.toHaveBeenCalled(); |
| 160 | +expect(statuses.some((status) => status.running === true)).toBe(false); |
| 161 | +}); |
| 162 | + |
143 | 163 | it("handles reconnect progress and max-attempt stop behavior", async () => { |
144 | 164 | for (const scenario of [ |
145 | 165 | { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -159,9 +159,6 @@ export async function monitorWebChannel(
|
159 | 159 | const replyLogger = getChildLogger({ module: "web-auto-reply", runId }); |
160 | 160 | const heartbeatLogger = getChildLogger({ module: "web-heartbeat", runId }); |
161 | 161 | const reconnectLogger = getChildLogger({ module: "web-reconnect", runId }); |
162 | | -const statusController = createWebChannelStatusController(tuning.statusSink); |
163 | | -statusController.emit(); |
164 | | - |
165 | 162 | const baseCfg = getRuntimeConfig(); |
166 | 163 | const sourceCfg = getRuntimeConfigSourceSnapshot(); |
167 | 164 | const { cfg, account } = resolveWebMonitorConfigSnapshot({ |
@@ -234,6 +231,8 @@ export async function monitorWebChannel(
|
234 | 231 | sleep, |
235 | 232 | isNonRetryableStatus: isNonRetryableWebCloseStatus, |
236 | 233 | }); |
| 234 | +const statusController = createWebChannelStatusController(tuning.statusSink); |
| 235 | +statusController.emit(); |
237 | 236 | |
238 | 237 | try { |
239 | 238 | while (true) { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。