Repository navigation
fix(cron): use agent-turn timeout for main systemEvent jobs with wakeMode=now - #50698
BryanTegomoh wants to merge 1 commit into
Conversation
…Mode=now When a systemEvent cron job targets the main session with wakeMode=now, the scheduler blocks while runHeartbeatOnce() executes the agent turn. The generic 10-minute timeout kills long-running turns even though the agent is actively working. Apply AGENT_TURN_SAFETY_TIMEOUT_MS (60 min) for this specific path, matching the ceiling already used for agentTurn jobs. Fixes openclaw#50621
Greptile SummaryThis PR fixes a premature timeout for Key points:
Confidence Score: 5/5
Last reviewed commit: "fix(cron): use agent..." |
|
CI failures (secrets/loader/memory tests) are pre-existing — also hitting unrelated PRs like #50743. Fix only touches |
|
closing — 21 CI failures, likely stale against main. will resubmit with a fresh branch if needed. |
Problem
When a
systemEventcron job targets the main session withwakeMode: "now", the scheduler callsrunHeartbeatOnce()and blocks while the agent turn runs. The outer timeout applied byresolveCronJobTimeoutMs()isDEFAULT_JOB_TIMEOUT_MS(10 minutes) for all non-agentTurnpayloads.Long-running agent turns (transcriptions, web searches, multi-step tasks) get killed with
"cron: job execution timed out"even though the agent is actively working. The reporter saw ~960s (16 min) runs getting cut.The
wakeMode: "next-heartbeat"path is not affected because it callsrequestHeartbeatNow()and returns immediately.Root cause
resolveCronJobTimeoutMs()treats allsystemEventjobs the same regardless of whether the scheduler actually blocks on the agent turn.Fix
Apply
AGENT_TURN_SAFETY_TIMEOUT_MS(60 min) whenjob.sessionTarget === "main" && job.wakeMode === "now", matching the ceiling already used foragentTurnjobs. All othersystemEventpaths keep the 10-min default.2 files changed, 1 logic branch + 2 tests added.
Fixes #50621