fix(core): read tool args without Pydantic property shadowing - #4627
Merged
seratch merged 2 commits intoAug 24, 2026
Merged
Conversation
Tool parameters named model_extra or model_fields_set validated correctly but were invoked with the BaseModel property values instead of the parsed field, so function tools silently received None or a set of field names.
Codex Review SummaryThis 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. |
seratch
approved these changes
Aug 24, 2026
seratch
enabled auto-merge (squash)
August 24, 2026 22:16
4 tasks
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
FuncSchema.to_call_args()usedgetattr()to recover tool arguments from the generated Pydantic model. For parameters namedmodel_extraormodel_fields_set, that hitsBaseModelproperties instead of the validated fields, so the tool is invoked withNoneor a set of field names even though JSON validation succeeded.This is distinct from #3547 / #3572, which were about names that crash
create_model(). These names build and validate successfully, then silently pass the wrong values.Reproduction
Solution
Read instance
__dict__first so Pydantic properties cannot shadow tool parameters. Nested model objects are preserved (unlikemodel_dump()).Test plan
model_extraandmodel_fields_setuv run pytest tests/test_function_schema.py tests/test_function_tool.py(101 passed)uv run ruff format/ruff checkon the changed filesuv run pyrighton the changed filesgit diff --checkcleanIssue number
N/A — no matching open issue. Adjacent reserved-name construction failures (#3547, #3549, #3572) were closed wontfix; this path is a silent wrong-argument bug after successful schema construction.
Checks
.agents/skills/code-change-verification/scripts/run.sh(fullmake formatcurrently fails on an unrelated pre-existing E501 in.agents/skills/implementation-final-review/scripts/test_skill_contract.pyonmain)/reviewbefore submitting this PR