Skip to content
TypeScript

refactor(server): name Codex's direct-only T3 MCP server t3-code-direct (#29068)

Theo Browne23075af981e4
diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
index 1734f9e0af8..2d14fa9518d 100644
--- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
@@ -1532,7 +1532,7 @@ describe("CodexAdapterV2 post-settle continuation", () => {
http_headers: { Authorization: "Bearer secret-codex-token" },
disabled_tools: ["t3_thread_wait"],
},
- "mcp_servers.t3code": {
+ "mcp_servers.t3-code-direct": {
url: "http://127.0.0.1:43123/mcp",
tool_timeout_sec: 3_900,
http_headers: { Authorization: "Bearer secret-codex-token" },
diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
index bda631ec99c..f81a3809b35 100644
--- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
@@ -1334,8 +1334,9 @@ export const CODEX_THREAD_CONFIG = {
// T3 waits can block for an hour; keep Codex's MCP timeout above that.
const CODEX_T3_MCP_TOOL_TIMEOUT_SEC = 65 * 60;
-// Calls arrive as `t3code.<tool>`; t3McpToolPresentation.ts must keep resolving that form.
-const CODEX_T3_WAIT_MCP_SERVER = "t3code";
+// Holds T3 tools Codex must call directly, never from Code Mode. Calls arrive as
+// `t3-code-direct.<tool>`; t3McpToolPresentation.ts must keep resolving that form.
+const CODEX_T3_DIRECT_MCP_SERVER = "t3-code-direct";
const CODEX_DIRECT_ONLY_T3_TOOL = "t3_thread_wait";
function codexThreadRuntimeParams(input: {
@@ -1373,7 +1374,7 @@ function codexThreadRuntimeParams(input: {
"mcp_servers.t3-code": { ...t3Server, disabled_tools: [CODEX_DIRECT_ONLY_T3_TOOL] },
// Code Mode runs a blocking wait as a nested call, and the model keeps working
// around it. A second, direct-only registration makes it a plain tool call.
- [`mcp_servers.${CODEX_T3_WAIT_MCP_SERVER}`]: {
+ [`mcp_servers.${CODEX_T3_DIRECT_MCP_SERVER}`]: {
...t3Server,
enabled_tools: [CODEX_DIRECT_ONLY_T3_TOOL],
omit_tools_from: ["code_mode", "deferred"],
diff --git a/docs/orchestration-v2/orchestrator-mcp-server.md b/docs/orchestration-v2/orchestrator-mcp-server.md
index 77f95873f06..11e7bd9a8d0 100644
--- a/docs/orchestration-v2/orchestrator-mcp-server.md
+++ b/docs/orchestration-v2/orchestrator-mcp-server.md
@@ -63,7 +63,7 @@ and `thread/fork` config, with the provider-session token in an
`Authorization` header. The same server is registered twice:
- `t3-code`: every tool except `t3_thread_wait`.
-- `t3code`: only `t3_thread_wait`, with `omit_tools_from = ["code_mode", "deferred"]`.
+- `t3-code-direct`: only `t3_thread_wait`, with `omit_tools_from = ["code_mode", "deferred"]`.
Code Mode runs a nested call as part of a script, so the model keeps working
while a blocking wait runs. The second entry makes the wait a direct tool call,
diff --git a/packages/shared/src/t3McpToolPresentation.test.ts b/packages/shared/src/t3McpToolPresentation.test.ts
index cd27e5cc452..4d30e4972d6 100644
--- a/packages/shared/src/t3McpToolPresentation.test.ts
+++ b/packages/shared/src/t3McpToolPresentation.test.ts
@@ -17,6 +17,8 @@ describe("resolveT3McpToolPresentation", () => {
"mcp__t3code__",
"T3-code.",
"t3code.",
+ "t3-code-direct.",
+ "mcp__t3_code_direct__",
"t3_code/",
"t3code:",
"mcp_t3-code_",
diff --git a/packages/shared/src/t3McpToolPresentation.ts b/packages/shared/src/t3McpToolPresentation.ts
index 3fc2db1648e..864bcd8950d 100644
--- a/packages/shared/src/t3McpToolPresentation.ts
+++ b/packages/shared/src/t3McpToolPresentation.ts
@@ -86,7 +86,14 @@ function tool(
return { displayName, labels, icon, summaryAction };
}
-const T3_MCP_SERVER_ALIASES = new Set(["t3-code", "t3_code", "t3code"]);
+// Codex registers "t3-code-direct" for T3 tools kept out of Code Mode.
+const T3_MCP_SERVER_ALIASES = new Set([
+ "t3-code",
+ "t3_code",
+ "t3code",
+ "t3-code-direct",
+ "t3_code_direct",
+]);
const T3_MCP_TOOLS: Readonly<Record<string, T3McpToolDefinition>> = {
link_pull_request: tool(
@@ -386,9 +393,10 @@ function resolveT3McpToolName(value: string): string | null {
: null;
}
- const namespaceMatch = /^(?<server>t3-code|t3_code|t3code)(?:[.:/]|\s*·\s*)(?<tool>.+)$/i.exec(
- label,
- );
+ const namespaceMatch =
+ /^(?<server>t3[-_]code[-_]direct|t3-code|t3_code|t3code)(?:[.:/]|\s*·\s*)(?<tool>.+)$/i.exec(
+ label,
+ );
if (namespaceMatch?.groups) {
return namespaceMatch.groups.tool ?? null;
}