Repository navigation
Conversation
deleteAfterRun finalization was restricted to at schedules, so a successful on-exit job with deleteAfterRun=true was retained as a disabled job instead of being removed (the gateway exit watcher durably disables on-exit jobs BEFORE firing as replay protection, and no later transition deleted them). Successful delete-after-run now covers every one-shot schedule kind; the pre-fire disable ordering is unchanged. Regression covers deletion on ok, retention without the flag, and retention on failure through the same force path the exit watcher fires. Fixes openclaw#104518
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 7:20 PM ET / 23:20 UTC. Summary PR surface: Source +2, Tests +70. Total +72 across 2 files. Reproducibility: yes. The exact CLI workflow reproduces a retained disabled job on current main, and the contributor's real patched gateway run shows the persisted job removed. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land one narrow shared-finalizer fix that preserves the watcher's fail-closed pre-fire persistence, deletes successful Do we have a high-confidence way to reproduce the issue? Yes. The exact CLI workflow reproduces a retained disabled job on current main, and the contributor's real patched gateway run shows the persisted job removed. Is this the best way to solve the issue? Yes. Extending the existing service-owned successful one-shot finalizer is the narrowest maintainable fix because it preserves durable pre-fire replay protection and avoids a second cleanup owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 453c049ac89d. Label changesLabel justifications:
Evidence reviewedPR surface: Source +2, Tests +70. Total +72 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (4 earlier review cycles)
|
Live before/after — the issue's exact repro on a real gatewayReal openclaw cron add \
--name beta5-on-exit-command-nodeliver-smoke \
--on-exit 'sh -c "exit 0"' \
--command 'printf BETA5_ON_EXIT_NODELIVER_OK' \
--no-deliver \
--delete-after-run
# watched command exits, payload fires…
openclaw cron list --all --jsonBEFORE — pristine current The payload succeeded but the job is retained as a disabled zombie — byte-for-byte the reported behavior. AFTER — this PR's dist, identical sequence: The watched command exited, the payload ran successfully, and the job is gone from the persisted cron listing — the documented one-shot cleanup, now covering on-exit schedules. No private paths, endpoints, or credentials appear above (fresh throwaway state dir, loopback only). @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
|
Maintainer refresh complete at
This is the preferred small fix for #104518 and is ready for the next landing batch. |
…4550) * fix(cron): delete successful on-exit deleteAfterRun jobs deleteAfterRun finalization was restricted to at schedules, so a successful on-exit job with deleteAfterRun=true was retained as a disabled job instead of being removed (the gateway exit watcher durably disables on-exit jobs BEFORE firing as replay protection, and no later transition deleted them). Successful delete-after-run now covers every one-shot schedule kind; the pre-fire disable ordering is unchanged. Regression covers deletion on ok, retention without the flag, and retention on failure through the same force path the exit watcher fires. Fixes openclaw#104518 * test(cron): prove durable on-exit finalization --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
#104518: an
--on-exitcron job created with--delete-after-runruns its payload successfully but is retained as a disabled job instead of being deleted — the reporter needed a manualcron rm. Root cause is a two-part interaction, exactly as the triage identified: the gateway exit watcher durably disables an on-exit job before firing it (persistCompletion→enabled: false, the fail-closed replay protection so a gateway restart cannot re-arm and re-run the watched command), and the successful delete-after-run finalization inapplyJobResultwas restricted toschedule.kind === "at"— so no transition ever removed the fired job.Why This Change Was Made
Per the triage's best solution ("generalize successful delete-after-run finalization to supported one-shot schedules … preserving durable pre-fire replay protection"):
shouldDeleteinsrc/cron/service/timer.tsnow covers every one-shot schedule kind ("at"and"on-exit"), still gated ondeleteAfterRun === true && status === "ok".applyJobResultconsumer used by both the timer path and the force path the exit watcher actually fires (cron.run(jobId, "force")→ops.tsdelete branch).ok— same asatjobs.User Impact
openclaw cron add --on-exit ... --delete-after-runnow behaves like the documented one-shot cleanup for--atjobs: success removes the job; no more zombie disabled entries needing manualcron rm.Evidence
Regression (
ops.regression.test.ts, drives the same disabled-job force path the exit watcher fires, per the triage's coverage list):deleteAfterRunon-exit job → removed from the store;deleteAfterRun: false→ retained, durably disabled withlastStatus: "ok"(persistence-order contract unchanged);deleteAfterRun: true→ retained disabled with the error state preserved.Fails on prior head for the reported reason:
expected { id: 'onexit-delete-ok', …(11) } to be undefined— the job was retained disabled, byte-for-byte the reported behavior.Validation:
ops.regression.test.ts12/12;timer.regression.test.ts72/72 (includes the existingat-schedule deleteAfterRun retry/delete coverage, unchanged);tsgo:core0; oxlint/oxfmt clean. Prod diff is the one guarded condition plus its ownership comment.Fixes #104518
🤖 Generated with Claude Code
https://claude.ai/code/session_01AJogTw4aGDiacwqju1uod6