Skip to content

fix(macos): wait for the current reconnect snapshot - #116550

Merged
vincentkoc merged 4 commits into
mainfrom
fix-macos-snapshot-waiter-timeout-v20
Jul 30, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
fix-macos-snapshot-waiter-timeout-v20

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where the macOS node session could report a replacement Gateway route as connected before that route's hello snapshot arrived when a completed route's delayed snapshot timeout fired during a fast reconnect.

Why This Change Was Made

Each bounded snapshot wait now owns a UUID-keyed continuation, so its timeout can resolve only that wait. Snapshot receipt and route reset still drain the complete current waiter set. A deterministic regression test reproduces the stale-timeout sequence across a route reset.

User Impact

Fast Gateway reconnects no longer admit the macOS route early with stale or missing snapshot-derived capabilities and session defaults.

Evidence

  • Focused Swift Testing regression passed: completed snapshot timeout cannot release a later route waiter
  • Adjacent lifecycle tests passed: connect joins the snapshot dispatched connected callback and transport reconnect does not wait for blocked disconnect lifecycle
  • node scripts/check-changed.mjs -- CHANGELOG.md apps/shared/OpenClawKit/Sources/OpenClawKit/GatewayNodeSession.swift apps/shared/OpenClawKit/Tests/OpenClawKitTests/GatewayNodeSessionTests.swift passed on Blacksmith Testbox
  • Fresh Codex autoreview: no accepted or actionable findings
  • AI-assisted; implementation and proof reviewed by the submitting maintainer

@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 30, 2026 20:18
@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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 5:33 PM ET / 21:33 UTC.

ClawSweeper review

What this changes

The branch gives each macOS Gateway snapshot wait its own UUID-keyed continuation, adds a deterministic fast-reconnect regression test, and makes an unrelated voice-ear expiry test wait on observable state rather than a fragile fixed delay.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer merge review. The patch narrowly prevents a completed route’s delayed snapshot timeout from releasing a replacement macOS Gateway route before that replacement receives its hello snapshot; it is a plausible availability fix with no actionable code defect found in the supplied diff. The current head remains cleanly mergeable but is behind main, and the exact-head native checks were still running, so landing should wait for those checks and an explicit maintainer decision. Likely related people: Mariano Belinky (high confidence) introduced the shared waiter-drain behavior that this patch refines.

Priority: P1
Reviewed head: 5e320be86c4d6f5b30c13f8dfc29550f555f7777
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, well-scoped availability repair with a deterministic regression test; merge readiness depends on the currently running native checks rather than a code correction.
Proof confidence 🌊 off-meta tidepool Not applicable: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; the supplied focused lifecycle evidence and exact-head native CI remain useful supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; the supplied focused lifecycle evidence and exact-head native CI remain useful supplemental validation.
Evidence reviewed 5 items Scoped lifecycle repair: The PR changes the snapshot waiter store from an array to UUID-keyed continuations; a timeout removes and resumes only its matching waiter, while snapshot receipt and route reset retain the complete-current-waiter drain behavior.
Regression coverage: The new test completes an initial snapshot wait, resets connection state, starts a replacement wait, lets the original timeout pass, then verifies the replacement wait remains pending until its own snapshot arrives.
Timing-test stabilization: The additional macOS test change replaces a fixed 60 ms sleep with a bounded poll of the observable expiry state, addressing the separately observed CI timing flake without changing production behavior.
Findings None None.
Security None None.

How this fits together

The macOS node session connects a native client to the Gateway and waits for the Gateway hello snapshot before treating a route as ready. Snapshot receipt or connection reset completes the relevant waiters, after which the route can expose snapshot-derived capabilities and session defaults to the app.

flowchart LR
  A[Gateway transport reconnect] --> B[macOS node session]
  B --> C[Wait for hello snapshot]
  C --> D{Snapshot, reset, or timeout?}
  D -->|Snapshot or reset| E[Drain current route waiters]
  D -->|Timeout| F[Resolve only matching waiter]
  E --> G[Route readiness and capabilities]
  F --> G
Loading

Decision needed

Question Recommendation
Should this availability-sensitive macOS reconnect fix be merged after the exact-head native checks complete, without another rebase if GitHub continues to report a clean merge and the final merge result preserves the reviewed lifecycle diff? Merge after native checks: Recommended: wait for the current-head macOS and shared-kit checks to pass, then merge while GitHub remains cleanly mergeable against current main.

Why: The patch is authored by a repository member and carries the protected maintainer label, so this workflow must leave the final landing judgment to a human even though the code review found no discrete defect.

Before merge

  • Resolve merge risk (P1) - Reconnect readiness is availability-sensitive: merge only after the exact-head native checks finish successfully and GitHub still reports a clean three-way merge against current main.
  • Resolve merge risk (P1) - The branch is behind current main; the supplied discussion says intervening commits do not touch these native files, but a maintainer should confirm the final merge result rather than treating that assertion as a substitute for merge-time validation.
Agent review details

Security

None.

PR surface

Other +50. Total +50 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 58 8 +50
Total 3 58 8 +50

Review metrics

Metric Value Why it matters
Timeout ownership 1 shared timeout drain replaced by UUID-local waiter resolution This is the central availability invariant: a completed route's timer can no longer complete a replacement route's pending snapshot wait.

Merge-risk options

Maintainer options:

  1. Wait for exact-head native validation (recommended)
    Recommended: let the queued and running macOS/shared native checks finish on commit 5e320be, then merge only if the clean merge state remains current.
  2. Require merge-result refresh
    If the base advances across the native lifecycle surface, rebase or validate the actual merge result before landing the reconnect-readiness change.

Technical review

Best possible solution:

Keep the UUID-scoped waiter ownership, accept the bounded polling test repair separately from runtime semantics, and land only after the exact-head native lane is green on a clean current-main merge result.

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

Yes in source: the added deterministic test establishes the stale-timeout sequence across a route reset, although this review did not execute it locally.

Is this the best way to solve the issue?

Yes. UUID-scoped waiter ownership is the narrowest maintainable fix because the timeout should resolve only the continuation it created while snapshot receipt and route reset still own complete current-waiter draining.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 47f8c1d6b0fa.

Labels

Label justifications:

  • P1: A fast reconnect can otherwise mark a macOS Gateway route ready before its required hello snapshot arrives, affecting an active connection workflow.
  • merge-risk: 🚨 availability: The patch changes the readiness gate for reconnecting native Gateway routes, so an incorrect lifecycle transition could stall or prematurely admit a route.
  • 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: This repository-member PR is exempt from the external-contributor real-behavior-proof gate; the supplied focused lifecycle evidence and exact-head native CI remain useful supplemental validation.

Evidence

What I checked:

Likely related people:

  • Mariano Belinky: The supplied feature-history review identifies Mariano Belinky's commit as the origin of the shared snapshot-waiter timeout drain that the patch makes route-waiter-specific. (role: feature introducer; confidence: high; commits: a4382607d7a8; files: apps/shared/OpenClawKit/Sources/OpenClawKit/GatewayNodeSession.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the exact-head macOS and shared native checks to complete successfully while GitHub remains cleanly mergeable.

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-07-30T20:22:09.387Z sha 3510a49 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T20:30:57.864Z sha be8be67 :: found issues before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-07-30T21:17:11.665Z sha 61e3e76 :: needs maintainer review before merge. :: none

…iter-timeout-v20

* origin/main:
  fix(gateway): project subagent topology for session lists (#116533)
@vincentkoc

Copy link
Copy Markdown
Member Author

ClawSweeper rank-up moves completed on refreshed head be8be6755f2c666d3e03b3c76c145bcf2a7a00a6:

  • Refreshed against current main 610346b8a6ff158e2da6ff3b6216ade5cf898f99; the upstream commit does not touch the changed macOS files.
  • Re-ran completed snapshot timeout cannot release a later route waiter on the refreshed head: passed in 1.234s.
  • Re-ran branch autoreview against refreshed origin/main: clean, no accepted/actionable findings, overall correctness 0.97.
  • Independently inspected the current lifecycle and history: snapshot receipt/reset still drain the current waiter set, while a delayed timeout now removes only its UUID-owned waiter. The original shared-drain implementation traces to a4382607d7a8752ed88ad9fc8ba11fae6bc620c0 (January 31, 2026, Mariano Belinky); no associated PR was returned by GitHub.

The restarted macOS/native checks are running on this exact head. I will land only after they are green.

@vincentkoc

Copy link
Copy Markdown
Member Author

Addressed the current-head ClawSweeper finding in 61e3e76b3a01ec62ab07c892c1487f979d19c9a6:

  • Removed the normal-PR CHANGELOG.md entry; release generation owns that file per AGENTS.md.
  • git diff --check is clean.
  • Fresh branch autoreview is clean with no accepted/actionable findings (overall correctness 0.96).

The runtime diff is unchanged from be8be6755f2c666d3e03b3c76c145bcf2a7a00a6, whose exact-head macOS Swift, OpenClawKit, iOS, macOS Node, and CI gate checks passed.

@vincentkoc

Copy link
Copy Markdown
Member Author

Latest ClawSweeper review has no actionable findings. For its optional final-main refresh move, I am taking the review's documented "accept the existing-head evidence" path:

  • origin/main is currently b7bfe21348c24abdb7d50ef257ef8b4bce4f4a3f.
  • None of the 18 intervening commits since the reviewed base changes GatewayNodeSession.swift or GatewayNodeSessionTests.swift.
  • The runtime diff on 61e3e76b3a01ec62ab07c892c1487f979d19c9a6 is identical to the fully green native-tested head be8be6755f2c666d3e03b3c76c145bcf2a7a00a6; the only later commit removes the release-owned changelog line.
  • The current-head CI rerun is also in progress with no failures.

Repeatedly merging a fast-moving main would invalidate identical proof without changing this lifecycle surface. I will merge after current-head checks are green, then verify CI on the actual landed main SHA.

@vincentkoc

Copy link
Copy Markdown
Member Author

The current-head macOS lane exposed a separate pre-existing timing defect in AppStateVoiceEarsTests: a 50 ms expiry was asserted after a fixed 60 ms sleep, leaving only 10 ms of scheduler slack under the parallel 1,576-test run. It failed all three CI attempts on this head and had also failed on the prior runtime head; the production implementation and the OpenClawKit regression both passed.

Addressed in 5e320be86c4 by polling the observable state with a one-second bounded deadline while preserving the immediate activation assertion.

Proof:

  • focused voice-ear expiry test: 20/20 passes
  • snapshot waiter regression: pass
  • SwiftFormat with config/swiftformat: clean
  • git diff --check: clean
  • fresh branch autoreview against origin/main at 47f8c1d6b0f: no accepted/actionable findings, correctness 0.96
  • no intervening main commit touches any of the three PR files

@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Jul 30, 2026
@vincentkoc
vincentkoc enabled auto-merge (squash) July 30, 2026 22:01
@vincentkoc
vincentkoc merged commit 60bf2bd into main Jul 30, 2026
58 of 59 checks passed
@vincentkoc
vincentkoc deleted the fix-macos-snapshot-waiter-timeout-v20 branch July 30, 2026 22:31
vincentkoc added a commit that referenced this pull request Jul 31, 2026
…-supported-paths

* origin/main: (168 commits)
  fix(plugins): keep registry sqlite root consistent (#116427)
  fix(cli): keep Gateway auth failures parseable in JSON (#116597)
  fix(trajectory): preserve prompts in oversized events (#116220)
  test(buzz): add live QA Lab channel lane (#116298)
  chore(i18n): refresh native locales (#116567)
  feat: add OpenClaw TUI prototype skill (#116583)
  fix(update): accept concrete versions selected by ranges (#116585)
  fix(agents): preserve locked session model routes
  test(qa-lab): preserve Matrix fault proxy identity
  fix(ci): extend OpenAI live profile setup budget (#116580)
  fix: prevent configured models from stalling startup (#116553)
  fix(cli): close MCP listener after one-shot commands
  fix(auto-reply): keep explicit NO_REPLY silent (#116548)
  test(discord): cover deferred backpressure terminals
  fix(discord): cancel backpressured realtime playback
  test(discord): cover realtime output backpressure
  fix(codex): add remote WebSocket heartbeat and reconnect (#116135)
  fix(macos): wait for the current reconnect snapshot (#116550)
  fix(outbound): recognize current-source message-tool sends (#116560)
  fix(voice-call): type cancelled consult outcomes
  ...

# Conflicts:
#	extensions/google/setup-api.test.ts
#	ui/src/e2e/model-setup.e2e.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 31, 2026
* fix(macos): isolate snapshot waiter timeouts

* chore: leave changelog to release generation

* test(macos): wait for voice ear expiry
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…-supported-paths

* origin/main: (168 commits)
  fix(plugins): keep registry sqlite root consistent (openclaw#116427)
  fix(cli): keep Gateway auth failures parseable in JSON (openclaw#116597)
  fix(trajectory): preserve prompts in oversized events (openclaw#116220)
  test(buzz): add live QA Lab channel lane (openclaw#116298)
  chore(i18n): refresh native locales (openclaw#116567)
  feat: add OpenClaw TUI prototype skill (openclaw#116583)
  fix(update): accept concrete versions selected by ranges (openclaw#116585)
  fix(agents): preserve locked session model routes
  test(qa-lab): preserve Matrix fault proxy identity
  fix(ci): extend OpenAI live profile setup budget (openclaw#116580)
  fix: prevent configured models from stalling startup (openclaw#116553)
  fix(cli): close MCP listener after one-shot commands
  fix(auto-reply): keep explicit NO_REPLY silent (openclaw#116548)
  test(discord): cover deferred backpressure terminals
  fix(discord): cancel backpressured realtime playback
  test(discord): cover realtime output backpressure
  fix(codex): add remote WebSocket heartbeat and reconnect (openclaw#116135)
  fix(macos): wait for the current reconnect snapshot (openclaw#116550)
  fix(outbound): recognize current-source message-tool sends (openclaw#116560)
  fix(voice-call): type cancelled consult outcomes
  ...

# Conflicts:
#	extensions/google/setup-api.test.ts
#	ui/src/e2e/model-setup.e2e.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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