fix(mcp): guide client and provider timeout recovery (#5608)
Teach client deadline recovery before REA results can be discarded, distinguish producer-owned server budgets, and preserve Evidence/cleanup uncertainty. Include actual Codex CLI recovery probes and CLI/MCP regression coverage. Fixes #5598 Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
This commit is contained in:
1 parent
2a6fc712eb
commit
a35623707e
14 files changed
+179
-37
No files matched your search
@@ -151,6 +151,11 @@ const TARGET_FREE_INSTRUCTIONS =
|
||||
const ACTIVE_TARGET_INSTRUCTIONS =
|
||||
"REA analyzes the active reverse-engineering target. Use the analysis tool that answers the question directly. Search or list symbols when discovery is needed; analyze_function provides a function dossier, and focused procedure tools return individual facets.";
|
||||
|
||||
// A host deadline can discard the response before error remediation reaches the
|
||||
// agent. Teach that distinction at initialization, not just in returned errors.
|
||||
const RECOVERY_INSTRUCTIONS =
|
||||
"Recovery: For invalid arguments, read the connected tool's input schema (refresh tools/list if stale), fix the reported fields and do not repeat the unchanged call. A returned REA provider_timeout is a server/provider deadline: follow its remediation and reuse accessible partial Evidence. A host error such as 'timed out awaiting tools/call' without a REA result is a client deadline, not proof that work or cleanup stopped. Do not repeat the unchanged analysis. Increase the host's tool deadline with execution/cleanup/delivery headroom; when configuration is not editable, report the required setting (Codex: mcp_servers.<server>.tool_timeout_sec, seconds). Server analysis_timeout_ms, when advertised, is a separate millisecond budget; raising it cannot fix a shorter client deadline. Session state does not establish completion of every target-free operation.";
|
||||
|
||||
export interface CreateServerOptions {
|
||||
readonly environment?: Readonly<NodeJS.ProcessEnv>;
|
||||
readonly delivery?: ToolResultDelivery;
|
||||
@@ -281,7 +286,7 @@ const createMcpServer = (
|
||||
session === undefined
|
||||
? ACTIVE_TARGET_INSTRUCTIONS
|
||||
: TARGET_FREE_INSTRUCTIONS
|
||||
} ${UNTRUSTED_CONTENT_INSTRUCTIONS}`,
|
||||
} ${RECOVERY_INSTRUCTIONS} ${UNTRUSTED_CONTENT_INSTRUCTIONS}`,
|
||||
},
|
||||
session === undefined
|
||||
? undefined
|
||||
|
||||
Reference in new issue
Block a user