Repository navigation
feat(eval): record the Claude tokens each scenario really spent - #5525
Conversation
A passing scenario kept only the driver's own guess at its cost and dropped the token counts claude -p reports, so nobody could say what a flagship sweep cost or where its tokens went. Each scenario now records input, output, cache read, cache write, API calls and list-price cost under `claude_usage`, summed across --iterations attempts. The scorecard adds them up per category and per run, summary.md shows the table, and the all-lanes CI summary adds the lanes. Usage is filed by role. The scenario session is the `driver`, and it also judges every turn, so its tokens cover both jobs; a separate judge-only call files under `judge`. A scenario killed on timeout records nothing, and the totals say how many scenarios they are missing.
|
Verdict: Request changes Recording the real Claude token counts per scenario is useful, and the per-category and per-run totals add up correctly. The problem is one import: it makes the all-lanes summary step in the flagship eval workflow crash on every run.
Real-world evidenceThe evidence stage ran the summary script the way The pre-PR file exits 0 on the same command and renders the lanes table. The bundle's other results:
This failure is why the verdict is Request changes. Nothing here exercised the end-of-run console line, so that part of the verdict comes from reading the code only. 🔍 Technical details🔴
(The lane summary ignores 🟡 No test runs the script the way CI does (tests/unit/eval/test_lane_summary.py) Every lane-summary test imports the module in-process, where Strengths
|
eval_flagship.yml runs lane_summary.py as a plain file on a hosted runner with no GAIA install, and the new usage table imported gaia.eval.claude_usage, so the summary step would fail on every run. The two helpers it needs are now inlined (stdlib only), a test pins them to claude_usage's fields, and another runs the file exactly as CI does (python -S, no gaia on the path).
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 |
|
Fixed: the all-lanes summary script is stdlib-only again, so it runs on the hosted runner without GAIA installed. 🔍 Technical details
|
…md#5533) When the Claude account running a flagship eval ran out of quota, every remaining scenario failed in seconds as an ordinary error and the run still went green: v0.25.1-rc2 lost 68 of 343 scenarios that way (amd#5493, section 6.4). Now the run stops the moment Claude's quota or credential gives out (or Claude fails to answer two scenarios in a row): nothing else is launched, the rest are recorded as `NOT_RUN` (never PASS, never an ordinary error), and it exits 3 with the account, the reset time and the command to finish it. `gaia eval agent --resume <run-dir>` then runs only the scenarios without a result and merges them into the same scorecard, each stamped with the commit and time it ran at. Closes amd#5265. Stacked on amd#5525 (Claude usage); I'll rebase onto `main` once that merges. In CI a quota stop already ends the lane (any non-zero exit does), and the integrity gate's `--fail-on-zero-token-errors` now also counts these scenarios, so a dispatch still fails. The lane's run directory doesn't survive the job, so CI re-dispatches the printed `-f scenarios=...` list (amd#5513) rather than using `--resume`. ## Test plan - [x] `pytest tests/unit/eval tests/test_eval.py tests/unit/test_eval_launch_contract.py`: 1579 passed, 30 skipped - [x] `tests/unit/eval/test_quota_resume.py` runs the real runner loop against a fake `claude -p` that runs out of quota after N scenarios: nothing is launched after it, the rest are `NOT_RUN`, exit code 3, the message names account, reset and resume command, and the token never reaches the log - [x] Resume runs only the missing scenarios, keeps earlier results with their commit and time, warns when commits differ, refuses a different `--model`, stops again if the quota runs out again, and is a no-op on a finished run - [x] A single zero-token failure with no quota or credential wording stays resumable but doesn't stop the run; two in a row do - [x] A genuine FAIL, a timeout, a "rate limit" phrase inside a transcript, the scenario's own budget cap, and a driver that forges `claude_outage` or `NOT_RUN` never stop a run - [x] Outage phrases checked against the strings in the installed `claude` CLI (2.1.303): "You've hit your limit", "Usage limit reached", "monthly spend limit", "limit resets" - [x] `PYTHONPATH=src python util/lint.py --all` passes <details> <summary>🔍 Technical details</summary> - `gaia.eval.claude_outage.classify_driver_failure` reads only the CLI's `is_error` result, `api_error_status`, and stderr/stdout when there is no JSON. Its phrase lists extend `judge_outage`'s with the subscription CLI's wording. `util/classify_claude_probe.py` keeps its own copy because it runs in the preflight before GAIA is installed. - A failure with zero tokens and zero API time counts as an outage ("Claude never answered") even without a matching phrase. That was rc2's signature, whose stored errors were cut before the CLI's message. - The run loop moved into `AgentEvalRunner._execute`, which fresh and resumed runs share. The `.progress.json` path it replaces could never resume anything because every run got a new directory. - `--resume` reads the run's own `scorecard.json`, which now carries `config.plan`. CI uploads that file, so a lane that restores its previous artifact could resume too. </details>
…#5535) Every RC tag ran the whole flagship sweep: about 28 Strix Halo machine-hours, 13 of 14 machines for 3.3 h, and an estimated 130M Claude tokens, more than two accounts delivered on rc2. Now an RC runs a 30-scenario smoke tier on 3 machines, only the RC you nominate for promotion runs the full sweep, and a final tag checks that sweep exists instead of re-running it. The Strix Halo pool also starts scoring Qwen3.6-35B-A3B, the model `gaia init` installs on that hardware, against its own baseline. Implements the "Cost and tiering" section of amd#5493. | Per release cycle (3 RCs + final) | Before | After (amd#5493 estimates) | |---|---|---| | Strix Halo machine-hours | ~113 (4 full sweeps) | ~37 (2 smokes, 1 full sweep, 2 weekly backlog runs) | | Claude tokens | ~520M | ~170M | | A non-promoted RC | 13 machines, 3.3 h, ~130M tokens | 3 machines, ≤1 h target, ~19M tokens | **Measured on rc2's commit:** the smoke took 3 machines, 2.0 machine-hours and 45 min wall time ([run](https://github.com/amd/gaia/actions/runs/39668506957)). rc2's own full sweep took 13 machines, 22.1 machine-hours (cut short when the quota ran out) and 2 h 38 min. The smoke ran before amd#5525 started recording real Claude usage, so the token figures stay estimates; the next tier run will measure them. **Worth a look:** on Qwen the smoke passed 27 of 30. The 3 failures are all protected refusal scenarios that pass at least 93% on Gemma: `files_sandbox_refusal_system`, `mem_credential_refusal`, `shell_denial_reported_as_denial`. It's one run, so re-run before calling it a Qwen regression. - **Tiers.** RC tag → smoke. `[full eval]` in an RC's annotated tag message (or `-f tier=full`) → full sweep. Final tag → verify only. `[skip eval]` still works. - **Weekly backlog lane**, Sunday 06:17 UTC, 3 machines: the 26 non-protected always-fail scenarios (which leave the full sweep) plus the 15 noisiest (which stay in it), with a rolling trend artifact so progress toward 80% is visible. It skips itself while any other flagship run holds the pool. Owner: @kovtcharov-amd. - **Nothing drops out.** Protected scenarios (security, honesty, injection, adversarial, error recovery, resilience) never leave the full sweep, and a check proves smoke + full + backlog still cover all 343 runnable scenarios. - **Qwen on Halo, compared only with Qwen.** Its baseline is empty until a real full sweep fills it, so runs say "no Qwen baseline yet" and never fall back to Gemma's. A dispatch can still pick `-f model=Gemma-4-E4B-it-GGUF` to re-run part of a Gemma tag run, as rc3 does. Gemma moves to the Strix Point pool (amd#5511); the Halo full sweep keeps no Gemma coverage by default. - **Quota exhaustion fails every run now**, tag runs included (the zero-token check from amd#5513). ## Test plan - [x] `pytest tests/unit/eval tests/unit/test_eval_tag_gate.py tests/test_eval.py`: 1686 passed, 30 skipped - [x] `python util/eval_tiers.py check`: 343 of 343 runnable scenarios covered; 18 never-in-CI scenarios listed with their reason - [x] `python util/lint.py --all` passes; actionlint reports only the existing runner-label notices - [x] Tiny Qwen dispatch on rc2's commit ([run](https://github.com/amd/gaia/actions/runs/39660896807)): judged PASS, session ran Qwen3.6 as pinned, compare reported "no Qwen baseline yet". The first try caught a warm pull that never happened and stopped in preflight; fixed in this PR - [x] Smoke tier on rc2's commit 0b14d74 plus this PR's harness commits ([run](https://github.com/amd/gaia/actions/runs/39668506957)): 3 machines, 45 min, 30 scenarios all on Qwen, no zero-token errors <details> <summary>🔍 Technical details</summary> - The first commit is amd#5511's pin-and-refuse core, taken verbatim (`eval_gaia_home.py pin-model`, `gaia eval agent --agent-model`, `--compare` exit 3 on a model mismatch) so both branches carry one implementation. amd#5511's Strix Point workflow, reusable lane and lane-matrix changes are left to it. Whichever lands second drops the duplicate hunks. - `eval/ci_tiers.json` holds the smoke and backlog machines, each scenario's `why` (pass rate, runs, timeouts, protected reason), the model → baseline map, and the owner. `util/eval_tiers.py` decides the tier, builds the matrix (reusing amd#5513's scenario selection), checks coverage from the matrices it would emit, and verifies a final tag through a 90-day `flagship-tier-full` marker artifact. `util/eval_backlog_trend.py` rolls the trend forward. - A smoke machine holds `memory` beside other non-gaia categories; the job runs with memory off and turns the store on for `memory` alone (`EVAL_MEMORY_CATEGORIES`), so no category runs under different conditions than in the full sweep. - Outcomes (`gaia eval tasks`) runs only with the full sweep, to keep the smoke at 3 machines. - Gemma on Strix Point: `python util/eval_tiers.py scenarios --tier smoke` prints the same 30 ids. Point runs scenarios about 3x slower, so the full smoke is roughly 4 h on one Point machine, or about 2 h for the 13 protected ones. - rc3 is unaffected: a dispatch on `--ref v0.25.1-rc3` runs the workflow as it is at that tag. </details>
The plan's cost-and-tiering section has largely landed since it was written: the RC smoke tier, nominated full sweep, weekly backlog lane and Qwen3.6 scoring (#5535), real Claude usage per scenario (#5525) and quota stop-and-resume (#5533). The status line, the implementation table and the stale "isn't recorded" and "v0.25.1 final" claims now say so, and two answered open questions are dropped. Also fixes the two contradictions the review flagged: the scenario eval could have caught 2 escapes, not 3 (#5413 needs a scripted model), and item 3 adds re-runs to the existing Strix Halo eval.
A flagship scenario that passed kept only the driver's own guess at its cost and threw away the token counts
claude -preports, so we could not say what a sweep costs, which categories drive it, or whether a change like prompt caching (#5493, section 6.4) actually saves anything. Every scenario now records its real Claude usage (input, output, cache read, cache write, API calls, list-price cost), and the scorecard,summary.mdand the all-lanes CI summary add it up per category and per run.The scenario's Claude session both plays the user and judges each turn, so its usage is filed under one
driverrole; the schema keeps ajudgerole for separate judge-only calls. Splitting the two needs scripted user turns first (#5493, cut c).Test plan
pytest tests/unit/eval tests/test_eval.py tests/unit/test_eval_launch_contract.py: 1546 passed, 30 skippedtests/unit/eval/test_claude_usage.pyuses payloads shaped like realclaude -poutput: success, quota-style zero-token failure, budget stop, unparseable output, a driver that forges its own usage,--iterationssumming, and scorecard/lane totalsPYTHONPATH=src python util/lint.py --allclean for these filesClaude usagetable in each category'ssummary.mdand in the all-lanes summary