Repository navigation
fix(cron): extend main system event timeout - #86733
ferminquant wants to merge 4 commits into
Conversation
|
Codex review: needs changes before merge. Reviewed June 15, 2026, 3:09 AM ET / 07:09 UTC. Summary PR surface: Source -3, Tests +16, Other +2. Total +15 across 26 files. Reproducibility: yes. Current main maps non-agent systemEvent jobs to DEFAULT_JOB_TIMEOUT_MS while the main-session wake-now path awaits runHeartbeatOnce under executeJobCoreWithTimeout. Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land a clean cron-only version that extends only the blocking main-session wake-now systemEvent timeout, preserves all other timeout behavior, restores wrapper-path regression coverage, and records maintainer acceptance of the longer cron slot occupancy tradeoff. Do we have a high-confidence way to reproduce the issue? Yes. Current main maps non-agent systemEvent jobs to DEFAULT_JOB_TIMEOUT_MS while the main-session wake-now path awaits runHeartbeatOnce under executeJobCoreWithTimeout. Is this the best way to solve the issue? Yes, conditionally. Reusing the existing one-hour safety ceiling only for the blocking wake-now path is narrower than removing the watchdog or adding configuration, but the submitted branch is not the best merge shape until unrelated churn is removed and wrapper coverage is restored. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against efbefceb0e2e. Label changesLabel justifications:
Evidence reviewedPR surface: Source -3, Tests +16, Other +2. Total +15 across 26 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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 PR egg ✨ Hatched: 🥚 common Neon Shellbean Hatch commandComment Hatchability rules:
Rarity: 🥚 common. What is this egg doing here?
|
This comment was marked as spam.
This comment was marked as spam.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…odex/50621-cron-systemevent-timeout
|
@steipete ready for review when you have a cycle. Routing to you since you're the BDFL; please reassign to a sub-owner if anyone else is closer to the area. |
… test, drop unused import)
|
Closing this PR rather than letting it sit indefinitely. |
Linked context
Closes #50621.
Summary
systemEventjobs withwakeMode: "now".systemEventjobs, includingwakeMode: "next-heartbeat".agentTurn.timeoutSecondsbehavior and the existing 60-minute safety ceiling for agent-turn jobs without an explicit timeout.AI assistance disclosure
I used Codex to inspect the issue, related closed PRs, existing cron source, tests, and validation output, then to draft and verify this patch. I reviewed and understand the affected path: cron resolves the job timeout in
src/cron/service/timeout-policy.ts,executeJobCoreWithTimeoutapplies that watchdog insrc/cron/service/timer.ts, and main-session wake-now system events block while awaitingrunHeartbeatOnce.Real behavior proof
Behavior addressed: A blocking main-session cron
systemEventwithwakeMode: "now"no longer uses the generic 10-minute job timeout while cron is waiting forrunHeartbeatOnce; the next-heartbeat systemEvent path remains on the generic timeout.Real environment tested: Local OpenClaw workspace on the rebased branch using the real cron timeout resolver and
executeJobCoreWithTimeoutpath with isolated fake cron dependencies and no live credentials.Exact steps or command run after this patch:
pnpm exec tsx .artifacts/issue-50621/runtime-proof.tsEvidence after fix:
Observed result after fix: The target main-session wake-now systemEvent resolved to the 60-minute safety ceiling, did not settle after the old 10-minute window, called
runHeartbeatOnceonce, and completed successfully after the heartbeat promise resolved. A main-session next-heartbeat systemEvent still resolved to the 10-minute default.What was not tested: A live provider/model run was not exercised; the proof isolates the cron watchdog path rather than spending credentials or model time.
Root Cause
resolveCronJobTimeoutMstreated everysystemEventjob as generic cron work, so it returnedDEFAULT_JOB_TIMEOUT_MSeven when the main-session wake-now path synchronously awaitedrunHeartbeatOnce. That made a long but valid main-session heartbeat run fail around the generic cron watchdog window even though the underlying work was running in the main session.Dependency contract / source proof
No external dependency behavior is changed. The relevant internal contracts are:
src/cron/types.ts:timeoutSecondsbelongs toagentTurnpayloads, notsystemEventpayloads.src/cron/service/jobs.ts: main-session jobs aresystemEventpayloads; isolated/current/session target jobs areagentTurnpayloads.src/cron/service/timer.ts:executeJobCoreWithTimeoutwraps the actual run usingresolveCronJobTimeoutMs, and the blocking main-session path awaitsrunHeartbeatOnceonly forwakeMode: "now".Regression Test Plan
src/cron/service/timeout-policy.test.tscovers the exact policy split:systemEvent+wakeMode: "now"usesAGENT_TURN_SAFETY_TIMEOUT_MS.systemEvent+wakeMode: "next-heartbeat"keepsDEFAULT_JOB_TIMEOUT_MS.src/cron/service/timer.regression.test.tscovers the real wrapper path by keepingrunHeartbeatOncepending past the old default timeout and confirming the job does not complete early.Security Impact
No credential, network, auth, or permission behavior changes. The patch only adjusts a local cron watchdog ceiling for one already-supported blocking runtime path.
Human Verification
I reviewed the affected cron timeout path, the main-session wake-now execution path, the related issue discussion, and closed reference PRs before accepting the final patch shape.
CODEOWNERS / owner review
The touched files are not matched by
.github/CODEOWNERS. Nearby cron owner rules exist forsrc/cron/stagger.tsandsrc/cron/service/jobs.ts, but this patch does not touch either file.Changelog
Contributor PR: no
CHANGELOG.mdentry added.Review conversations
Reference issue/PR review checked before implementation:
Risks
Behavior tradeoffs
Scope boundaries
wakeMode: "next-heartbeat"behavior.systemEventjobs unbounded or long-running.agentTurn.timeoutSeconds, includingtimeoutSeconds <= 0.Validation
Passed: 3 files, 58 tests.
Passed: changed lanes
core,coreTests.Passed: "The timeout policy change is narrowly scoped to main-session wake-now systemEvent jobs and is covered by focused policy and regression tests. I did not identify a correctness regression in the changed code."