Skip to content

fix(cron): explicit cron wakes bypass heartbeat quiet-hours gate (#105413)#105830

Merged
steipete merged 1 commit into
openclaw:mainfrom
SymbolStar:fix/issue-105413
Jul 18, 2026
Merged

fix(cron): explicit cron wakes bypass heartbeat quiet-hours gate (#105413)#105830
steipete merged 1 commit into
openclaw:mainfrom
SymbolStar:fix/issue-105413

Conversation

@SymbolStar

@SymbolStar SymbolStar commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #105413

What Problem This Solves

Main-session cron jobs execute through the heartbeat runner. Before this change, that transport also inherited heartbeat.activeHours, so an explicit cron wake outside the heartbeat window returned quiet-hours before reading the queued cron payload. The job was silently skipped even though heartbeat scheduling policy does not own cron execution.

Why This Change Was Made

The rewrite normalizes the wake source once, before heartbeat override resolution and policy gates. Explicit and reason-inferred cron wakes then use the same source for heartbeat configuration, active-hours admission, preflight prompt selection, and persisted outcome metadata.

Ordinary scheduled heartbeats still obey active hours. Cron still uses the existing tagged-event prompt, delivery, busy-lane, and event-consumption paths; only the heartbeat scheduling-window gate is bypassed.

This replaces the original patch on current main. It preserves @SymbolStar's diagnosis and contributor credit while integrating the newer targeted-notification gate and replacing a weak not quiet-hours assertion with a full queued-event execution test.

User Impact

Recurring or one-shot sessionTarget: main / payload.kind: systemEvent jobs now run their actual payload outside heartbeat active hours. Inside and outside the window, the model receives the cron-event prompt instead of a generic heartbeat poll.

Evidence

  • Integrated regression queues a tagged cron event at 07:00 UTC with heartbeat active hours 08:00–24:00, then proves:
    • result is ran;
    • exactly one model reply is requested;
    • provider is cron-event;
    • prompt contains the scheduled payload;
    • prompt excludes heartbeat-poll text;
    • delivery runs.
  • Focused local suite: 25/25.
  • Blacksmith stress: 30 consecutive focused runs, 750/750 tests, zero failures.
  • Heartbeat/cron interaction matrix: 5 files, 98/98 tests, covering ordinary quiet hours, wake coalescing, tagged cron prompts, and main-job heartbeat delegation.
  • Blacksmith check:changed: production/test types, lint, format, boundaries, import cycles, database-first guard, and related checks passed.
  • Autoreview: clean; no accepted/actionable findings, correctness confidence 0.91.
  • Live isolated gateway reached readiness on custom port 29741 with the 00:00–00:01 UTC quiet window and OpenAI credentials available. Fresh-state admin RPC correctly required device identity; the Testbox had no approved identity to reuse, so no model-call claim relies on that blocked lane.

Co-authored-by credit is preserved for jindongfu. AI-assisted maintainer rewrite; I reviewed the active-hours gate, wake-source inference, preflight prompt selection, main-session cron caller, event consumption, and sibling wake paths.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Jul 13, 2026
@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 4:06 PM ET / 20:06 UTC.

Summary
The branch normalizes inferred heartbeat wake sources, exempts cron-originated wakes from heartbeat active-hours skipping, and adds regression coverage in the heartbeat-runner test suite.

PR surface: Source +6, Tests +32. Total +38 across 2 files.

Reproducibility: no. high-confidence live reproduction was supplied for this updated head. The source path and added regression scenario make the quiet-hours branch reproducible by inspection, but they do not prove an after-fix gateway cron payload reaches a real agent turn.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #105413
Summary: This PR is a candidate fix for the open active-hours/main-session cron regression; the related reports describe adjacent but not identical event-consumption and timing-race failures.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted after-fix gateway evidence for an outside-hours main-session systemEvent cron payload.
  • Show the control case that an ordinary scheduled heartbeat still skips during the same active-hours window.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR supplies source analysis and regression tests but no redacted after-fix gateway cron run demonstrating that the payload executes outside active hours; add terminal output, runtime logs, or a reproducible live transcript and redact private details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging changes the effective schedule for existing cron-originated wakes: jobs that were previously suppressed by heartbeat.activeHours will run outside that window, so maintainer-visible proof should establish that active hours are intentionally limited to heartbeat polling.
  • [P1] No after-fix real gateway execution is supplied for the user-visible failure mode, leaving payload delivery and ordinary-heartbeat preservation unverified outside mocks/tests.

Maintainer options:

  1. Prove the intended scheduling boundary (recommended)
    Add redacted after-fix gateway output showing an outside-hours cron payload runs while a normal scheduled heartbeat still returns quiet-hours.
  2. Accept the scheduling contract explicitly
    A maintainer may accept that heartbeat.activeHours never governs cron-triggered execution, including for existing configurations that previously relied on suppression.

Next step before merge

  • [P1] The remaining merge blocker is contributor-supplied real runtime proof rather than a discrete code repair suitable for an automated fix worker.

Security
Cleared: The two-file runtime/test diff does not add dependencies, secrets handling, external execution, or a concrete security-boundary regression.

Review details

Best possible solution:

Provide redacted real gateway evidence that a main-session systemEvent cron executes its payload outside active hours while an ordinary scheduled heartbeat remains skipped, then land the narrow wake-source gate if that contract is confirmed.

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

No high-confidence live reproduction was supplied for this updated head. The source path and added regression scenario make the quiet-hours branch reproducible by inspection, but they do not prove an after-fix gateway cron payload reaches a real agent turn.

Is this the best way to solve the issue?

Yes, provisionally: carrying the resolved wake source through heartbeat resolution, quiet-hours gating, preflight, and event logging is narrower and less drift-prone than a separate cron-only bypass. Real runtime proof is still needed before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1626a1696c60.

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: Cron-originated wakes that were previously skipped outside configured heartbeat active hours would begin executing after merge.

Label justifications:

  • P1: The patch targets a regression that can silently prevent scheduled cron payloads from reaching an agent turn for affected users.
  • merge-risk: 🚨 compatibility: Cron-originated wakes that were previously skipped outside configured heartbeat active hours would begin executing after merge.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR supplies source analysis and regression tests but no redacted after-fix gateway cron run demonstrating that the payload executes outside active hours; add terminal output, runtime logs, or a reproducible live transcript and redact private details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +6, Tests +32. Total +38 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 5 +6
Tests 1 32 0 +32
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 43 5 +38

What I checked:

  • Cron wake boundary: The patch derives one wakeSource before heartbeat resolution, uses it for cron-specific merging and preflight, and skips quiet-hours only when that source is cron; ordinary scheduled heartbeats still take the active-hours gate. (src/infra/heartbeat-runner.ts:1324, 4652c6dca645)
  • Regression coverage: The changed ghost-reminder harness adds active-hours and deterministic-clock controls, then adds a tagged-cron-payload case outside heartbeat hours alongside the existing cron/heartbeat behavior tests. (src/infra/heartbeat-runner.ghost-reminder.test.ts:318, 4652c6dca645)
  • Canonical report remains open: The PR is explicitly proposed as the fix candidate for the still-open report describing main-session system-event cron payloads being skipped during heartbeat quiet hours. (4652c6dca645)
  • Real-behavior evidence gap: The PR body documents tests and source analysis but does not provide a redacted after-fix gateway run showing a main-session system-event cron payload executes outside heartbeat.activeHours; passing checks are supplemental to that proof.

Likely related people:

  • mbelinky: The PR’s feature-history map identifies commit d4e59a3666d8 as the cron-to-heartbeat delegation contract relevant to this change. (role: related delegation-path contributor; confidence: medium; commits: d4e59a3666d8; files: src/cron/service/timer.ts)
  • vignesh07: The PR’s feature-history map identifies commits 54513f424066 and 4c4d2558e34c as the tagged cron-event prompt behavior that the patch must preserve. (role: related cron-prompt contributor; confidence: medium; commits: 54513f424066, 4c4d2558e34c; files: src/infra/heartbeat-runner.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-13T01:40:52.562Z sha 7efab2b :: needs real behavior proof before merge. :: none

@steipete
steipete merged commit a7e4765 into openclaw:main Jul 18, 2026
131 of 133 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

2 participants