Repository navigation
fix(android): recover dropped gateway events - #129723
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 10:15 PM ET / August 26, 2026, 02:15 UTC. ClawSweeper reviewWhat this changesThe PR detects skipped gateway event sequence numbers in Android’s WebSocket session, triggers existing recovery before forwarding the next event or node command, and adds reconnection regressions. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open for maintainer merge handling: this is a focused Android session-state repair with no actionable patch finding, and it is protected by maintainer ownership context. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe gateway assigns event sequences per WebSocket connection and deliberately leaves gaps when slow-client events are dropped. Android GatewaySession receives those frames and ChatController refreshes authoritative chat and run state when it receives a recovery signal. flowchart LR
A[Gateway broadcaster] --> B[Per-connection sequence]
B --> C[Android Gateway Session]
C --> D{Sequence gap?}
D -->|yes| E[Chat recovery signal]
E --> F[History and run refresh]
D -->|no| G[Normal event or node command]
F --> G
G --> H[Android chat UI]
Before merge
Agent review detailsSecurityNone. PR surfaceOther +196. Total +196 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Retain the connection-local detector and existing ChatController recovery path, then merge after exact-head Android validation remains green. Do we have a high-confidence way to reproduce the issue? Yes: a focused loopback-WebSocket scenario can create a skipped sequence, and current source shows Android lacks the producer for its existing seqGap recovery path. Is this the best way to solve the issue? Yes: tracking at the per-connection receiver matches the broadcaster contract and reuses the existing ChatController recovery owner rather than adding a parallel refresh path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c841a9958abc. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Android silently kept stale assistant replies, run state, usage, and subagent progress after the gateway dropped a slow-client event. The existing ChatController recovery path already refreshes authoritative history on a sequence gap, but Android GatewaySession never emitted that signal.
Why This Change Was Made
Gateway broadcast sequences are per connection, advance only after scope and subscription filters, and intentionally skip a number when a slow client drops an eligible event. Track that sequence in the existing Connection owner and mirror the Apple client: emit seqGap before the next normal event or node invocation, reset naturally on reconnect, and recheck the current connection plus READY state after the recovery callback. Challenge frames, first events, missing sequences, duplicates, and older events retain their existing semantics. The production change adds ten lines and does not change protocol, configuration, authentication, or gateway permissions.
User Impact
A missed gateway event now refreshes Android chat history and clears stale live-run, usage, and subagent presentation before the next event is delivered. Existing connections and device commands remain unchanged when their event sequences are contiguous.
Evidence
Before:
After: