Repository navigation
fix(schema): keep user fields named after stripped keywords in remove passes - #5893
rubenmarcus wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
Fix all with cubic | Re-trigger cubic
…keep-keyword-named-fields
…o fix/schema-cleanup-keep-keyword-named-fields
|
This diff touches |
…keep-keyword-named-fields
|
The import fix landed as #6076, so I rebased: 11a3ef8 merges main at a71d547. All three checks are clean locally on the new head: |
…keep-keyword-named-fields
…keep-keyword-named-fields
… schema comment kept ours, test fixtures union)
…keep-keyword-named-fields
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Fixes #5829.
Problem
When
remove_defaultsand/orremove_min_itemsare set, the finalremove_forbidden_fieldspass pops the keysdefault,minItems, andmin_itemsfrom every dict it walks, including thepropertiesmapping, where those strings are user field names. A Pydantic output model with fields nameddefault,minItems, ormin_itemsends up with those entries deleted frompropertieswhilerequiredstill lists them and the strict pass has setadditionalProperties: false: the schema is unsatisfiable and the LLM cannot produce a valid response.Fix
The pass now tracks whether it is inside a
propertiesmapping. The mapping level itself never has keys popped (names there are data, not schema keywords); each property's schema is still processed normally, so default values and minItems annotations are stripped where they actually appear. This mirrors the earlier fix intest_optimizer_treats_property_names_as_data_not_schema_keywords, which covered the flattening pass but not the remove passes.Verification
The new regression model uses fields named
default,minItems, andmin_itemsplus a field with a default value, asserting the names survive in bothpropertiesandrequiredwhile the default value is still stripped from annotations.Head
7809760d1merges upstreammain(b49a68e40). That side of the merge touchesREADME.md,examples/models/fireworks.pyandpyproject.tomlonly, sobrowser_use/llm/schema.pyand the test file are unchanged from the previous heade82fa21cc.Disclosure: this PR was prepared with AI assistance (GLM via Oh My Pi) and reviewed before submission.
Summary by cubic
Fixes #5829.
remove_defaultsandremove_min_itemsno longer delete user fields nameddefault,minItems, ormin_itemsfrom thepropertiesmapping, which previously left the schema unsatisfiable underadditionalProperties: false. The removal pass now treats keys inside apropertiesmapping as data rather than schema keywords, while still stripping default values and minItems annotations from each property's schema. Adds a regression test covering fields named after the stripped keywords plus a field with a default value.Written for commit e82fa21. Summary will update on new commits.