Repository navigation
fix: resume interrupted work when new messages arrive after restart - #147486
Conversation
Keep durable restart state with its recovery owner instead of consuming it during prompt preparation. Resume the interrupted turn through the existing Gateway recovery path before admitting new work, and direct the agent to reconcile current state and continue the original task.
|
🦞👀 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 13, 2026, 6:41 PM ET / 22:41 UTC. ClawSweeper reviewWhat this changesThe PR preserves durable interruption state during prompt preparation, starts existing restart recovery before admitting new messages, and updates continuation instructions and regression coverage. Merge readiness✅ Ready for maintainer review This PR remains useful: current main retains the reported early interruption-flag clearing, and no verified merged replacement was established. No actionable correctness defect was found in the introduced changes. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s reply admission layer coordinates incoming messages with active and interrupted agent work. Restart recovery uses saved session state and transcripts to resume work while subsequent messages wait in the existing follow-up queue. flowchart TD
A[Incoming message] --> B[Reply admission]
C[Saved interrupted session] --> B
B --> D{Recovery pending?}
D -->|Yes| E[Existing recovery owner]
E --> F[Resume saved task]
D -->|No| G[Normal reply processing]
E --> H[Queue new messages]
H --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -5, Tests +259, Docs +6. Total +260 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep interruption state under the existing recovery owner until adoption or settlement, with new messages using the established follow-up queue. Do we have a high-confidence way to reproduce the issue? Yes, from source: prepare a new message against an interrupted session with an existing delivery claim, then fail adoption and release its foreground owner. Current main clears the interruption marker too early; this review did not execute that sequence. Is this the best way to solve the issue? Yes. Removing prompt preparation’s durable write and invoking the existing recovery owner addresses the lifecycle conflict without introducing another recovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c92ce0278f4a. 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.
|
Keep durable restart state with its recovery owner instead of consuming it during prompt preparation. Resume the interrupted turn through the existing Gateway recovery path before admitting new work, and direct the agent to reconcile current state and continue the original task.
What Problem This Solves
Fixes interrupted work becoming stuck with “restart recovery claim changed before agent adoption” when a new message arrives after a Gateway restart.
User Impact
The interrupted turn resumes from its saved context, and new messages use the existing follow-up queue while recovery owns the session. The agent is told that the restart did not cancel the task and to check current state, reconcile uncertain tool outcomes, and continue without asking the user to repeat the request.
Why This Change Was Made
Prompt preparation was clearing the durable interruption flag before the agent adopted its run. A subsequent claim conflict could then remove recovery state while leaving the old delivery claim behind. Prompt hints now leave durable state to the recovery owner, and foreground admission starts the existing recovery path before taking ownership of new work.
Existing delivery authority, permissions, reset behavior, and tombstone handling are preserved. No configuration or schema migration is required.
Evidence