fix: let isolated cron setup use the job timeout budget#96219
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 11:25 PM ET / 03:25 UTC. Summary PR surface: Source +7, Tests +17. Total +24 across 3 files. Reproducibility: yes. Source inspection shows current main always arms a fixed 60-second setup watchdog before runner start while isolated 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:
Next step before merge
Security Review detailsBest possible solution: Land the bounded derived-watchdog fix if maintainers accept longer stuck-setup occupancy, while tracking post-start deadlocks, Codex initialize diagnostics, and configurability in their separate items. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main always arms a fixed 60-second setup watchdog before runner start while isolated Is this the best way to solve the issue? Yes for the narrow pre-runner setup-timeout bug. The fix sits at the watchdog owner, reuses the existing job timeout budget, avoids a new config surface, and leaves broader Codex and post-start cleanup behavior to separate work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa3c9de45965. Label changesLabel justifications:
Evidence reviewedPR surface: Source +7, Tests +17. Total +24 across 3 files. View PR surface stats
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
|
|
Same family of issue observed here (RapidFix.be) but with a post-start failure mode, not a pre-start timeout. Our pattern: The isolated session does start — it claims the queue item (sets status='processing'), runs for 60-108 seconds, but then the model call fails or returns empty content. The session hangs with " Two root causes we found (local LLM context):
Fixes applied locally: The 60-second setup watchdog (this PR's fix) would help when the model is slow to respond, but once the session has started and made a model call, a different cleanup mechanism is needed to prevent orphaned "processing" states and "already-running" deadlocks. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
What Problem This Solves
OpenClaw cron isolated
agentTurnjobs could fail before the runner ever started because the setup watchdog had a fixed 60-second ceiling, independent of the job's much larger timeout budget. Aaron's liveRoute Meeting Transcripts (Daily)cron (3549b060-2ab7-440b-aca5-7c8c9871e0d3) showed this exact failure pattern: repeated runs ended after about 60 seconds withcron: isolated agent setup timed out before runner start, no session id, no model/provider, and no token usage.Root cause
The isolated cron agent setup watchdog had a hardcoded 60-second ceiling. Installed-code evidence from the failing environment pointed to
server-cron-B_E4z-Px.js:493(CRON_AGENT_SETUP_WATCHDOG_MS = 6e4) plusserver-cron-B_E4z-Px.js:566-569, where the setup watchdog fired while still waiting for the runner.Fix
Derive the isolated-agent setup watchdog from the job timeout with bounded limits: keep the existing 60-second minimum for short jobs, cap setup at 10 minutes, and otherwise allow setup to use half of the job timeout budget. Timeout diagnostics still use
setupTimeoutErrorMessage(...), and setup timeout telemetry reports the derived watchdog timeout.Sibling occurrences
Searched for
CRON_AGENT_SETUP_WATCHDOG_MS,setupTimeoutErrorMessage,waiting_for_runner, andresolveCronAgentSetupWatchdogMs. The only cron setup watchdog path issrc/cron/service/agent-watchdog.ts; it is fixed here. Other hits are tests and retry-hint text, intentionally unchanged.Evidence
Added a regression test for an isolated cron
agentTurnwhose runner starts after the previous 60-second setup ceiling but before the job timeout.origin/main:node scripts/test-projects.mjs src/cron/service/agent-watchdog.test.tsfailed withcron: isolated agent setup timed out before runner start.node scripts/test-projects.mjs src/cron/servicepassed, 15 files / 151 tests.pnpm test:changedpassed, 2 files / 9 tests.pnpm lintpassed;pnpm checkpassed.pnpm format:checkcurrently reports unrelated baseline formatting issues across 218 existing files; targetedpnpm exec oxfmt --check src/cron/service/agent-watchdog.test.ts src/cron/service/agent-watchdog.ts src/cron/service/timer.tspassed, andgit diff --check origin/mainpassed.3549b060-2ab7-440b-aca5-7c8c9871e0d3; it completedokin 128,683 ms with session30d3924b-6479-4bf7-a922-d6d6c3e27afd, modelgpt-5.5, provideropenai. Scheduler readback now showslastRunStatus=ok,lastStatus=ok,last_error=null, andconsecutive_errors=0.