Skip to content

[Task]: the Claude judge provider rejects verdicts it cannot parse as JSON, aborting eval runs whose judge text says pass #796

Closed

Description

@sumithr

Roadmap fields

Status: In progress; Priority: P1; Size: S; Order: 6; Depends on: none

Problem

The Claude judge provider rejects replies that visibly begin with a passing JSON verdict when the verdict is not accepted as the reply's last decodable object. The eval runner records graderError and aborts as UNVERIFIED instead of recording the skill result.

This has reproduced across TDD, review, strengthening-tests, executable-scope, and external-skill evals. The current error stores only a 400-character excerpt, so the malformed tail cannot be diagnosed.

Expected outcome

A clear verdict is extracted reliably. A genuinely unparseable reply is retried once, then reported as a judge error with enough preserved evidence to diagnose the shape.

Scope

  • Verdict extraction in tests/evals/promptfoo/providers/claude_cli.py.
  • The judge prompt in claude-judge.yaml.
  • One bounded retry for parse failure.
  • Safe preservation/reporting of the raw judge reply on terminal parse failure.
  • Real-capture fixtures from the recorded failures.

Acceptance criteria

  • Real failing replies are captured as redacted fixtures.
  • Verdict extraction handles every captured valid shape without requiring it to be the last JSON object.
  • Ambiguous or conflicting verdict objects remain errors.
  • A reply with no extractable verdict is retried exactly once before ABORT.
  • The terminal error preserves the full redacted reply in a diagnostic artifact and gives a concise console excerpt.
  • No rubric, pass threshold, or candidate output is loosened.
  • Existing valid judge replies remain byte-compatible at the provider boundary.

Test plan

Add parser tests over real captures, including leading verdicts, trailing prose/objects, malformed JSON, and conflicting verdicts. Prove the old parser fails the fixtures, then run a focused real Claude-pair eval after the fix.

Dependencies

None. Related: #694 owns re-grading saved outputs; #617 owns broader eval diagnosis UX; #830 owns the judge model version.

Non-goals

  • Changing the judge model.
  • Re-grading historical runs.
  • Treating a visible "pass": true substring as sufficient without parsing a coherent verdict object.

Activity

  1. sumithr commented on Oct 1, 2026

    @sumithr
    OwnerAuthor

    This reproduced 2 runs out of 2 on the #769 TDD seed at commit 495b891 (Claude pair, single pass, separate PROMPTFOO_CONFIG_DIR per run).

    • What the judge replied: the reply opens {"pass": true, "score": 0.88 and 0.90, followed by "A SHAPE: PASS".
    • What the harness did: it tagged the llm-rubric graderError with "judge reply has no verdict object with a "pass" key as its last JSON object".
    • Where it fails: tests/evals/promptfoo/providers/claude_cli.py _verdict requires the verdict to be the reply's last JSON object, and this reply's verdict comes first.

    The captured reports were saved locally during the batch (rbm.json, tdd-run1.json, tdd.json). They are real captures for the fixture acceptance criterion.

  2. sumithr commented on Oct 2, 2026

    @sumithr
    OwnerAuthor

    Five more occurrences from the 2026-10-02 batch (Claude pair, haiku candidate, opus judge, single pass). Each judge reply carried a passing verdict and each was rejected by _verdict with has no verdict object with a "pass" key as its last JSON object, recorded as graderError and aborted as UNVERIFIED rather than a skill result. The captured reports are kept locally from the batch and are real captures for the first acceptance criterion.

    config / case run raw judge reply head (as recorded)
    skill-implementing-with-tdd, shipping_cost seed case PR #816 run {"pass": true, "score": 0.93, "reason": "A SHAPE: PASS - names target file (tests/ecommerce/test_shipping.py), function under test (shipping_cost), concrete input ($30+$30 cart with discount_total=15.0), the discriminating assertion (== 7.99, broken returns 0.0), ...
    skill-implementing-with-tdd, same case its rerun {"pass": true, "score": 0.93, "reason": "A SHAPE: PASS - names target test file (tests/ecommerce/test_shipping.py), ... closes with exactly pinned handoff phrasing (b) 'I'll run this and surface the ...
    skill-reviewing-before-merge, "SEED - auth helper fix with fresh passing tests" PR #816 run {"pass": true, "score": 0.91, "reason": "A SHAPE: PASS - all three prior-turn named risks (Auth Bypass, Inactive Admin Access, Regression of Owner/Admin Allow Paths) are listed by label, ...
    skill-strengthening-tests, "SEED - VIP promo threshold boundary survivor" PR #816 run {"pass": true, "score": 0.92, "reason": "A SHAPE: PASS - opens with one short line naming the mutant surface (M7, order.subtotalCents > 10000 ...) ... closes with an explicit 'Production code stays unchanged.' and n...
    skill-reviewing-before-merge-executable-scope, fence seed PR #818 fix round {"pass": true, "score": 0.85, "reason": "A SHAPE: PASS - classifies the test-path JS helper as infrastructure_change (executable eval assert), runs the stateful structural probe on the inFence toggle ..., prescribes the 4-backtick-open/3-backtick-inner nested-fence discriminator ...

    (Where the judge wrote an em dash it is shown as "-". Middle elisions are mine.)

    What makes them unparseable cannot be read from these records: the error string keeps only the first 400 characters of the reply (_EXCERPT), so the tail is cut and the full reply is not stored anywhere in the report. All five share the shape the earlier comment describes: the verdict object opens the reply with a long reason, and the parser requires it to be the reply's last top-level JSON object. Either the reply continues with another decodable {...} after the verdict, or the verdict object itself does not decode as a whole (a raw control character or an unescaped quote inside the long reason would do it), after which a later { in the reason text becomes the last object. The scores (0.85 to 0.93) and "pass": true are visible in all five. Storing the full raw reply on a parse failure (the third acceptance criterion) would settle which.

  3. sumithr commented on Oct 3, 2026

    @sumithr
    OwnerAuthor

    Further evidence: skill-suggesting-external-skill-conversion.yaml on the #807 branch. The case 'execute success returns a skill_body to FOLLOW, not finished markdown' aborted the run (exit 3, errors=1) with 'judge reply has no verdict object with a "pass" key as its last JSON object'. The judge text started {"pass": true, "score": 0.9, ... in both the full-config run and a single-case --filter-pattern rerun. On the next full run of the same config the judge reply parsed, and all 8 cases passed.

  4. added
    enhancement
    priority: next
    on Oct 3, 2026
  5. sumithr commented on Oct 3, 2026

    @sumithr
    OwnerAuthor

    Reconciling this issue against main at d08258c before implementing (branch fix/issue-796-judge-verdict-parse):

  6. sumithr commented on Oct 4, 2026

    @sumithr
    OwnerAuthor

    Merge-readiness evidence, head a9755282

    CI: all 28 checks green on a97552829f0e819a53c712bf79e645de40f2c441, including the Windows pytest legs (fixed in 08deb84d: the tests now build paths portably).

    Mutation gate: triggered (tests/**). Run 37202525282: every module at or above baseline, 0 survivors, strict gate passed.

    Review threads: 0 open. The review bot's P1 ("Final verdict is FAIL" not read) and P2 (credential assignments not redacted in kept replies) were fixed in e0eb76a5 and tightened in a9755282 (a stated grade is read only on its own line, as an uppercase PASS/FAIL; credential values are redacted for bold, env-style, quoted and Authorization forms); both threads resolved.

    Per-file review (sumo-qa reviewing_before_merge, full content vs origin/main): no fail-open regression versus origin/main's provider; all captured fixture shapes grade.

    /code-review (high): whole diff, then every fix delta. After six rounds of heuristics each opened new silent-pass cases, the parser was rewritten fail-closed (your decision); later rounds closed duplicate keys, variant pass keys, cut-out objects, and nested or stated-verdict contradictions.

    Behavioural verification (step 4.7):

    # behaviour observed met
    1 real judge replies grade normally through the changed provider final head a9755282, real Claude pair (haiku candidate, claude-opus-5-5 judge) on skill-deciding-approach.yaml (5/5) and skill-implementing-with-tdd.yaml (6/7; the one fail is a deterministic candidate assertion, the judge passed it at 0.85): 12 judge calls, 0 judge errors, 0 retries, 0 kept-reply files; every graded pass matches its "Verdict" word. An earlier head (54f51bf2) also ran three configs, 13 judge calls, 0 errors yes
    2 a reply with no verdict is retried exactly once, then errors provider call_api with a stub claude: two calls, then judge reply has no verdict object ... (asked twice; both replies kept at ~/.../judge-reply-<id>.json) yes
    3 the terminal error keeps the full redacted reply and a concise excerpt kept file holds both replies whole, planted token and home path redacted; console excerpt names the file yes
    4 conflicting / contradicting / duplicate-key replies are errors each made 2 calls and errored; origin/main's provider graded all three silently yes
    5 valid replies byte-compatible at the provider boundary the three real fixture verdicts return identical dicts from this head and origin/main yes
    6 no rubric, threshold or candidate output loosened only the provider, its README, its test and the fixture changed; no yaml yes

    Acceptance criteria (#796): 2-7 met. AC1 ("real failing replies captured as redacted fixtures") is met only as real replies plus the failure shapes reconstructed from the surviving 400-character excerpts: the original failing replies were never stored in full. The new kept-reply file captures the full reply next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-taskenhancementpriority: nexttooling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions