-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: channels.whatsapp.start-account blocks event loop ~40s, triggering reconnect storm #78165
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Description
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.Crash, hang, restart loop, or process-level availability failure.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
The
channels.whatsapp.start-accountstartup phase blocks the Node event loop for ~30–40s on a single tick, causing anevent_loop_delayliveness warning and tripping WhatsApp's keepalive timeout, which forces an immediate reconnect that re-runs the same expensive bootstrap (reconnect storm).Steps to reproduce
2026.5.4on Windows 11 with a long-lived WhatsApp account paired (existing Baileys session, large signal store).openclaw channels login --channel whatsapp --account default).Reproduced live at 20:38 local with the diagnostic below; the same
start-accountphase reappears every time the WA listener is brought back up after being idle for hours.Expected behavior
channels.<id>.start-accountshould never block the event loop long enough to trip the liveness warning (eventLoopDelayMaxMs< 1000ms) or the upstream WhatsApp keepalive (~30s), so a single reconnect completes in one bootstrap cycle without cascading further reconnects. Other channels (Telegram, Signal) bootstrap in <1s on the same gateway and do not exhibit this pattern.Actual behavior
Single tick of work inside
start-accountblocks the loop for ~40s. The diagnostic line:While the loop is blocked, the WhatsApp WebSocket keepalive misses its window and the underlying provider drops the socket, which then auto-reconnects and re-enters
start-account— looping until the bootstrap finally completes (typically one or two extra cycles, ~60–80s of unresponsiveness).The relevant frame in the bundled output (
dist/server-channels-CP_Np2uZ.js:401) is just aPromise.resolve().then()aroundplugin.gateway.startAccount(...)— the long synchronous chunk lives inside the WhatsApp plugin'sstartAccount(Baileys auth-state load + replay), so chunking/yielding (e.g.await new Promise(setImmediate)between heavy steps, or moving the auth-state replay to aworker_thread) needs to happen inside that plugin, not at the call site.OpenClaw version
2026.5.4
Operating system
Windows 11 (10.0.26200, x64)
Install method
npm global (
npm install -g openclaw, Node v24.15.0)Model
github-copilot/claude-opus-4.7
Provider / routing chain
openclaw -> github-copilot
Additional provider/model setup details
Provider/model is unrelated to the symptom —
start-accountruns inside the gateway/channel-plugin host before the agent runtime is involved. Same gateway hosts Telegram + webchat with no event-loop warnings.Logs, screenshots, and evidence
Bundled call site (for reference, not a fix location):
The fix needs to land inside the bundled WhatsApp plugin's
startAccountimplementation (Baileys-side auth-state load / signal-store rehydrate).Impact and severity
2026.5.4— fires every time the WA listener bootstraps.waiting=0 queued=1in the diagnostic shows queued work), and stuckprocessing,q=1,age=41swork items on the affected session.Additional information
patches/@[email protected]addresses media-stream races but not the auth-state bootstrap cost.gateway restart) oropenclaw channels logout/login --channel whatsapp --account defaultresets the session so the nextstart-accountis cheaper, but the underlying expensive synchronous step remains.whatsapp-relogincron auto-revive failures). Suspect the two are related — when the bootstrap blocks long enough, the watchdog cron itself can't run because the loop is stuck.