feat(subagent): increase default timeout from 10 min to 30 min

A subagent that times out loses all its work, so a generous default
reduces wasted compute. Update the constant, tool description, system
prompt guidelines, and documentation to reflect the new 1800s default.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jiang Bohan 2026-02-12 17:54:53 +08:00
parent 143d779376
commit 5b0cbd4d7d
5 changed files with 13 additions and 13 deletions

View file

@ -123,7 +123,7 @@ The subagent system allows a parent agent to spawn isolated child agents that ru
| `announce.ts` | System prompt builder, findings reader, message formatter, delivery |
| `announce-queue.ts` | Debounced queue for batching announcements when parent is busy |
| `command-queue.ts` | Concurrency limiter for subagent lane slots |
| `lanes.ts` | Lane config: max concurrency (10), default timeout (600s) |
| `lanes.ts` | Lane config: max concurrency (10), default timeout (1800s) |
| `types.ts` | Shared types: SubagentRunRecord, SubagentRunOutcome, etc. |
| `registry-store.ts` | Persistence: save/load runs to disk for crash recovery |
@ -159,10 +159,10 @@ Child run error (e.g., missing API key for provider)
## Timeout Behavior
Default: 600s (10 min). System prompt guides the parent LLM:
- Simple tasks: 600s (default)
- Moderate tasks: 900-1200s (15-20 min)
- Complex tasks: 1200-1800s (20-30 min)
Default: 1800s (30 min). System prompt guides the parent LLM:
- Simple tasks: 1800s (default)
- Moderate tasks: 1800-2400s (30-40 min)
- Complex tasks: 2400-3600s (40-60 min)
On timeout:
1. Timeout timer fires in `watchChildAgent()`

View file

@ -10,8 +10,8 @@ export const DEFAULT_SUBAGENT_MAX_CONCURRENT = 10;
// Timeout defaults
// ---------------------------------------------------------------------------
/** Default subagent timeout: 10 minutes. */
export const DEFAULT_SUBAGENT_TIMEOUT_SECONDS = 600;
/** Default subagent timeout: 30 minutes. */
export const DEFAULT_SUBAGENT_TIMEOUT_SECONDS = 1800;
/** Maximum safe value for setTimeout (~24.8 days). */
const MAX_SAFE_TIMEOUT_MS = 2_147_000_000;
@ -19,7 +19,7 @@ const MAX_SAFE_TIMEOUT_MS = 2_147_000_000;
/**
* Resolve the effective timeout in milliseconds for a subagent run.
*
* - `undefined` / negative default (600 s)
* - `undefined` / negative default (1800 s)
* - `0` no timeout (MAX_SAFE_TIMEOUT_MS)
* - positive number use as-is, clamped to safe range
*/

View file

@ -273,7 +273,7 @@ function watchChildAgent(record: SubagentRunRecord, timeoutSeconds?: number): Pr
resolveSlot(); // Release the queue slot
};
// Always set a timeout (default 10 min, 0 = ~24 days via resolveSubagentTimeoutMs)
// Always set a timeout (default 30 min, 0 = ~24 days via resolveSubagentTimeoutMs)
const timeoutTimer = setTimeout(() => {
cleanup({ status: "timeout" });

View file

@ -299,9 +299,9 @@ export function buildConditionalToolSections(
"",
"### Timeout Guidelines",
"Set timeoutSeconds generously — a sub-agent that times out loses all its work.",
"- Simple tasks (search, read, summarize): 600 (10 min, the default)",
"- Moderate tasks (multi-step research, file downloads + analysis): 9001200 (1520 min)",
"- Complex tasks (code generation, PDF creation, multi-file operations): 12001800 (2030 min)",
"- Simple tasks (search, read, summarize): 1800 (30 min, the default)",
"- Moderate tasks (multi-step research, file downloads + analysis): 18002400 (3040 min)",
"- Complex tasks (code generation, PDF creation, multi-file operations): 24003600 (4060 min)",
"When in doubt, use a longer timeout.",
"",
);

View file

@ -29,7 +29,7 @@ const SessionsSpawnSchema = Type.Object({
timeoutSeconds: Type.Optional(
Type.Number({
description:
"Execution timeout in seconds. Default: 600 (10 min). " +
"Execution timeout in seconds. Default: 1800 (30 min). " +
"Set to 0 for no timeout (useful for complex, long-running tasks). " +
"The subagent will be terminated if it exceeds this limit.",
minimum: 0,