Skip to content

fix(cron): respect per-job timeoutSeconds in executeJob path (#16841)#16880

Closed
echoVic wants to merge 2 commits intoopenclaw:mainfrom
echoVic:fix/cron-agent-timeout-16841
Closed

fix(cron): respect per-job timeoutSeconds in executeJob path (#16841)#16880
echoVic wants to merge 2 commits intoopenclaw:mainfrom
echoVic:fix/cron-agent-timeout-16841

Conversation

@echoVic
Copy link
Copy Markdown
Contributor

@echoVic echoVic commented Feb 15, 2026

Summary

Fixes #16841

The executeJob function (used for missed-job recovery, runDueJobs, and manual/forced runs via ops.ts) called executeJobCore directly without any timeout wrapper. Unlike the onTimer batch path which correctly used Promise.race with payload.timeoutSeconds, jobs running through executeJob relied solely on the inner agent timeout from resolveAgentTimeoutMs, which defaults to cfg.agents.defaults.timeoutSeconds and ignores the per-job payload.timeoutSeconds override.

Changes

Added the same Promise.race timeout wrapper to executeJob, reading payload.timeoutSeconds from the job config with DEFAULT_JOB_TIMEOUT_MS (10 min) as the fallback — matching the existing onTimer behavior.

Testing

  • Existing cron tests pass (service.issue-regressions, service.rearm-timer-when-running)
  • Linter and formatter pass (oxlint + oxfmt)

Greptile Summary

Adds Promise.race timeout wrapper to the executeJob function to respect per-job timeoutSeconds configuration. Previously, jobs executed via executeJob (used for missed-job recovery, manual runs, and forced execution) bypassed the job-level timeout and relied only on the inner agent timeout. This change mirrors the existing timeout logic in onTimer (lines 230-245), applying the same jobTimeoutMs calculation and Promise.race pattern with proper timeout cleanup.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation exactly mirrors the proven timeout pattern from onTimer (lines 230-245), uses the same timeout calculation logic, includes proper cleanup via .finally(), and maintains consistency across both execution paths. The change is minimal, focused, and directly addresses the documented issue.
  • No files require special attention

Last reviewed commit: d29fc2c

echoVic and others added 2 commits February 17, 2026 19:53
…w#16841)

The executeJob function (used for missed-job recovery, runDueJobs, and
manual/forced runs) called executeJobCore without any timeout wrapper,
unlike the onTimer batch path which correctly used Promise.race with
payload.timeoutSeconds.

This meant jobs running through executeJob relied solely on the inner
agent timeout from resolveAgentTimeoutMs (which defaults to the config
value agents.defaults.timeoutSeconds), ignoring the per-job
payload.timeoutSeconds override.

Add the same Promise.race timeout to executeJob, reading
payload.timeoutSeconds with DEFAULT_JOB_TIMEOUT_MS (10 min) as fallback,
matching the existing onTimer behavior.

Closes openclaw#16841
@echoVic
Copy link
Copy Markdown
Contributor Author

echoVic commented Feb 18, 2026

Friendly ping 👋 — CI is green, would appreciate a review when you get a chance. Thanks!

@Takhoffman
Copy link
Copy Markdown
Contributor

Closing as superseded by newer merged cron timeout work in #22411 and existing mainline timeout coverage. The executeJob path now uses executeJobCoreWithTimeout (see src/cron/service/ops.ts), so this PR is no longer needed.

@Takhoffman Takhoffman closed this Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron agentTurn jobs: no configurable per-job timeout (hardcoded 120s kills complex tasks)

3 participants