mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix(codex): preserve custom tools during request normalization
Add CODEX_PASSTHROUGH_TOOL_TYPES allowlist so Responses-native freeform tools (e.g. grammar-backed apply_patch) survive normalizeCodexTools and reach the upstream Codex Responses API intact. Refs #1907 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
13abe7f7f6
commit
ed68bcedf8
@@ -26,6 +26,9 @@ const CODEX_HOSTED_TOOL_TYPES = new Set([
|
||||
"tool_search"
|
||||
]);
|
||||
|
||||
// Responses-native freeform tools carry a name plus format payload and must pass through intact.
|
||||
const CODEX_PASSTHROUGH_TOOL_TYPES = new Set(["custom"]);
|
||||
|
||||
// Allowlist of fields accepted by Codex Responses API — anything else is stripped
|
||||
const RESPONSES_API_ALLOWLIST = new Set([
|
||||
"model", "input", "instructions", "tools", "tool_choice", "stream", "store",
|
||||
@@ -72,6 +75,7 @@ function normalizeCodexTools(body) {
|
||||
return true;
|
||||
}
|
||||
if (type !== "function") {
|
||||
if (CODEX_PASSTHROUGH_TOOL_TYPES.has(type)) return true;
|
||||
if (!type || tool.function || typeof tool.name === "string") return false;
|
||||
return CODEX_HOSTED_TOOL_TYPES.has(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user