Repository navigation
fix(cron): cancel removed conditions before main-session handoff - #138313
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The lifecycle boundary looks well chosen. Registering cancellation while the condition trigger owns the run, then releasing it only at onPayloadExecutionStarted, closes the gap where removal/disable could race the evaluator and still publish a late fire. The regression where the evaluator ignores abort but cannot publish is especially important. Reusing the shared abortable sleep also removes a bespoke cancellation path. I don’t see a blocking issue here.
|
@clawsweeper review The initial completed review is still missing. Exact-head CI for |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 10:39 AM ET / 14:39 UTC. ClawSweeper reviewWhat this changesThe PR keeps cron cancellation active while a trigger condition runs, releases it before a main-session payload hands off to heartbeat, and adds regression coverage and documentation. Merge readiness✅ Ready for maintainer review No blocking correctness or security finding. Current main still lacks cancellation binding for main-session trigger conditions; this PR adds it at the cron-run owner boundary and preserves the independent heartbeat lifecycle after handoff. Priority: P1 Review scores
Verification
How this fits togetherCron jobs can run a condition before dispatching a payload. Conditions need cancellation while they run; main-session payloads then queue work to the shared heartbeat lifecycle. flowchart LR
A[Cron schedule] --> B[Trigger condition]
B --> C[Cancellation handle]
C --> D{Condition fires?}
D -->|No| E[Reschedule]
D -->|Yes| F[Main-session payload]
F --> G[Shared heartbeat]
H[Operator remove or disable] --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -10, Tests +135, Docs +2. Total +127 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the owner-boundary cancellation lifetime: abort pending conditions on operator removal or disable, but leave already handed-off heartbeat work under its existing lifecycle. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible: current main only creates a cancellable handle for detached payloads, while main-session conditions receive the abort signal only through that missing handle. Is this the best way to solve the issue? Yes—the fix attaches cancellation to the condition’s actual lifecycle owner and releases it synchronously at the existing main-session handoff, rather than adding a downstream suppression. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 523221e3767f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged in 4b732d72e65 from reviewed head 091385547e06. Pending cron conditions now stop when the operator removes or disables their job. Cancellation ends at the main-session handoff, preserving the existing heartbeat lifecycle. The fix removes 10 production lines. Validation includes 130 focused tests, seven normal Gateway command scenarios, three before/after HTTP heartbeat handoff controls, full changed checks, independent review and green exact-head CI. The completed ClawSweeper review has no findings. Main contains the landed commit and is clean. The original completion-comment request received HTTP 403 after the confirmed merge. Read-only native reconciliation verified the landed tree and the absence of a completion marker; this records the administrative closeout. |
…9-prep * commit '407a8f453c0f0306af1ddc0aafa8697c1d49a9e7': (312 commits) perf(ui): coalesce automation event refreshes (#138065) fix: reject incomplete Skill Workshop directory reads (#138082) test(ui): decouple rendering checks from generated wording (#138283) perf: avoid temporary entries in bounded JSON traversal (#138017) fix(irc): render complete messages before splitting (#138328) perf: prepare worker trajectory payloads only for recorded events (#138086) fix(mcp): paginated listings no longer time out after a forward clock step (#137206) fix(codex): page native transcripts and bound UI previews (#136282) feat(gateway): apply more settings without restarting (#138112) fix(docs): preserve mirrored ClawHub maturity links (#138241) fix(test): own UI animation and legacy database setup (#138296) fix(tts): preserve literal directives in Markdown code (#138319) fix: load chat widgets behind authenticated gateways (#138074) chore(ui): cover native approval finalization (#137259) fix(cron): cancel conditions before main-session handoff (#138313) fix(backup): preserve text after embedded NUL characters (#138327) fix(android): align composer control sheets (#137442) fix(ci): wait for replacement PR runs instead of stale failures (#138307) fix(sessions): keep Gateway responsive with long transcripts (#138094) fix(computer): map window inputs to delivered image coordinates (#138271) ... # Conflicts: # scripts/release-check.ts # test/release-check.test.ts
Additional instructions
Maintainers can update this branch through normal repository access.
What Problem This Solves
Fixes an issue where removing or disabling an automation during a main-session condition left its command running. Disabling could also enqueue the system event and record success after the operator had stopped the automation.
Why This Change Was Made
The scheduler previously chose cancellation lifetime from the eventual payload, leaving main-session conditions without a callback. The existing active marker and controller now own cancellation through condition evaluation, then release it synchronously before the main-session payload takes over. Shared heartbeat and detached payload lifecycles retain their existing ownership.
The duplicate heartbeat retry timer/listener and its single-use parameter are removed in favor of the existing abortable-sleep helper. Production: 25 added / 35 removed, net −10. Tests: net +135, including moved table indentation; documentation: +2. Configuration, stored formats, schema, migrations and delegated authority are unchanged.
User Impact
Removing or disabling a condition stops its pending command and prevents the canceled condition from starting the payload. Once a main-session heartbeat has already taken over, its request completes under the existing heartbeat lifecycle.
Evidence
4a4b39734084529d59584fe9e7f184db3b1c3d09, after fix(cron): preserve the final reply after automation self-removal #138231 landed, preserves all six final files byte-for-byte. The published head is091385547e0628503f555e0e1e70d9731d8958db. Required exact-head CI must pass before landing.The first pre-bind fixture used an invalid schedule/condition combination and was corrected before production edits; the corrected regression then failed for the intended cancellation defect. Two rejected timer implementations did not cooperate with the existing fake clock. The final code uses the canonical helper and retains the original timing assertions, without a new mock or longer timeout.
Release-note context: stop removed or disabled automation conditions before they can execute delayed commands or start a main-session payload; preserve heartbeat completion after handoff.