perf(mcp): reduce cold-start work

This commit is contained in:
morluto
2026-07-26 15:02:58 +00:00
parent 6d37efe8fa
commit fecddc0549
27 changed files with 1323 additions and 293 deletions
+4 -3
View File
@@ -6,6 +6,7 @@ import writeFileAtomic from "write-file-atomic";
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
import { PRODUCT_IDENTITY } from "../identity.js";
import { MCP_STARTUP_POLICY } from "../mcpStartupPolicy.js";
import { resolveClientConfigTransactionPath } from "./ClientConfigPath.js";
import type {
ClientConfigurationInspection,
@@ -21,8 +22,6 @@ const defaultCommand = (): readonly string[] => [
"mcp",
];
const CODEX_STARTUP_TIMEOUT_SECONDS = 30;
/** Back up, atomically update, and semantically read back one JSON MCP configuration. */
export const configureJsonClient = async (
client: SetupClient,
@@ -299,7 +298,9 @@ const clientConfigurationDesired = (
command: command[0] ?? PRODUCT_IDENTITY.cliBinary,
args: command.slice(1),
...(client.name === "codex"
? { startup_timeout_sec: CODEX_STARTUP_TIMEOUT_SECONDS }
? {
startup_timeout_sec: MCP_STARTUP_POLICY.codexStartupTimeoutSeconds,
}
: {}),
...(Object.keys(environment).length === 0 ? {} : { env: environment }),
};