Skip to content

fix(whatsapp): prevent shutdown test stalls on slow admission - #166531

Merged
RomneyDa merged 1 commit into
mainfrom
fix/whatsapp-serialized-drain-test-clock
Oct 7, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/whatsapp-serialized-drain-test-clock

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes the WhatsApp serialized-reply shutdown test hanging when durable admission reaches debounce after its fake clock has already advanced.

User Impact

CI no longer depends on SQLite/worker admission finishing within a virtual clock tick. Production WhatsApp behavior is unchanged.

Why This Change Was Made

The same 120-second timeout blocked both the frozen 2026.9.9 validation and its otherwise passing repair PR. The existing test is byte-identical on current main. A held durable-admission probe reproduced the cause: after advancing the clock before releasing admission, the first callback remained at zero and its debounce timer was still pending.

Wait on the existing shouldDebounce milestone before advancing 50 ms. Reuse the file's selective fake-clock helper so real I/O milestones continue running. All reply ordering and socket shutdown assertions stay intact; no timeout increase, retry, extra test, or production seam.

Evidence

  • Pre-fix late-admission probe failed with the intended zero-callback assertion (1.867s execution); it drained the listener during cleanup.
  • Full existing file: 18/18 tests passed with --maxWorkers=1, 33.98s wrapper wall (30.46s Vitest including transformations); repaired case 246ms.
  • Independent P1 review: scoped-clean.
  • Formatting and git diff --check passed. Changed-file type-aware lint passed.
  • Original root failure: exact CI job. The cancelled peer finished all tests successfully; it is fail-fast collateral, not a second regression.
  • This repair unblocks the approved release backports. Release publication remains paused. Exact-head required CI passed: changed Node 167s job wall, changed boundary 137s job wall (164 tests / 12 files, 61.71s Vitest), and changed extension configuration 138s job wall. The changed extension-configuration job exercised the full WhatsApp file: 18/18 passed, 61.83s Vitest wall, repaired case 176ms. ClawSweeper completed exact-head review with no findings.

@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: XS labels Oct 7, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review October 7, 2026 08:47
@clawsweeper clawsweeper Bot added P2 Normal backlog priority 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. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 4:52 AM ET / 08:52 UTC.

ClawSweeper review

What this changes

The PR makes the WhatsApp shutdown test wait for durable admission before advancing its selective fake clock.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on the pinned main revision. The synchronization addresses the admission race without weakening shutdown assertions; no actionable patch defect was found.

Priority: P2
Reviewed head: 0247bec6096c1ee9e8c5db1b0201befb7a6a3b6a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused synchronization repair preserves meaningful assertions and supplies relevant reported validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The MEMBER-authored PR changes only test synchronization around the existing WhatsApp delivery owner. Reported failing-probe and passing-suite results support the repair; no production or stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The MEMBER-authored PR changes only test synchronization around the existing WhatsApp delivery owner. Reported failing-probe and passing-suite results support the repair; no production or stored-data contract changes.
Evidence reviewed 6 items Introduced repair: The introduced delta replaces unrestricted fake timers with the existing selective clock helper and awaits the debounce predicate milestone. The two-handler, four-send, and send-before-close assertions remain intact.
Milestone precedes timer installation: For the first direct message, the WhatsApp debounce predicate and shared debouncer timer installation run without an intervening await. Resolving the milestone therefore lets the test advance time after the timer exists.
Current main still needs the repair: Pinned main retains the immediate clock advance without an admission milestone. The verified test merge has the exact main and PR-head parents, and its delta against main contains only this test repair.
Findings None None.
Security None None.

How this fits together

WhatsApp inbound messages pass through durable admission and debounce before reply handlers run. Shutdown drains those handlers before closing the socket; this PR repairs the test's synchronization around that flow.

flowchart LR
  A[Incoming WhatsApp messages] --> B[Durable admission]
  B --> C[Debounce buffer]
  C --> D[Reply handlers]
  E[Shutdown request] --> F[Drain pending work]
  D --> F
  F --> G[Socket close]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +3. Total +3 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 10 7 +3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 10 7 +3

Review metrics

None.

Technical review

Best possible solution:

Keep the existing shutdown coverage synchronized with admission while preserving reply ordering and socket-close checks.

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

Yes, source establishes the race: durable admission can install the debounce timer after the original test advances time. The body reports a forced late-admission failure; this review did not execute it.

Is this the best way to solve the issue?

Yes, waiting on the existing debounce milestone and reusing the selective clock is a focused repair that retains the observable shutdown contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 92fca0f5bfef.

Labels

Label changes:

  • add P2: This is a bounded test synchronization repair for a documented validation stall, with no production behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR changes only test synchronization around the existing WhatsApp delivery owner. Reported failing-probe and passing-suite results support the repair; no production or stored-data contract changes.

Label justifications:

  • P2: This is a bounded test synchronization repair for a documented validation stall, with no production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The MEMBER-authored PR changes only test synchronization around the existing WhatsApp delivery owner. Reported failing-probe and passing-suite results support the repair; no production or stored-data contract changes.

Evidence

What I checked:

  • Introduced repair: The introduced delta replaces unrestricted fake timers with the existing selective clock helper and awaits the debounce predicate milestone. The two-handler, four-send, and send-before-close assertions remain intact. (extensions/whatsapp/src/monitor-inbox.delivery-and-dedupe.test.ts:582, 0247bec6096c)
  • Milestone precedes timer installation: For the first direct message, the WhatsApp debounce predicate and shared debouncer timer installation run without an intervening await. Resolving the milestone therefore lets the test advance time after the timer exists. (extensions/whatsapp/src/inbound/message-debounce.ts:171, 0247bec6096c)
  • Current main still needs the repair: Pinned main retains the immediate clock advance without an admission milestone. The verified test merge has the exact main and PR-head parents, and its delta against main contains only this test repair. (extensions/whatsapp/src/monitor-inbox.delivery-and-dedupe.test.ts:582, 45278ae59b73)
  • Reported validation and release relationship: The captured PR body reports an intentionally failing late-admission probe, 18/18 passing existing tests after repair, 33.98 seconds wrapper wall time, and a 246 ms repaired case. The open release backport at fix: backport Doctor and Claude reply repairs to 2026.9.9 #166524 identifies this as its owning main-branch test repair, rather than a replacement implementation. (0247bec6096c)
  • Feature-history routing: Available main-history metadata identifies Peter Steinberger's shutdown coverage and retry-clock work, and Marcus Castro's independent debounce admission work. These support routing candidates, not verified source-line introduction attribution. (extensions/whatsapp/src/monitor-inbox.delivery-and-dedupe.test.ts, 92fca0f5bfef)
  • Read-only review limitations: Source and main-history metadata were inspected. Deeper historical patch/blame reads failed when unavailable objects attempted retrieval with HTTP 403, and the live GraphQL read also returned 403. Tests were not executed under the read-only review contract; reported execution results remain contributor evidence.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Marcus Castro: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@RomneyDa
RomneyDa merged commit 1f576e4 into main Oct 7, 2026
176 checks passed
@RomneyDa
RomneyDa deleted the fix/whatsapp-serialized-drain-test-clock branch October 7, 2026 08:56
@RomneyDa

RomneyDa commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Merged via squash.

RomneyDa added a commit that referenced this pull request Oct 7, 2026
RomneyDa added a commit that referenced this pull request Oct 7, 2026
Backport the approved Doctor/update and Claude CLI fixes to the frozen 2026.9.9 cut. Preserve release-local migration prelude and recovery paths. Include the landed WhatsApp fixture synchronization repair uncovered by validation. No version, dependency, schema, or publication change.

Sources: #164868, #163369, #165837, #165596, and #166531.

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Víctor Gurbani Carballo <[email protected]>
Co-authored-by: Abdel Gomez-Perez <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
NerQuiLes pushed a commit to Xtampa-AI/openclaw that referenced this pull request Oct 11, 2026
Audit all 253 September-only commits against da0cbcc. Port only
applicable fixes and final companions, preserving October owners and
shipped upgrade contracts. Exclude September-specific waivers, schema
rollback, dependency changes, and credential-absence pass conditions.

Adapt retained ACP archive receipts without reopening retired custody;
retain SDK1.30.1 issuer fencing and explicit re-registration; exclude
standalone worker copies from beta.2 updater compatibility bridges.
Report settled Doctor release failures before the no-config early return.

Sources below are whole backports or scoped repair selections:

fix(discord): keep health inspection from blocking Gateway connections (openclaw#166736)
Source-commit: dc26366

fix: avoid foreign-listener race in Gateway acquisition proof (openclaw#166883)
Source-commit: bd0b97d

fix(ci): admit workspace package tests in Windows replay (openclaw#166895)
Source-commit: 9bc88a6

fix(release): restore beta.2 updater inventory and Podman control (openclaw#166872)
Source-commit: e203c64

fix(copilot): plugin tool calls fail from the second turn of a session (openclaw#164598)
Source-commit: c6e5ae8

fix(test): await WhatsApp inbound drain (openclaw#165842)
Source-commit: 05170cd

fix(qa-lab): keep SUT CLI in isolated launcher
Source-commit: 6681bcd

test(qa-lab): assert resolved companion CLI cwd
Source-commit: a60b458

fix(release): accept candidate-owned child evidence (openclaw#165357)
Source-commit: 500c95a

fix(acp): migrate metadata from retained sessions
Source-commit: 16398dc

fix(release): isolate first-hop service containment (openclaw#164898)
Source-commit: 85124fe

fix(release): isolate upgrade survivor scenarios (openclaw#165007)
Source-commit: aad828f

test(release): expect isolated survivor scenarios (openclaw#165009)
Source-commit: 02e7f91

fix(release): split restart auth validation (openclaw#165048)
Source-commit: 6160d9f

test: serialize PowerShell completion process suites (openclaw#166229)
Source-commit: 320e52b

fix(update): settle only this Doctor's commands in managed custody (openclaw#164868)
Source-commit: bdb44e2

fix(claude-cli): replies hang until the run times out when a background agent runs Bash (openclaw#165596)
Source-commit: 889611b

fix(whatsapp): synchronize shutdown test with durable admission (openclaw#166531)
Source-commit: 1f576e4

fix: prevent heartbeat live replies from abbreviating markers (openclaw#166777)
Source-commit: c4ed37e

fix(ci): keep full release validation within measured budgets (openclaw#166774)
Source-commit: 471f950

improve(ci): reuse Watch cache and expose shared scan build progress (openclaw#166498)
Source-commit: 66d898f

fix(e2e): normalize registry helper image modes (openclaw#163188)
Source-commit: 1a09bec

fix: MiniMax live validation misses Code Mode file reads (openclaw#163619)
Source-commit: fc23bc8

fix(test): read canonical ACP upgrade metadata
Source-commit: 46c8dd2

fix(qa): remove unavailable Telegram emoji fixture (openclaw#164956)
Source-commit: e785c56

fix(release): reconcile full validation regressions (openclaw#166200)
Source-commit: a3e349e

fix(release): unblock stable validation evidence (openclaw#166315)
Source-commit: 5ac0f82

fix(release): unblock 2026.9.9 full qualification (openclaw#166341)
Source-commit: 8aa6d7c

test(irc): await owned monitor signals (openclaw#163180)
Source-commit: 429ea8c

fix(release): unblock 2026.9.9 full validation (round 4) (openclaw#166485)
Source-commit: ccb390b

fix(release): repair Doctor teardown and FRV evidence recovery
Source-commit: 5d7fa8e

fix(release): bound FRV job reads and normalize ghost evidence
Source-commit: 1854d41

test(release): align priority fixture with bounded job pages
Source-commit: 4fd4fcc

fix(test): keep MCP validation connected after automatic pairing approval (openclaw#166849)
Source-commit: 0979efd

fix(release): address 2026.9.9 validation failures and retain diagnostics (openclaw#166962)
Source-commit: a024875

fix(release): repair fleet and CLI validation fixtures (openclaw#166977)
Source-commit: b899f42

fix: keep 2026.9.9 upgrades on state schema 19 (openclaw#166959)
Source-commit: bcfc888

fix(ui): keep passive chat viewers following incoming turns
Source-commit: 6d9689d

fix(doctor): commit transcript archive migration progress per batch and honor interruption (openclaw#165837)
Source-commit: 3a085ea

fix(doctor): restore release repair settlement
Source-commit: fab3a66

fix(release): reconcile FRV backports
Source-commit: 0c01cc6

fix(ui): refresh end geometry during interaction (openclaw#166239)
Source-commit: 5b71763

fix(ui): preserve follow intent across content growth (openclaw#166258)
Source-commit: ffcdd4d

fix(ui): gate content follow on height changes (openclaw#166301)
Source-commit: 4964263

fix(release): preserve gateway fixture close callback (openclaw#166348)
Source-commit: 64ad20a

test(ui): await collaborator smooth follow (openclaw#166285)
Source-commit: 90abf6a

Co-authored-by: Eric Curtin <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Abdel Gomez-Perez <[email protected]>
Co-authored-by: Patrick Erichsen <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

1 participant