fix: harden agent prompt handling

This commit is contained in:
Codex
2026-05-30 13:52:18 +08:00
parent 9eb44acd18
commit 5a858f89b5
12 changed files with 212 additions and 69 deletions

View File

@@ -36,6 +36,7 @@ import {
CLEANUP_TIMEOUT,
PROCESS_KILL_ESCALATION_TIMEOUT,
ACP_ABORT_TIMEOUT,
ACP_PROMPT_TIMEOUT,
ENGINE_DESTROY_TIMEOUT,
DEPS_SYNC_TIMEOUT,
NPM_MIRRORS,
@@ -151,6 +152,7 @@ describe("Constants", () => {
expect(CLEANUP_TIMEOUT).toBeGreaterThan(0);
expect(PROCESS_KILL_ESCALATION_TIMEOUT).toBeGreaterThan(0);
expect(ACP_ABORT_TIMEOUT).toBeGreaterThan(0);
expect(ACP_PROMPT_TIMEOUT).toBeGreaterThan(0);
expect(ENGINE_DESTROY_TIMEOUT).toBeGreaterThan(0);
expect(DEPS_SYNC_TIMEOUT).toBeGreaterThan(0);
});

View File

@@ -151,6 +151,9 @@ export const PROCESS_KILL_ESCALATION_TIMEOUT = 5000;
/** ACP 会话取消超时 (ms) */
export const ACP_ABORT_TIMEOUT = 15_000;
/** ACP prompt 等待响应超时 (ms) */
export const ACP_PROMPT_TIMEOUT = 60_000;
/**
* 用户主动取消会话时,挂在 `Error` 上的 `code`(与 `message` 语言无关)。
* `message` 经主进程 `t()` 本地化后,`isPromptCancellation` 仍靠此字段识别,避免误触发 MCP 重试。