Handle structured output review payloads - #33
Merged
danielmartin merged 1 commit intoMar 6, 2026
Merged
Conversation
Claude can return review data in `structured_output` even when the legacy `result` field is empty. The current parser only looks at `result`, so a valid review payload can be lost and the action can degrade into an empty review. This change checks `structured_output` first, falls back to parsing `result` for compatibility, and fails the review if neither contains a valid payload. The tests now cover the `structured_output` path and the failure case so the action does not silently approve malformed responses.
HungKNguyen
approved these changes
Mar 6, 2026
amit-nayar
added a commit
that referenced
this pull request
Jul 16, 2026
Reviewers currently have to flip a PR out of draft to get a review, then
back into draft to keep working - `skip-draft-prs` applies
unconditionally to every trigger, including an explicit `@bot` mention
or the `review` comment command.
This builds on Daniel Martin's unmerged fork commits
(`danielmartin/nutrient-code-review`) which add the plain `review`
comment command and split `ready_for_review` into its own trigger, then
adds the missing piece: the draft-PR skip now exempts `mention` and
`slash_command` triggers, since those are an explicit per-PR request
from a human rather than automatic noise. Automatic triggers (`open`,
`commit`, `ready_for_review`) are unaffected and still fully respect
`skip-draft-prs`.
One commit from Daniel's fork ("Backport parser and ready-state fixes")
was dropped - it re-applied an older, less strict version of
review-payload parsing that's already superseded by what's on `main` (PR
#33), so it only produced merge conflicts with no behavioral gain.
Consumer: PSPDFKit/PSPDFKit#55849 pins to this branch and is blocked on
this merging.
---------
Co-authored-by: Daniel Martín <mardani29@yahoo.es>
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.
This fixes a failure mode in the review parser.
Right now we only parse Claude's serialized
resultfield. In recent runs, Claude sometimes returned the valid review payload instructured_outputwhileresultwas empty, which made the action drop a good response and degrade into an empty review.This patch checks
structured_outputfirst, falls back toresultfor compatibility, and fails the run if neither contains a valid review payload. That follows the same direction as Anthropic'sclaude-code-action, which treatsstructured_outputas the schema-backed output path: https://github.com/anthropics/claude-code-action/blob/main/base-action/src/run-claude-sdk.ts#L208-L228Tests are updated to cover the
structured_outputpath and the failure case.