Skip to content

Commit f00cb87

Browse files
fix(opencode): say t3-code is not a Code Mode namespace even when a request names it
Code Mode search returns an empty list for a partial namespace, and threads sharing a directory need distinct MCP server names, so T3 cannot make `t3-code` match. Tell the agent to substitute the full name when a request writes `t3-code`, and that an empty result does not mean a tool is missing. AI-assisted; verified with the tests and tools listed above.
1 parent c582316 commit f00cb87

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2932,7 +2932,11 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
29322932
value: [
29332933
buildRuntimeInstructions({ harness: "OpenCode", model: bigPickle.model }),
29342934
t3OrchestrationSystemPrompt(true, false),
2935-
`T3 Code's MCP server in this thread is \`${server}\`. Use that full name, not \`t3-code\`, wherever a server or tool namespace is asked for.`,
2935+
[
2936+
`T3 Code's MCP server in this thread is \`${server}\`, and that full name is its tool namespace.`,
2937+
`Code Mode \`search\` returns an empty list, not an error, for \`t3-code\` or any other partial namespace, so pass \`${server}\` even where a request writes \`t3-code\`.`,
2938+
"An empty search result does not mean a T3 Code tool is missing: search again without `namespace`.",
2939+
].join(" "),
29362940
].join("\n\n"),
29372941
}),
29382942
reply("session.instructions.entry.put", null),

‎packages/provider-opencode/src/server/v2/adapter.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,14 @@ export const t3McpServerName = Effect.fn("t3McpServerName")(function* (threadId:
363363
return `t3-code-${Hex.encode(digest).slice(0, 16)}`;
364364
});
365365

366-
// Code Mode search matches a namespace only as a whole path segment and returns nothing otherwise.
366+
// Code Mode search matches a namespace only as a whole path segment and returns nothing otherwise,
367+
// and threads sharing a directory need distinct server names, so `t3-code` cannot be the namespace.
367368
const mcpServerInstructions = (name: string) =>
368-
`T3 Code's MCP server in this thread is \`${name}\`. Use that full name, not \`t3-code\`, wherever a server or tool namespace is asked for.`;
369+
[
370+
`T3 Code's MCP server in this thread is \`${name}\`, and that full name is its tool namespace.`,
371+
`Code Mode \`search\` returns an empty list, not an error, for \`t3-code\` or any other partial namespace, so pass \`${name}\` even where a request writes \`t3-code\`.`,
372+
"An empty search result does not mean a T3 Code tool is missing: search again without `namespace`.",
373+
].join(" ");
369374

370375
// Last match wins: deny all threads' T3 servers, then allow only this thread's.
371376
const mcpRules = (mcpServerName: string | null): ReadonlyArray<Rule> =>

0 commit comments

Comments
 (0)