[WRONG BRANCH] fix(responses): enforce explicit empty tool catalogs for undeclared-tool guard - #306
[WRONG BRANCH] fix(responses): enforce explicit empty tool catalogs for undeclared-tool guard#306luvs01 wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 40b9ae62b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hasExplicitWireToolCatalog = outboundRequestBody !== undefined | ||
| && Array.isArray((outboundRequestBody as Record<string, unknown>).tools); | ||
| const undeclaredToolGuardActive = (declaredWireToolNames.size > 0 || hasExplicitWireToolCatalog) |
There was a problem hiding this comment.
Treat
additional_tools as an explicit catalog
When a Responses Lite request carries its catalog only in an input item such as {type:"additional_tools", tools:[]} and omits top-level tools—a supported shape parsed in src/responses/parser.ts—this check remains false because the collected name set is empty and only outboundRequestBody.tools is inspected. A routed provider can therefore return a client-executed call such as apply_patch and have it relayed despite the explicit catalog authorizing no client tools. Detect array-bearing additional_tools items as explicit catalogs as well, and cover the empty additional-tools-only case in the regression tests.
Useful? React with 👍 / 👎.
@Wibias stepped down from developing opencodex, and repository permission was reduced to read access. Move him out of the current-maintainers table into a new Former maintainers section, drop him from the CODEOWNERS default-reviewer line and the four high-impact runtime paths, and record the change with the 2026-07-27 addition entry it closes. Nothing he authored is unwound: commits, merged pull requests, release-note attributions, and the code comments citing his reviews stay as they are.
40b9ae6 to
52f7324
Compare
Motivation
tools: []outbound catalog disabled the undeclared-tool guard and allowed routed passthrough providers to relay client-executed tool calls (for exampleapply_patch).Description
toolsarray by addinghasExplicitWireToolCatalogand changingundeclaredToolGuardActiveinsrc/server/responses/core.tsto consider that case while keeping theauthMode === "forward"exemption.toolBridgeMaps.declaredToolNamesso hosted-tool mapping still widens the accepted set rather than narrowing it.tests/responses-undeclared-tool-guard.test.tsto assert that an omitted catalog (no tools field) remains relayed for compatibility but an explicit empty catalog (tools: []) now causes streamed and non-streamed upstream client tool calls to be refused.Testing
bun test tests/responses-undeclared-tool-guard.test.ts tests/github-copilot-stream-contract.test.ts tests/deepseek-inbound-wire.test.ts tests/deepseek-responses-item-id-repair.test.ts tests/responses-custom-tool-repair.test.ts, which passed (91 tests across the touched suites).bun run typecheckandbun run privacy:scan, both of which succeeded in this environment.bun run testof the entire suite in this session hit unrelated environment/timing failures (lab/timeouts and proxy-related harness constraints) and is not reflective of the focused regression coverage added; the focused Responses tests and compatibility scenarios for this change passed.Codex Task