fix(security-guidance): allow null findings in StructuredOutput schema#74021
Open
sourabharsh wants to merge 1 commit into
Open
fix(security-guidance): allow null findings in StructuredOutput schema#74021sourabharsh wants to merge 1 commit into
sourabharsh wants to merge 1 commit into
Conversation
The agentic commit reviewer's FINDINGS_SCHEMA required 'findings' to be
type 'array'. When the model found no vulnerabilities it sometimes
emitted null instead of [], causing a schema rejection that wasted an
extra turn retrying. Observed in 31 review sessions across 7 repos.
The consuming code already handles null via 'inv.get("findings") or []'
in llm.py, so only the schema was too strict.
Fixes anthropics#73270
This was referenced Jul 4, 2026
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
The agentic commit reviewer's
FINDINGS_SCHEMArequiredfindingsto be typearray. When the model found no vulnerabilities it sometimes emittednullinstead of[], causing a schema rejection that wasted an extra turn retrying. Observed in 31 review sessions across 7 repos.The consuming code already handles
nullviainv.get("findings") or []inllm.py(lines 1324, 1368), so only the schema was too strict.Changes
plugins/security-guidance/hooks/review_api.py: Changedfindingstype from"array"to["array", "null"](1 line)plugins/security-guidance/hooks/test_findings_schema.py: Added 6 regression tests covering null, empty array, populated array, missing key, and consumer-side handlingValidation
All 6 tests pass:
Fixes #73270