Repository navigation
fix(eval): name a judge outage instead of dying in an SDK traceback - #4123
Conversation
When the Claude judge ran out of credit, the Email Triage Eval ended a 21-minute run in a raw anthropic.BadRequestError whose last line was an HTTP 400 — indistinguishable from a malformed request, and no hint that nothing had been scored. A reader who does not know Anthropic returns 400 (not 402) for "credit balance is too low" reads it as an eval defect. The three judge factories in gaia.eval (drafting, briefing, action items) all called client.get_completion() unguarded. They now share judge_completion_text(), which classifies a raised SDK exception into JudgeOutageError and re-raises anything it does not recognise untouched — a genuine bug must not be relabelled as someone else's billing problem. The three CI report scripts wrap main() in run_with_outage_guard(), so an outage prints a named, actionable report and exits 1 with no traceback. JudgeOutageError subclasses RuntimeError, never ValueError, and that is load-bearing: judge_drafts and judge_briefings turn a ValueError into an ERRORED scorecard row, which is right for an unparseable verdict and exactly wrong for an outage — it would publish a billing lapse as a model regression. A test asserts the exception is not a ValueError so a later refactor cannot quietly reintroduce that. Status 402/429 and 401/403 classify on their own; 400 deliberately does not, so the credit-balance case is reached by phrase and a malformed request still fails as itself. The tests feed the verbatim rejection text of both live failure modes (the credit-balance 400 and the weekly-limit message, which share no substring with each other). Not shared with util/classify_claude_probe.py on purpose: util/ is repo tooling, is not a package and is not shipped in the wheel, so gaia.eval cannot import it. The right end-state is the reverse dependency.
|
Verdict: Approve When the Claude judge runs out of credit, the email evals now stop with a report that says so — what happened, who fixes it, where to go — instead of ending a 21-minute run in an SDK traceback that looks like the agent failed. All three email judges route through one guarded call, so the outage path can't be fixed in two of them and missed in the third, and a 400 that really means "your request is wrong" still fails as itself. Nothing blocking. The one thing worth knowing: the same unguarded judge call still exists in the session-eval lane, where it also retries three times before dying in a traceback — a follow-up, not a merge blocker. Real-world evidenceThe evidence bundle exercised all three real report scripts on this runner with only the Claude HTTP boundary faulted with the verbatim production error body. Before → after on the drafting script: The check that matters most for trust — a genuinely malformed request is not relabelled as someone's billing problem: Spot regression covered the contrast case: a reachable judge returning garbage still writes 18 🔍 Technical detailsIssues found🟢 The same unguarded judge call survives in the session-eval lane ( 🟢 🟢 Note on the duplicated phrase listsThe module docstring is upfront that Strengths
|
When the Claude judge runs out of credit, the Email Triage Eval currently ends a 21-minute run in a raw SDK traceback whose last line is an HTTP 400 — the same code Anthropic returns for a malformed request. Nothing in that output says the judge never scored anything, so the run reads as "the eval is broken" (or worse, as a model regression) when the actual fix is a spend-limit increase by someone else entirely. After this change the same failure prints a named report — what it is, what to do, where to go — and exits 1 with no traceback.
The bug was in three places, not one: the drafting, briefing and action-item judges all called the SDK unguarded, and all three run in the same CI lane. They now share one guarded call site, so the outage path can't be fixed in two of them and missed in the third.
A 400 on its own still fails as itself. Only the credit-balance and weekly-limit phrasings (and 402/429/401/403) are reclassified — a genuine bug must not be relabelled as someone else's billing problem.
Related: #4080 (the judge org running out of monthly spend is the live instance of this).
Test plan
python -m pytest tests/unit/eval/test_judge_outage.py tests/unit/eval/test_claude_judge.py -q→ 61 passedpython -m pytest tests/unit/eval/ -q→ no new failures (8 pre-existing failures intest_release_scorecard.py, unchanged atmain)python util/lint.py --black --isortclean on the touched files🔍 Technical details
The load-bearing detail.
JudgeOutageErrorsubclassesRuntimeError, neverValueError.judge_draftsandjudge_briefingsboth catchValueErrorto write anERROREDscorecard row — correct for an unparseable verdict, and exactly wrong for an outage, because it would publish a billing lapse as per-case model failures.TestOutageIsNotAValueErrorasserts this explicitly so a later refactor can't quietly reintroduce it, andTestJudgeDraftsAbortsOnOutagecovers both sides: an outage aborts the run, while an unparseable verdict still producesstatus == "ERRORED".Classification rules. 402/429 → quota and 401/403 → credential, decided on
status_codealone. 400 is deliberately in neither set, since Anthropic uses it both for "credit balance is too low" and for a malformed request; that case is reached by phrase instead. Exceptions are duck-typed onstatus_coderather than importinganthropic, matching howclaude.pyguards its own import, so the module stays importable without the[eval]extras.Test inputs are the real rejection strings, not paraphrases — the credit-balance 400 body and
You've hit your weekly limit · resets Sep 23, 8am (America/Los_Angeles). Those two share no substring, so a classifier tuned only to the first would still miss the live CI failure; both are asserted.Verified end to end by running the real
eval_drafting_report.main()with only the Anthropic transport stubbed: exit code 1, the named report on stderr, no traceback.Why not
util/classify_claude_probe.py. It draws the same line for the CI preflight, but it classifies the text of aclaude -pprobe, while this classifies a raised SDK exception inside the library. They cannot be one file today:util/has no__init__.py, is not a package, andsetup.pysetspackage_dir={"": "src"}, so it is not in the wheel andgaia.evalcannot import it. The right end-state is the reverse dependency — the phrase lists live here and the probe script imports them — which is a follow-up, not this PR.