Files
morluto 089dfa3a8b fix(setup): derive client deadlines from one record per client (#15371)
* fix(setup): derive client deadlines from one record per client

Each supported client definition now declares the MCP deadlines it applies
to REA's server: key, unit, built-in default, maximum, coverage and whether
progress resets it. Setup raises a shorter or missing deadline to REA's
recommendation within the client's maximum and keeps a longer one; doctor
reports the same shortfall from the same record. Cline, Zed, Antigravity,
Hermes, Goose and Gemini CLI gain deadlines; the codex/kimi/grok/dsh name
branches, the Goose timeout literal and the per-client startup constants
are removed.

Refs #15337

* fix(setup): keep a raised Goose timeout over a short inherited one and expect Antigravity's deadline
2026-12-01 01:48:59 +00:00

74 lines
3.6 KiB
TypeScript

import { currentClientRegistrationCommand } from "../../src/application/ClientRegistrationIdentity.js";
export const codexToolPolicy = {
default_tools_approval_mode: "prompt",
enabled_tools: ["binary_session", "inspect_binary"],
disabled_tools: ["run_script"],
env_vars: [
"LANG",
{ name: "HOST_TERM" },
{ name: "LOCAL_FLAG", source: "local" },
{ name: "REMOTE_FLAG", source: "remote" },
],
required: true,
supports_parallel_tool_calls: false,
cwd: "/caller/working-directory",
future_policy: { label: "retain this client setting", weight: 2, offset: -0 },
tools: {
binary_session: {
approval_mode: "approve",
output_token_limit: 9007199254740993n,
},
"inspect.binary": { approval_mode: "auto" },
"run/script": { approval_mode: "writes" },
["__proto__"]: { approval_mode: "prompt", future_option: true },
},
};
/** The same client policy in native table and inline-table representations. */
export const codexToolPolicySource = (
layout: "tables" | "inline table",
registrationCommand: readonly string[] = currentClientRegistrationCommand(),
): string => {
const [command, ...args] = registrationCommand;
return layout === "tables"
? [
"# retained root comment",
'model = "caller-model"',
"[mcp_servers.other]",
'command = "other"',
"[mcp_servers.rea]",
`command = ${JSON.stringify(command)}`,
`args = ${JSON.stringify(args)}`,
"startup_timeout_ms = 75500",
"tool_timeout_sec = 999",
'default_tools_approval_mode = "prompt"',
'enabled_tools = ["binary_session", "inspect_binary"]',
'disabled_tools = ["run_script"]',
'env_vars = ["LANG", {name = "HOST_TERM"}, {name = "LOCAL_FLAG", source = "local"}, {name = "REMOTE_FLAG", source = "remote"}]',
"required = true",
"supports_parallel_tool_calls = false",
'cwd = "/caller/working-directory"',
'future_policy = { label = "retain this client setting", weight = 2.0, offset = -0.0 }',
"[mcp_servers.rea.env]",
'CALLER_SETTING = "kept exactly"',
"[mcp_servers.rea.tools.binary_session]",
'approval_mode = "approve" # caller approval',
"output_token_limit = 9007199254740993",
'[mcp_servers.rea.tools."inspect.binary"]',
'approval_mode = "auto"',
'[mcp_servers.rea.tools."run/script"]',
'approval_mode = "writes"',
"[mcp_servers.rea.tools.__proto__]",
'approval_mode = "prompt"',
"future_option = true",
"",
].join("\n")
: [
"# retained root comment",
'model = "caller-model"',
`mcp_servers = { other = { command = "other" }, rea = { command = ${JSON.stringify(command)}, args = ${JSON.stringify(args)}, startup_timeout_sec = 49.5, startup_timeout_ms = 75500, tool_timeout_sec = 999.5, default_tools_approval_mode = "prompt", enabled_tools = ["binary_session", "inspect_binary"], disabled_tools = ["run_script"], env_vars = ["LANG", {name = "HOST_TERM"}, {name = "LOCAL_FLAG", source = "local"}, {name = "REMOTE_FLAG", source = "remote"}], required = true, supports_parallel_tool_calls = false, cwd = "/caller/working-directory", future_policy = { label = "retain this client setting", weight = 2.0, offset = -0.0 }, env = { CALLER_SETTING = "kept exactly" }, tools = { binary_session = { approval_mode = "approve", output_token_limit = 9007199254740993 }, "inspect.binary" = { approval_mode = "auto" }, "run/script" = { approval_mode = "writes" }, __proto__ = { approval_mode = "prompt", future_option = true } } } }`,
"",
].join("\n");
};