Repository navigation
fix(cron): preserve the final reply after automation self-removal - #138231
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Good boundary. Self-removal is tied to the exact admitted instance and active marker, while operator removal still cancels. The ownership matrix covers the important replacement/expiry cases.
|
Codex review: blocked before merge. Reviewed September 4, 2026, 9:51 AM ET / 13:51 UTC. ClawSweeper reviewWhat this changesThe PR lets an isolated cron automation delete its own schedule without cancelling its final reply, while retaining cancellation for operator-initiated deletion. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 3 items remain Keep open. The earlier reload-stability finding is addressed, and the patch places the continuation decision at the active-run owner boundary; current main still unconditionally cancels a removed active job. This maintainer-owned, protected PR needs a refreshed merge candidate and green exact-head checks before landing. Priority: P1 Review scores
Verification
How this fits togetherCron tracks each executing automation with an active marker while the Gateway processes deletion requests. The changed decision determines whether a persisted deletion cancels the run or permits its still-authorized owner to finish delivery and cleanup. flowchart LR
A[Isolated cron run] --> B[Active job marker]
B --> C[Gateway deletion request]
C --> D[Admission ownership check]
D --> E[Finish final reply]
D --> F[Cancel operator removal]
E --> G[History and cleanup]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -2, Tests +233. Total +231 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the owner-bound continuation only after the current-main merge candidate proves that authorized self-removal completes while operator deletion still cancels the active run. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main unconditionally cancels the active marker after durable deletion, and the added focused service/RPC cases exercise that exact self-removal path. I did not execute the test suite in this read-only review. Is this the best way to solve the issue? Yes. The patch changes the deletion owner’s cancellation decision and revalidates the exact live admission, rather than adding a downstream delivery exception that could weaken operator cancellation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 068ef71bd20e. 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 (3 earlier review cycles)
|
086616c to
f3cbf32
Compare
|
Merged via squash.
|
…enclaw#138231) * fix(cron): let admitted runs finish after self-removal * fix(cron): retain self-removal owners across module copies
Additional instructions
Maintainers can update this branch through normal repository access; it is in the main repository.
What Problem This Solves
An isolated agent automation that removed its own schedule was canceled before it could return its final result. This contradicted the documented self-cleanup flow and left a failed run in Automations history.
Why This Change Was Made
Bind the existing mutation commit guard to the exact admitted operational instance and active marker. After deletion persists, only that registered, still-live owner may continue; operator removal, expired authority, closed or replaced admissions, copied guards, and replacement markers still cancel. The active marker remains until execution settles, preserving terminal history and deferred session cleanup. No public cancellation option, schema, stored format, configuration, protocol, or migration changes.
The removal owner previously treated every deletion as an operator cancellation. The completion owner now shares its deferred interruption handling, failure projection, empty-webhook outcome, and detached-run abort diagnostics. This change is based on the already-merged timed/unlimited runner refactor and does not duplicate or count that upstream deletion. Production delta: 174 added / 176 deleted (net −2); regression tests: 233 added.
User Impact
Agent automations can remove their completed schedule and still deliver their final result. Removing a running automation as an operator continues to cancel it. The active run retains its normal completion history and cleanup ownership.
Evidence
Validation: four real service/RPC self-removal cases fail on the unchanged base (manual and scheduled runs, with and without a timeout). The corrected change passes 400 focused tests covering admission ownership, operator cancellation, timeout/watchdog behavior, settled webhook delivery, retained history and deferred cleanup; scoped formatting and lint and the complete canonical core/coreTests changed gate also pass. The first broad gate found two test-fixture type errors; the corrected fixture still fails all four original cases on the exact unchanged base and passes against the fix. A normal isolated Gateway using its real built-in agent runtime and a local synthetic HTTP model verifies manual and naturally scheduled self-removal reaches its final result, while a separate operator deletion still aborts. Browser proof uses the actual source Control UI, documented development connection, normal browser device pairing and Gateway RPC; selected screenshots contain only synthetic run data. Original videos remain local because a later sidebar paint includes a host-derived owner display name.
Independent managed review completed in two batches with no accepted actionable P0–P2 findings across their union. The first report was explicitly batch-limited, so it is not presented as a standalone full-diff verdict. The managed scanner withheld one unchanged sensitive-filename validator dataset; its decision was preserved, and the maintainer separately inspected that validator directly. No review scanner or sandbox bypass was used.
A separate script/condition issue was recorded for independent repair: protected own-job tool calls fail before execution because that producer never creates canonical run admission. This change repairs the existing isolated-agent completion owner.
Release-note context: restore documented agent-automation self-cleanup without interrupting the run’s final reply; preserve cancellation when an operator removes a running automation.
The full changed gate passed all 29 checks in 432.74 seconds with unchanged source hashes. Hosted CI on the published commit is required before landing.
Before:
After:
Current head:
c3953d899e8fe1f125a4a950b97b8e6b1605b297. The latest ClawSweeper finding and rank-up request are addressed: both ownership associations now live in the existing process-global active-job state, alongside the markers they describe. Reloads before and after guard creation retain the exact owner; closed, aborted, replaced, copied and different-instance paths still reject. Two reload cases failed before the correction while 42 controls passed; the corrected owner and manual-run suites pass all 50 tests.The final correction was independently reviewed in two complete managed batches with no actionable findings. The final changed gate passed all checks in 590.53 seconds with unchanged source hashes; this supplements the original complete seven-file gate. Five fresh normal-Gateway scenarios pass with eight local synthetic HTTP model requests: manual self-removal, ordinary/status controls, naturally scheduled self-removal and operator cancellation. Both Gateway/provider pairs shut down cleanly. Cross-module reload itself is proved by owner-boundary tests; the normal Gateway proof does not claim a forced runtime hot reload or an external model service.
The maintainer accepts this bounded continuation repair under the requested autonomous QA/landing scope. It preserves the existing authorization predicate, changes no stored format or policy, and keeps operator cancellation intact. Required CI must be green on this exact head before merge.
Current-main review disposition: the latest ClawSweeper review confirms the reload finding is resolved and has no actionable code or security findings. Its current-main request was checked directly: main
068ef71bd20e0b22f92c26364b758551aa13363bcomposes cleanly withc3953d899e8fe1f125a4a950b97b8e6b1605b297(treeb67061986bf43f8038ebe4e588b1fd6560195a77), and all seven candidate files remain byte-identical. Eight changed/causal files have no source drift from the original main baseline. A rebase is therefore skipped under the repository's advisory-drift policy; no overlapping cron change was found in this comparison. Required exact-head CI still gates landing. The four incomplete jobs in attempt 1 had no runner execution; the inspected check-dependencies annotation reports that no self-hosted runner acquired the job. The same-source retry is running. No source, assertion, timeout or CI policy was weakened.Final CI: run 33877721716, attempt 2 passed on
c3953d899e8fe1f125a4a950b97b8e6b1605b297. The final PR check rollup is 132 passed and 43 skipped, with zero pending or failing checks. The retry completed the four jobs that had failed to acquire runners; no source change was needed.