Repository navigation
fix(eval): let the email judge run on the subscription credential - #3490
Conversation
… the repo Nine design and reference docs were sitting untracked in the working copy, so the decisions they record were invisible to everyone else — including the skill-bound task execution design that the async-task and multi-slot-broker work is meant to build against. Alongside them sat a 45MB mailbox corpus, agent-run captures, and internal analysis, none of which were gitignored. `git add -A` would have committed a mailbox to a public repo. The ignore block that already quarantines private working reports now covers those classes too, and its pointer to where that material lives is corrected — the path it named has not existed for some time.
The Email Agent Eval has failed on every branch for weeks, ~25 minutes into each run. The Anthropic account behind the ANTHROPIC_API_KEY repo secret is out of credit, and that key was the only credential the three judge-scored email evals could use. Every other Claude workflow in this repo already prefers CLAUDE_CODE_OAUTH_TOKEN. A subscription token cannot authenticate a direct Messages API call, so gaia.eval.judge_client drives it through `claude -p` instead and keeps the SDK path for the API key. Neither credential present is still a loud failure. Two things the old preflight could not catch, now covered: - It asserted the variable was non-empty, which an out-of-credit key satisfies. It now sends one trivial prompt down the real transport, so a dead credential costs 10 seconds instead of 25 minutes of the serial Lemonade slot. - `claude -p` exits 0 on an API error and prints the error as its result, so --output-format text would have handed the judge "API Error: 400 ..." as a verdict. The transport reads --output-format json and raises on is_error. The judge runs with Claude Code's agent prompt replaced, tools denied, MCP servers off, settings sources cleared and an empty cwd, so a CLI verdict is scored from the rubric alone — as close to the SDK judge as the transport gets. Also drops the count_tokens round-trip that get_completion made on every call just to write a debug line; it was the frame the 400 surfaced in.
Skill audit
✅ All audited skills cleared the tier they claim. Per-finding detail is withheld here on purpose. Read it in the Security > Code scanning tab, or download the |
Verdict: Approve with suggestionsThis unblocks the Email Agent Eval, which has been red on every branch for weeks because the only judge credential it accepted belonged to an out-of-credit account. The evals can now run on the Claude Code subscription token, and the preflight proves the credential actually works before the run claims 25 minutes of the single Lemonade slot. The transport work itself is careful and well tested — the one thing to fix before merge is a documentation claim that contradicts the code. Worth fixing:
Worth knowing (not blocking): the committed baselines and Real-world evidenceThe evidence bundle is present and substantial, and it supports the verdict: the change is exercised on the surfaces this lane can reach, and the before→after is real rather than asserted. Same environment, subscription token present and no API key — before the change the gate refused to run at all: [BRIEF-EVAL] ERROR: ANTHROPIC_API_KEY is not set on this runner — the Claude judge cannot score briefings. ...
exit=1After, the credential is accepted and the run proceeds until it hits the boundary this runner genuinely can't cross (no Lemonade, no [BRIEF-EVAL] manifest: .../briefing_gate_thresholds.json
[BRIEF-EVAL] enforce=False approval_min=0.7 recall_min=0.8 hallucination_free_min=0.95
RuntimeError: The briefing eval needs the email agent. ... install it from source instead: ...
exit=1The exact CI credential shape was checked, not assumed — the workflow blanks the key to an empty string rather than unsetting it, and that still selects the CLI transport: $ env ANTHROPIC_API_KEY= CLAUDE_CODE_OAUTH_TOKEN=dummy-not-a-real-token ...
judge_credential_present -> True
selected transport -> ClaudeCliClientAnd every flag in the outgoing call was verified against the installed CLI's own $ claude --version
2.1.218 (Claude Code)
OK -p OK --model OK --output-format
OK --system-prompt OK --setting-sources OK --strict-mcp-config
OK --mcp-config OK --disallowed-tools OK --no-session-persistenceDeferred, and stated in the bundle rather than glossed: no live probe against the real secret (the evidence lane doesn't run credential flows), and no end-to-end judged eval — that needs Lemonade and is pending the strix-halo lane. Screenshot evidence is correctly N/A; this PR touches no UI surface. So the claim "the evals will now score green in CI" rests on the workflow's own preflight on a legitimate run, not on anything proven here — that's the right place for it, but it is the one thing the dispatch in the test plan still has to confirm. 🔍 Technical details🟡 Docs claim a credential preference the code doesn't implement
Two ways out. Reword to "the workflows prefer the subscription token by blanking the key; (That flip also needs 🟡
|
|
🟡 Two findings from the first review are still unfixed in this push. The "selection lives in judge_client" comment still points the wrong way.
🔍 Technical details
if api_key:
return ClaudeClient(model=model) # ← API key wins
if oauth_token:
return ClaudeCliClient(model=model)The docstring on
|
These three assert the judge factories never send a `temperature`, by spying on ClaudeClient. Routing the factories through judge_client made them read the environment first, so on a runner with no credential they raised before ever reaching the spy — green locally (a stray .env supplies a key) and red in CI. Set the key and clear the token in the fixture, so the transport under test is the one the assertion is about rather than whatever the machine happens to have.
|
🟡 The credential-preference mismatch flagged in the prior review is still open, and this push adds more incorrect claims rather than fewer.
The 🔍 Technical details
New incorrect claims introduced by this push:
Fix: either flip the two
|
Only `.gitignore` conflicted: both sides appended a new block at the end of the file. Kept both — the local-scratch block from this branch and the frozen-agent build block from main.
Follow-up fixes for #3490. Changed: .github/workflows/{email_scorecard_refresh,test_email_agent_eval,release_agent_email}.yml; .gitignore; docs/plans/email-eval-node-frontend.mdx; hub/agents/email/npm/EVALUATION.md; hub/agents/email/python/packaging/eval_{action_item,briefing,drafting}_report.py; src/gaia/eval/judge_client.py; tests/unit/test_eval_judge_client.py; hub/agents/email/python/tests/test_eval_{drafting,briefing}_report.py. Exact changed path list is available from git diff. This PR targets the original feature branch because the current account cannot push to `amd/gaia`. It carries the prepared maintenance changes for that PR. ## Test plan - [x] Previously completed local validation: Validation: 43 tests passed covering judge selection, CLI invocation/error handling and all three report scripts (tests-3490.log). Exact live ClaudeCliClient transport using the existing authenticated Max subscription returned ['OK'] in about four seconds (3490-judge-probe.log). This proves actual tool flags/model/auth invocation works, not only mocked selection. All three workflow YAML files parse; Black/isort/Flake8/diff pass. - [ ] Fresh CI on the combined feature branch. - [ ] Remaining live-model, hardware or platform checks described in the original PR, where applicable. - [ ] Human review before merging the original PR.
# Conflicts: # .github/workflows/test_email_agent_eval.yml # docs/plans/email-triage-skill.mdx
|
Every item in this review has already been fixed — the comment predates the current head by two weeks and was never re-run. The credential docs and the code now agree: Nothing to do here. The PR is mergeable. 🔍 Technical detailsVerified at The code is unchanged and deliberate —
So the resolution taken was the second of the two the review offered: reword the labels to match API-key-first behaviour, rather than flip the Site by site:
Unrelated but worth knowing before anyone reads this PR's eval lanes: the judge credential's org is out of monthly spend (#4080) until Sep 23 8am Pacific, so a red eval check on this branch right now measured nothing. |
Main added judge-outage classification (judge_completion_text / JudgeOutageError) to the three email judges while this branch moved them onto make_judge_client. The two are orthogonal — kept both: the judges select their transport by credential and still name an outage instead of scoring it. Main's TestJudgeFactoriesClassify patched gaia.eval.claude.ClaudeClient directly, which this branch only reaches when ANTHROPIC_API_KEY is set, so it failed on a keyless runner. The helper now pins the transport. Also repoints this branch's new setup-node comment at eval_flagship.yml, which main renamed from test_eval_agent_gemma_consolidation.yml.
|
🟡 A new test in the action-item test file will fail with The test 🔍 Technical details
# wrong: eval_action_item_report has no generate_briefings attribute
monkeypatch.setattr(mod, "generate_briefings", generate)
Fix — swap the function name: The analogous tests in |
The Email Agent Eval has been red on
mainand on every open PR for weeks, dying ~25 minutes into each run. It is not measuring anything: the Anthropic account behind theANTHROPIC_API_KEYsecret is out of credit, and that key was the only credential the three judge-scored email evals could use. This routes them onto the Claude Code subscription token that every other Claude workflow here already prefers, and makes the preflight prove the credential works instead of merely existing — so a dead credential costs 10 seconds rather than 25 minutes of the single serial Lemonade slot.A subscription token can't authenticate a direct Messages API call, so it is driven through
claude -p(the transportgaia.eval.runneralready uses); the API key keeps the SDK path. Neither present is still a loud failure, never a skip.Test plan
pytest tests/unit/test_eval_judge_client.py hub/agents/email/python/tests/— 41 passingemail_scorecard_refresh.ymlas a subset run (it gets the same transport and never commits)Notes for the reviewer
🔍 Technical details
Two failure modes the old preflight could not catch. It asserted the env var was non-empty, which an out-of-credit key satisfies — hence weeks of red. It now sends one trivial prompt down the real transport. Separately,
claude -pexits 0 on an API error and prints the error as its result (verified: a bogus model returnsis_error: true,subtype: "success", exit 0), so--output-format textwould have handed the judge"API Error: 400 ..."as a verdict. The transport reads--output-format jsonand raises onis_error.Judge comparability. Committed baselines and
SCORECARD.mdwere scored by the SDK judge. The CLI judge runs with Claude Code's agent prompt replaced, tools denied, MCP servers off,--setting-sources ""and an empty cwd — measured, that cuts the injected context from ~31K tokens to ~200, so it sees the rubric and little else. Worth an A/B before trusting a refreshed scorecard.Latency. Measured 12.6 / 13.3 / 13.7s per call on a 31KB prompt with the production argv. 51 judge calls ≈ 11 min against a 90-min budget — and the refresh workflow's own header records the SDK drafting judge alone taking 21 min, so this is likely faster.
Not fixed here, stated plainly. If the judge answers but every reply is unparseable, drafting and action-item record per-case errors, their gate comes back
skipped, and the step still exits 0. Only briefing fails on that. The workflow header claimed otherwise; it now says what the code does. Closing it means changing those scripts' exit semantics and the committed tests that pin them — its own change.Scope note.
get_completionalso stopped making acount_tokensround-trip on every call just to write a debug line. It was the frame the 400 surfaced in, and it doubled judge API calls.Relationship to #3403. That PR fixes the same class of failure for
test_eval_agent_gemma_consolidation.ymland explicitly leaves the email evals out of scope ("they will keep failing until the account is funded"). This is the email half; the two do not overlap.