Skip to content

Commit 04729c8

Browse files
committed
fix(tower): honor forced model for reviewers
1 parent 3bd516a commit 04729c8

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎docs/zh/configuration/env-vars.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ kimi
150150
| `KIMI_CODE_IDENTITY_SLUG` | 协议标识,用于发给第三方 provider 的 `User-Agent` 产品名和 MCP 客户端名,优先级高于 `[identity] slug`。未设置时由名称派生 | 任意非空字符串;会转小写并将连续非字母数字字符折叠为 `-` |
151151
| `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` | 是否向模型提供介绍 Kimi Code 自身的内置 Skills,优先级高于 `config.toml` 的 `builtin_product_skills`(默认开启) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` |
152152
| `KIMI_CODE_TUI_FULL_SCREEN` | 启用实验性的 fullscreen alternate-screen 界面:可滚动的 transcript 视口、鼠标选择文本、可点击链接、Ctrl-Shift-F 搜索 | `1` 开启;其他值保持常规内联界面 |
153-
| `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | [subagent 模型池](./config-files.md#subagent-模型池)默认启用,在包括交互式 TUI 在内的所有启动方式下生效;设为假值可禁用;master `KIMI_CODE_EXPERIMENTAL_FLAG=1` 会强制启用本功能 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` |
153+
| `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | [subagent 模型池](./config-files.md#subagent-模型池) 默认启用,在包括交互式 TUI 在内的所有启动方式下生效;设为假值可禁用;master `KIMI_CODE_EXPERIMENTAL_FLAG=1` 会强制启用本功能 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` |
154154
| `KIMI_CODE_EXPERIMENTAL_SUBAGENT_FORK` | 在 `Agent` 和 `AgentSwarm` 工具上启用实验性的 `fork` 参数,让模型可以以调用方 Agent 对话历史的快照而不是空上下文启动 subagent;master `KIMI_CODE_EXPERIMENTAL_FLAG=1` 也会启用本功能 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` |
155155
| `KIMI_MCP_STARTUP_TIMEOUT_MS` | 所有 MCP server 的全局默认连接超时(毫秒);优先级高于 `config.toml` 的 `[mcp] startup_timeout_ms`,但低于 `mcp.json` 中单个 server 的 `startupTimeoutMs`(默认 `30000`) | `1` 到 `2147483647` 的整数;非法值被忽略 |
156156
| `KIMI_MCP_TOOL_TIMEOUT_MS` | 所有 MCP server 的全局默认单次工具调用超时(毫秒);优先级高于 `config.toml` 的 `[mcp] tool_timeout_ms`,但低于 `mcp.json` 中单个 server 的 `toolTimeoutMs`(默认 `60000`) | `1` 到 `2147483647` 的整数;非法值被忽略 |

‎packages/agent-core-v2/src/features/tower/tools/spawn/spawnTool.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { subagentLabels } from '#/session/agentLifecycle/subagentMetadata';
3434
import { ISessionContext } from '#/session/sessionContext/sessionContext';
3535
import {
3636
DEFAULT_SUBAGENT_TIMEOUT_MS,
37+
isSubagentModelForced,
3738
resolveSubagentBinding,
3839
resolveSubagentThinking,
3940
wrapSubagentModelError,
@@ -162,13 +163,14 @@ export class TowerSpawnTool implements ITowerSpawnTool {
162163
const binding =
163164
own.modelAlias === undefined
164165
? undefined
165-
: args.kind === 'reviewer'
166-
? { model: own.modelAlias, thinking: own.thinkingLevel, modelSource: 'inherited' as const }
167-
: resolveSubagentBinding(
168-
this.config,
169-
this.flags,
170-
{ modelAlias: own.modelAlias, thinkingLevel: own.thinkingLevel },
171-
);
166+
: resolveSubagentBinding(
167+
this.config,
168+
this.flags,
169+
{ modelAlias: own.modelAlias, thinkingLevel: own.thinkingLevel },
170+
args.kind === 'reviewer' && !isSubagentModelForced(this.config)
171+
? 'primary'
172+
: undefined,
173+
);
172174
let handle: SubagentHandle;
173175
try {
174176
handle = await this.launch(prompt, description, toolCallId, controller, binding);

‎packages/agent-core-v2/test/features/tower/tools/spawnTool.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ describe('TowerSpawnTool', () => {
402402
});
403403
});
404404

405-
it('binds reviewers to the tower model when the secondary model is forced', async () => {
405+
it('binds reviewers to the forced secondary model when it is configured', async () => {
406406
secondaryModel = { model: 'cheap/fast', force: true };
407407

408408
const result = await execute({
@@ -412,9 +412,9 @@ describe('TowerSpawnTool', () => {
412412
});
413413

414414
expect(result.isError).toBeUndefined();
415-
expect(result.output).toContain('model: kimi-code');
415+
expect(result.output).toContain('model: cheap/fast');
416416
expect(createAgent).toHaveBeenCalledWith({
417-
binding: { profile: 'tower-worker', model: 'kimi-code', thinking: 'off' },
417+
binding: { profile: 'tower-worker', model: 'cheap/fast', thinking: undefined },
418418
labels: { parentAgentId: 'main' },
419419
});
420420
});

0 commit comments

Comments
 (0)