fix: #3308 reject chat custom tool calls explicitly#3309
fix: #3308 reject chat custom tool calls explicitly#3309seratch merged 3 commits intoopenai:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b2c3cbed8
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
seratch
left a comment
There was a problem hiding this comment.
Thanks for the fix. One compatibility concern: this changes the released Chat Completions behavior from silently ignoring custom tool calls to always raising. That is safer, but it is still a behavior change for users/providers that currently rely on the old behavior.
Can we gate this behind strict_feature_validation instead?
Suggested shape:
- Pass
OpenAIChatCompletionsModel._strict_feature_validationinto bothConverter.message_to_output_items()andChatCmplStreamHandler.handle_stream(). - Raise only when
strict_feature_validation=True. - Keep the default
Falsebehavior compatible with today’s behavior. - For streaming, please make sure ignored custom tool call indexes stay ignored across later chunks where
typemay be omitted, so we do not accidentally build a malformedResponseFunctionToolCall.
Since existing strict feature validation errors in this model use UserError, I think this should probably use UserError too rather than AgentsException.
|
Handled. PR updates:
Extra edge coverage:
|
f854554 to
962a2cb
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
customtool-call rejection behindstrict_feature_validationso the default behavior stays compatible.UserErrorfor unsupportedcustomtool calls in both non-streaming and streaming Chat Completions strict mode.typedo not become malformed function-call items.Test plan
uv run pytest tests/models/test_openai_chatcompletions_converter.py -k custom_tool_calluv run pytest tests/models/test_openai_chatcompletions_converter.py -k "custom_tool_call or mixed_custom"uv run pytest tests/models/test_openai_chatcompletions_stream.py -k custom_tool_calluv run pytest tests/models/test_openai_chatcompletions.py -k custom_tool_calluv run pytest tests/models/test_openai_chatcompletions_converter.py tests/models/test_openai_chatcompletions_stream.py tests/models/test_openai_chatcompletions.pybash .agents/skills/code-change-verification/scripts/run.shIssue number
Closes #3308
Checks
make lintandmake format