Repository navigation
fix(gateway): recover admitted turns across restart - #130491
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 7:46 PM ET / 23:46 UTC. ClawSweeper reviewWhat this changesThe branch makes Gateway restart recovery find active session-work admissions after transient chat-run registrations have been cleaned up, then marks the durable session for restart-safe recovery. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep this PR open: current main still has the empty-transient-map gates that miss an admitted turn, while the proposed owner-boundary repair and regression coverage are coherent. It needs maintainer review after a current-main rebase because it changes persisted restart-recovery state. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherGateway shutdown drains or interrupts active reply work before startup recovery resumes interrupted sessions. The session-work admission registry is the durable-work owner when transient chat-run maps no longer identify the turn. flowchart LR
A[Gateway restart] --> B[Shutdown reply drain]
B --> C[Session-work admissions]
C --> D[Restart session marker]
D --> E[Durable session record]
E --> F[Startup recovery dispatch]
Decision needed
Why: The author is a repository member and the PR carries the protected maintainer label; automated cleanup must not close it, while the disconnected local history prevents independently proving the final merge result. Before merge
Agent review detailsSecurityNone. PR surfaceSource +21, Tests +61. Total +82 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current main and retain one admission-owner-derived marking path, with the focused restart-recovery scenario proving the resumed turn receives restart-safe tools. Do we have a high-confidence way to reproduce the issue? Yes, source reproducibly shows current main returning before admission ownership is considered, and the added regression test models that exact empty-chat-run condition; this read-only review did not rerun it. Is this the best way to solve the issue? Yes, the repair moves discovery to the admission owner that remains live after chat-run cleanup instead of extending another transient-map fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0b450013ea0f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
(cherry picked from commit 2c3a54f)
What Problem This Solves
Fixes #130485. A forced Gateway restart could miss an admitted in-flight turn after chat-run cleanup, so startup never dispatched the required restart-safe recovery.
Why This Change Was Made
Restart recovery now derives interrupted-session marking from the authoritative session-work admission owner instead of the narrower chat-run and recovery-candidate maps. Shutdown and maintenance callers share that canonical marking flow, and obsolete duplicate lifecycle plumbing is removed.
Production LOC: +55/-34 (net +21). Tests: +63/-2. The production growth records the missing owner-boundary state and removes the prior narrower path.
User Impact
In-flight channel turns survive forced Gateway restarts through the intended restart-safe recovery policy instead of silently missing the first recovery dispatch.
Evidence
dispatching restart-safe recovery.mainwith{ marked: 0, skipped: 0 }and passes on this head with{ marked: 1, skipped: 0 }.172and56tests).gateway-restart-inflight-run.AI-assisted: yes. No agent transcript is included.