@devries-cameron20 / t3code Mirror · read-only / commits / 467ec62e08
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 12:15 UTC

fix(server): Codex calls delegate_task directly instead of from Code Mode (#30019)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 14, 2026 at 20:41 UTC 467ec62e08d8fe5e56dca223b8aa91bb5100b8fc
3 files changed +15 -13
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+2 -2
@@ -2006,13 +2006,13 @@ describe("CodexAdapterV2 post-settle continuation", () => {
2006 url: "http://127.0.0.1:43123/mcp",
2007 tool_timeout_sec: 3_900,
2008 http_headers: { Authorization: "Bearer secret-codex-token" },
2009 - disabled_tools: ["t3_thread_wait"],
2009 + disabled_tools: ["t3_thread_wait", "delegate_task"],
2010 },
2011 "mcp_servers.t3-code-direct": {
2012 url: "http://127.0.0.1:43123/mcp",
2013 tool_timeout_sec: 3_900,
2014 http_headers: { Authorization: "Bearer secret-codex-token" },
2015 - enabled_tools: ["t3_thread_wait"],
2015 + enabled_tools: ["t3_thread_wait", "delegate_task"],
2016 omit_tools_from: ["code_mode", "deferred"],
2017 },
2018 },
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+5 -5
@@ -1492,7 +1492,7 @@ const CODEX_T3_MCP_TOOL_TIMEOUT_SEC = 65 * 60;
1492 // Holds T3 tools Codex must call directly, never from Code Mode. Calls arrive as
1493 // `t3-code-direct.<tool>`; t3McpToolPresentation.ts must keep resolving that form.
1494 const CODEX_T3_DIRECT_MCP_SERVER = "t3-code-direct";
1495 -const CODEX_DIRECT_ONLY_T3_TOOL = "t3_thread_wait";
1495 +const CODEX_DIRECT_ONLY_T3_TOOLS = ["t3_thread_wait", "delegate_task"];
1496
1497 function codexThreadRuntimeParams(input: {
1498 readonly threadId: ThreadId | null;
@@ -1526,12 +1526,12 @@ function codexThreadRuntimeParams(input: {
1526 ? {}
1527 : {
1528 // Override only T3's servers so launch-argument MCP servers survive.
1529 - "mcp_servers.t3-code": { ...t3Server, disabled_tools: [CODEX_DIRECT_ONLY_T3_TOOL] },
1530 - // Code Mode runs a blocking wait as a nested call, and the model keeps working
1531 - // around it. A second, direct-only registration makes it a plain tool call.
1529 + "mcp_servers.t3-code": { ...t3Server, disabled_tools: CODEX_DIRECT_ONLY_T3_TOOLS },
1530 + // Code Mode runs a blocking wait or delegate wait as a nested call, and the model
1531 + // keeps polling it. A second, direct-only registration makes it a plain tool call.
1532 [`mcp_servers.${CODEX_T3_DIRECT_MCP_SERVER}`]: {
1533 ...t3Server,
1534 - enabled_tools: [CODEX_DIRECT_ONLY_T3_TOOL],
1534 + enabled_tools: CODEX_DIRECT_ONLY_T3_TOOLS,
1535 omit_tools_from: ["code_mode", "deferred"],
1536 },
1537 }),
docs/orchestration-v2/orchestrator-mcp-server.md
+8 -6
@@ -63,12 +63,14 @@ Codex gets T3's MCP server in each thread's `thread/start`, `thread/resume`,
63 and `thread/fork` config, with the provider-session token in an
64 `Authorization` header. The same server is registered twice:
65
66 -- `t3-code`: every tool except `t3_thread_wait`.
67 -- `t3-code-direct`: only `t3_thread_wait`, with `omit_tools_from = ["code_mode", "deferred"]`.
68 -
69 -Code Mode runs a nested call as part of a script, so the model keeps working
70 -while a blocking wait runs. The second entry makes the wait a direct tool call,
71 -like Codex's own wait tools. Codex reports calls as `<server>.<tool>`, so
66 +- `t3-code`: every tool except `t3_thread_wait` and `delegate_task`.
67 +- `t3-code-direct`: only `t3_thread_wait` and `delegate_task`, with
68 + `omit_tools_from = ["code_mode", "deferred"]`.
69 +
70 +Code Mode yields a script after about 30 seconds, so the model polls a blocking
71 +`t3_thread_wait` or `delegate_task` with `mode: "wait"`, resending its context
72 +on each poll. The second entry makes both direct tool calls, like Codex's own
73 +wait tools. Codex reports calls as `<server>.<tool>`, so
74 `packages/shared/src/t3McpToolPresentation.ts` must resolve both server names.
75 Tool display and pending-work detection depend on it.
76