Skip to content

fix: reconnect after WhatsApp stream replacement#266

Merged
steipete merged 3 commits into
openclaw:mainfrom
ngutman:fix-streamreplaced-reconnect
May 23, 2026
Merged

fix: reconnect after WhatsApp stream replacement#266
steipete merged 3 commits into
openclaw:mainfrom
ngutman:fix-streamreplaced-reconnect

Conversation

@ngutman
Copy link
Copy Markdown
Member

@ngutman ngutman commented May 23, 2026

Summary

  • handle whatsmeow StreamReplaced events in the sync event handler
  • route stream replacement through the existing reconnect path used for disconnects
  • add a regression test that verifies follow mode reconnects after stream replacement

Tests

  • go test ./...

@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 23, 2026

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-23 09:03 UTC / May 23, 2026, 5:03 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
The PR routes whatsmeow StreamReplaced events through the existing sync reconnect channel and adds a follow-mode regression test.

Reproducibility: yes. from source inspection: current main ignores StreamReplaced while the pinned whatsmeow module emits it for replaced streams without using the existing Disconnected reconnect path. I did not run tests because this review is read-only.

PR rating
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Summary: Small focused bug fix with regression coverage and no blocking findings; proof gating is not applicable for this member-authored PR.

Rank-up moves:

  • none
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Not applicable: The real behavior proof gate is not applicable because the PR is member-authored; the body reports go test ./... as validation.

Next step before merge
No repair lane is needed; this member-authored PR is ready for ordinary maintainer review and CI rather than cleanup automation.

Security
Cleared: The diff only changes internal Go event handling and a unit test; it does not touch dependencies, CI, secrets, install scripts, or other supply-chain surfaces.

Review details

Best possible solution:

Land the narrow handler and regression test after normal maintainer review and CI, preserving the existing reconnect deadline behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, from source inspection: current main ignores StreamReplaced while the pinned whatsmeow module emits it for replaced streams without using the existing Disconnected reconnect path. I did not run tests because this review is read-only.

Is this the best way to solve the issue?

Yes; reusing the existing disconnected channel is the narrowest maintainable fix because it preserves the current reconnect loop, timeout, and output/event plumbing.

Label changes:

  • add P2: This is a focused sync reliability bug fix for a real WhatsApp lifecycle event with limited blast radius.
  • add rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🌊 off-meta tidepool, patch quality is 🐚 platinum hermit, and Small focused bug fix with regression coverage and no blocking findings; proof gating is not applicable for this member-authored PR.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The real behavior proof gate is not applicable because the PR is member-authored; the body reports go test ./... as validation.

Label justifications:

  • P2: This is a focused sync reliability bug fix for a real WhatsApp lifecycle event with limited blast radius.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🌊 off-meta tidepool, patch quality is 🐚 platinum hermit, and Small focused bug fix with regression coverage and no blocking findings; proof gating is not applicable for this member-authored PR.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The real behavior proof gate is not applicable because the PR is member-authored; the body reports go test ./... as validation.

What I checked:

  • Current main only reconnects from Disconnected events: Current main emits the disconnected signal for events.Disconnected, but there is no StreamReplaced case in the sync event handler. (internal/app/sync_events.go:86, dc75b680c4ae)
  • Existing reconnect path is channel-driven: runSyncFollow already consumes the disconnected channel and calls reconnect with MaxReconnect, so the PR reuses the established reconnect mechanism. (internal/app/sync_idle.go:10, dc75b680c4ae)
  • PR diff is focused: The PR adds a StreamReplaced handler that emits a lifecycle event and sends the existing disconnected signal, plus a fake-WA test expecting a second connect call. (internal/app/sync_events.go:91, 8e34edaf358c)
  • Upstream event semantics checked: The pinned whatsmeow module defines StreamReplaced as the event emitted when another client connects with the same keys, and its client dispatches that event for replaced stream errors. (go.mau.fi/whatsmeow/types/events/events.go:113, 6dd3d24c1ca6)
  • No duplicate canonical item found: A GitHub issue/PR search for StreamReplaced and stream replacement terms only returned this PR as the matching item.
  • Member-authored PR: GitHub PR metadata reports author_association MEMBER, so cleanup automation should not close it. (8e34edaf358c)

Likely related people:

  • steipete: GitHub history shows steipete split the sync event and idle loops and has multiple earlier sync-path changes, including the reconnect loop structure this PR reuses. (role: feature-history owner; confidence: high; commits: 668d7e5762a9, 0796db5ff95b; files: internal/app/sync_idle.go, internal/app/sync_events.go)
  • dinakars777: GitHub history shows dinakars777 added NDJSON lifecycle events, which is adjacent to the new stream_replaced event emitted by this PR. (role: adjacent owner; confidence: medium; commits: 108da989f7bd; files: internal/app/sync_idle.go, internal/app/sync_events.go)
  • dovocoder: Recent merged commits touched sync event handling and sync tests around live WhatsApp events, making dovocoder a useful routing candidate for this area. (role: recent area contributor; confidence: medium; commits: 12c8d8a6a98a, 20e114aa9df2, 8d35558f5633; files: internal/app/sync_events.go, internal/app/sync_test.go)

Codex review notes: model gpt-5.5, reasoning high; reviewed against dc75b680c4ae.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal priority bug or improvement with limited blast radius. labels May 23, 2026
@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 23, 2026

ClawSweeper PR egg

✨ Hatched: ✨ glimmer Frosted Proofling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: ✨ glimmer.
Trait: hums during re-review.
Image traits: location review cove; accessory proof snapshot camera; palette rose quartz and slate; mood determined; pose guarding a tiny green check; shell translucent glimmer shell; lighting gentle morning glow; background miniature CI buoys.
Share on X: post this hatch
Copy: My PR egg hatched a ✨ glimmer Frosted Proofling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@steipete steipete merged commit e9f1830 into openclaw:main May 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants