fix(schema): honour additionalProperties: true at schema compilation#774
Merged
Conversation
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
compile_unified_schema(agent_actions/output/response/vendor_compilation.py) hardcoded"additionalProperties": Falsefor the OpenAI-compatible, Anthropic, and Ollama targets, ignoring a schema file's declaredadditionalProperties: true. A UDF (kind: tool) or LLM output carrying an extra key then passed preflight but crashed mid-run withAdditional properties are not allowed— after upstream LLM tokens were already spent, with downstream cascade-skips.The fix reads the declared value at each of the three compile sites:
_validate_against_schema) and LLM-output validation, so fixing the compiler fixes both paths.False— no behaviour change for existing schemas (7897 existing tests unchanged).expander_schema.py:83usessetdefault("additionalProperties", False)on the source item dict, which already preserves a declaredtrue. Left unchanged; pinned with a regression test so a future refactor can't silently regress it.additionalProperties: false. A user who declarestrueand targets strict OpenAI opts into the provider's behaviour — that is the author's explicit choice; the framework honours the file.Scope: only the three hardcoded
Falsesites changed. The gemini/cohere branches (already omit the key) and the jsonschema validator (correctly enforces whatever it's handed) are untouched.Verification
tests/unit/output/response/test_additional_properties_honoured.py(new). The five vendor honour-true cases + extra-key-validates were RED against the hardcode; GREEN after the fix. Default-strict guards and the nested-items pinning guards are green throughout.test_udf_output_extra_key_accepted_when_truecompiles aadditionalProperties: trueschema and runs an extra-key payload through the real_validate_against_schemaUDF path — no crash; the default schema still raisesSchemaValidationError.pytest tests/unit/output tests/validation tests/core/test_udf_schema_validation.py -q→ 542 passed.pytest -q→ 7897 passed.ruff check agent_actions testsandruff format --check agent_actions tests→ clean.