Repository navigation
fix: recover conversations stranded after gateway restarts - #153433
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 12:43 AM ET / 04:43 UTC. ClawSweeper reviewWhat this changesThe PR lets new chat messages, retained retries, and explicit recovery resume stranded conversations in place, with regression coverage and updated recovery documentation. Merge readiness✅ Ready for maintainer review This remains a useful recovery fix: current main and the latest release still exclude failed and statusless sessions from orphan reconciliation. No blocking defect was found in the introduced changes. Priority: P1 Review scores
Verification
How this fits togetherGateway admission checks incoming chat requests against persisted session state. Restart recovery reconciles interrupted work before admitting another turn, preserving the conversation and preventing duplicate execution. flowchart TD
A[Chat message or explicit recovery] --> B[Validate request and session]
B --> C[Inspect unfinished recovery]
C --> D{Live run or cloud worker?}
D -->|Yes| E[Preserve active ownership]
D -->|No| F[Reconcile interrupted session]
F --> G[Resume retained work]
G --> H[Admit new work without duplication]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +111, Tests +256, Docs +2. Total +369 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep recovery centralized in the existing guarded owner so stranded conversations resume in place before new input can replace their retained delivery claim. Do we have a high-confidence way to reproduce the issue? Yes: current source excludes failed and statusless sessions carrying unfinished recovery state, and the PR supplies concrete Gateway request scenarios for both. This review did not execute the reproduction. Is this the best way to solve the issue? Yes: extending the existing orphan-reconciliation owner and invoking it before durable retry resolution addresses the admission wedge without adding a competing recovery mechanism or changing stored formats. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4891bc477fa7. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
What Problem This Solves
Fixes conversations repeatedly rejecting messages with “conversation changed” after a Gateway restart leaves unfinished recovery state behind a failed or statusless run. Refreshing the conversation could not repair that state.
User Impact
Users can continue the same conversation through a new message or a retry of the retained request. Explicit
sessions.recovercan also resume the stranded work in place, preserving the session key and transcript.Why This Change Was Made
Normal chat admission and explicit recovery now share the existing guarded orphan-reconciliation owner. Reconciliation runs before durable retry resolution or a new delivery claim can replace the old one. Live runs, cloud workers, stale session/branch/settings requests, completed runs, and tombstones retain their existing protections. No schema, configuration, retention, or permission change is required; existing stored recovery markers are the input to repair after an update.
Evidence
pnpm build, core and test typechecks, formatting, lint, dead-export scans, and the remaining changed-code guards passed. The changed-check run stopped on a test cleanup lint issue; that mechanical correction and every remaining guard were then verified directly.Review disposition
A subsequent device-retention finding was reviewed against the authenticated request dispatcher, the recovery admission owner, and the Gateway instance runtime. The requesting client capture already spans the awaited handler. Guarded reconciliation restores an existing durable obligation; automatic recovery then uses its named session admission and instance-owned system principal, with session/claim/generation revalidation. It does not admit the retry's new input under a detached browser credential. The current request rechecks authority after resolution. No additional caller-retention policy was added to previously accepted recovery work.