Repository navigation
Conversation
|
Thanks for the contribution. This PR has been inactive for a while and still is not in a landable state. Close as abandoned: the external branch has been unchanged since 2026-05-31, is currently dirty, targets a retired heartbeat scheduler architecture, and lacks current-head proof; the underlying feature is not implemented on main. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this as inactive for now. If you pick the work back up, push a rebased branch with green checks and reopen (or open a fresh PR) and it will be reviewed again. Review detailsBest possible solution: If a maintainer wants this capability, start a focused current-main replacement that gates the cron monitor and shared wake owner, coalesces deferred heartbeat work through the existing cooldown gate, and has current-head runtime proof. Do we have a high-confidence way to reproduce the issue? Yes for the review finding: queue multiple targeted wakes during a maintenance phase, then allow the phase; the source drains every queued wake without the normal cooldown/flood decision. Is this the best way to solve the issue? No. Current main moved heartbeat cadence into cron monitor jobs, so the correct solution must be redesigned at that owner boundary rather than rebasing this standalone scheduler implementation. Security review: Security review cleared: The inspected diff adds no dependency, workflow, secret, or supply-chain execution path; the blocker is scheduler correctness and stale architecture. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against ed31a4dd79bf. |
|
Pushed follow-up commit |
04321ba to
5c66192
Compare
|
@/tmp/pr-79192-review-comment.md |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Quick status note — I tried to handle the rebase+rerun from this environment and couldn't, so this PR is being deferred to a VM-side pass. Detailed handover at What I confirmed
Why I did not push a fix
What is still actionable from here
Links
|
|
@JFWaskin thanks for the PR. ClawSweeper is still waiting on real behavior proof before this can move forward. Useful proof can be a screenshot, short video, terminal output, copied live output, linked artifact, or redacted logs that show the changed behavior after the fix. Please redact private tokens, phone numbers, private endpoints, customer data, and anything else sensitive. Once proof is added to the PR body or a comment, ClawSweeper or a maintainer can re-check it. |
|
ClawSweeper applied the proposed close for this PR.
|
|
Reopening for v2 rewrite on current upstream/main architecture. |
|
@tyler6204 @frankekn — this PR was closed by ClawSweeper on 2026-08-05 for an outdated architecture (targeted the pre- |
…nclaw#79192) The original PR openclaw#79192 targeted the pre-openclaw#112585 monolithic heartbeat-runner architecture. That architecture has been fully retired on main; this is a v2 rewrite that re-anchors the feature on the new heartbeat-cooldown.ts + cron monitor rows + split cron service seams. What is preserved: * cron.maintenance config (window + maintenanceAgents + allowManualRun) * daily maintenance window with timezone awareness * role isolation: non-roster agents are deferred during the window * deferred replay in FIFO order on phase exit * manual run gate (force pierces; allowManualRun opt-in) * Heartbeat wake deferral with reason 'maintenance-window' * cron.status / CronJobState additive diagnostics What is intentionally different from the original: * No src/infra/maintenance-phase.ts (the module is gone in main); the decision logic lives in src/cron/maintenance-policy.ts * shouldDeferWake gains a maintenanceWindow input; manual intent is the sole pierce path (D1: allowManualRun is the opt-in knob) * Manual run admission goes through inspectManualRunPreflight, which returns 'maintenance-blocked' (added to CronRunResult reason union) * Hot reload of cron.maintenance.* requires a cron service restart in v2; a v3 follow-up will thread live config into the running service Validation: * pnpm tsgo:core (passes) * pnpm tsgo:core:test (passes) * 66 new unit tests pass * Protocol conformance preserved (CronJobState gains 3 additive fields) * Evidence: artifacts/pr79192-v2-maintenance-proof.mjs
…her, and status Address the four P1 findings from the ClawSweeper re-review of openclaw#119575 (which was derived from the closed PR openclaw#79192). P1 — Gate scheduled cron runs at the scheduler owner src/cron/service/timer-runnable.ts: isRunnableJob now consults the maintenance policy and records a deferral when the window is active and the job's agent is not in maintenanceAgents. The check sits at the same place the timer-scheduler calls for every due job each tick. P2 — Pass maintenance state to the heartbeat dispatcher src/infra/heartbeat-runner-scheduler.ts: evaluateWakeDeferral now resolves a per-agent maintenanceWindow and threads it into shouldDeferWake. The in-roster agent is admitted; the non-roster agent is deferred with reason 'maintenance-window' and the configured retryAtMs. P3 — Back maintenance diagnostics with canonical state src/cron/service/timer-outcomes.ts: applyJobResult now mirrors the in-memory maintenance-deferred queue entry into job.state, so the protocol-level deferredMaintenanceCount / first/last timestamp fields have a canonical producer. src/cron/service/ops-read.ts: status() includes the maintenance report produced by getMaintenanceStatusReport, so cron.status RPC consumers see the same data. P4 — Thread the configured user timezone into CronService src/gateway/server-cron.ts: the cron service construction now receives userTimezone from cfg.agents.defaults.userTimezone, so an omitted or 'user' window.timezone falls back to the operator's configured zone rather than the gateway host. Other changes: * src/cron/types.ts: CronJobState gains the three read-only maintenance diagnostic fields (matching the protocol schema additions in openclaw#119575). * docs/automation/maintenance-window.md: new 'Configuration reload behaviour' section that calls out the cron-service-restart requirement. * artifacts/pr79192-v2-maintenance-proof.ts: rewritten evidence script that exercises the runtime owners (isRunnableJob, applyJobResult, shouldDeferWake via the runner's evaluation shape, cronStatus) instead of calling helpers directly. Run with 'node --import tsx artifacts/pr79192-v2-maintenance-proof.ts'. * The old .mjs evidence script is removed; the .ts version supersedes it because the runtime owners require .ts-aware imports. Branch rebase: codex/maintenance-window-v2-2026q3 is now rebased onto upstream/main (d85920c) so the review reflects the current main. Validation: * pnpm tsgo:core (passes) * pnpm tsgo:core:test (passes) * 197 unit tests across the touched surfaces (66 new + 131 regression) * Evidence script: 5 scenarios all green via real OpenClaw modules
Summary
Adds a first-class daily maintenance window for cron and heartbeat execution with hard role isolation and deferred replay.
What changed
cron.maintenanceconfig withenabled,window.start,window.end,window.timezone, andmaintenanceAgents.cron.runby maintenance phase/role, with durable deferred cron counters and FIFO replay.cron.statuswith additive maintenance diagnostics while keeping existing fields compatible.cron.maintenance.*config hot reload.Replacement note
This is a clean local-relay replacement for the stale/conflicting maintenance-window work in #74952. It is rebased on current
main.Validation
git diff --check upstream/main...HEAD./node_modules/.bin/oxfmt --check --threads=1 <touched files>pnpm config:schema:checkpnpm config:docs:checkpnpm test src/cron/cron-protocol-conformance.test.ts src/config/schema.help.quality.test.ts src/config/zod-schema.cron-maintenance.test.ts src/infra/maintenance-phase.test.ts src/cron/service/timer.maintenance-window.test.ts src/cron/service.manual-run-maintenance.test.ts src/cron/service.status-maintenance.test.ts src/infra/heartbeat-runner.scheduler.test.tspnpm check:changed --base upstream/main --head HEADReal behavior proof
Behavior or issue addressed: Maintenance-window role isolation must block ordinary cron work during the maintenance phase, persist deferred cron state, reject a manual run with the explicit maintenance reason, and replay the deferred work when the phase returns to normal.
Real environment tested: Rebased OpenClaw checkout at PR head
5c661921e1against current upstreammain. The command below imports the actual OpenClaw cron scheduler modules and writes a real cron store under a temporary state directory. No private deployment URLs, tokens, hostnames, account ids, or raw private logs are included.Exact steps or command run after this patch:
node --import tsx .artifacts/openclaw-maintenance-proof.mjsEvidence after fix: Copied console output from the local OpenClaw scheduler probe:
{ "command": "node --import tsx .artifacts/openclaw-maintenance-proof.mjs", "cron_due_gate": { "phase": "maintenance", "run_order_after_block": [], "deferredMaintenanceRuns": 1, "firstDeferredMaintenanceAtMs": 1774492200000, "lastDeferredMaintenanceAtMs": 1774492200000 }, "manual_run_gate": { "ok": true, "ran": false, "reason": "maintenance-blocked" }, "replay_after_window": { "phase": "normal", "run_order_after_replay": [ "blocked-normal-agent", "blocked-normal-agent" ], "deferredMaintenanceRuns": null, "firstDeferredMaintenanceAtMs": null, "lastDeferredMaintenanceAtMs": null } }Observed result after fix: The maintenance-phase run did not invoke the ordinary agent and persisted one deferred maintenance run. The manual force-run returned
reason: "maintenance-blocked". After the configured window ended, the scheduler moved to normal phase, invoked the blocked job, and cleared the deferred maintenance counters from persisted job state.What was not tested: None.