Repository navigation
fix(tier1): retry an invalid rubric judge reply once and name the problem - #415
Conversation
…blem A rubric judge reply that is not valid JSON, or whose checks miss, repeat or invent a criterion or carry an out-of-range score or a non-boolean pass flag, used to end rubric-eval with a HIGH llm_invalid_response or llm_unavailable finding after a single request, which fails Tier 1. RubricJudge.process now sends the request once more with the original prompts plus the problem found by _normalize_rubric_checks (or the JSON parse error), and returns the second reply as parsed so the validator's fail-closed paths still apply to it. Provider errors (failed requests, refusals, truncated replies) are not retried and keep last_failure and the fallback of LLMClient.process. The number of requests is recorded as judge_attempts in the rubric_eval metadata, the success detail and the llm_* finding. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the retry note - judge_attempts now counts the times rubric-eval asked the judge (1, or 2 after a rejected reply). It is left out when the first request fails, so a run with no provider no longer reports 1 next to "did not run". The LLM client's own transient-error retries are not counted. - The retry check validates the reply against the criteria passed to RubricJudge.process, not always the default rubric, so a correct reply to custom criteria is not sent again. - The log line and the retry note keep the first 500 characters of the problem. A reply that invents one very long criterion id no longer slows the warning or sends that id back to the model in full. - Docs and CHANGELOG say that the client still retries transient provider errors (SKILL_EVAL_LLM_MAX_RETRIES) and that only a request that still fails, a refusal or a truncated reply is not asked again. - The Claude 5.5 rubric request test mocks a complete reply and checks that one request is sent. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
The retry caught only json.JSONDecodeError, so a first reply that json.loads rejects with a plain ValueError (an integer past the digit limit) or a RecursionError (nesting too deep) skipped the retry and ended as llm_unavailable after one request. Catch both; the problem text for a JSONDecodeError is unchanged. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bring the branch up to date with public main (d717f22). Conflicts: - CHANGELOG.md: both sides appended an entry at the end of Unreleased > Fixed, after the HTTPie network-exfiltration entry. Kept main's `tier3 compare` Overall lift entry and placed this branch's `rubric-eval` retry entry after it. No released section changed. docs/tier1-validation.mdx merged cleanly: main added the "Tier 1 in automatic CI" section near the top, and this branch's two paragraphs stay inside the rubric-eval accordion. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Review found a credential-handling issue in the new retry diagnostic; fixing with a regression test.
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Reviewed the full production diff and rubric/provider/error-handling callers. Fixed the inline credential-leak finding in 8558454: sanitize judge-supplied rejection text before logging or truncation, with two regression cases (both failed before the fix). All 29 retry-contract tests pass under locked dependencies; full src/tests Ruff lint and formatting of changed Python files pass. Current main ce52a09 merged without conflicts and the signed-off fix was pushed normally. Broader pre-existing rubric/client selection was interrupted during slow filesystem fixtures, without claiming a completed full-suite run. No remaining actionable finding; PR remains open and unmerged.
rng1995
left a comment
There was a problem hiding this comment.
The published-docs audit found a broken link introduced here; fixing the site URL.
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Final follow-up: fixed the published environment-variable link in rubric retry guidance and resolved its inline thread. Pinned Fern5.121 check passes with 0errors and 1existing configuration warning. The credential-redaction fix and its previously passing 29 retry-contract tests remain unchanged; the documentation follow-up was signed off and pushed normally. Both inline findings are addressed. Open and unmerged.
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Resolved new-main CHANGELOG conflicts while retaining the rubric, credential-redaction, docs and upstream entries. Against main a0b65a9: 29 retry contracts pass, full src/tests Ruff lint passes, and pinned Fern check has 0 errors/1 existing warning. PR was still open and the latest-main merge check was clean before the signed-off normal push.
Signed-off-by: Narendran Raghavan <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Current-head integration review: reconciled the actual CHANGELOG-only conflict with main b38b71b, preserving all entries and placing the complete rubric retry entry and both review-fix notes after the assigned stable anchor. The reviewed credential redaction and published documentation link remain intact. Verification on this head: 29 invalid-reply retry contracts passed, Ruff src/tests passed, and Fern check found 0 errors (1 existing warning). Fresh pre-push open/head/base/main checks and both merge-tree checks passed. No PR merge performed.
chrisknvidia
left a comment
There was a problem hiding this comment.
LGTM. I checked the retry path in RubricJudge.process: a parse error (including the plain ValueError and RecursionError cases) or a _normalize_rubric_checks problem gets exactly one more request, and the second reply goes back through the same validation, so a second bad reply still fails closed as HIGH. Request errors, refusals and truncated replies are not retried, last_failure is reset on each call, and judge_attempts is left out when no reply came back. The problem text is redacted and capped before it goes into the log line and the retry prompt. The 320 rubric/LLM-client tests pass and ruff is clean.
chrisknvidia
left a comment
There was a problem hiding this comment.
Reading this after it merged, so treat what follows as follow-ups.
I read the full src diff, ran test_rubric_eval.py and the touched client test locally (all pass; 24 of the new tests fail against main's src), and probed the retry with scripted replies. The code does what it says. The only change I need before merge is in the CHANGELOG.
What I checked. The judge is asked exactly once more: last_attempts is set to 2 before the second request and the second reply is never re-checked in process(), so there is no third ask (the tests script exactly two replies, so a third would fail them). A refusal, a truncated reply, an empty reply or a request that still fails after the client's own retries goes to the same fallback as before, so it is not asked again and reports llm_unavailable with the diagnostic; truncated replies are never salvaged. If the second reply is also invalid it is returned as parsed and validate() re-checks it with the same default criteria, so it ends as a HIGH llm_invalid_response (or llm_unavailable when it is not JSON). Nothing silently passes or gets a score, and a first reply that process() accepts is always one the validator accepts. A valid first reply sends one request and returns the same dict as before. There is no token or cost accounting in this path to update; judge_attempts counts asks, not the client's retries. The retry note for a parse failure uses the JSON error text, which does not quote the reply, and the note built from the checks is redacted before it is cut to 500 characters. Redaction does not mangle legitimate problem text (the longest possible missing-ids message is 256 characters), and it stays fast on 200 KB adversarial input (under 0.3 s each).
To fix: CHANGELOG.md has two extra one-line bullets about the redaction and the docs link. Those are fixes to the retry feature in the entry above, which has not been released, so please fold them in or drop them.
Not blocking: the second-failure finding message and rubric_eval.summary still carry the raw, full-length validation_error (a secret-looking id shows as sk- in the log but in full in the report); control characters are not stripped from the retry note; and process() copies LLMClient.process, which will drift. Details are in the inline comments.
|
Post-merge follow-up: #484 addresses the final-report rejection diagnostic exposure, single-line retry/final diagnostic controls and unreleased-changelog cleanup from this review. Nine new regression cases failed before the fix; 130 rubric tests pass with 1 skip, full src/tests Ruff passes, and independent review approved the candidate. The shared-client extraction suggestion has a technical disposition in its inline thread. #484 is ready for review and not yet merged; no closed branch was edited. |
Summary
RubricJudge.processnow checks the judge's reply before returning it. Whenjsoncannot parse the reply (aJSONDecodeError, or the plainValueErrororRecursionErrorthatjson.loadsraises for an integer past the digit limit or nesting too deep), or itschecksfail_normalize_rubric_checks(a missing, repeated or unknown criterion, a score outside 0 to 10, a pass flag that is not a boolean, an empty or non-listchecks), it asks the judge once more: the same system prompt and user prompt, plusYOUR PREVIOUS REPLY WAS REJECTED: <problem>. Reply again with ONLY one JSON object in the shape described above.process(criteria=, whichcreate_user_promptalready honors), orRUBRIC_CRITERIAwhen none are given._normalize_rubric_checkstakes an optionalcriteriaargument for this; the validator still calls it with the default.... [truncated]. The problem can quote the judge's own text, such as an invented criterion id of any length. The finding still carries the full text, as onmain.llm_invalid_responsefinding, orllm_unavailablewhen it is still not JSON.SKILL_EVAL_LLM_MAX_RETRIES. A request that still fails after those retries, a refusal, an empty reply and a truncated reply are not asked again: they return the fallback withlast_failureset, as inLLMClient.process. A truncated reply is never salvaged.response_schema,schema_nameand reasoning budget, as today.judge_attempts, the number of timesrubric-evalasked the judge (1, or 2 after a rejected reply), in the skill'srubric_evalsuccess detail orllm_*finding and, for a single skill, in therubric_evalobject. The client's own retries are not counted. When the first request fails, for example because no provider is configured, no reply came back andjudge_attemptsis left out. Folder runs keep one count per skill.rubric-evalaccordion ofdocs/tier1-validation.mdx. CHANGELOG entry under Unreleased > Fixed.docs/tier1-validation.mdx. This PR's hunk stays inside therubric-evalaccordion, apart from theirs. Open PR feat(tier3): add fixed-source skill interaction evaluation #392 also editstests/inference/test_llm_client.py; its hunks (import httpxaboveimport pytest, the endpoint test near line 199) are apart from this PR's (the constants import, the Claude 5.5 rubric test near line 1073), and that file merges with feat(tier3): add fixed-source skill interaction evaluation #392 with no conflicts. No open PR touchesrubric_eval.py.Why
Rubric evaluation runs in Tier 1 whenever a provider is configured.
RUBRIC_JSON_SCHEMAdoes not constrain criterion ids, so a reply can still skip, repeat or invent a criterion, and some providers ignore the schema. Onmain,RubricJudgeinheritsLLMClient.process, which sends one request. The first reply that misses a criterion becomes a HIGHllm_invalid_responsefinding, and HIGH always fails Tier 1, so the user has to rerun. A reply in prose becomesllm_unavailable. One retry that names the problem usually recovers.Reproduced on
mainwith a scripted judge (first reply missingerror_handling_quality, then a valid reply): 1 request andLLM judge returned invalid rubric evidence: missing criterion ids: error_handling_quality. On this branch: 2 requests, scored 80.0, passed.Kept from public
RUBRIC_JSON_SCHEMA, the system and user prompts, and_extract_jsonare unchanged. The retry reuses_normalize_rubric_checksfor the problem text, so the judge sees the same message the finding would show, cut to 500 characters._aggregate_rubric_score, the 7-point criterion threshold, the all-criteria-pass gate,judge_passand the judge's ownscore/overall_passas diagnostics.llm_unavailablefinding, never a skipped rubric or a 0/100 score.llm_providerandllm_model_usedname the model that answered the request that was scored, which after a retry is the second request.salvage_truncated_responsestays off for the rubric judge.Tests
tests/validators/test_rubric_eval.py: 27 new tests inTestInvalidReplyRetry:checks, prose, unclosed JSON). The retry prompt is the first prompt plus the problem, both requests carry the rubric schema, the score is computed locally (90.0 while the judge said 0), there is nollm_*finding, andjudge_attemptsis 2 in therubric_evalobject and the success detailjson.loadsrejects with a plainValueError(an integer one digit past the interpreter's limit) or aRecursionError(with a message, and without one) is retried once with the parser's message, orRecursionErrorwhen there is none, and then scored (3 cases). A stand-in parser raises theRecursionError, because the nesting depth that triggers it differs by Python version and platform. TheValueErrorcase is skipped on an interpreter with no digit limitjudge_attempts1llm_invalid_responsenaming the second reply's problem (2 cases), and a second unparseable reply reportsllm_unavailablellm_unavailablewith their diagnostic and record nojudge_attempts(3 cases); a refusal on the retry reportsllm_unavailablewithjudge_attempts2llm_unavailablefinding and nojudge_attemptsjudge_attempts1... [truncated]criteria=, a correct reply sends one request, and a reply missing a custom criterion is retried with a note that names it and no default criterion (2 cases)last_failureoutput_configformat, and the report names the model that answered the retrytests/inference/test_llm_client.py:test_claude_5_5_rubric_gets_schema_effort_and_server_side_fallbacknow mocks a complete rubric reply, checks that exactly one request is sent and still checks its schema, effort and server-side fallback options.src/frommain(d717f22) and this PR's tests,test_rubric_eval.pyhas 22 failed, 97 passed, 1 skipped. 22 of the 27 new tests fail, on the request count, the result or the newjudge_attemptsfield. The other 5 (the 3 provider errors, no provider, and a correct custom-criteria reply) send the same single request asmain, which records no count.tests/validators/test_rubric_eval.py: 119 passed, 1 skipped.tests/inference/test_llm_client.py,tests/test_publication_evidence.py,tests/reporting/test_reporters.py,tests/reporting/test_rich_markup_escaping.py,tests/cli/test_tier_workflows.py,tests/test_commands.py,tests/test_cli.py,tests/validators/test_markdown.py,tests/test_ci_workflows.py,tests/ci/test_image_build.py,tests/test_ci_change_classifier.py,tests/test_oss_packaging.py,tests/test_harbor_claude_refusal_fallback.py,tests/tier3/test_private_loose_source.pyandtests/test_benchmark_rollout_docs.py: 1193 passed, 1 skipped.mainat d717f22. That merge conflicted only inCHANGELOG.md, where both Unreleased > Fixed entries are kept. The counts above are on the merged branch.ruff checkandruff format --checkare clean on the changed Python files, andscripts/check_oss_boundary.pypasses.🤖 Generated with Claude Code