Repository navigation
fix(cron): prevent run waits from failing after clock changes - #129805
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 11:47 PM ET / August 26, 2026, 03:47 UTC. ClawSweeper reviewWhat this changesThis PR changes Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for normal maintainer handling: current main still measures the wait budget with wall time, while this focused patch moves that owner loop to monotonic elapsed time without a concrete regression found in review. The remaining exact-head check is still in progress. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe cron CLI starts a queued manual run, then polls the Gateway task ledger until it records a terminal status or the operator’s wait budget expires. The wait loop derives each polling RPC timeout and returns the final result to the CLI. flowchart LR
A[Operator runs cron command] --> B[CLI queues manual run]
B --> C[Wait loop]
C --> D[Monotonic elapsed-time budget]
D --> E[Gateway run-history poll]
E --> F{Terminal status?}
F -->|yes| G[CLI prints completion]
F -->|no| C
Decision needed
Why: The protected maintainer label and member authorship require explicit human handling even though the code review found no blocking defect. Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +12. Total +12 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the monotonic clock at the CLI wait-loop owner, retain integer timeout derivation, and land only after the remaining exact-head validation and maintainer review complete. Do we have a high-confidence way to reproduce the issue? Yes, by source: current main subtracts Is this the best way to solve the issue? Yes. The wait loop owns the deadline, and monotonic elapsed time plus integer rounding fixes the clock-jump defect without changing gateway protocol or user configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 345cfde43dc9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...
What Problem This Solves
Fixes an issue where operators running
openclaw cron run --waitcould receive an immediate false timeout after the system clock moved forward, or wait far beyond their requested deadline after the clock moved backward.Why This Change Was Made
Measure the existing CLI wait deadline with the monotonic clock instead of wall time. Round elapsed milliseconds down before deriving each Gateway RPC timeout so fractional monotonic readings preserve the existing positive safe-integer timeout contract, including the initial poll for a zero-duration wait.
User Impact
Manual cron runs remain observable and respect their requested wait deadline across NTP corrections and manual system-clock changes. Explicit shorter RPC timeouts and zero-duration waits retain their existing behavior.
Evidence
1after a one-hour forward jump; a one-hour backward jump inflates a remaining75msdeadline into a600000msGateway timeout.219 passedacrosssrc/cli/cron-cli.test.tsandsrc/cli/cron-cli/register.cron-simple.test.ts.markdown-it, and@earendil-works/pi-tui; exact-head hosted CI must validate the fresh dependency graph.+3/-3; regression tests:+14/-2.