Skip to content

fix(agent): recover verdict from duplicated JSON objects (#227) - #228

Merged
rebuildup merged 1 commit into
release/rex-remotefrom
227
Nov 23, 2026
Merged

rebuildup merged 1 commit into
release/rex-remotefrom
227

Conversation

@rebuildup

@rebuildup rebuildup commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #227. Found by the Issue #226 model comparison: claude-sonnet-5-5-high through agy returns the verdict JSON object twice in a single response ({...}\n{...}), so JSON.parse(envelope.response) threw and every run classified invalid-output despite status: SUCCESS and well-formed content.

  • New extractJsonValues() scans top-level balanced JSON objects (string/escape aware); the last complete object is the verdict candidate.
  • No schema relaxation needed: local validation only checks required keys, and extra fields like location are already tolerated.
  • Still fail-closed: nothing parseable → invalid-output as before.

Test plan

  • bun test script/agent.agy-review.test.ts — 32 pass (new duplicated-object case)
  • tsc --noEmit clean
  • Post-merge: re-run claude-sonnet eval slice → review-completed

Generated with Devin

Summary by CodeRabbit

  • Bug Fixes
    • Local reviews can now process responses containing multiple JSON verdicts and use the final verdict.

…nse (#227)

claude-sonnet-5-5-high via agy returns the verdict object twice in one
response; JSON.parse fails on the concatenation and every run classified
invalid-output. extractJsonValues now scans top-level JSON values and the
last complete object is used as the verdict candidate; unparseable
responses still fail closed.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The review parser now extracts complete top-level JSON objects from the response and selects the last object as the verdict candidate. A pipeline test covers a response containing two concatenated verdict objects.

Changes: Verdict Parsing

Layer / File(s) Summary
Extract complete JSON objects
script/agent/agy-review.ts
The new extractJsonValues function returns successfully parsed complete top-level JSON objects in order. It handles quoted strings and escapes, skips invalid candidates, and stops when an opening object has no matching close.
Select and validate the final verdict
script/agent/agy-review.ts, script/agent.agy-review.test.ts
Local parsing selects the last extracted object and checks it for the required keys. The pipeline test verifies that two concatenated verdict objects produce a completed review with the second verdict.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

Possibly related PRs

  • rebuildup/dotfiles#222 — This PR changes verdict parsing in the agy review harness and retains its invalid-output behavior.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@rebuildup
rebuildup merged commit 7145e9f into release/rex-remote Nov 23, 2026
3 of 4 checks passed
@rebuildup
rebuildup deleted the 227 branch November 23, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant