Repository navigation
feat(providers): strip named hosted tools only beside client tools - #8499
Merged
Merged
Conversation
…equests A Gemini-backed OpenAI-compatible Responses gateway serves hosted web_search alone and function calling alone, but answers HTTP 400 when one request declares both. unsupportedHostedTools avoided the 400 only by removing the search-only capability the gateway does serve. unsupportedHostedToolsWithClientTools uses the same closed vocabulary and alias expansion, and strips the named hosted declarations only when the request also declares a function or custom tool, or a namespace with members, in tools, additional_tools, or a tool_search_output result. It feeds the same denial set as the unconditional list, so tool_choice and allowed_tools reconciliation are shared. unsupportedHostedTools stays authoritative, and an unset field leaves every body unchanged. The field is validated by the config schema and management API, accepted and cleared by PATCH, returned by GET, and classified in the editor and model-rename rosters. Both hosted-tool lists now survive a same-destination dashboard save; previously the form's POST overwrite dropped unsupportedHostedTools. The hosted-tool denial section moves to its own structure doc to keep chat-compat.md within the line budget. Closes #8204
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Contributor
Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…enies Codex turns always carry client tools, so modelPreferHostedTools plus unsupportedHostedToolsWithClientTools on the same tool removed both the client image_gen declaration and the hosted tool. Reject the pair, as the unconditional list already does. Refs #8204
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some Gemini-backed Responses gateways accept hosted
web_searchalone and function calling alone, but answer HTTP 400 when one request carries both (Please enable tool_config.include_server_side_tool_invocations to use Built-in tools with Function calling.). The only workaround wasunsupportedHostedTools: ["web_search"], which also removes the search-only capability the gateway serves.This adds the opt-in provider field the owner chose on #8204:
unsupportedHostedToolsWithClientTools(same closed vocabulary and alias expansion asunsupportedHostedTools) strips the named hosted declarations only when the same request declares a client tool: afunctionorcustomtool, or a namespace with members, intools, a client-loadedadditional_toolscatalog, or atool_search_outputresult. A request that declares only hosted tools keeps them.stripUnsupportedHostedToolsalready uses (src/responses/hosted-tool-policy.ts,src/adapters/openai-responses/tool-schema.ts).tools,additional_tools,tool_choiceandallowed_toolsreconciliation therefore run through the same code as the unconditional list. A forced selector for a removed tool becomes"none"exactly as before.unsupportedHostedToolsstays authoritative. With the new field unset or[], the request is unchanged and the client-tool scan never runs.PATCH/GET, the editor field policy, and the provider-rename roster know the field.POST /api/providerswith an existing name) dropped the storedunsupportedHostedTools, confirmed with a fail-first probe on unmodifieddev. Both hosted-tool lists now travel with the other upstream-behavior fields inPROVIDER_COMPAT_CARRY_FIELDS. Carrying only the new list would let a hosted-only request forward a tool the dropped unconditional list had denied. This changes save behavior for the existing field: it now survives an edit that omits it, like the other eleven carried fields.structure/chat-compat.mdwas at 599/600 lines, so its hosted-tool section moved unchanged into a newstructure/providers/hosted-tool-denials.md(manifest andINDEX.mdregenerated).Closes #8204
Verification
dev:tests/responses/responses-hosted-tool-conditional.test.ts7 pass / 8 fail (mixed request strips; function/custom/namespace; alias expansion; names only what is listed; client-loaded catalog; selector reconciliation; management and schema validation).tests/server/management-provider-compat-carry.test.ts23 pass / 3 fail.devlocally): the eight hosted-tool, carry, upgrade, Muse and combo files: 228 pass, 0 fail.bun run typecheck,bun run structure:check,bun run privacy:scan: pass. Layout, layout tooling, file-size ratchet, Lab boundary, structure SSOT and quota-reset boundary guards: 128 pass, 0 fail.bun run test:changed(2,405 files, isolatedHOME; the run was split in two after a SIGTERM): 54,506 pass, 34 fail. All 34 are the environment-only set that fails identically on cleandevin this container:local-control-socket(17), the real-npm Codex CLI update suites (16), and onecatalog-omit-disabled-nativecase.bun run test; macOS/Windows.Checklist
Maintainer judgment
unsupportedHostedToolsnow survives a same-destination dashboard save, as the other upstream-behavior fields already do.stripUnsupportedHostedToolsgets the same set as before and skips the scan. The existing hosted-tool declaration, Muse tool-choice and combo send-contract suites pass unchanged.