Repository navigation
Claude Code optional tool parameters become strict on OpenAI Responses routes #3922
Description
Activity
- addedprovider-compatibilityProvider compatibility reportsProvider compatibility reportsproviderProvider adapters, OpenAI-compat presets, upstream API quirksProvider adapters, OpenAI-compat presets, upstream API quirks
on Sep 7, 2026 - addedtoolstool_calls, MCP, web-search / sidecar toolstool_calls, MCP, web-search / sidecar tools
on Sep 7, 2026 리뷰 · 우선순위 68 / 80
이 이슈는 Claude Code(Anthropic Messages)가 보낸 커스텀 툴 정의에
strict필드가 없을 때, OpenCodex가/v1/messages→/v1/responses로 옮기면서 function tool에도strict를 아예 안 넣는 문제입니다. 지금devHEAD09f669a75의src/claude/inbound-content-options.tstoolsToResponses는type: "function",name, (있으면)description,parameters: input_schema만 넣고strict는 복사하지 않습니다. Anthropic 쪽에서는strict: true를 명시해야 strict tool use가 켜지지만, OpenAI Responses API는 function tool의strict를 생략하면 strict 취급하는 쪽으로 동작합니다. 그래서 원본input_schema에서required: ["prompt"]만 두고isolation/options를 선택으로 둔 툴이, 업스트림에서는 선택 인자를 빠뜨리면 깨집니다. 이슈에 적힌 curl 재현과 “생략이면strict: false를 내보내라”는 매핑은 현재 코드와 정확히 맞습니다. hostedweb_search분기와 native Anthropic passthrough는 이 번역 경로 밖이라 같이 건드리면 안 됩니다.src/responses/parser-tools.ts는 이미 들어오는strictboolean을 보존하는 쪽이므로, 고치려면 번역 입구에서 기본값을 넣고 그 값이 어댑터까지 살아남는지만 확인하면 됩니다. 지금dev는 #3925로 2.48.0 open-dev이고 Claude/Responses 스택(#3877 thinking order, #3830 reasoning envelope, #3808 compatibility gate 등)이 깔려 있어, 이 구멍은 그 위에 남는 호환 버그입니다. types/config 분할과는 무관합니다.라인 src/claude/inbound-content-options.ts toolsToResponses - function 툴 push 때
strict를 넣지 않는다. 여기가 이슈의 직접 원인이다.
라인 (제안) toolsToResponses strict 기본값 -typeof raw.strict === "boolean" ? raw.strict : false처럼 생략→false, 명시 true/false 보존이 이슈 제안과 맞다. 스키마properties/required/중첩은 그대로 전달해야 한다.
경로 src/responses/parser-tools.ts - 이미t.strict !== undefined면 보존한다. 번역층에서 false를 명시해 주면 이후 경로가 삼키지 않는지 회귀로 확인하면 된다.
경로 hosted web_search / native Anthropic -type.startsWith("web_search")분기와 Anthropic 직접 경로는 이 기본값 삽입 대상이 아니다. 회귀 범위에서 빼지 말고 “영향 없음”을 증명해야 한다.
경로 테스트 - omitted / false / true를 Messages→Responses outbound 전체 경로로 고정하고, 원본 JSON Schema 불변을 assert하는 회귀가 필요하다.메인테이너의 판단이 필요한 지점
- Responses 업스트림이 정말로 “생략 = strict”인지(문서·실측) 한 번 더 확인할지, 이슈 작성자 실측만으로 바로 고칠지
strict: false를 항상 명시하는 것이 일부 게이트웨이/프록시에서 거부되는지(거부하면 제공자별 예외가 필요한지)- 수정 PR을 help-wanted로 둘지, Claude Messages 번역 담당 기여자에게 바로 붙일지
너의 추천
수락.toolsToResponses에서 생략 시strict: false를 명시하고, omitted/false/true + 스키마 불변 + web_search/native 무영향을 회귀로 고정한 작은 PR을 받는다. 중복 이슈로 보이면 이 티켓에 묶고, 임시 워크어라운드(클라이언트에strict: false를 직접 넣기)는 코멘트로만 안내하면 된다.이 댓글은 grok-bot이 작성했습니다
- added a commit that references this issue
on Sep 7, 2026 Fixed on
devby #3942, squash-merged asa13041740.toolsToResponsesnow emitsstrictfrom the source Anthropic tool exactly as you described: an explicittrueorfalseis preserved, an omitted one becomes an explicitfalse, and theinput_schemais forwarded unchanged, includingproperties,requiredand nested schemas. A non-boolean value cannot opt the tool into strict mode, since that is not a valid Anthropic opt-in.Hosted
web_searchleaves the translator before the function-tool branch and gains nostrictfield, and native Anthropic passthrough never reaches translation, so both are unaffected as you asked.The regression exercises omitted,
falseandtruethrough the complete outbound path and asserts on the body a real Responses adapter serializes, not on the translator's return value — reading the translator's own object back would have passed even if the field were dropped downstream.- added a commit that references this issue
on Sep 8, 2026 - added a commit that references this issue
on Sep 17, 2026
Client or integration
Claude Code
Provider or upstream service
OpenAI Responses API / ChatGPT Codex
OpenCodex version
2.47.0 / commit 8bc9e4e
Endpoint or capability
/v1/messages → /v1/responses function tool translation
Current behaviour
When Claude Code sends a custom tool definition without an explicit
strictfield, OpenCodex translates it into a Responses function tool while also omittingstrict.This changes the request semantics because the Responses API treats an omitted
strictvalue as strict mode. As a result, parameters that are optional in the original Anthropicinput_schemacan be treated as required by the upstream Responses provider.For example, a tool may require only
promptwhile definingisolationandoptionsas optional. After translation, the upstream provider applies strict schema handling even though the client did not request it.Expected behaviour
Translated function tools should preserve the semantics of the original Anthropic tool definition:
strictis omitted, OpenCodex should emitstrict: false.strict: falseshould remain false.strict: trueshould remain true.properties,required, or nested schemas.Minimal redacted request or reproduction
Actual response or error
Upstream documentation
Anthropic tool definitions and optional parameters:
https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools
Anthropic strict tool use is enabled explicitly with
strict: true:https://platform.claude.com/docs/en/agents-and-tools/tool-use/strict-tool-use
OpenAI Responses API reference:
https://platform.openai.com/docs/api-reference/responses/create
Suggested mapping or implementation notes
During Anthropic Messages → Responses translation, emit:
strict: typeof tool.strict === "boolean" ? tool.strict : false
The value must then survive the internal parser and the Responses adapter unchanged. Regression coverage should exercise omitted, false, and true values through the complete outbound request-building path and verify that the original JSON Schema is unchanged.
Additional context and attachments
The fix has been verified against the reported failure. It restores optional tool arguments while preserving explicit strict-mode requests, hosted web search, and native Anthropic passthrough.
Checks