Repository navigation
fix(cron): release admission before continuation cleanup - #135155
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 8:58 AM ET / 12:58 UTC. ClawSweeper reviewWhat this changesThe PR releases an isolated cron run’s session-work admission before deleting its idle exact-run continuation alias, and adds regression coverage for that ordering. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep this PR open. It fixes a source-proven isolated-cron cleanup ordering bug, and the earlier regression and real-behavior-proof gaps are now addressed; normal exact-head CI remains. Priority: P2 Review scores
Verification
How this fits togetherIsolated cron runs hold a session-work admission while executing, then finalize their runtime and session state. The finalizer removes an idle run-scoped continuation alias only after ownership is released, while preserving browser cleanup afterward. flowchart LR
A[Cron job] --> B[Isolated run setup]
B --> C[Session-work admission]
C --> D[Agent execution]
D --> E[Finalize runtime]
E --> F[Release admission]
F --> G[Remove idle run alias]
G --> H[Browser cleanup]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +54. Total +57 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Merge the owner-boundary ordering repair after exact-head CI passes: release the admission before alias deletion, while retaining the cleaner’s existing media, delivery, and compare-and-set safeguards. Do we have a high-confidence way to reproduce the issue? Yes in source. Current main keeps the run admission active until after alias cleanup, while the deletion owner treats that lease as competing work; the contributor also supplied matching packaged-run receipts. Is this the best way to solve the issue? Yes. The finalizer owns both release and cleanup, and moving release before deletion fixes the conflict without weakening the cleaner’s pending-work or row-identity guards. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 45f155d88a9b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Redacted packaged-run proof — isolated cron continuation cleanupCaptured on 2026-09-01 from the patched OpenClaw 2026.8.1 package running on the Manual run receipts
Cleanup-warning checkThe gateway journal was searched across the interval containing both manual runs: Direct regression provenanceThe focused lifecycle regression supplies a deletable exact-run continuation, This red/green mutation proves the regression would fail if alias cleanup moved |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer verification is complete on
Production delta is net 0 lines. Tests and test support add 48 lines. The latest ClawSweeper rank-up move required normal exact-head CI, which is complete. |
|
Thanks @brettdaman! Proof: Two real isolated cron jobs completed through the Gateway on current main and exact head. Before the fix, both retained exact-run rows and logged the competing-work cleanup error. After the fix, both left zero exact-run rows and logged no cleanup warning.
|
What Problem This Solves
Isolated cron runs could finish successfully while retaining an otherwise unused exact-run continuation session. The Gateway logged
Cannot delete session while competing work is in flightbecause cleanup treated the completed run's own admission as competing work.Why This Change Was Made
The isolated-run finalizer now disposes the runtime and releases session-work admission before it starts exact-run alias deletion. Browser cleanup remains guaranteed by the outer finalizer.
User Impact
Successful isolated cron jobs no longer retain idle continuation aliases or emit the competing-work cleanup warning.
Evidence
2cedaddb5e23848d4358faddcd609afb6570fa94: two realcron add+cron run --waitflows completed successfully, each logged the competing-work warning, and SQLite retained two distinctready,basePersisted=trueexact-run rows.node scripts/run-vitest.mjs src/cron/isolated-agent/run.session-lifecycle.test.tsfailed only the cleanup-order assertion (admissionActive=true; 18 passed, 1 failed).86a9ec8437a7194c13e7261aa6201f3e55b29365: the same two real Gateway cron flows completed successfully, SQLite retained zero exact-run rows, and the Gateway logged no cleanup warning.git diff --checkpassed.Worked on by