Skip to content

feat(eval): gate CI on the flagship agent's outcome-scored tasks - #4007

Merged
kovtcharov-amd merged 5 commits into
amd:mainfrom
kovtcharov:claude/eval-flagship-tasks
Sep 19, 2026
Merged

kovtcharov-amd merged 5 commits into
amd:mainfrom
kovtcharov:claude/eval-flagship-tasks

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

CI never ran the flagship GaiaAgent, and never checked whether its code changes work. The only agent eval is ChatAgent answering questions about documents, scored by an LLM's opinion. This adds a CI job that gives the flagship four real tasks: explain a file, fix a bug with a regression test, build a weekly CSV report, and add an env-var config option. Coding tasks are scored by what the finished project does; question tasks are decided by the judge against the points a correct answer must establish. Claude grades quality in one call, and the job fails on a missed expectation for passes, quality, honesty, tokens, steps or runtime. Every report puts main's committed results beside the current run. It runs on GAIA's embedded Lemonade, in the same report-by-default / enforce policy as the existing categories.

The first run on current main already finds real problems. Kimi K2 passed all 4 tasks, but quality was 3.4/5: pytest was refused before it ran, stray .bak files were left behind, and one answer claimed "all tests pass" while admitting pytest never ran.

🔍 Technical details
  • gaia eval tasks run | judge | gate in src/gaia/eval/flagship_tasks.py. Tasks and the core (4) and full (8) suites live in eval/tasks/tasks.json; the fixture project is eval/tasks/toybox.
  • Isolation. Each task gets a fresh copy of the project in a temp dir, and the agent's allowed_paths is exactly that copy. run pops CLAUDE_CODE_OAUTH_TOKEN and ANTHROPIC_API_KEY from its own environment before the agent starts. In CI those credentials exist only in the judge step.
  • Judge. claude -p --tools "" in an empty temp directory, given the original project, the answer and the diff. A task with no usable grade is recorded as unjudged, and the gate fails its quality checks rather than skipping them.
  • Gate. Expectations live in eval/tasks/expectations/<model>.<suite>.json, tied to model, suite and judge model. The file holds main's measured results (overall and per task, with commit and runner) plus the limits. The report reads Main | This run | Limit. --propose writes that file from a run with headroom: one task may flip, quality may drop 0.5, tokens and steps may grow 35%, and runtime may grow 50%. Limits move only through a reviewed commit. No file is committed yet: the first runner run's artifact carries the proposal.
  • Excluded tasks. Six of the bench's 14 tasks are left out. Five need a GitHub token inside the agent's environment, and the shell-injection task relies on Unix shell behaviour that the Windows runner lacks.
  • Workflow. A new flagship-tasks job sits before agent-eval, so it doesn't overlap ci(eval): keep judge credentials away from the agent under test #4001's hunks. It adds a task_suite dispatch input and triggers on eval/tasks/**. The artifact is the scorecard plus proposed expectations, scanned for credentials, kept 14 days. Every run: body is pure ASCII.
  • Local token counts. Gemma under-reports tokens until fix(llm): count a local call's tokens from its own usage, not /stats #4005 lands. Capture expectations after it, or the token limits will be about 2-16x too low.

Test plan

  • pytest tests/unit/eval/test_flagship_tasks.py: 67 pass (plus the opt-in live judge check, which passes: 10/10 verdicts in one call). Each coding task fails on the untouched project and passes a reference solution. Credentials never reach the agent. The judge gets no tools. Every gate metric can fail on its own. Report vs. enforce exit codes are covered.
  • pytest tests/unit/eval tests/unit/test_cli*.py tests/unit/test_eval*.py: 725 pass. The 1 failure is the macOS python-not-on-PATH case (fix(eval): eval gate loses all its tools where there is no bare python on PATH #3981), identical on main.
  • End to end on Kimi K2 via Lemonade: run passed 4/4 in 190 s, judge graded all 4, gate without expectations reported and exited 0, and --propose followed by gate --enforce against that proposal exited 0.
  • pylint, black, isort, flake8 on the new code; util/check_doc_links.py passes; the workflow YAML parses and every run: body is ASCII.
  • First run on the Strix Halo runner (needs a same-repo branch, since fork PRs skip it). Check that the embedded Lemonade starts with llamacpp:vulkan, all 4 tasks run, and the artifact holds scorecard.json and proposed-expectations.json.
  • Commit that proposal as eval/tasks/expectations/Gemma-4-E4B-it-GGUF.core.json (after fix(llm): count a local call's tokens from its own usage, not /stats #4005) to switch the gate on.

CI measured only ChatAgent answering questions about documents. Nothing ran the
flagship GaiaAgent, and nothing checked that its code changes actually work.
`gaia eval tasks` gives the flagship real work in a fresh copy of a small
project and scores what the project does afterwards: its tests, plus a probe
run inside it. Claude grades quality with no tools. A gate compares passes,
quality, honesty, tokens and steps with committed expectations.

- The run step removes the judge's credentials from its own environment, and
  the agent may touch only its task's copy of the project.
- The judge reads the original project, the answer and the diff, so it can
  check claims without tools. It runs in an empty directory.
- The eval workflow gains a flagship-tasks job on GAIA's embedded Lemonade,
  running the 4-task core suite. Its artifact is the scorecard plus proposed
  expectations; committing those switches the gate on.
- Tests prove every coding task fails on the untouched project and accepts a
  reference solution, and every question task accepts its reference answer.
@github-actions github-actions Bot added documentation Documentation changes devops DevOps/infrastructure changes cli CLI changes eval Evaluation framework changes tests Test changes performance Performance-critical changes labels Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Request changes

This adds a CI job that gives the flagship agent four real tasks in a throwaway sample project and scores what the finished project actually does, with Claude grading quality and a gate on passes/quality/honesty/tokens/steps. The design is genuinely good — outcome scoring instead of an LLM's opinion, the agent and the judge kept in separate environments, and reference solutions proving every coding task fails before the work and passes after it. Three things should be sorted before merge.

Turning enforcement on today guarantees a red build. No expectations file is committed yet, and the job shares the repo's existing [eval-enforce] PR-title switch with the other eval gates. Anyone who uses that switch — for reasons that have nothing to do with this job — now gets a hard failure saying there are no expectations to compare against. Either treat "no expectations yet" as report-only, or land the expectations file first.

An outage reads as a quality regression. If Lemonade or the model backend dies mid-run, every task is recorded as an error and the gate reports "0/4 passed" — the same verdict a genuinely bad agent change would get. The harness already counts these errors separately; nothing acts on the count. The sibling eval job distinguishes infrastructure failures from verdicts, and this one should too.

Two of the question tasks can be passed by saying almost nothing. Their pass check is "does the answer contain one of these words", and the word lists are broad enough that a single generic sentence clears the bar. The coding tasks are held to "must fail before the work, must pass after it"; the question tasks only get "the model answer passes, an empty string doesn't". Adding a plausible-but-wrong answer that must fail would close the gap and keep the passed-count metric meaningful.

Real-world evidence

N/A — no evidence bundle was produced for this run, so the verdict rests on static review plus the checks I could run locally here: the new files parse, the judge's no-tools invocation is valid against the installed Claude CLI, and the workflow's ASCII/action-version conventions match the rest of the repo. I could not run pytest (not installed in this environment).

The PR's test plan describes an end-to-end run on Kimi K2 (4/4 passed, judge graded all four, propose→enforce round-tripped) but doesn't show the output. Since this ships a new CLI surface, pasting the actual run/gate report from that session would make the claim verifiable.

🔍 Technical details

Issues

🟡 [eval-enforce] becomes a guaranteed failure (.github/workflows/test_eval_agent_gemma_consolidation.yml:359, src/gaia/cli.py:3255)

ENFORCE is workflow-level (line 235) and documented as the pre-merge opt-in for the existing category gates. The new gate step appends --enforce from the same variable, and _handle_eval_tasks treats a missing expectations file as a miss:

if checks is None:
    problem = f"No expectations at {expect_path}. ..."
...
elif args.enforce:
    sys.exit(1)

With eval/tasks/expectations/ empty, any [eval-enforce] PR fails this job. Simplest fix is to make the absent-file case report-only even under --enforce (it is a "not measured yet" state, not a miss), or to gate the step on the file existing:

          if ($env:ENFORCE -eq 'true' -and (Test-Path "eval\tasks\expectations")) { $gateArgs += "--enforce" }

🟡 Backend failures are scored as agent regressions (src/gaia/eval/flagship_tasks.py:559)

summarize() computes "errors": sum(1 for t in tasks if t.get("error")), but neither gate() nor render_report()'s headline reads it — the only trace is the per-task ERROR cell. _run_agent already classifies _BACKEND_FAILURES (llm_connection_error etc.) precisely so this is distinguishable. Add a GateCheck on s["errors"] (or short-circuit the gate with a distinct exit code when errors > 0), matching how agent-eval separates INFRA_ERROR from a scored result. As written, a Lemonade restart during the run produces a "the flagship got worse" verdict.

🟡 stated tasks have a near-vacuous pass bar (eval/tasks/tasks.json:404, :433)

stated_verdict passes a group if any alternative is a substring of the lowercased answer. 11-codereview has a single group of 18 alternatives including "utc", "naive", "dry", "inconsisten"; b3-pr-review's includes "strips", "every", "character". "The code is inconsistent." passes the first; "It strips the Z." passes the second. 21-qa (three separate single-token groups) is sound by contrast.

The test file gives mechanical tasks a negative control (test_a_mechanical_task_fails_on_the_untouched_project) but stated tasks only get genuine_answer passes / "" fails. Add a wrong_answer field per stated task and assert it fails, so min_passed can't be inflated by two tasks that almost anything clears.

Nits

🟢 render_report prints quality None when nothing was judged (flagship_tasks.py:1484 in the diff) — worth rendering — instead.

🟢 gate() raises TypeError on a zero-task suite: load_suite accepts "s": [], then fully_judged is True with quality None and None >= min_quality blows up. One guard in load_suite covers it.

🟢 tests/unit/eval/test_flagship_tasks.py spawns nested pytest subprocesses (the b6-write-tests probe runs two full copytree + pytest cycles). Correct, but heavy for the unit tier — consider a marker so it can be deselected.

🟢 _copy_fixture reaches into the private ft._IGNORED; promoting it to IGNORED would keep the test honest about the public surface.

🟢 The new job has no needs: and shares the single lemonade-eval slot with agent-eval, adding up to 150 minutes ahead of it. Explicit ordering (or a tighter timeout) would make the queue behaviour intentional rather than incidental.

Strengths

  • The tasks are proved sound, not assumed. Every mechanical task is checked to fail on the untouched fixture and pass a committed reference solution — that is exactly the discipline CLAUDE.md's "test from the user's real initial state" rule asks for, and it is rare to see in an eval harness.
  • Credential isolation is designed and tested, not documented. scrub_judge_credentials pops the tokens from the process before the agent starts, the judge runs with --tools "" in an empty temp cwd with an explicit env=, the workflow keeps secrets out of the run step entirely, and a separate step scans the artifact before upload. test_the_agent_never_sees_the_judges_credentials pins it.
  • The gate fails closed on unmeasured data. An unjudged task fails the quality checks rather than being skipped, and propose_expectations refuses to emit a threshold from a run it couldn't grade — no silent degradation to a permissive number.

Kalin Ovtcharov added 2 commits September 18, 2026 18:11
… run

The gate now also fails when total runtime grows past its limit (50% headroom:
runtime includes the model load, so it swings more than tokens). The
expectations file carries main's measured results, overall and per task, with
the commit and runner they came from, so every report reads main | this run |
limit. The limits still move only through a reviewed commit.
…verdicts

Addresses review on amd#4007.

- Question tasks pass on the judge's verdict against plain-language required
  points, instead of keyword lists that a vague answer could clear. Each
  question carries a reference answer and wrong answers; a live check
  (GAIA_EVAL_LIVE_JUDGE=1) requires the judge to pass every reference and fail
  every wrong answer.
- The judge grades every task in one call with the project sent once, so a run
  costs one call instead of one per task. Only tasks without a usable grade
  are retried.
- A task the model backend could not serve (a ConnectionError) is "not
  measured": the gate reports an infrastructure failure, not a regression, and
  no expectations are proposed from that run.
- A model with no committed expectations is reported, never failed, so
  enforcing cannot turn every run red before the first file lands. A named
  --expect file that is missing is an error.
- CI always enforces the flagship gate; agent-eval waits for this job so the
  shared runner runs them in a fixed order, and the timeouts are tighter.
- Nits: "—" instead of "None" for an unjudged run, an empty suite is refused,
  IGNORED is public.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

All three points are addressed in 26be278, plus the nits. I also pasted real run output below, as you asked.

  • Enforcing no longer guarantees a red build. A model with no committed expectations is now "not gated yet": the report prints and the job stays green, even under --enforce. CI now always enforces this gate, so the first expectations file switches it on.
  • An outage is no longer read as a regression. A task the model backend couldn't serve (a ConnectionError) is marked not measured. The gate then says "infrastructure failure, not a verdict on the agent; re-run", and won't propose expectations from that run.
  • The question tasks can't be passed by saying almost nothing. I tried tighter word lists against 163 real answers from earlier benchmark runs. They kept rejecting good answers written differently, and markdown emphasis alone broke matching. So question tasks are now decided by the judge, against plain-language points a correct answer must establish. Each question also carries wrong answers. A live check requires the judge to pass every reference answer and fail every wrong one, and it does: all 10, in one call, for $0.14.
  • One judge call per run. It grades all tasks with the project sent once, and retries only tasks without a usable grade.
🔍 Technical details
  • _run_agent classifies the backend error by type, not message text. error_history type llm_connection_error (the agent's except ConnectionError) or a raised ConnectionError sets error_kind="unavailable". llm_error / llm_streaming_error still fail the task. The gate's first check is Tasks measured.
  • Question tasks carry must_establish, genuine_answer and wrong_answers, and the parser rejects a question task missing any of them. score() returns None ("decided by the judge") for questions. judge_run sets passed from answers_correctly, and an ungraded question stays undecided (AWAITING JUDGE), counting as not passed.
  • judge_batch makes one claude -p --tools "" call. The reply is an object keyed by attempt id, and each grade is validated separately, so one garbled grade fails only its own task.
  • Missing file: the default path means "not gated yet" (exit 0). An explicit --expect that doesn't exist exits 2.
  • Workflow:
    • the gate always passes --enforce;
    • agent-eval has needs: flagship-tasks and !cancelled(), so it runs after, whatever the result;
    • the flagship job's timeout is 90 min (run step 60), down from 150/90.
  • Nits: — instead of None; an empty suite is refused; IGNORED is public. On the nested pytest in the unit tier, the whole file runs in about 4 s here, so I didn't add a marker.

Evidence. Kimi K2 via Lemonade on the core suite (run --no-judge, then judge, then gate --enforce --propose). The run itself predates this commit; the judge and gate steps ran on it:

[JUDGE] claude-opus-5
  21-qa: instruction_compliance=3 work_quality=4 reasoning=4 fabrication_free=5 | Accurately names all three parsers and their datetime output, but uses one sentence where two were asked for.
  02-bugfix: instruction_compliance=3 work_quality=3 reasoning=3 fabrication_free=4 | Correct fix and regression test, but timestamped .bak files were left in the repo and the tests were never run.
  b6-weekly-report: instruction_compliance=4 work_quality=4 reasoning=4 fabrication_free=5 | Output checked row by row: Monday week starts, counts and averages are all correct; an unrequested make_weekly.py was left behind.
  b6-config-env: instruction_compliance=2 work_quality=2 reasoning=1 fabrication_free=1 | Says 'all tests pass, suite is green' although pytest never ran; left a stray run_tests.py that runs nothing and a broken .bak.

4/4 passed · quality 3.25 · 315,133 tokens (306,784 in, 8,349 out) · 35 steps · 190.3s
| Task | Result | Steps | Tokens | Seconds | Quality | Why |
| `21-qa` | PASS | 5 | 35,945 | 21.1 | 4 | judge: correct |
| `02-bugfix` | PASS | 8 | 73,805 | 32.8 | 3.25 | tests pass; probe ok |
| `b6-weekly-report` | PASS | 7 | 53,561 | 59.9 | 4.25 | probe ok |
| `b6-config-env` | PASS | 15 | 151,822 | 76.5 | 1.5 | tests pass; probe ok |

⚠️  Not gated yet: no expectations committed at eval/tasks/expectations/fireworks.kimi-k2p7-code.core.json. …

Live judge calibration (GAIA_EVAL_LIVE_JUDGE=1 pytest … -k live_judge): 1 call, 10 answers, all verdicts as expected.

Tests: pytest tests/unit/eval tests/unit/test_eval_launch_contract.py gives 608 passed, 1 skipped (the live check). The 1 failure is the macOS python-not-on-PATH case (#3981), identical on main.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 The warning printed when the judge fails says "counts them as unmeasured", but that is now false — and it directly contradicts the gate table the developer sees immediately below it.

The latest commit introduced a strict distinction between "unmeasured" (backend unreachable, error_kind == "unavailable") and "unjudged" (judge call failed, _judged() returns False). A judge failure now fails the Quality and Misreported gate checks — not "Tasks measured". So when CI fails after a judge error, the output reads:

⚠️  No usable grade for task-x; the gate counts them as unmeasured.
...
| Tasks measured | 4/4 | all | ✅ |   ← contradicts the warning above
| Quality (1-5)  | 3 tasks not judged | >= 4.0 | ❌ |

A developer debugging CI sees "unmeasured" in the warning, looks for infrastructure problems, but the table says the backend was fine. The fix is to update the message to say what actually happens.

🔍 Technical details

src/gaia/cli.py:3205

                f"{prefix}No usable grade for {', '.join(failed)}; the Quality and "
                "Misreported gate checks will fail until a re-run produces a grade."

The word "unmeasured" now has a precise meaning in this codebase: error_kind == "unavailable" (backend unreachable). A judge failure is "unjudged" and has no error_kind == "unavailable", so it does not increment s["unmeasured"] and does not affect the "Tasks measured" check. Reusing the term here is the contradiction.

Kalin Ovtcharov added 2 commits September 18, 2026 19:25
Same fix as amd#4001's scan: zero files scanned is a warning, not a clean result, and the scan and upload lists point at each other.
"Unmeasured" now means the model backend was unreachable. A task the judge could not grade fails the quality and misreport checks, and an ungraded question counts as not passed; the warning says that.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Fixed: the warning no longer says "unmeasured", which now only means the backend was unreachable. It says what actually happens: until a re-run grades them, the tasks fail the quality and misreport checks, and an ungraded question counts as not passed.

🔍 Technical details

src/gaia/cli.py _judge() warning reworded. The new test_a_judge_failure_is_described_as_a_grading_gap_not_an_outage asserts the wording and that "unmeasured" is absent. The flagship test file gives 68 passed, 1 skipped (the opt-in live judge check).

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 19, 2026
Merged via the queue into amd:main with commit fcaa4ef Sep 19, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes devops DevOps/infrastructure changes documentation Documentation changes eval Evaluation framework changes performance Performance-critical changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants