openclaw - 💡(How to fix) Fix docs+fix: script cron jobs have undocumented 10-min default timeout; timeoutSeconds not documented for script payload [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#52168Fetched 2026-04-08 01:14:51
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
commented ×1

cron jobs with payload.kind = "script" have a hardcoded default timeout of 600 seconds (10 minutes). This default is not documented anywhere. timeoutSeconds is listed in the docs only for agentTurn payloads, leaving script job authors with no guidance.

Error Message

Any long-running script job (batch importers, data sync, PDF processing, etc.) silently fails after 10 minutes with consecutiveErrors accumulating. Authors have no documented way to fix it and may not realize the issue is a timeout since the error message is generic.

Root Cause

cron jobs with payload.kind = "script" have a hardcoded default timeout of 600 seconds (10 minutes). This default is not documented anywhere. timeoutSeconds is listed in the docs only for agentTurn payloads, leaving script job authors with no guidance.

Fix Action

Fix / Workaround

  1. Add timeoutSeconds to the script payload docs — same treatment as agentTurn
  2. Document the default timeout per payload kind (script = 10 min, agentTurn = 60 min)
  3. Document timeoutSeconds: 0 = unlimited behavior
  4. Consider raising DEFAULT_JOB_TIMEOUT_MS for script from 10 to 30–60 min — 10 min is too short for legitimate workloads
  5. Add a global config knob (e.g. cron.defaultScriptTimeoutSeconds) for operators who want a different default without patching every job

Code Example

const DEFAULT_JOB_TIMEOUT_MS = 10 * 60_000;        // script and systemEvent — 10 min
const AGENT_TURN_SAFETY_TIMEOUT_MS = 60 * 60_000;  // agentTurn — 60 min

---

function resolveCronJobTimeoutMs(job) {
  const configuredTimeoutMs =
    (job.payload.kind === "agentTurn" || job.payload.kind === "script") &&
    typeof job.payload.timeoutSeconds === "number"
      ? Math.floor(job.payload.timeoutSeconds * 1000)
      : void 0;

  if (configuredTimeoutMs === void 0)
    return job.payload.kind === "agentTurn"
      ? AGENT_TURN_SAFETY_TIMEOUT_MS   // 60 min default
      : DEFAULT_JOB_TIMEOUT_MS;        // 10 min default

  return configuredTimeoutMs <= 0 ? void 0 : configuredTimeoutMs;  // 0 = unlimited
}
RAW_BUFFERClick to expand / collapse

Summary

cron jobs with payload.kind = "script" have a hardcoded default timeout of 600 seconds (10 minutes). This default is not documented anywhere. timeoutSeconds is listed in the docs only for agentTurn payloads, leaving script job authors with no guidance.

Source (compiled from src/cron/service/timeout-policy.ts)

const DEFAULT_JOB_TIMEOUT_MS = 10 * 60_000;        // script and systemEvent — 10 min
const AGENT_TURN_SAFETY_TIMEOUT_MS = 60 * 60_000;  // agentTurn — 60 min

The asymmetry is significant and undocumented: agentTurn jobs get a 60-minute safety ceiling by default; script jobs get only 10 minutes.

resolveCronJobTimeoutMs behavior

function resolveCronJobTimeoutMs(job) {
  const configuredTimeoutMs =
    (job.payload.kind === "agentTurn" || job.payload.kind === "script") &&
    typeof job.payload.timeoutSeconds === "number"
      ? Math.floor(job.payload.timeoutSeconds * 1000)
      : void 0;

  if (configuredTimeoutMs === void 0)
    return job.payload.kind === "agentTurn"
      ? AGENT_TURN_SAFETY_TIMEOUT_MS   // 60 min default
      : DEFAULT_JOB_TIMEOUT_MS;        // 10 min default

  return configuredTimeoutMs <= 0 ? void 0 : configuredTimeoutMs;  // 0 = unlimited
}
  • timeoutSeconds does work on script payloads — no platform ceiling above it
  • timeoutSeconds: 0 means no timeout (unlimited)
  • Without it, script jobs silently hit 10 min and fail with "cron: job execution timed out"

What the docs say

The cron jobs reference lists timeoutSeconds under agentTurn fields only:

timeoutSeconds: optional timeout override

The script payload schema in the docs shows only command, args, env, cwd — no timeoutSeconds.

Impact

Any long-running script job (batch importers, data sync, PDF processing, etc.) silently fails after 10 minutes with consecutiveErrors accumulating. Authors have no documented way to fix it and may not realize the issue is a timeout since the error message is generic.

Requests

  1. Add timeoutSeconds to the script payload docs — same treatment as agentTurn
  2. Document the default timeout per payload kind (script = 10 min, agentTurn = 60 min)
  3. Document timeoutSeconds: 0 = unlimited behavior
  4. Consider raising DEFAULT_JOB_TIMEOUT_MS for script from 10 to 30–60 min — 10 min is too short for legitimate workloads
  5. Add a global config knob (e.g. cron.defaultScriptTimeoutSeconds) for operators who want a different default without patching every job

extent analysis

Fix Plan

To address the issue, we need to update the documentation and consider adjusting the default timeout for script jobs. Here are the steps:

  • Update documentation:
    • Add timeoutSeconds to the script payload docs.
    • Document the default timeout per payload kind (script = 10 min, agentTurn = 60 min).
    • Document timeoutSeconds: 0 = unlimited behavior.
  • Adjust default timeout (optional):
    • Consider raising DEFAULT_JOB_TIMEOUT_MS for script from 10 to 30–60 min.
  • Add global config knob (optional):
    • Introduce a global config option (e.g., cron.defaultScriptTimeoutSeconds) for operators to set a custom default timeout.

Example Code Changes

To implement the global config knob, you can add the following code:

const cronConfig = {
  // ...
  defaultScriptTimeoutSeconds: 30, // default to 30 minutes
};

function resolveCronJobTimeoutMs(job) {
  // ...
  if (configuredTimeoutMs === void 0)
    return job.payload.kind === "agentTurn"
      ? AGENT_TURN_SAFETY_TIMEOUT_MS
      : cronConfig.defaultScriptTimeoutSeconds * 1000;
  // ...
}

Verification

To verify the fix, you can:

  • Check the updated documentation for script payload and default timeouts.
  • Test a script job with a timeout set to 0 (unlimited) and verify it runs without timing out.
  • Test a script job with a timeout set to a custom value and verify it times out accordingly.
  • If the global config knob is implemented, test setting a custom default timeout and verify it applies to script jobs.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix docs+fix: script cron jobs have undocumented 10-min default timeout; timeoutSeconds not documented for script payload [1 comments, 2 participants]