Repository navigation
fix(gateway): identify interrupted work when a chat resumes - #205755
Conversation
Carry the interrupted backend run into restart provenance. Use its recorded tool results to distinguish a saved operation from an error or missing acknowledgement, including when older results share the same chat. Reported-by: Leandro F. Chaves <[email protected]>
|
🦞👀 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. What this changesThis PR carries the interrupted execution’s identity into restart recovery and clears stale attribution when another run takes ownership. Example: A reminder request from run current-execution is interrupted while an older reminder exists in the same conversation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review This PR provides useful recovery attribution, and the lifecycle conflict resolution preserves preparation failures without introducing a blocking regression. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway shutdown and lifecycle settlement persist session recovery markers; startup converts eligible markers into ordinary session events consumed by the resumed agent. flowchart TD
A[Live execution owners] --> B[Shutdown selection]
C[Lifecycle terminal] --> D[Session writer]
B --> D
D --> E[SQLite restart marker]
E --> F[Startup recovery]
F --> G[Session event provenance]
G --> H[Resumed agent]
Technical reviewBest possible solution: Keep attribution in the existing marker and session-event owners while tracking strict outcome enforcement separately on the linked issue. Do we have a high-confidence way to reproduce the issue? Current main demonstrably omits the originating execution from restart admission, matching the maintainer’s public real-Gateway reproduction; this read-only review ran no target code. Is this the best way to solve the issue? The smallest complete attribution repair extends existing marker, lifecycle, and provenance owners without transcript scans or scheduler-specific machinery; it does not enforce model compliance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 593dcf6b17c8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +83, Tests +124. Total +207 across 15 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed November 26, 2026, 1:43 AM ET / 06:43 UTC (Revision 4). |
Resolve live and retained evidence in the session marker owner. Carry an observed backend start through its restart terminal and keep a client request interrupted before execution unattributed.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Consume the predecessor's restart marker when a different run claims the session. A failed cleanup write can otherwise leave old scheduler receipts attached to a fresh input interrupted before backend execution. Keep the marker while the original continuation awaits admission.
|
@clawsweeper re-review Please review corrected head |
|
🦞👀 Re-review progress:
|
Merge the current lifecycle writer into the restart evidence branch. Apply terminal overrides and backend-start attribution only outside workspace preparation failures. Exercise the overlap with stale provider and shutdown data from an observed attempt.
|
@clawsweeper re-review Please review the lifecycle conflict resolution at |
|
🦞👀 Re-review progress:
|
|
The remaining generated-validator failure is present on unchanged main. CI tested merge The schema, generator, checked-in predicates and lockfile have identical Git objects on the tested merge and parent. In an independent paired AWS run, regenerating the validators on each revision produced the same two-addition, one-deletion diff, SHA-256 |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…#205755) * fix(gateway): identify interrupted work when a chat resumes Carry the interrupted backend run into restart provenance. Use its recorded tool results to distinguish a saved operation from an error or missing acknowledgement, including when older results share the same chat. Reported-by: Leandro F. Chaves <[email protected]> * fix(sessions): bind restart evidence to the executing attempt Resolve live and retained evidence in the session marker owner. Carry an observed backend start through its restart terminal and keep a client request interrupted before execution unattributed. * fix(sessions): clear stale restart evidence on writer transfer Consume the predecessor's restart marker when a different run claims the session. A failed cleanup write can otherwise leave old scheduler receipts attached to a fresh input interrupted before backend execution. Keep the marker while the original continuation awaits admission.
* fix(gateway): identify interrupted work when a chat resumes Carry the interrupted backend run into restart provenance. Use its recorded tool results to distinguish a saved operation from an error or missing acknowledgement, including when older results share the same chat. Reported-by: Leandro F. Chaves <[email protected]> * fix(sessions): bind restart evidence to the executing attempt Resolve live and retained evidence in the session marker owner. Carry an observed backend start through its restart terminal and keep a client request interrupted before execution unattributed. * fix(sessions): clear stale restart evidence on writer transfer Consume the predecessor's restart marker when a different run claims the session. A failed cleanup write can otherwise leave old scheduler receipts attached to a fresh input interrupted before backend execution. Keep the marker while the original continuation awaits admission. (cherry picked from commit d63a7c9) Release adaptation: Retain the release workspace-preparation terminal message and keep failed preparation from inheriting execution metadata; only a confirmed backend start becomes restart provenance. No database schema change. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
A restarted chat could see an interrupted outer tool call without knowing which execution produced the nested scheduler results. An older reminder with the same name could lead it to confirm the wrong request. Leandro F. Chaves (@fonchaves) reported this in issue #187354. His contributor PR handles scheduler discovery and the extra CLI process.
User Impact
When recovery can identify the interrupted run, the assistant receives its ID and can verify a scheduled job by its returned ID, report a recorded error, or say that an interrupted action has an unknown outcome. It can continue independent work in the same request.
Why This Change Was Made
The session marker now carries the originating run through the existing restart event provenance. A unique live root supplies its own ID. A pending continuation can retain it within the same supervisor scope. A backend that observed execution start can supply it at shutdown even if the snapshot missed it. Starting a replacement attempt clears that observation. A client request interrupted before backend execution keeps its empty marker. When a different run takes writer ownership, the session store clears its predecessor’s retained marker in the same write. This also covers a failed startup cleanup followed by a fresh browser input. Capture reuses the pass over live runs and adds no startup transcript scans or scheduler reads. The persisted field is optional and uses the existing event shape.
Evidence
3e97bba47d3b merges 0780dd62406b into the previously reviewed head. A workspace preparation failure retains its own error even after an observed backend start and competing restart and provider metadata. A genuine restart still attributes only the current executing attempt. The session writer still clears a predecessor’s marker on independent admission and preserves it while recovery is pending. 99/99 focused tests passed across six files on AWS. Scoped formatting and lint passed. Twelve unaffected PR files are byte-identical to the prior head, and main’s provider-summary change in the lifecycle projection merged cleanly. AWS test run · Previous green CI · Current CI
On baseline, 0/5 restart events supplied the originating run. On 98ccbc7, all 5/5 supplied the correct ID. A scripted model used real session history and the native scheduler to verify the saved job, report both typed errors, and leave both interrupted shell commands unretried. An older successful job of the same name was present in the invalid session. All five independent shell tasks completed. Baseline · Gateway and shell proof
93/93 tests passed across eight restart, admission, terminal, and upgrade suites. The runtime build, scoped lint, formatting, and session-identity ratchet passed. The unchanged browser test verifies that a pre-runtime client request cannot supply the backend ID. The captured-start test failed before the terminal writer fix and passed after it. Failing test · Exact-tree validation · Hosted CI
A released 2026.11.10 Gateway wrote the old marker with
operatorSourceandqueuedInputIdsand nosourceRunId. The candidate started against that same database. It retained the session ID, user label, and original user message, produced one recovery reply, and supplied no invented run ID. Released-to-head upgradeA one-shot failure while clearing a prior recovery marker let a fresh browser input retain the previous run’s ID after a pre-runtime abort on 98ccbc7. On de456c5, durable admission clears the prior marker. The later restart retains the fresh input with no attributed execution, and a second shutdown during pending recovery still preserves the predecessor. 36/36 focused tests passed across four files, with formatting, scoped lint and the session identity ratchet passing. Failing regression · Repaired transition
The issue stays open. In the counterexample on 98ccbc7, a model that ignored the evidence sent two success replies and repeated the already-committed CLI request. The number of jobs rose from 1 to 2. Enforcing truthful delivery and preventing retries of opaque shell effects in a mixed request need a separate product decision. The reported arm64 container OOM remains unverified. Counterexample