The best way to control Claude Code, Codex and more from any computer or phone
perf(server): Codex calls t3_thread_wait directly instead of from Code Mode (#29026)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Nov 1, 2026 at 20:56 UTC
0c4454ca6adc09058f3d311db6744788507d6af5
4 files changed
+41
-19
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+8
@@ -1530,6 +1530,14 @@ describe("CodexAdapterV2 post-settle continuation", () => {
1530
url: "http://127.0.0.1:43123/mcp",
1531
tool_timeout_sec: 3_900,
1532
http_headers: { Authorization: "Bearer secret-codex-token" },
1533
+ disabled_tools: ["t3_thread_wait"],
1534
+ },
1535
+ "mcp_servers.t3code": {
1536
+ url: "http://127.0.0.1:43123/mcp",
1537
+ tool_timeout_sec: 3_900,
1538
+ http_headers: { Authorization: "Bearer secret-codex-token" },
1539
+ enabled_tools: ["t3_thread_wait"],
1540
+ omit_tools_from: ["code_mode", "deferred"],
1541
},
1542
},
1543
},
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+20
-8
@@ -1334,6 +1334,9 @@ export const CODEX_THREAD_CONFIG = {
1334
1335
// T3 waits can block for an hour; keep Codex's MCP timeout above that.
1336
const CODEX_T3_MCP_TOOL_TIMEOUT_SEC = 65 * 60;
1337
+// Calls arrive as `t3code.<tool>`; t3McpToolPresentation.ts must keep resolving that form.
1338
+const CODEX_T3_WAIT_MCP_SERVER = "t3code";
1339
+const CODEX_DIRECT_ONLY_T3_TOOL = "t3_thread_wait";
1340
1341
function codexThreadRuntimeParams(input: {
1342
readonly threadId: ThreadId | null;
@@ -1346,6 +1349,14 @@ function codexThreadRuntimeParams(input: {
1349
readonly config: Readonly<Record<string, Schema.Json>>;
1350
} {
1351
const { mcpSession } = input;
1352
+ const t3Server =
1353
+ mcpSession === undefined
1354
+ ? undefined
1355
+ : {
1356
+ url: mcpSession.endpoint,
1357
+ tool_timeout_sec: CODEX_T3_MCP_TOOL_TIMEOUT_SEC,
1358
+ http_headers: { Authorization: mcpSession.authorizationHeader },
1359
+ };
1360
return {
1361
...(input.runtimePolicy?.cwd == null ? {} : { cwd: input.runtimePolicy.cwd }),
1362
...(input.modelSelection === undefined ? {} : { model: input.modelSelection.model }),
@@ -1355,16 +1366,17 @@ function codexThreadRuntimeParams(input: {
1366
...(input.threadId === null
1367
? {}
1368
: { [`shell_environment_policy.set.${PortScanner.AGENT_THREAD_ENV}`]: input.threadId }),
1358
- ...(mcpSession === undefined
1369
+ ...(t3Server === undefined
1370
? {}
1371
: {
1361
- // Override only T3's server so launch-argument MCP servers survive.
1362
- "mcp_servers.t3-code": {
1363
- url: mcpSession.endpoint,
1364
- tool_timeout_sec: CODEX_T3_MCP_TOOL_TIMEOUT_SEC,
1365
- http_headers: {
1366
- Authorization: mcpSession.authorizationHeader,
1367
- },
1372
+ // Override only T3's servers so launch-argument MCP servers survive.
1373
+ "mcp_servers.t3-code": { ...t3Server, disabled_tools: [CODEX_DIRECT_ONLY_T3_TOOL] },
1374
+ // Code Mode runs a blocking wait as a nested call, and the model keeps working
1375
+ // around it. A second, direct-only registration makes it a plain tool call.
1376
+ [`mcp_servers.${CODEX_T3_WAIT_MCP_SERVER}`]: {
1377
+ ...t3Server,
1378
+ enabled_tools: [CODEX_DIRECT_ONLY_T3_TOOL],
1379
+ omit_tools_from: ["code_mode", "deferred"],
1380
},
1381
}),
1382
},
docs/orchestration-v2/orchestrator-mcp-server.md
+12
-11
@@ -58,17 +58,18 @@ check the `orchestration` capability before reading or mutating state.
58
59
### Codex V2
60
61
-Codex app-server receives the remote MCP server through command-line config
62
-overrides:
63
-
64
-```text
65
--c mcp_servers.t3-code.url=http://127.0.0.1:<port>/mcp
66
--c mcp_servers.t3-code.bearer_token_env_var="T3_MCP_BEARER_TOKEN"
67
-```
68
-
69
-The provider-session token is placed in `T3_MCP_BEARER_TOKEN`. Both the
70
-production Codex launcher and the injectable test launcher use the same
71
-projection helper.
61
+Codex gets T3's MCP server in each thread's `thread/start`, `thread/resume`,
62
+and `thread/fork` config, with the provider-session token in an
63
+`Authorization` header. The same server is registered twice:
64
+
65
+- `t3-code`: every tool except `t3_thread_wait`.
66
+- `t3code`: only `t3_thread_wait`, with `omit_tools_from = ["code_mode", "deferred"]`.
67
+
68
+Code Mode runs a nested call as part of a script, so the model keeps working
69
+while a blocking wait runs. The second entry makes the wait a direct tool call,
70
+like Codex's own wait tools. Codex reports calls as `<server>.<tool>`, so
71
+`packages/shared/src/t3McpToolPresentation.ts` must resolve both server names.
72
+Tool display and pending-work detection depend on it.
73
74
### Claude Agent SDK V2
75
packages/shared/src/t3McpToolPresentation.test.ts
+1
@@ -16,6 +16,7 @@ describe("resolveT3McpToolPresentation", () => {
16
"mcp__t3_code__",
17
"mcp__t3code__",
18
"T3-code.",
19
+ "t3code.",
20
"t3_code/",
21
"t3code:",
22
"mcp_t3-code_",