feat(agents): configurable default runTimeoutSeconds for subagent spawns#24594
Merged
steipete merged 3 commits intoopenclaw:mainfrom Feb 24, 2026
Merged
Conversation
f63d23b to
863418a
Compare
When sessions_spawn is called without runTimeoutSeconds, subagents previously defaulted to 0 (no timeout). This adds a config key at agents.defaults.subagents.runTimeoutSeconds so operators can set a global default timeout for all subagent runs. The agent-provided value still takes precedence when explicitly passed. When neither the agent nor the config specifies a timeout, behavior is unchanged (0 = no timeout), preserving backwards compatibility. Updated for the subagent-spawn.ts refactor (logic moved from sessions-spawn-tool.ts to spawnSubagentDirect). Closes #19288 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Matches convention used by all other *Seconds/*Ms timeout fields. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e5810e5 to
1497658
Compare
Contributor
|
Landed via temp rebase onto main. Gate run:
Land commit: 1497658 Post-approval follow-up included docs + changelog updates for:
Thanks @mitchmcalister! |
plgs2005
pushed a commit
to plgs2005/openclaw
that referenced
this pull request
Feb 24, 2026
abdelkadermeflahi6-web
referenced
this pull request
Feb 24, 2026
abdelkadermeflahi6-web
referenced
this pull request
Feb 24, 2026
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
2 tasks
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 26, 2026
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
…24594) (thanks @mitchmcalister) (cherry picked from commit 8c5cf2d) # Conflicts: # docs/tools/subagents.md
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
…24594) (thanks @mitchmcalister) (cherry picked from commit 8c5cf2d) # Conflicts: # docs/tools/subagents.md
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When sessions_spawn is called without runTimeoutSeconds, subagents previously defaulted to 0 (no timeout). This adds a config key at agents.defaults.subagents.runTimeoutSeconds so operators can set a global default timeout for all subagent runs.
The agent-provided value still takes precedence when explicitly passed. When neither the agent nor the config specifies a timeout, behavior is unchanged (0 = no timeout), preserving backwards compatibility.
Closes #19288
Summary
sessions_spawndefaults to no timeout (0) when the agent omitsrunTimeoutSeconds, and there's no config key to change this defaultagents.defaults.subagents.runTimeoutSecondsconfig key; movedloadConfig()above the timeout resolution block insessions-spawn-tool.tsso the config value is available; added zod schema + TypeScript type for the new fieldrunTimeoutSecondspassed by the agent still wins; deployments without the config key behave identically to before (0 = no timeout)Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
agents.defaults.subagents.runTimeoutSeconds(number, seconds, default: unset = 0 = no timeout)sessions_spawncalls that omitrunTimeoutSecondswill use this value instead of 0runTimeoutSecondsstill takes precedenceSecurity Impact (required)
NoNoNoNoNoRepro + Verification
Environment
Steps
agents.defaults.subagents.runTimeoutSeconds: 900inopenclaw.jsonsessions_spawncall without explicitrunTimeoutSeconds(e.g., ask Johnny5 to spawn sports-analyst)agentgateway call should showtimeout: 900Expected
timeout: 900(from config)Actual
timeout: 0(hardcoded fallback)timeout: 900(config default applied)Evidence
Three new unit tests (all passing,
pnpm test:fast621/622 — 1 pre-existing failure inbrowser/server.post-tabs-open-profile-unknown):sessions_spawn default runTimeoutSeconds > uses config default when agent omits runTimeoutSeconds— config set to 900, no param passed, assertstimeout: 900sessions_spawn default runTimeoutSeconds > explicit runTimeoutSeconds wins over config default— config 900, param 300, assertstimeout: 300sessions_spawn default runTimeoutSeconds (config absent) > falls back to 0 when config key absent— no config key, assertstimeout: 0Human Verification (required)
runTimeoutSeconds: 900, container starts cleanlyMath.max(0, Math.floor(...))runTimeoutSeconds(only global default tested)Compatibility / Migration
YesYes— new optional config keyagents.defaults.subagents.runTimeoutSecondsNo— when absent, behavior is identical to before (0 = no timeout)Failure Recovery (if this breaks)
runTimeoutSecondsfrom config and restart — reverts to 0 (no timeout)openclaw.json(remove key fromagents.defaults.subagents)loadConfig()being called beforeparamsare available (shouldn't happen —paramscomes fromargswhich is available at function entry)Risks and Mitigations
min: 0so operators can always disable; agent can override per-spawnGreptile Summary
Adds a new config key
agents.defaults.subagents.runTimeoutSecondsso operators can set a global default timeout for all subagent runs spawned viasessions_spawn. When an agent omitsrunTimeoutSeconds, the config default is used; when both are absent, behavior is unchanged (0 = no timeout). The implementation movesloadConfig()earlier in theexecutefunction to make the config available for timeout resolution, adds Zod schema + TypeScript type for the new field, and includes three well-structured unit tests covering the key scenarios (config applied, explicit override wins, config absent fallback).Number.isFinite()+Math.max(0, Math.floor(...))protects against invalid config valuesloadConfig()move is safe — it was previously called a few lines later, and all variables it depends on are already availablerunTimeoutSeconds(subagents-tool.ts,commands-subagents.ts) read from the registry entry, which is populated at spawn time, so the config default flows through correctly.int()compared to all other*Secondstimeout fields in the codebaseConfidence Score: 4/5
.int()on the Zod validator). No logic bugs or security concerns.src/config/zod-schema.agent-defaults.ts— missing.int()constraint for consistency with other timeout fieldsLast reviewed commit: f63d23b
(2/5) Greptile learns from your feedback when you react with thumbs up/down!