Repository navigation
fix(cron): paused future one-shots disappear after Run now - #152126
Conversation
Keep the documented future one-shot occurrence after an out-of-band manual run, including paused jobs and runs queued across the scheduled deadline. Reuse the existing preserved-occurrence marker across reload and enablement, while clearing it when scheduling inputs change. Ordinary completed one-shots remain consumed, and retry slots keep precedence over the authored date. Extends the manual-run scheduling contract from #114491. Existing deleted jobs are not recovered; downgrading to older code can lose this protection.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 4:45 PM ET / 20:45 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR preserves paused future one-shot automations after Run now, retains their scheduled occurrence across restart and re-enablement, and adds regression coverage and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main and the latest release. No blocking defect was found, and the refreshed integrated-build UI evidence resolves the previous proof request. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw’s cron service receives saved automation schedules and manual Run now requests. It coordinates execution and persists completion state so later scheduled runs, restarts, and UI views agree. flowchart TD
A[Saved one-shot automation] --> C[Cron admission]
B[Manual Run now] --> C
C --> D[Execute automation]
D --> E[Preserve or consume occurrence]
E --> F[Saved job and run history]
F --> G[Restart and re-enable]
G --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +75, Tests +253, Docs +2. Total +330 across 15 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep authored one-shot occurrences in the existing scheduler state until actual scheduled consumption or a genuine scheduling edit, while preserving pause state. Do we have a high-confidence way to reproduce the issue? Yes: create a paused future Once automation with Delete after run enabled, then run it successfully. Current-main source establishes the deletion path, and the supplied before screenshot corroborates it; this review did not execute the scenario. Is this the best way to solve the issue? Yes. Reusing the existing occurrence marker repairs the established manual-run contract without adding configuration, schema fields, or a competing scheduler. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d492bb93684a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Record the borrowed future occurrence in the authoritative manual reservation before an enablement edit can stale its completion. This preserves the pending scheduled run across restart when queued execution begins after its deadline. Keep actual schedule changes authoritative, including changes away and back. The same entry-point regression fails on the original parent and the first paused-job fix. Cover both admission times, active schedule invalidation, restart, and eventual scheduled consumption through CronService.
|
Merged via squash.
|
…49075-c1-control-repair * commit 'dc5b321b5f89f9cf0e704ee202ea3059fb1ce63d': (79 commits) fix: start background context maintenance after durable turns (#151936) fix(models): avoid ambient state reads during prepared selection (#152119) feat: recover abandoned Crabbox source staging (#152006) chore(ui): refresh control ui locales (#152098) fix(ui): keep cloud startup prompts and progress in chat (#152024) fix: report completed subprocess cleanup after cancellation (#152107) perf(reply): reuse normalized inbound text (#152110) fix(cron): paused future one-shots disappear after Run now (#152126) perf(sessions): reuse rows and skip discarded terminal labels (#152109) fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135) fix(ui): load remote images in compact activity previews (#152045) refactor(health): skip unused verbose account projection (#152108) fix: restore dashboard test limits and SQLite test compilation (#152089) test(qa-lab): stabilize timeout recovery delivery proof (#152100) fix: probe SQLite when Node denies worker threads (#152075) perf(gateway): keep GitHub co-author trailer scans linear (#152115) fix(media): report CLI models with missing command or args (#151969) refactor: remove retired runtime code and duplicate helpers (#151973) perf(plugins): combine runtime and tool call scopes (#152101) test(memory): seed restart fixtures with the Gateway stopped (#152038) ...
…n-20260918-v4 * origin/main: (81 commits) fix: retire failed setup plugins without replaying facade initialization (#152026) fix(test): select Node for built runtime recovery fixtures (#152162) refactor(auth): reuse privately assembled choice groups (#152166) fix: preserve chat media delivery and session boundaries (#152079) fix: keep stale Stop messages from canceling replacement sessions (#152116) improve(plugins): reduce mutable argument handling overhead (#152154) fix(scripts): prevent host tooling drift from blocking PR workflows (#152078) improve: reduce model capability preparation work (#152128) fix: stop marking delivered scheduled reports as failed (#152165) fix: start background context maintenance after durable turns (#151936) fix(models): avoid ambient state reads during prepared selection (#152119) feat: recover abandoned Crabbox source staging (#152006) chore(ui): refresh control ui locales (#152098) fix(ui): keep cloud startup prompts and progress in chat (#152024) fix: report completed subprocess cleanup after cancellation (#152107) perf(reply): reuse normalized inbound text (#152110) fix(cron): paused future one-shots disappear after Run now (#152126) perf(sessions): reuse rows and skip discarded terminal labels (#152109) fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135) fix(ui): load remote images in compact activity previews (#152045) ...
…152126) * fix(cron): preserve paused one-shots after manual runs Keep the documented future one-shot occurrence after an out-of-band manual run, including paused jobs and runs queued across the scheduled deadline. Reuse the existing preserved-occurrence marker across reload and enablement, while clearing it when scheduling inputs change. Ordinary completed one-shots remain consumed, and retry slots keep precedence over the authored date. Extends the manual-run scheduling contract from openclaw#114491. Existing deleted jobs are not recovered; downgrading to older code can lose this protection. * fix: restore SQLite test compilation * fix(cron): retain manual one-shot ownership before enablement Record the borrowed future occurrence in the authoritative manual reservation before an enablement edit can stale its completion. This preserves the pending scheduled run across restart when queued execution begins after its deadline. Keep actual schedule changes authoritative, including changes away and back. The same entry-point regression fails on the original parent and the first paused-job fix. Cover both admission times, active schedule invalidation, restart, and eventual scheduled consumption through CronService.
Related: #114491
What Problem This Solves
Fixes paused future Once automations being deleted after a successful Run now when Delete after run is enabled, even though their scheduled occurrence has not happened.
User Impact
Running a paused future one-shot now leaves it paused and keeps its saved occurrence. Re-enabling it restores that occurrence, including when a manual run was accepted before the deadline but waited in the command queue until afterward. Enabling the job during that delayed manual execution also preserves its pending occurrence across restart.
The fix applies to existing saved jobs without a configuration change or database schema migration. It does not recover jobs already deleted. Downgrading to older code can clear the retained occurrence marker and lose this protection. Ordinary completed one-shots remain consumed when re-enabled.
Why This Change Was Made
The manual-run contract in #114491 preserves a future scheduled occurrence. Completion inferred that occurrence only from
nextRunAtMs, but pausing intentionally removes that runnable timestamp. A successful manual run therefore reached delete-after-run handling despite the future authored date.Completion now uses the authored one-shot date when no runnable slot exists, while preserving existing retry-slot precedence. The existing
forcePreservedNextRunAtMsmarker retains that exact authored occurrence through paused maintenance, reload, and enablement. Manual reservation records this provenance before an enablement edit can make completion stale. Genuine scheduling edits invalidate it; actual scheduled completion consumes it. Keeping the marker also prevents a delayed manual success from being mistaken for the scheduled execution after restart or re-enabling.The one-shot computation and marker validation share a small scheduler helper. Existing store reload coverage moves to a sibling test file to respect the repository's line caps. No new state field, scheduling policy, or retention policy is introduced.
Evidence
987b622a92bf, create a future Once automation, leave it paused with default Delete after run, and click Run now. The run completes successfully, then the job disappears and its selected detail reports it cannot be found. An enabled future one-shot control remains saved after Run now. The inspected synthetic before/after screenshots are attached in the originating chat and embedded below.58aaf1dfcontaining73912959e807, create a new future Once automation for September 21 at 09:30 America/Los_Angeles with default Delete after run, pause it, and click Run now. The actual OpenAI run (gpt-5.6-luna) completes successfully in four seconds with the expected synthetic response. The same job remains visible as Paused with its original date. After a full reload, the list still contains that paused job with its original date. The saved Delete after run switch remains checked. Enabling shows the original September 21 date and Next in 3d; another full reload retains that active schedule. Re-pausing succeeds and restores the Paused state.00598a56e84d: eleven scheduler/store/admission test files pass all 323 tests, covering direct and queued manual runs, paused durable state with no runnable timestamp, successful history, restart, re-enable, actual due execution/deletion, schedule replacement, removal, retries, reservation cleanup/conflicts, and ordinary completed-job non-revival.Before
After
97025447efc7with all scheduler source matchinga56c641677cc, upgrade the existing paused future Once job and click Run now. Actual OpenAIgpt-5.6-lunahistory reports OK in three seconds with the expected synthetic response. The job remains Paused at September 21, 09:30. Enabling shows Active and Next in 3d; a full reload retains the active job and date. Re-pausing restores the saved paused state.CI integration at
a56c641677cc: merged reviewed main47c4fbcband the exact three-line repair from #152133, preserving both ancestries. All scheduler, documentation, and regression-test blobs match local build97025447efc7, where the unchanged 24-case one-shot suite passes with current main’s scheduler execution ownership. The three SQLite file blobs exactly match #152133; fresh review of the integrated PR delta is clean.Hosted CI: the earlier heads encountered duplicate declarations in three unchanged SQLite test files from a shared-main merge interaction. The integrated head includes that repair. The same three file contents have since landed on main in
3fceb86048c4(#152028), satisfying the dependency on #152133. Exact-head CI 35391856269 passed, and the current-head review reported no actionable findings. Both images render in the originating chat and on this PR. Native preparation and merge completed with the reviewed head unchanged; landed aseed0fcc30c4bon main.