-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(responses): bridge write_stdin through exec #3246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,20 +35,23 @@ export function namespacedToolName(namespace: string | undefined, name: string): | |
| * Codex unified-exec name normalization. | ||
| * | ||
| * Codex's code-mode shell tool is declared as `exec` (a freeform custom tool whose own | ||
| * description mentions the nested `await tools.exec_command(...)` helper). Routed models — | ||
| * DeepSeek in particular — sometimes echo that helper name as the tool-call name, emitting | ||
| * `exec_command` or `apply_patch` instead of the declared `exec`. Accept these nested helper | ||
| * names only when the request catalog actually declares `exec` and does not itself declare the | ||
| * emitted name (an MCP server may legitimately advertise one under its own namespace). | ||
| * description mentions the nested `await tools.exec_command(...)` helper). Some routed providers | ||
| * echo that helper name as the tool-call name, emitting `exec_command`, `write_stdin`, or | ||
| * `apply_patch` instead of the declared `exec`. Accept these nested helper names only when the | ||
| * request catalog actually declares `exec` and does not itself declare the emitted name (an MCP | ||
| * server may legitimately advertise one under its own namespace). | ||
| */ | ||
| const LEGACY_SHELL_BRIDGE_TOOL_NAMES = ["exec_command", "shell_command"] as const; | ||
| const CODE_MODE_HELPER_TOOL_NAMES = [...LEGACY_SHELL_BRIDGE_TOOL_NAMES, "apply_patch"] as const; | ||
| const CODE_MODE_HELPER_TOOL_NAMES = [ | ||
| ...LEGACY_SHELL_BRIDGE_TOOL_NAMES, | ||
| "write_stdin", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Route A catalog can declare bare Map 🤖 Prompt for AI Agents |
||
| "apply_patch", | ||
| ] as const; | ||
|
|
||
| /** | ||
| * The one declared name that turns nested-helper normalization on. Declaring it is not just a | ||
| * name: it also decides whether an emitted `exec_command`/`shell_command`/`apply_patch` is | ||
| * accepted as that shell tool, so callers that build declared-name sets must add it only for a | ||
| * genuine bare declaration. | ||
| * name: it also decides whether an emitted helper name is accepted as that shell tool, so callers | ||
| * that build declared-name sets must add it only for a genuine bare declaration. | ||
| */ | ||
| export const CODE_MODE_EXEC_TOOL_NAME = "exec"; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a request declares the Code Mode
exectool alongside a separateexec_commandorshell_command, addingwrite_stdinto this shared list does not bridge it:normalizeDeclaredToolNamesees the legacy declaration and returnswrite_stdinunchanged, so the downstream undeclared-tool guard rejects the call with a 502 even thoughwrite_stdinitself was not declared and should belong toexec. Treatwrite_stdinlikeapply_patchbefore the legacy-name ambiguity check, or apply that check only when the emitted name is itself one of the legacy shell aliases.Useful? React with 👍 / 👎.