Repository navigation
fix(cron): use agent-turn timeout for main systemEvent jobs with wakeMode=now - #50670
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
|
Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
Greptile SummaryThis PR fixes a real timeout bug where Key observations:
Confidence Score: 5/5
Last reviewed commit: "fix(cron): use agent..." |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4616532917
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (job.sessionTarget === "main" && job.wakeMode === "now") { | ||
| return AGENT_TURN_SAFETY_TIMEOUT_MS; |
There was a problem hiding this comment.
Don't raise all default main-session wakes to a 60-minute stall window
Because wakeMode defaults to "now" for cron jobs (src/cron/normalize.ts:414-416), this branch silently changes most existing main-session systemEvent jobs from the 10-minute safety cap to a 60-minute cap. When runHeartbeatOnce() wedges on a provider/network stall, executeJobCoreWithTimeout() is the only thing that frees the worker (src/cron/service/timer.ts:53-73), and cron still runs with concurrency 1 by default (src/cron/service/timer.ts:81-85). In that scenario one stuck reminder now blocks unrelated scheduled jobs for up to 50 extra minutes, so the fix trades one false-timeout bug for a much larger scheduler-starvation window.
Useful? React with 👍 / 👎.
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