diff --git a/apps/ai-game-creator-shell/scripts/agent-swarm-test-chat.mjs b/apps/ai-game-creator-shell/scripts/agent-swarm-test-chat.mjs index 246cc297a..fa10ae383 100644 --- a/apps/ai-game-creator-shell/scripts/agent-swarm-test-chat.mjs +++ b/apps/ai-game-creator-shell/scripts/agent-swarm-test-chat.mjs @@ -141,7 +141,7 @@ export const usage = `用法: --no-open 手工模式启动预览但不自动打开浏览器 --task <需求> 通过 manual 入口非交互提交自定义需求 --plan 走「做方案」立项策划入口,不做游戏,不做产物验收和试玩 - --timeout-minutes <分钟> 设置本次执行期限;自动任务默认 50 分钟,手工模式默认不限时 + --timeout-minutes <分钟> 设置本次执行期限;自动任务默认 50 分钟,--plan 默认 6 分钟,手工模式默认不限时 --dry-run 只检查目录发现和项目准备,不启动 LLM -h, --help 显示帮助`; @@ -222,7 +222,11 @@ export function shouldStartPersistentPreview(options) { } export function resolveSwarmTestTimeoutMs(options) { - const minutes = options.timeoutMinutes ?? (options.task ? 50 : null); + // 立项策划的设计目标是五分钟出方案,给一分钟余量;再久就是卡住了,早失败 + // 比让 harness 空等更有用。做游戏那条链路的 50 分钟不变。 + const planMinutes = options.plan ? 6 : null; + const minutes = + options.timeoutMinutes ?? planMinutes ?? (options.task ? 50 : null); return minutes === null ? null : minutes * 60_000; } diff --git a/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts b/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts index f06404855..be8b984fc 100644 --- a/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts +++ b/apps/ai-game-creator-shell/tests/agentSwarmTestEntry.test.ts @@ -730,6 +730,28 @@ describe('Swarm test argument parsing', () => { ).toBe(false); }); + it('bounds the plan lane to its own five-minute design target', () => { + // 交互模式也要有上限:立项策划没有可试玩产物可等,卡住就该早失败。 + expect(resolveSwarmTestTimeoutMs(parseSwarmTestArguments(['--plan']))).toBe( + 6 * 60_000, + ); + expect( + resolveSwarmTestTimeoutMs( + parseSwarmTestArguments([ + '--plan', + '--task', + '做一个解谜游戏的立项方案', + ]), + ), + ).toBe(6 * 60_000); + // 显式 --timeout-minutes 仍然压过默认值。 + expect( + resolveSwarmTestTimeoutMs( + parseSwarmTestArguments(['--plan', '--timeout-minutes', '20']), + ), + ).toBe(20 * 60_000); + }); + it('applies a bounded default only to non-interactive tasks', () => { expect(resolveSwarmTestTimeoutMs(parseSwarmTestArguments([]))).toBeNull(); expect(