Repository navigation
fix(cron): cancellation reason survives late delivery finalization - #129331
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4156e57 to
4ef16a5
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4156e57 to
4ef16a5
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 10:28 PM ET / August 26, 2026, 02:28 UTC. ClawSweeper reviewWhat this changesThis PR preserves an operator cancellation reason when late cron finalization records the underlying execution and delivery outcome. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo blocking correctness finding: this is the current owner-boundary repair for a source-proven cron lifecycle bug. It should remain open for protected maintainer handling and exact-head CI completion. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherCron writes generic task lifecycle state and cron-specific detail, then projects that detail into run history. A late completion event must update cron history without overwriting an operator-owned cancellation outcome. flowchart LR
A[Operator cancellation] --> B[Generic task record]
C[Cron completion event] --> D[Late finalization]
D --> E[Cron detail]
B --> F[Persisted task row]
E --> G[Run history projection]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +24. Total +32 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land this owner-boundary repair once exact-head CI is green, retaining the generic fallback for legacy task rows and the split between cancellation reason and cron execution history. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main clears a cancelled row’s error during late finalization, and the focused regression captures that exact ordering. Is this the best way to solve the issue? Yes. Keeping cancellation state in the generic task owner while storing the distinct cron execution outcome in cron detail avoids conflating two valid outcomes and preserves legacy reads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 93573e8fdf7a. LabelsLabel 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) |
4ef16a5 to
1fd6335
Compare
1fd6335 to
8015e3e
Compare
|
Maintainer decision: accept the durable ownership split in this PR. The generic task lifecycle remains authoritative for the operator cancellation outcome and reason. Cron-owned detail is the canonical source for the underlying execution error and summary on newly written rows, with the tested legacy-row fallback retained. Focused proof after refreshing onto current main: 52/52 tests passed across task-run finalization, interruption, and history projection. Fresh Codex autoreview reported no actionable findings. This records the owner decision requested by the latest ClawSweeper review before guarded landing. |
|
Maintainer decision: accept the durable ownership split in this PR. The generic task lifecycle remains authoritative for the operator cancellation outcome and reason. Cron-owned detail is the canonical source for the underlying execution error and summary on newly written rows, with the tested legacy-row fallback retained. Focused proof after refreshing onto current main: 52/52 tests passed across task-run finalization, interruption, and history projection. Fresh Codex autoreview reported no actionable findings. This records the owner decision requested by the latest ClawSweeper review before guarded landing. |
Keep the generic task cancellation outcome and reason authoritative while storing the underlying cron execution, completion, and delivery outcomes in cron-owned history detail. Co-authored-by: Tak Hoffman <[email protected]>
8015e3e to
37c83f7
Compare
|
Land-ready proof for exact head 37c83f7:
|
|
Merged via squash.
|
…claw#129331) Keep the generic task cancellation outcome and reason authoritative while storing the underlying cron execution, completion, and delivery outcomes in cron-owned history detail. Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...
Related: #125397
Related: #117425
What Problem This Solves
Fixes an issue where operators who cancel or disable a running cron task can lose the recorded cancellation reason when a later cron completion event attaches execution and delivery history.
This replaces the stale, conflicting implementation in #125397 while preserving its original author and current
completionStatussemantics.Why This Change Was Made
The generic task lifecycle remains authoritative for cancellation status and reason, while cron-owned detail remains authoritative for execution, completion, and delivery outcomes. Late cron finalization can therefore attach accurate history without clearing an accepted operator cancellation reason.
The replacement retains current main's required-delivery completion contract and implements both Rank-up moves from ClawSweeper's latest #125397 review: preserve
completionStatusduring rebase and prove cancelled task state together with failed required delivery.Production LOC: +16/-8 (net +8) in the existing task-finalization/detail codec; tests: +32/-8 (net +24). The production growth records the otherwise-lost cron-owned execution error/summary in the existing detail object while leaving generic cancellation fields authoritative. No config, schema, protocol, or parallel persistence path is added.
Maintainer decision: accept the additive cron-detail contract for this repair. It is the owner-authored design from #125397, uses only the existing JSON detail object, preserves the generic cancellation contract, and is necessary to retain cron-native execution/completion/delivery facts without erasing the operator cancellation reason. Older readers continue to open the row and retain their prior projection; the tested legacy fallback remains intact.
User Impact
Cancelled or disabled cron task records keep the operator-visible cancellation reason, while cron history still reports the underlying execution, failed completion, and interrupted delivery accurately.
Evidence
13934fef3d77: applying only the new regression test and runningnode scripts/run-vitest.mjs src/cron/service/task-runs.test.ts -t 'keeps operator cancellation reason when required delivery is interrupted'failed atsrc/cron/service/task-runs.test.ts:483; the persisted cancelled task was missingerror: "Cancelled by operator.".4ef16a512172:node scripts/run-vitest.mjs src/cron/service/task-runs.test.ts src/cron/service/timer-job-runner.interruption.test.ts src/cron/task-run-history.test.ts src/cron/service.persists-delivered-status.test.ts src/cron/service/timer.regression.test.ts— 140 passed. This covers the original cancellation/finalization order, thecompletionStatus: "failed"history projection, interruption mapping, a real hanging webhook cancellation, and timeout-disabled operator cancellation.node scripts/check-changed.mjs -- src/cron/service/task-runs.ts src/cron/task-run-detail.ts src/cron/service/task-runs.test.ts src/cron/service/timer-job-runner.interruption.test.ts src/cron/task-run-history.test.ts— passed, including formatting, production/core-test typechecks, zero-warning lint, dead exports, database guards, and import cycles..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output— clean, no accepted/actionable findings; correctness 0.99.AI-assisted implementation and verification. No user transcripts are included.