Repository navigation
fix: prevent completed conversations from resuming after restart - #166340
roboclaw-bot wants to merge 2 commits into
Conversation
Preserve unowned terminal recovery fences behind the existing explicit recovery boundary instead of authorizing a new turn. Retain genuine interruption and delivery custody. Fixes #166300. Co-authored-by: hannesrudolph <[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: blocked before merge. Reviewed October 6, 2026, 7:37 PM ET / 23:37 UTC (Revision 2). ClawSweeper reviewWhat this changesThe PR quarantines ambiguous legacy recovery records to prevent unsolicited conversation restarts, consolidates recovery checks, and adds regression coverage and documentation. Merge readiness⛔ Blocked before merge - 4 items remain The fix remains necessary on current main, and the consolidation introduces no concrete blocking code finding. Both previously identified merge blockers remain unresolved. Priority: P1 Review scores
Verification
How this fits togetherGateway restart recovery reads persisted session obligations and decides whether to resume agent work or preserve the session for explicit recovery. Its decisions control fresh tool execution and subsequent replies. flowchart TD
A[Persisted session state] --> B[Startup recovery scan]
B --> C[Recovery ownership classification]
D[New foreground input] --> C
C -->|Unowned terminal residue| E[Preserved recovery tombstone]
C -->|Unfinished owned work| F[Agent continuation]
E --> G[Explicit Resume action]
F --> H[Tools and reply delivery]
Decision needed
Why: The restriction prevents unsafe historical replay but changes continuation behavior for existing sessions; the contributor explicitly leaves recovery-owner acceptance outstanding. Before merge
Agent review detailsSecurityNone. PR surfaceSource -27, Tests +224, Docs +9. Total +206 across 11 files. View PR surface stats
Review metrics
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: Preserve ambiguous legacy obligations without replay, retain legitimate recovery, and expose the existing Resume action under an approved and verified upgrade contract. Do we have a high-confidence way to reproduce the issue? Yes, from source: the reported failed/aborted row with an unmatched runtime fence becomes recoverable on current main. This review did not execute a reproduction; the linked report independently records production dispatch and delivery. Is this the best way to solve the issue? Yes at the owner boundary: preserving ambiguous evidence without minting a new execution obligation is narrower than age cutoffs or arbitrary assistant-final checks. The foreground restriction still needs owner acceptance and upgrade validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 45228e1aeed6. 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
HistoryReview history (1 earlier review cycle)
|
Keep the legacy replay fix while sharing inspection and foreground-claim validation. Remove redundant rollover eligibility and replace helper-only coverage with public recovery checks. Production code is net negative against the original PR base. Co-authored-by: hannesrudolph <[email protected]>
|
Closing as obsolete. Obsolete after #185730 replaced the reconstruction/fence/tombstone recovery architecture this PR changes. Current recovery uses graceful-stop markers and ordinary resume inputs; this closure is not a claim that every restart-related defect is resolved. This closes the PR without deleting its branch. |
Closes #166300
What Problem This Solves
Fixes an issue where users updating or restarting a Gateway could have a completed historical conversation resume, run tools, and send an unsolicited reply. A legacy failed-recovery row could retain an unmatched runtime fence after its execution and delivery owners had been cleared.
Why This Change Was Made
Recovery now distinguishes retained evidence from permission to execute again. A terminal row with only an unowned runtime fence is preserved behind a quiet, zero-attempt recovery tombstone instead of becoming a fresh executable cycle. Startup marking and foreground admission use the same owner-level classification.
This does not guess completion from an assistant final or session age, discard unmatched fences, or change the transcript resume policy. Existing recovery cycles, runtime/writer identities, harness-completion ownership, pending finals, and delivery claims retain their recovery behavior. No schema or configuration changes.
The refactor consolidates the two recovery inspectors and duplicated foreground-claim guards, removes the redundant rollover-eligibility layer, and keeps outcome policy in the existing state owner rather than introducing another production module.
User Impact
Completed legacy conversations no longer restart themselves from ambiguous leftover state. The original transcript, timestamps, and recovery evidence stay intact, without a new message or notice. If continuation is needed, the existing Resume in new session, /new, or /reset paths remain available.
The intentional tradeoff is that this narrowly identified ambiguous legacy state requires explicit recovery instead of ordinary in-place input. Genuine interrupted work and owed replies remain automatically recoverable.
Reported by @hannesrudolph.
Work sessions
The net-negative follow-up was implemented and verified in the original discussion session linked above.
Evidence
Production delta: +118/−145, net −27 lines relative to the original base 51f772a (previous candidate: net +61). Tests/fixtures: +269/−45, net +224; docs: +9. The complete PR remains net positive because it retains regression coverage.
Proof uses isolated SQLite/startup and public-handler execution with mocked dispatch, not live provider/channel traffic or an installed-updater run. The full repository test suite was not run. Before merge, recovery-owner acceptance of the documented foreground restriction and published-driver-to-candidate upgrade evidence remain outstanding; this PR stays draft.