Skip to content

fix(cron): retry recurring wake-now jobs on temporary busy skips#76083

Merged
obviyus merged 3 commits into
openclaw:mainfrom
xuruiray:codex/75964-cron-busy-ghost-run
May 2, 2026
Merged

fix(cron): retry recurring wake-now jobs on temporary busy skips#76083
obviyus merged 3 commits into
openclaw:mainfrom
xuruiray:codex/75964-cron-busy-ghost-run

Conversation

@xuruiray

@xuruiray xuruiray commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #75964

Test plan

  • pnpm test src/cron/service/timer.regression.test.ts src/cron/service.runs-one-shot-main-job-disables-it.test.ts src/cron/service.main-job-passes-heartbeat-target-last.test.ts
  • pnpm test src/infra/heartbeat-runner.ghost-reminder.test.ts src/infra/heartbeat-wake.test.ts
  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md src/cron/service/timer.ts src/cron/service/timer.regression.test.ts src/cron/service.main-job-passes-heartbeat-target-last.test.ts
  • pnpm check:changed

@clawsweeper

clawsweeper Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

Summary
The PR changes recurring main-session wakeMode: "now" cron handling to retry temporary busy heartbeat skips, updates cron regression tests, and adds a changelog entry for #75964.

Reproducibility: yes. Current main has a high-confidence source-level reproduction: run a recurring main-session wakeMode: "now" cron job with runHeartbeatOnce returning requests-in-flight, and it enters the recurring fast-exit branch that records ok after one deferred wake.

Next step before merge
A repair worker can safely make the narrow changelog attribution fix on the PR branch without changing runtime behavior.

Security
Cleared: The diff only touches cron scheduling logic, tests, and changelog text; it does not change dependencies, workflows, secrets, permissions, package metadata, or downloaded code paths.

Review findings

  • [P3] Credit the known contributors in the changelog — CHANGELOG.md:36
Review details

Best possible solution:

Land the narrow cron timer fix after adding changelog credit and letting exact-head CI complete, while leaving broader recurring retry policy work to the existing separate retry issues.

Do we have a high-confidence way to reproduce the issue?

Yes. Current main has a high-confidence source-level reproduction: run a recurring main-session wakeMode: "now" cron job with runHeartbeatOnce returning requests-in-flight, and it enters the recurring fast-exit branch that records ok after one deferred wake.

Is this the best way to solve the issue?

Yes for the runtime behavior. The PR uses the narrow maintainable boundary: retry temporary requests-in-flight and lanes-busy skips through the existing bounded wait while preserving the cron-in-progress deferred wake path.

Full review comments:

  • [P3] Credit the known contributors in the changelog — CHANGELOG.md:36
    OpenClaw changelog policy asks user-facing contributor entries to include a human Thanks @... attribution when the credited people are known. This new fix entry has no attribution even though both the reporter and PR author are known, so add a credit such as Thanks @kshetrajna12 and @xuruiray.
    Confidence: 0.86

Overall correctness: patch is correct
Overall confidence: 0.86

Acceptance criteria:

  • pnpm exec oxfmt --check --threads=1 CHANGELOG.md

What I checked:

Likely related people:

  • scoootscooob: Merged PR fix(cron): avoid busy-wait drift for recurring main jobs #58872 added the recurring main-session busy fast-exit and regression test that this PR refines. (role: introduced adjacent behavior; confidence: high; commits: 10750fb80e8f; files: src/cron/service/timer.ts, src/cron/service.issue-regressions.test.ts)
  • steipete: Recent main history shows multiple cron and heartbeat maintenance commits on the central timer and heartbeat-runner paths. (role: recent maintainer; confidence: high; commits: 42d73fd955af, 61d53f98d314, f5e7557c70c1; files: src/cron/service/timer.ts, src/infra/heartbeat-runner.ts)
  • obviyus: Recent work preserved deferred cron heartbeat targets and wake overrides on the same cron-to-heartbeat request contract. (role: adjacent owner; confidence: medium; commits: 1d4e4314dddc, 4c8299ca3d4f; files: src/cron/service.main-job-passes-heartbeat-target-last.test.ts, src/cron/service/timer.ts, src/infra/heartbeat-wake.ts)

Remaining risk / open question:

  • The exact PR head still needs the remaining in-progress CI check to finish before merge.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 61fc62ade70a.

@obviyus obviyus self-assigned this May 2, 2026
@obviyus
obviyus force-pushed the codex/75964-cron-busy-ghost-run branch from 7f40c72 to 1c9ff48 Compare May 2, 2026 13:44

@obviyus obviyus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the recurring wake-now main-session cron bug path: temporary heartbeat busy skips now retry through the existing bounded loop instead of recording an ok ghost run after one deferred wake.

Maintainer follow-up: added the required changelog attribution/PR reference and trimmed the cron-in-progress comment to the actual invariant.

Local gate: tests skipped by maintainer request; ran targeted oxfmt on the touched changelog and cron timer files.

@obviyus
obviyus merged commit 473fc0a into openclaw:main May 2, 2026
79 checks passed
@obviyus

obviyus commented May 2, 2026

Copy link
Copy Markdown
Contributor

Landed on main.

Thanks @xuruiray.

lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants