Skip to content

fix(cron): paused future one-shots disappear after Run now - #152126

Merged
steipete merged 4 commits into
mainfrom
codex/qa-paused-future-once
Sep 18, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/qa-paused-future-once

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

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 forcePreservedNextRunAtMs marker 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

  • Actual UI before-proof: on 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.
  • Actual UI after-proof: on local build 58aaf1df containing 73912959e807, 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.
  • Regression proof: untouched production fails four paused cases (16 pass). A deletion-guard-only change leaves the queued-across-deadline case failing (19 pass), demonstrating that keeping the row alone loses the scheduled occurrence on re-enable. The store reload matrix separately fails its enablement case before the marker normalization repair (28 pass).
  • Enable-during-execution regression: a queued run accepted before the deadline, started afterward, and enabled while its payload runs loses the pending occurrence after restart on both the original parent and the first fix. Recording the marker at reservation repairs this sibling defect. The test also changes the schedule away and back while active to prove that genuine edits invalidate the old occurrence.
  • Final local proof at 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.
  • Checks: all 31 selected checks pass, including core production types, the services test type graph, targeted typed lint, line-cap/assertion/storage guards, and import cycles. Focused docs MDX sanity and whitespace checks pass. Fresh independent P0–P2 review of the complete staged candidate is clean. An additional four trigger/pacing sibling files previously passed all 76 tests. The existing screenshots show the first fix; the same unchanged UI behavior was rechecked on the integrated source as described below.

Before

Before: paused future Once automation disappears after Run now

After

After: successful manual run leaves the future Once automation paused

  • Integrated-source real UI proof: on local build 97025447efc7 with all scheduler source matching a56c641677cc, upgrade the existing paused future Once job and click Run now. Actual OpenAI gpt-5.6-luna history 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 main 47c4fbcb and the exact three-line repair from #152133, preserving both ancestries. All scheduler, documentation, and regression-test blobs match local build 97025447efc7, 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 as eed0fcc30c4b on main.

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.
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 19:58
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 4:45 PM ET / 20:45 UTC (Revision 3).

ClawSweeper review

What this changes

The 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
Reviewed head: a56c641677cc869e8308734c852e3082e7e13078

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-level repair with strong lifecycle regressions, inspected visual evidence, and refreshed real UI verification.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots show the cron completion repair’s visible result, and the captured integrated-build UI observations exercise an existing saved job through Run now, re-enablement, reload, and re-pausing with scheduler source matching the reviewed head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after screenshots show the cron completion repair’s visible result, and the captured integrated-build UI observations exercise an existing saved job through Run now, re-enablement, reload, and re-pausing with scheduler source matching the reviewed head.
Evidence reviewed 7 items Current main still has the defect: The fetched main implementation requires a future nextRunAtMs to preserve a one-shot during manual completion. Paused jobs lack that runnable timestamp, allowing successful delete-after-run completion to remove them.
Latest release retains the same condition: The v2026.9.4 source also requires previousScheduleState.nextRunAtMs before preserving the future occurrence; this PR’s central repair is not present there.
Occurrence retention stays with the scheduler: The shared helper falls back to the authored future date while preserving runnable-slot precedence. Reservation records the existing occurrence marker, enablement retains it, and genuine scheduling edits invalidate it.
Findings None None.
Security None None.

How this fits together

OpenClaw’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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +75, Tests +253, Docs +2. Total +330 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 7 103 28 +75
Tests 7 631 378 +253
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 736 406 +330

Review metrics

Metric Value Why it matters
Production versus test growth production net +75 lines; tests net +253 lines Production growth consolidates occurrence validation and retention across existing scheduler owners; test growth covers durable lifecycle regressions.

Technical review

Best 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.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: Run now can silently delete a saved paused automation and lose its future scheduled execution.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): Inspected before/after screenshots show the cron completion repair’s visible result, and the captured integrated-build UI observations exercise an existing saved job through Run now, re-enablement, reload, and re-pausing with scheduler source matching the reviewed head.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after screenshots show the cron completion repair’s visible result, and the captured integrated-build UI observations exercise an existing saved job through Run now, re-enablement, reload, and re-pausing with scheduler source matching the reviewed head.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after screenshots show the cron completion repair’s visible result, and the captured integrated-build UI observations exercise an existing saved job through Run now, re-enablement, reload, and re-pausing with scheduler source matching the reviewed head.

Evidence

What I checked:

  • Current main still has the defect: The fetched main implementation requires a future nextRunAtMs to preserve a one-shot during manual completion. Paused jobs lack that runnable timestamp, allowing successful delete-after-run completion to remove them. (src/cron/service/timer-outcomes.ts:193, d492bb93684a)
  • Latest release retains the same condition: The v2026.9.4 source also requires previousScheduleState.nextRunAtMs before preserving the future occurrence; this PR’s central repair is not present there. (src/cron/service/timer-outcomes.ts:189, 3a9d69db306c)
  • Occurrence retention stays with the scheduler: The shared helper falls back to the authored future date while preserving runnable-slot precedence. Reservation records the existing occurrence marker, enablement retains it, and genuine scheduling edits invalidate it. (src/cron/service/one-shot-schedule.ts:7, a56c641677cc)
  • Regression coverage exercises observable lifecycle behavior: The reviewed service tests cover paused and enabled jobs, success/error/skipped results, queued deadline crossings, enablement during execution, restart, schedule replacement, and eventual scheduled consumption. The completed-job test also verifies that re-enabling does not revive an ordinary consumed occurrence. Tests were inspected, not executed in this read-only review. (src/cron/service.one-shot-schedule-ownership.test.ts:237, a56c641677cc)
  • Inspected visual proof and resolved prior follow-up: Both prepared images were inspected: the before image shows successful run history with a missing-job error, while the after image shows the retained paused automation, original date, and successful result. The captured body at sourceRevision 0ccabb6631581820cd9b6c2ac1fba66ed31d162265aa9cea6afae2d870e097f9 additionally records an integrated-source real UI run on build 97025447efc7 with scheduler source matching the reviewed head: an existing saved job survives Run now, enabling, reload, and re-pausing. This answers the prior refreshed-build proof request. The body discloses that already-deleted jobs are not recovered and older code can lose the protection on downgrade. (a56c641677cc)
  • Prior merged work establishes the intended contract: fix(cron): preserve future one-shots during manual runs #114491 merged the future-one-shot manual-run preservation contract; its documented proof covered enabled jobs. Current-main history also identifies steipete’s shared outcome-owner refactor at ffab5e9. These support routing beyond authorship of this proposal; exact line-introduction attribution was not established. (src/cron/service/timer-outcomes.ts, ffab5e92a8df)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-18T20:06:26.160Z sha 7391295 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-18T20:25:26.190Z sha 00598a5 :: blocked before merge. :: none

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.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 18, 2026
Merge main 47c4fbc and the exact reviewed repair from #152133 to remove
shared-main duplicate promisify declarations blocking scheduler PR CI.
Keep both upstream ancestries. Scheduler source matches the independently
reviewed local build, including the current execution-owner cutover.
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 18, 2026
@steipete
steipete merged commit eed0fcc into main Sep 18, 2026
230 checks passed
@steipete
steipete deleted the codex/qa-paused-future-once branch September 18, 2026 20:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…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)
  ...
vincentkoc added a commit that referenced this pull request Sep 18, 2026
…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)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant