Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
7 changes: 4 additions & 3 deletions apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion docs/orchestration-v2/orchestrator-mcp-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/t3McpToolPresentation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ describe("resolveT3McpToolPresentation", () => {
"mcp__t3code__",
"T3-code.",
"t3code.",
"t3-code-direct.",
"mcp__t3_code_direct__",
"t3_code/",
"t3code:",
"mcp_t3-code_",
Expand Down
16 changes: 12 additions & 4 deletions packages/shared/src/t3McpToolPresentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down
Loading