fix(responses): normalize invented default. namespace back to the declared bare tool - #4264
Conversation
… track bare provenance
- Downstream identity normalization in Responses relay: rewrite provider-invented
default. prefix or namespace: "default" back to declared bare tool for SSE streams
(added, done, terminal completed/incomplete snapshots) and non-streaming JSON
responses, preserving all item fields (id, call_id, arguments).
- Bare tool provenance tracking: collectDeclaredBareWireToolNames collects top-level
and builtin functions namespace declarations that do not carry . or __, preventing
declarations like foo__view_image from authorizing default.view_image or
{ namespace: "default", name: "view_image" }.
- Shared normalization helper: update normalizeDeclaredToolName and guard helper
docstrings to clarify default namespace normalization boundary beyond code-mode
exec helpers.
- Test coverage in tests/responses/responses-undeclared-tool-guard.test.ts covering
bare wire collection, SSE stream item rewriting, terminal snapshot rewriting, JSON
rewriting, negative controls for declared namespaced tools, and preservation of
explicitly declared default. and default__ tools.
… function_call_arguments.done
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced 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. |
리뷰 · 우선순위 70 / 80이 PR은 Codex 앱이 비-OpenAI 모델로 라우팅할 때, 클라이언트가 맨 이름으로 선언한 도구( 고치는 방식은 가드를 느슨하게 풀지 않습니다. 파일은 다섯 개(+793/−19)입니다. 경로 src/server/responses-undeclared-tool-guard.ts · collectDeclaredBareWireToolNames - 맨 이름만 모읍니다. 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
|
Integrating under the Exact-head CI evidence — head Layer 3 of the manual chain. Parent #4263 landed; auto-retargeted to |
391e40d
into
codex/4167-claude-desktop-delete-unavailable
Summary
Carries #4181 by @chilung-cgu so #4176 lands in this release train. The diff is that branch's three commits cherry-picked unchanged.
A routed non-OpenAI provider invents a
default.namespace for a tool the client declared bare. Codex declaresview_image; the provider emitsdefault.view_image; the undeclared-tool guard sees a name that is not in the caller's catalog and aborts the stream. The user loses the turn for a tool they did declare.The fix does not loosen the guard. It teaches the request path which bare names the caller actually declared —
collectDeclaredBareWireToolNamesthreads adeclaredBareWireToolNamesset alongside the existingdeclaredWireToolNames— and then normalizesdefault.<name>back to<name>only when<name>is genuinely in that declared bare set. Adefault.prefix on something the caller never declared is still rejected exactly as before. Provenance is tracked so a continuation cannot widen the caller snapshot.The normalization is applied on the replay path and on the streamed client JSON, including
function_call_arguments.done, which is what makes a 2-turn continuation relay the same identity the caller sent.Verification
dev...headrange (5 files, +793/-19).tests/responses/responses-undeclared-tool-guard.test.ts(+459) andtests/adapters/bridge-legacy-shell-normalization.test.ts(+10).bun test tests/lab/core-lab-boundary.test.tscould not complete locally — a concurrent test run in another worktree holds the Bun user lock. This PR touchessrc/server/responses/core.ts, so that guard is the one to watch in CI; the new imports come fromresponses-undeclared-tool-guard, whichcore.tsalready imported, so no new module reach is introduced.bun run typecheckand the full suite are left to CI on Linux, Windows, and macOS.Checklist
Closes #4176
Supersedes #4181
Stacked on #4263. Base retargets to
devonce the parent lands.Co-authored-by: chilung b0423031@gmail.com