Repository navigation
fix(cron): preserve canceled run status through cleanup - #167524
Conversation
Retain the prompt admission through terminal emission and join its accepted terminal writes before finalization seals the saved continuation. Explicit close and replacement still revoke immediately. The asynchronous lookup introduced by #165028 let sealing overtake the cancellation write. The unchanged Gateway regression passes on the parent, fails on that commit, and passes with this fix.
|
🦞👀 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 changesThe branch waits for accepted terminal writes before closing a scheduled run’s admission and sealing its saved session. Example: The operator removes an active scheduled job.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR remains useful: current main retains the cleanup race, and the focused repair preserves existing cancellation and revocation contracts. No actionable patch defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherOpenClaw runs scheduled agent jobs through the Gateway and retains session records for later inspection. Terminal events update those records before the scheduled run releases its temporary resources. flowchart TD
A[Scheduled agent job] --> B[Prompt admission]
B --> C[Agent execution]
C --> D[Terminal event]
D --> E[Accepted session writes]
E --> F[Wait for settlement]
F --> G[Close admission]
G --> H[Seal saved session and clean up]
Technical reviewBest possible solution: Keep terminal persistence in the existing run owner and settle it before continuation sealing, preserving immediate explicit revocation. Do we have a high-confidence way to reproduce the issue? Yes: source establishes the early-close and asynchronous-persistence race, and the existing real-Gateway removal test asserts the missing Is this the best way to solve the issue? Yes: joining the existing terminal-write owner repairs the ordering invariant without weakening the ready-row fence or introducing another persistence path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 17cc94a953e7. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +18. Total +18 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel 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 Reviewed October 8, 2026, 7:43 PM ET / 23:43 UTC. |
) Retain the prompt admission through terminal emission and join its accepted terminal writes before finalization seals the saved continuation. Explicit close and replacement still revoke immediately. The asynchronous lookup introduced by openclaw#165028 let sealing overtake the cancellation write. The unchanged Gateway regression passes on the parent, fails on that commit, and passes with this fix.
What Problem This Solves
Fixes saved cron continuations that lose their
killedstatus when an active scheduled job is removed.User Impact
Subsequent session reads retain the cancellation outcome after the temporary base session and placement have been cleaned up.
Why This Change Was Made
The asynchronous lifecycle lookup introduced in #165028 lets continuation sealing overtake terminal persistence. Cron now retains the prompt admission until that exact run's accepted terminal writes settle, then closes admission and seals the continuation. Explicit close and replacement remain immediate; the existing ready-row fence stays in force.
Evidence
d511ab92b63a, fails on4bd8ee5fedcbwith the missing status, and passes with this fix. Both removal and one-shot cleanup remain covered; the repaired case takes 21.990 seconds.check-changedstops only at the inherited dead export below; all nine checks after it passed in a separate Linux run.ClientVoiceToolEffect, already removed on main byd76f6ec74ec6.