From f9945eeb409b2e9c825220062a21328debbbcc48 Mon Sep 17 00:00:00 2001 From: keaixiaozhu Date: Sat, 18 Jul 2026 15:13:49 +0800 Subject: [PATCH] fix(agent-core): correct v1 Agent tool description to say fixed 2-hour timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1 engine's Agent tool description told the model "subagents use a fixed 30-minute timeout", but the actual default has been 2 hours since v0.23.6 (#1562) and was aligned across engines in v0.24.2 (#1704). The v2 tool description was updated at the time; the v1 copy was missed and the test assertion in packages/agent-core/test/tools/agent.test.ts:131 enshrined the stale string, so the drift went unnoticed. Since the interactive CLI defaults to the v1 engine, this stale text is what most sessions injected into model context. Actual timeout enforcement was already 2 hours (DEFAULT_SUBAGENT_TIMEOUT_MS in subagent-host.ts) — only the LLM-facing description was wrong. Update: - packages/agent-core/src/tools/builtin/collaboration/agent.md:12 — "fixed 30-minute" → "fixed 2-hour" (matches v2's agent.md). - packages/agent-core/src/session/subagent-host.ts:41 — the JSDoc still said "(30 min)", update to "(2 hours)". - packages/agent-core/test/tools/agent.test.ts:131 — assertion updated. Fixes #1817 --- .changeset/fix-v1-agent-tool-description-timeout.md | 5 +++++ packages/agent-core/src/session/subagent-host.ts | 2 +- packages/agent-core/src/tools/builtin/collaboration/agent.md | 2 +- packages/agent-core/test/tools/agent.test.ts | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/fix-v1-agent-tool-description-timeout.md diff --git a/.changeset/fix-v1-agent-tool-description-timeout.md b/.changeset/fix-v1-agent-tool-description-timeout.md new file mode 100644 index 0000000000..61b9f417e8 --- /dev/null +++ b/.changeset/fix-v1-agent-tool-description-timeout.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Correct the v1 engine `Agent` tool description to say "fixed 2-hour timeout" instead of the stale "fixed 30-minute timeout" — the default was raised to 2 hours in v0.23.6 (#1562) and aligned across engines in v0.24.2 (#1704), but the v1 tool description shown to the model was missed. Since the interactive CLI defaults to the v1 engine, this stale text is what most sessions injected into model context, which could cause the model to unnecessarily split long delegations or resume subagents believing they had been killed by a nonexistent 30-minute cap. Actual enforcement was already correct; only the LLM-facing description was wrong. diff --git a/packages/agent-core/src/session/subagent-host.ts b/packages/agent-core/src/session/subagent-host.ts index d6c4b6369d..09ca752326 100644 --- a/packages/agent-core/src/session/subagent-host.ts +++ b/packages/agent-core/src/session/subagent-host.ts @@ -38,7 +38,7 @@ const SUBAGENT_TIMEOUT_ENV = 'KIMI_SUBAGENT_TIMEOUT_MS'; /** * Resolve the effective subagent per-task timeout. Precedence: * `KIMI_SUBAGENT_TIMEOUT_MS` (positive integer ms) → `configMs` → - * `DEFAULT_SUBAGENT_TIMEOUT_MS` (30 min). Set a large value to effectively + * `DEFAULT_SUBAGENT_TIMEOUT_MS` (2 hours). Set a large value to effectively * disable the cap. The value feeds the background-task manager's per-task * timeout, so it governs foreground and background subagents (and AgentSwarm). */ diff --git a/packages/agent-core/src/tools/builtin/collaboration/agent.md b/packages/agent-core/src/tools/builtin/collaboration/agent.md index ec0533e7ef..d8b65d7c0d 100644 --- a/packages/agent-core/src/tools/builtin/collaboration/agent.md +++ b/packages/agent-core/src/tools/builtin/collaboration/agent.md @@ -9,7 +9,7 @@ Writing the prompt: Usage notes: - When the task continues earlier work a subagent already did, prefer resuming that agent (pass its `resume` id) over spawning a fresh instance — the resumed agent keeps its prior context. - A subagent's result is only visible to you, not to the user. When the user needs to see what a subagent produced, summarize the relevant parts yourself in your own reply. -- Subagents use a fixed 30-minute timeout. If one times out, resume the same agent instead of starting over. +- Subagents use a fixed 2-hour timeout. If one times out, resume the same agent instead of starting over. When NOT to use Agent: skip delegation for trivial work you can do directly — reading a file whose path you already know, searching a small known set of files, or any task that takes only a step or two. Delegation has a context-handoff cost; it pays off only when the task is substantial enough to outweigh it. diff --git a/packages/agent-core/test/tools/agent.test.ts b/packages/agent-core/test/tools/agent.test.ts index ec5109c2ef..b277023753 100644 --- a/packages/agent-core/test/tools/agent.test.ts +++ b/packages/agent-core/test/tools/agent.test.ts @@ -128,7 +128,7 @@ describe('AgentTool', () => { const host = mockSubagentHost({ spawn: vi.fn() }); const tool = agentTool(host); - expect(tool.description).toContain('fixed 30-minute timeout'); + expect(tool.description).toContain('fixed 2-hour timeout'); expect(tool.description).not.toContain('operator-configured background timeout'); expect(tool.description).not.toContain('no time limit'); // Background guidance must steer foreground-by-default, so the model doesn't