Skip to content

feat(eval): give the flagship agent a measured scorecard and a release gate - #4056

Closed
itomek wants to merge 6 commits into
mainfrom
issue-2983
Closed

itomek wants to merge 6 commits into
mainfrom
issue-2983

Conversation

@itomek

@itomek itomek commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #2983 — deliberately does not close it. The measured card cannot be produced in this
session (see the blocking callout and the note at the end), so #2983 stays open naming that
blocker rather than being closed on infrastructure alone.

The flagship GAIA agent — the first thing a new user meets — can ship a release with no evidence its answers are any good. The email agent publishes a measured score every release and blocks the release if that score drops; the flagship publishes nothing and blocks on nothing, so a change that quietly made it worse would pass every unit test and go out the door. This gives the flagship the same measured score and the same release block, and surfaces the card where integrators actually look.

It also fixes the reason the flagship could not be measured at all: the five scenarios that test whether an agent picks the right tool are pinned to a different agent, and the command-line flag meant to redirect them is ignored.

Important

Draft — must not merge yet. hub/agents/gaia/npm/SCORECARD.md does not exist; it has to come from a real eval run, which is waiting on an inference machine. Because scorecard-gate is in the publish job's needs: and the gate fails on a missing card by design, merging this as-is would fail the next flagship release. The card lands first, or this does not merge. No number in this PR is hand-authored and none will be.

Why new scenarios instead of repointing the existing ones

#3814 posed this as "fix the scenarios or the bar". Repointing the five tool_selection scenarios to agent_type: gaia looked like the obvious move and is the one thing that must not happen.

compare_scorecards (src/gaia/eval/runner.py:1469+) diffs per scenario_id, not per category. A repoint keeps the same five ids while changing which agent produces them, so --compare against the committed scorecard_tool_selection.json baselines would report improved / regressed / unchanged — a verdict that looks valid while comparing two different agents. That is the trap #3906 hit on csv_analysis and could only annotate with a _stale_note; doing it deliberately five times is worse. It would also delete the only tool-selection coverage the chat package's doc profile has.

New ids avoid both: the doc ids keep diffing cleanly against their baselines (nothing invalidated, no _stale_note), and the new ids land in only_in_current, which the compare already reports separately from regressions. Mixing two agents in one category is established precedent — #3906 did exactly that in rag_quality.

The premise, source-confirmed at src/gaia/eval/runner.py:1947-1948: "Per-scenario agent_type from YAML overrides CLI --agent-type". So --agent-type gaia is dead on these scenarios and #3814 §3 cannot observe the flagship by any invocation available today.

The clones are not copy-paste — the doc original of data_vs_recall_disambiguation reasons about analyze_data_file being a conditional bundle member, which is false for the flagship's full profile.

Two things that would have made the published number a lie

Provenance. scorecard.json recorded only the CLI-level --agent-type in its run config, so a run invoked --agent-type gaia could emit a scorecard labelled gaia whose scenarios had every one of them run doc. The resolved agent is now stamped per scenario, inside run_scenario_subprocess, which both runner call sites go through — so the two cannot drift apart. Backward compatible: compare_scorecards keys on scenario_id, and a test pins that old baselines still diff normally, self-invalidating if a future re-baseline makes it vacuous.

Zero-judged runs. Infra errors are excluded from the category average, so an all-INFRA_ERROR run would otherwise render a healthy-looking card. The generator raises instead — as it does for a file with no per-scenario provenance, no flagship scenario, or no ctx_size to stamp.

No absolute bar, on purpose. Email resolves --min-aggregate / --min-urgent-recall from a thresholds manifest built on a labelled corpus. The flagship has neither that manifest nor a second measurement, so a threshold set here would be a guess wearing the costume of a bar. Presence + regression only; an absolute bar is a follow-up.

Test plan

Executed:

  • pytest tests/unit/eval/test_*.py -q → 681 passed, 1 skipped (up from 668 on main)
  • pytest tests/unit/eval/test_scenario_agent_types.py -q → 63 passed (up 5 — fix(eval): point five scenarios at a real agent, and reject unknown agent types #3906's guard globs scenarios, one parametrized case per new scenario, and it stays green)
  • python -m gaia.eval.scorecard_gate --scorecard hub/agents/gaia/npm/SCORECARD.md → exit 1, with an actionable error:
    ERROR: SCORECARD.md missing at hub/agents/gaia/npm/SCORECARD.md.
      Run 'python gen_scorecard.py' (or 'carry_forward') to generate it, then commit the file before releasing.
    
  • yaml.safe_load(.github/workflows/release_agent_gaia.yml) → OK
  • python util/lint.py --black --isort → clean

Still to run, and what gates promotion out of draft:

  • A real gaia eval agent run on AMD hardware producing hub/agents/gaia/npm/SCORECARD.md
  • The gate passing that real card (exit 0), and blocking a manufactured regression via --baseline-file (exit 1)
  • A by-hand recompute of round(100·Σ(wᵢvᵢ)/Σwᵢ, 2) from aggregate.components matching the recorded aggregate.value

Evidence provenance — read before trusting the check list. Every [x] above is a local
pytest / lint run, pasted verbatim. None of it is CI. This PR was opened as a draft, and
test_gaia_cli.yml:39-41 gates the whole test tree on draft == false || contains(labels, 'ready_for_ci') — so until the ready_for_ci label was added, Unit Tests, API Tests, Lint, Test
Gaia Agent and Test Eval Tool were all skipping while the check list still rendered green. Judge
this PR on the pasted output, not on the badges.

Why the last three boxes are unchecked and will stay that way for now. The eval that produces
the card needs the one self-hosted Windows Strix Halo runner carrying the lemonade-eval label —
the only machine in the fleet that can judge a scenario eval. At the time of writing, 16 runs are
queued on it
, of which roughly 40% are superseded duplicates from successive pushes on other
branches. Two completed eval jobs today took 79 and ~60 minutes, so this PR's run
(35627620637, created 16:45Z) starts in an estimated 15–19 hours. The run is left queued and will
produce the card when it reaches the front.

Nothing about this PR is blocked by this PR: the adapter works, its guards fire on real data, the
gate blocks correctly, and the corpus tripwire is clear. It is blocked by fleet capacity.

A scorecard.json recorded only the CLI-level --agent-type in its run
config, but a scenario's own agent_type: overrides that flag. A run
invoked --agent-type gaia could therefore emit a scorecard labelled
gaia whose scenarios had every one of them run doc — provenance that
is false on its face, and unusable as the basis for a published
release scorecard.

The resolved agent is now stamped onto every scenario result inside
run_scenario_subprocess, which both runner call sites (the initial
pass and the --fix rerun pass) go through, so the two cannot drift
apart. The skipped-no-document path records it too.

Adding the key is backward compatible: compare_scorecards keys on
scenario_id, so baselines recorded before the field existed still
diff normally. A test pins that, and self-invalidates if a future
re-baseline makes it vacuous.

Refs #2983
@github-actions github-actions Bot added eval Evaluation framework changes tests Test changes performance Performance-critical changes labels Sep 21, 2026
All five tool_selection scenarios pin agent_type: doc, and a scenario's
own agent_type overrides the CLI flag, so no invocation of
`gaia eval agent --category tool_selection` could measure the flagship
agent. The milestone's regression bar was reading ChatAgent's doc
profile and could not see the flagship's tool growth at all.

These are new ids rather than a repoint of the existing five.
compare_scorecards diffs per scenario_id, so reusing the ids while
changing which agent produces them would make --compare report
improved/regressed/unchanged against the committed baselines while
actually comparing two different agents — a verdict that looks valid
and is not. New ids leave the doc baselines diffing cleanly and land
in only_in_current until a flagship baseline exists. The doc profile
also keeps its coverage, which a repoint would have deleted.

The clones are not copy-paste. The doc original of
data_vs_recall_disambiguation reasons about analyze_data_file being a
conditional bundle member, which is false for the flagship's full
profile; its counterpart asks the question that is real there —
whether semantic selection surfaces the tool at all when ~26 of ~80
tools reach the model. Turns and ground truth are unchanged wherever
the expected answer is agent-independent, so the paired ids stay
comparable.

pytest tests/unit/eval/test_scenario_agent_types.py -q -> 63 passed
(up 5, one parametrized case per new scenario).

Refs #2983
Turns a real `gaia eval agent` run into hub/agents/gaia/npm/SCORECARD.md,
the published card the flagship has never had. Mirrors the email
adapter's shape, not its metric: email scores a labelled corpus, this
reads a scenario run, so the aggregate is a weighted mean of per-category
judge scores and is named weighted_judge_score rather than
weighted_accuracy — calling an LLM judge score "accuracy" would
misdescribe it.

Provenance is read per scenario, never from the run config or a
filename, because a scenario's own agent_type overrides the CLI flag and
a run invoked --agent-type gaia can contain scenarios that ran doc.

Every degenerate input raises with what failed and what to do about it,
rather than producing a plausible number: a file with no per-scenario
agent_type at all, no scenario that ran the flagship, nothing judged,
or no ctx_size to stamp. The zero-judged guard is the important one — an
all-INFRA_ERROR run would otherwise render a healthy-looking card,
since infra errors are excluded from the average.

The card ships in a public npm tarball and on the hub page, so paths are
repo-relative and hardware is a class descriptor; the run's lemonade_url
and response transcripts never reach it.

pytest tests/unit/eval/test_release_scorecard.py -q -> 116 passed
lint (black, isort) -> clean

Refs #2983
The flagship could publish with no evidence of answer quality at all,
while email — the reference sidecar — has blocked every release on a
measured card for months. This adds the same gate and surfaces the card
where integrators look.

Presence + regression only, deliberately: email resolves absolute bars
from a thresholds manifest built on a labelled corpus, and the flagship
has neither that manifest nor a second measurement to derive a bar
from, so a number set here would be a guess wearing the costume of a
bar. An absolute bar is a follow-up once more than one measurement
exists.

--expected-version is what keeps the published number honest. The card
is regenerated only when a fresh eval runs, so without that check it
drifts silently behind the package version and ships a stale score.

Publishing to the hub is guarded on the file existing so a release cut
before the first flagship eval still publishes its docs; the gate job is
what makes the card mandatory. Note the consequence: with scorecard-gate
in publish's needs and no SCORECARD.md committed yet, the next flagship
release fails until a real eval produces one. That is the intended
behaviour and the reason this change cannot merge on its own.

Also corrects two documents this change falsified — the scorecard
playbook (the flagship is now a second adopter, with a judge-scored
scenario harness rather than a labelled corpus) and the email-triage
plan's acceptance bar.

Verified:
  pytest tests/unit/eval/test_*.py -q -> 681 passed, 1 skipped
  python -m gaia.eval.scorecard_gate --scorecard hub/agents/gaia/npm/SCORECARD.md
    -> exit 1, "SCORECARD.md missing", naming the generator to run
  yaml.safe_load(release_agent_gaia.yml) -> OK
  lint (black, isort) -> clean

Refs #2983
Resume mode appended a prior run's trace verbatim, so it was the one
result-construction path the previous commit left unstamped. A scorecard
built from a resumed run would carry a half-populated agent column, and
the generator either raises on it or drops real flagship results as
unattributable.

On reachability, against my own first reading: this branch is hard to
reach in normal operation. _run_locked mints a fresh timestamped run_id
per call and creates the run dir under it, so .progress.json can only
pre-exist when two runs start inside the same second and collide on the
id, or when results_dir is pointed at an existing run dir directly. The
fix is therefore defensive consistency with the other three paths rather
than a repair of an observed failure, and it is not claimed as more
than that. It is left in because a known half-populated column is worse
than none, and setdefault cannot regress a trace that is already stamped.

No test accompanies it: the path has no harness in the repo and cannot
be triggered without either forcing an id collision or reaching into
internals, and a mocked test that never exercises the real branch would
assert nothing.

pytest tests/unit/eval/test_*.py -q -> 681 passed, 1 skipped
lint (black, isort) -> clean

Refs #2983
@itomek

itomek commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator Author

Adapter evidence, ahead of the real eval run. Both of these are executed against real files in this branch, not mocks.

It refuses to attribute an unattributable run. Pointed at a committed baseline recorded before the harness stamped provenance:

$ python hub/agents/gaia/python/packaging/gen_scorecard.py \
    --scorecard-json tests/fixtures/eval_baselines/gemma-4-e4b-d71cd914/scorecard_tool_selection.json

ERROR: No scenario in tests/fixtures/eval_baselines/gemma-4-e4b-d71cd914/scorecard_tool_selection.json
carries an 'agent_type' field, so there is no way to tell which agent produced these results.
This is an old-format run, recorded before the harness stamped the resolved per-scenario agent.
Re-run the eval on the current tree ('gaia eval agent --category <category> --agent-type gaia')
and use that run's scorecard.json — a scorecard built from an unattributed run would claim to
measure the flagship without evidence.
See src/gaia/eval/runner.py (_resolve_scenario_agent_type).
EXIT=1

That is the guard that matters most here: the failure mode this issue exists to prevent is a published number that claims to measure the flagship without having done so.

The arithmetic is recomputable by hand, which is the point of publishing aggregate.components rather than just a score:

metrics:  memory         value 0.9  weight 1.0
          tool_selection value 0.7  weight 2.0

(1.0 × 0.9 + 2.0 × 0.7) / (1.0 + 2.0) = 2.3 / 3 = 0.76667  →  76.67
aggregate.value: 76.67   ✓

Rendered from the committed fixture into a temp dir (--output-dir /tmp/…), so no card is committed from fixture data.

🔍 What the rendered card does and does not carry

test_cases_run: 3 against dataset size: 4 — the two are distinct fields, and the gap is the INFRA_ERROR scenario being correctly excluded from judged.

hardware is a CLI flag defaulting to a class descriptor (AMD Ryzen AI (class descriptor, not a host)), never a hostname. ctx_size is stamped in recipe.environment so scorecard_gate --require-ctx-match has something to check and the regression comparison is not silently skipped.

The methodology string states plainly that the aggregate is a judge score and not an accuracy — there is no labelled ground truth in this corpus, only a rubric. That is also why aggregate_name is weighted_judge_score rather than email's weighted_accuracy.

Category means are computed from the filtered flagship scenarios rather than read from the run's summary.by_category, because that block pools every agent in the run.

Remaining before this leaves draft: run 35627620637 has to produce a real scorecard.json. It is queued behind sjlab-stx-halo-18, the only runner carrying the lemonade-eval label, which is online and busy.

@github-actions github-actions Bot added documentation Documentation changes devops DevOps/infrastructure changes sidecar Agent sidecar contract / harness labels Sep 21, 2026
@itomek itomek added the ready_for_ci Run CI workflows on draft PR without requesting review label Sep 21, 2026
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Skill audit

Skill Verdict Claimed tier Cleared tiers Findings Rules
.claude/skills/adding-eval-scorecard ✅ ALLOW experimental experimental, community none —
hub/agents/gaia/npm ✅ ALLOW experimental experimental 1 high body.injection.credential_request

✅ 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 skill-audit-reports artifact from this run. Offending source text is withheld from CI everywhere — reproduce it locally with gaia skill audit <dir> --show-snippets.

@github-actions

Copy link
Copy Markdown
Contributor

Request changes — but only on details; the design is right and the draft blocker the author flagged is the correct one.

This gives the flagship agent the same published, measured score and the same release block the email agent already has, and fixes the reason it could not be measured before (every tool-selection scenario was pinned to another agent, and the scorecard never recorded which agent actually ran). The per-scenario provenance stamp and the refuse-to-emit-on-a-zero-measurement run are the two things that keep the published number honest, and both are done well.

Three things to fix before this leaves draft:

  • The "how to reproduce this" command printed inside the published scorecard doesn't work as written when the run covered more than one category. It lists each category as a separate flag, but the eval command only accepts one — so anyone following the card silently measures a subset and gets a different number than the card claims. That instruction is the whole point of publishing a scorecard, so it needs to be runnable verbatim.
  • The release gate can quietly downgrade itself to a presence-only check. If a scorecard ever turns up without the context-window stamp, the gate skips the regression comparison and passes. Email survives that because it also enforces an absolute floor; the flagship deliberately has no floor, so nothing at all would be checked. The gate already has a flag to make a missing stamp a hard failure — pass it.
  • The package README tells integrators the scorecard "can lag the package version", which the new release gate makes impossible: a version mismatch is now a hard release failure. Reword so the published claim matches what CI actually enforces.

Real-world evidence

evidence-bundle.md is present and unusually thorough: the adapter really generated a card from the committed fixture (aggregate 76.67, hand-recomputed and matching), the release gate was run in all three branches the new CI job takes (missing card → exit 1, presence-only → exit 0, baseline-ref → exit 0) plus a version-drift failure, --compare was run across a pre-provenance baseline and a stamped run with no verdict change, all five new scenarios were resolved by the real harness, and npm pack confirmed the card ships. That evidence is what supports approving the design; it is also where the reproduction-command bug was caught, which is why the verdict is "request changes" rather than "approve".

Real inference — an actual gaia eval agent run producing the published card — is marked pending strix-halo lane and remains the author's own promotion gate. No Agent UI or MCP surface changed, so nothing is deferred there.

🔍 Technical details

Issues

🟡 Published reproduction command is not runnable for a multi-category run (hub/agents/gaia/python/packaging/gen_scorecard.py:204)

--category is a plain store arg (src/gaia/cli.py:2057 — no action="append", no nargs), so --category memory --category tool_selection keeps only the last. The evidence bundle observed exactly this: --category memory finds 25 scenarios, --category tool_selection finds 10, both together find 10. A reader following the card's Reproduction section measures one category and cannot land on the recorded aggregate. Omitting the flag runs the whole corpus (runner.py:421 skips filtering when category is falsy) and the adapter filters to the flagship anyway, so that is the faithful reproduction. The or "--category all" fallback is dead but also wrong — no scenario has category all, so it would match zero.

    # --category takes ONE value (argparse store): emitting several silently
    # keeps the last, so drop the flag when the run spanned more than one —
    # an unfiltered run covers them all and this adapter filters to gaia.
    categories = f"--category {category_names[0]}" if len(category_names) == 1 else ""

(With the flag dropped, line 222's f-string renders a double space — worth collapsing at the same time.)

🟡 scorecard-gate omits --require-ctx-match (.github/workflows/release_agent_gaia.yml:89-97)

scorecard_gate.py:521-540: a candidate card with no recipe.environment.ctx_size skips the regression comparison and returns PASS. Email tolerates that because its absolute bars still apply (release_agent_email.yml:364-380 resolves --require-ctx-match from its thresholds manifest); the flagship gate deliberately has no --min-aggregate, so an unstamped card leaves nothing enforced but presence. The adapter's own docstring already names this failure mode ("an unstamped card silently disarms the gate") — and since build_payload refuses to emit without a ctx size, the flag costs nothing:

            python -m gaia.eval.scorecard_gate \
              --scorecard hub/agents/gaia/npm/SCORECARD.md \
              --baseline-ref "${PREV}" --expected-version "${PKGVER}" \
              --require-ctx-match
          else
            python -m gaia.eval.scorecard_gate \
              --scorecard hub/agents/gaia/npm/SCORECARD.md \
              --expected-version "${PKGVER}" --require-ctx-match
          fi

🟡 README contradicts the gate this PR wires (hub/agents/gaia/npm/README.md:225)

"It is regenerated only when a fresh eval runs, not on every release, so it can lag the package version above" — --expected-version (scorecard_gate.py:322-337) fails the release when agent.version ≠ the package version, so at release time it provably cannot lag. What can lag is the measurement (carried forward from an earlier commit after confirming nothing eval-affecting changed).

- Eval results: [`SCORECARD.md`](./SCORECARD.md) — what was measured, on which version and commit. Its version always matches the package (CI blocks a release otherwise), but the measurement itself may have been carried forward from an earlier release when nothing eval-affecting changed.

🟢 Misleading remedy in the no-provenance error (gen_scorecard.py:585-593)

--agent-type defaults to None (cli.py:2077), so a run over scenarios that declare no agent_type: writes "agent_type": null on the current tree — not just on old runs. The message says "This is an old-format run … Re-run the eval on the current tree", which reproduces the same null. Worth adding "or pass --agent-type gaia".

🟢 No CHANGELOG.md entry (hub/agents/gaia/npm/)

SCORECARD.md joins the published tarball and the README gains two links, but the unreleased section doesn't mention it. CLAUDE.md lists CHANGELOG among the doc surfaces that move together for a hub package.

Strengths

  • Provenance is stamped in run_scenario_subprocess, which both runner call sites funnel through (runner.py:1141) — the two paths cannot drift apart by construction, and the setdefault in the resume path keeps an already-stamped trace's real value instead of overwriting it.
  • The generator refuses rather than rendering a flattering zero: no per-scenario provenance, no flagship scenario, zero judged scenarios, or no ctx size each raise with the three-part actionable error CLAUDE.md asks for. _is_judged correctly rejects bool and non-finite scores.
  • Public-artifact hygiene is tested, not asserted: test_rendered_scorecard_leaks_no_host_or_absolute_path checks the rendered card for backend_url, localhost, transcripts and absolute paths — the fixture deliberately carries all of them.
  • The backward-compat test self-invalidates (test_scenario_agent_provenance.py:1474-1488): it fails loudly once the committed baseline gains agent_type, instead of quietly becoming vacuous.
  • New scenario ids instead of repointing the existing five keeps the committed tool_selection baselines diffing against the same agent — the reasoning in the PR body matches what compare_scorecards actually does, and the clones' ground truth is identical to the originals (verified line-by-line).

The missing-card case asserted only that the gate returned 1. Every
failure path in that gate returns 1 — a regression, an unreadable card,
an unparseable one, a bad flag — so the assertion could not fail for the
reason the test is named after. A gate that stopped mentioning which
file was missing, or how to produce it, would have kept this test green.

Now asserts the card's path and the generator to run appear in the
output, so the message that makes the failure actionable is covered by
the test that claims to cover it.

pytest tests/unit/eval/test_scorecard_gate.py -q -> 44 passed

Refs #2983
@github-actions

Copy link
Copy Markdown
Contributor

The three issues from the last review are still open — none of the requested changes appear in this push.

🟡 Reproduction command still broken for multi-category runs — gen_scorecard.py:204 still emits --category memory --category tool_selection …, but --category is a single store arg that keeps only the last value. Anyone following the card's Reproduction section measures one category, not the aggregate the card claims.

🟡 --require-ctx-match still missing from the scorecard gate — .github/workflows/release_agent_gaia.yml still invokes scorecard_gate without this flag, leaving the flagship gate with nothing to check if a card ever arrives without a ctx_size stamp (no --min-aggregate means presence alone passes).

🟡 README still says the scorecard "can lag the package version" — hub/agents/gaia/npm/README.md:225 still carries the old wording, contradicting the --expected-version check this PR wires in the gate.

🔍 Technical details

Reproduction command (gen_scorecard.py:204):

    categories = f"--category {category_names[0]}" if len(category_names) == 1 else ""

Drop the flag when more than one category was run — an unfiltered run covers all of them and the adapter filters to gaia anyway.

--require-ctx-match (release_agent_gaia.yml, both scorecard_gate invocations ~lines 718–725):

            python -m gaia.eval.scorecard_gate \
              --scorecard hub/agents/gaia/npm/SCORECARD.md \
              --baseline-ref "${PREV}" --expected-version "${PKGVER}" \
              --require-ctx-match

(And the else branch too.)

README wording (hub/agents/gaia/npm/README.md:225): Replace "so it can lag the package version above" with "but its version always matches the package (CI blocks a release otherwise); the measurement itself may be carried forward from an earlier release."

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Heads up on an overlap — we're consolidating the scenario eval onto the flagship agent, so some of this PR's premise changes.

The decision is one eval that measures the flagship and nothing else: the per-scenario agent_type pins go away entirely, --agent-type starts actually working, and the doc/chat baselines get retired rather than diffed. That dissolves the trap you documented here — there's no cross-agent comparison left to make, because only one agent remains. CI also widens from 3 categories to 12 (everything except vision and web_system, for the runner-environment reason your workflow comments already call out).

Nothing to do while this is a draft — flagging it so the overlap isn't a surprise when you pick it back up. The scorecard and release-gate half is unaffected and still wanted; it's specifically the five cloned tool_selection scenarios that would end up duplicating the retargeted originals.

🔍 Technical details

The consolidation drops agent_type: from all 55 pinned scenario YAMLs and removes the per-scenario override at src/gaia/eval/runner.py:1947, with a guard test failing any scenario that reintroduces a pin. tests/fixtures/eval_baselines/gemma-4-e4b-d71cd914/* is retired wholesale — not re-diffed — so compare_scorecards keying on scenario_id is no longer a correctness hazard: every id in the new baseline was produced by the same agent.

Your provenance fix (stamping the resolved agent per scenario inside run_scenario_subprocess) is worth keeping regardless of which lands first — a scorecard that records only the CLI-level flag is unverifiable either way.

kovtcharov-amd pushed a commit to kovtcharov/gaia that referenced this pull request Sep 22, 2026
Part of amd#4052 — deliberately not closing it. Criteria 1-4 (the Gmail
backend, shape parity with the Outlook arm, read-only consent
declaration, and the four-state no-mailbox error) are met and covered by
tests here. Two are not, and neither can be met by code:

- **The eval comparison** needs a working judge and a committed flagship
baseline. The judge is out of org budget repo-wide (amd#4080) and the
flagship has no baseline yet (amd#2983). No eval was run and none is
claimed.
- **The live-mailbox transcript** needs a human on a box with a
connected Gmail. amd#4074 owns that as the milestone's exit gate.

Leaving amd#4052 open keeps those visible rather than closing them by
implication.

The flagship agent could only read Outlook. Ask it about your Gmail and
it answered `Agent 'installed:gaia' has no grant for microsoft` — a
Microsoft error, on a machine where Google was the connected mailbox.
Now the same five email tools read either mailbox, pick the right one on
their own, and when neither is usable they say which mailbox is in which
state and give you the one command that fixes it.

A first-time Google user is asked to **read your email** and nothing
more. If your Google account was already connected for the Email Triage
Agent it carries the broader `gmail.modify` scope; the flagship reuses
that rather than sending you back through a browser, and needs only a
local grant-ledger write.

### Two things the reviewer should know

**The spec was wrong and this PR corrects it.** Issue amd#4052 and
`docs/plans/email-triage-skill.mdx:134` both describe this as "a backend
relocation" of the sidecar's `gmail_backend.py`. The credentials are
genuinely shared; the code is not.

<details>
<summary>🔍 Why it could not be a relocation</summary>

- `_email/graph.py:10-14` already states the rule this follows: the
flagship must not depend on the standalone email package it is meant to
replace.
- `gmail_backend.py:59-63` imports `gaia_agent_email.google_errors` and
`gaia_agent_email.scopes` — both sidecar-package modules.
- Decisive: `LiveGmailBackend` never emits the provider-neutral shape.
`list_messages` (`:790-811`) returns `{"messages":[{"id","threadId"}]}`
— id stubs, no headers — and `get_message` (`:813-819`) returns the raw
Gmail resource. The flattening lives in
`gaia_agent_email/tools/read_tools.py` (3414 lines), which does not come
along. Without it none of `message_summary`'s shape exists, and that
shape is the whole reason the skill never learns which mailbox answered.

Measured: `gmail.py` is 425 lines against `gmail_backend.py`'s 1256,
matching what Phase 0 did (242 vs `outlook_backend.py`'s 722). The plan
doc is corrected in this PR — both the "relocated from" table row and
the "largely a relocation, not a rewrite" paragraph above it.
</details>

**One pre-existing flaw is deliberately not fixed here.** `graph.py:119`
interpolates raw `response.text[:300]` into a user-facing error string.
It lives in the Outlook backend, which this change does not otherwise
touch, and folding an unrelated cleanup into a feature PR blurs the
diff. The new Gmail backend does not copy the pattern: its errors are
built only from Gmail's structured `reason` field and an `extendedHelp`
link rejected unless it starts with `https://`. Tracked separately in
amd#4082.

### Test plan

- [ ] `python -m pytest tests/unit/agents/tools/ -q` → **113 passed**.
Includes all 33 pre-existing email tests, unmodified.
- [ ] `python -m pytest hub/agents/gaia/python/tests/test_gaia_agent.py
-q` → **22 passed** (19 before, 3 added). The `tools_count: 80` drift
guard still holds: no tool was added or renamed.
- [ ] `python util/lint.py --all` → **exit 0**. Black, isort, Pylint,
Flake8, Import Validation and Bandit all PASS.
- [ ] `python -m pytest tests/unit/ -q -p no:randomly` → 24 failing node
ids on this branch, **28 on a clean checkout of the base commit**. Zero
failures are unique to this branch; the branch fixes none of them either
(the 4-test difference is a `gaia` console-script PATH check,
environment state). Both runs captured in full.

Shape parity is asserted by value type and format, not key presence — a
green key-set test passes while every value is wrong. `received` is
`Z`-suffixed UTC built from epoch-millis (a naive `fromtimestamp` breaks
"what came in today"); `from` survives both `"Doe, Jane" <j@x>` and
`=?UTF-8?B?…?=`; `preview` is entity-unescaped; `CATEGORY_PROMOTIONS`
never reaches the field the triage skill reads as user tags; an inline
base64 attachment is asserted absent from the body.

Outgoing request shape is asserted too, over a real
`httpx.MockTransport`: `labelIds` are checked against Gmail's documented
system-label **IDs** (Gmail 400s on names), `metadataHeaders` is
asserted to ride with `format=metadata`, a failed fetch is asserted to
raise rather than silently shorten a listing, and the empty-mailbox path
is driven by a transport that **omits** the `messages` key the way the
real API does.

### Not closed by this PR

- **A turn's cumulative body budget is unbounded.** `read_email` caps
one body at 12,000 characters and marks the truncation visibly, which is
~12% of the 32K NPU context at the worst density I measured (3.0
chars/token, for quoted thread history — plain text runs 4.7 and HTML
3.7). But the cap is **per message**: an agent reading eight messages
while triaging can still exhaust the window, and nothing tracks the
running total. Out of scope here; tracked separately.
- **AC5 (eval)** — not run and not claimed. The judge credential is
rejected on the Anthropic org's monthly spend limit (amd#4080) and the
flagship has no committed baseline (amd#2983, amd#4056), so there is nothing
to regress against.
- **AC6 (live Gmail)** — needs a human with a connected Google account;
no transcript is fabricated here.
- **Search relevance ordering** — a server behaviour, unobservable under
a mock transport. Recorded as unproven rather than implied by the
`q`-parameter test that is present.
@itomek itomek self-assigned this Sep 28, 2026
@itomek itomek removed their assignment Sep 29, 2026
@kovtcharov

Copy link
Copy Markdown
Contributor

The five new *_gaia.yaml scenarios are no longer needed, and they would break this PR on rebase. main now rejects any scenario carrying agent_type at load, and every scenario already scores the flagship by default. All five clones set agent_type: gaia, so they fail the loader. Suggest dropping them and keeping the rest: the per-scenario provenance stamp, gen_scorecard.py and the release gate are still the missing pieces.

On "no absolute bar": the scenario evals already carry perf and quality manifests, but their numbers are placeholders in report mode (200k input tokens and 600 s per scenario, not enforced). The plan in the flagship-validation workstream is to replace them with limits measured over 3 repeated runs per category on the Strix Halo pool (tokens, turns, tool calls, wall time, judged score), the same way gaia eval tasks propose now sets the outcome-task gate from the worst of N runs. The card this PR publishes can then report against measured bars rather than none.

🔍 Technical details
  • Loader: src/gaia/eval/runner.py (~432) — 'agent_type' is not honoured … Delete the key.
  • +agent_type: gaia in all five of eval/scenarios/tool_selection/{data_vs_recall_disambiguation,known_path_read,multi_step_plan,no_tools_needed,smart_discovery}_gaia.yaml.
  • Placeholders: tests/fixtures/gaia/perf_gate_thresholds.json ("enforce": false, comment: "deliberately generous placeholders, not measurements"); quality_gate_thresholds.json (enforce on, loose absolute floors, no baseline).
  • The tier expansion adds t1–t4 coverage to gaia_tool_selection (9 scenarios, flagship-native), which overlaps what the clones were for.

aksh8b pushed a commit to aksh8b/gaia that referenced this pull request Oct 4, 2026
amd#4640)

Five contributor skills under `.claude/skills/` were giving instructions
that stopped matching the repo. They pointed builders and responders at
agents deleted when per-task agents became hub skills, such as "mirror
the `analyst` package" or "link the jira/docker/blender guide". One
cited a `gaia audio` command that doesn't exist. Another said the base
`Agent` never imports Lemonade at module level, when it does. After this
PR, each of those skills names the agents, guides and imports that
actually exist.

The 16 product skills under `hub/skills/` needed no change. Every tool,
command, flag and path they reference checks out, and all 16 pass `gaia
skill audit` with ALLOW. That means nothing the flagship agent reads at
runtime changed, so no eval is needed for this PR.

<details>
<summary>🔍 Technical details</summary>

- `gaia-build-agent`: templates to mirror are now `hello-world` /
`word-count` / `email`, and the closer base class is `ChatAgent`. The
non-default model example is the email agent's NPU pick, not a
summarizer. The eval step now matches CLAUDE.md: there is no committed
baseline yet, so report the measured scores.
- `integrate-hub-agent`: the agent list now matches `hub/agents/`. The
name-divergence example is now real: the flagship's module is
`gaia_agent` and its npm package is `@amd-gaia/gaia`. The entry point
comes from `gaia-agent.yaml` `entry_module`, because the flagship has no
`build_registration()`.
- `github-issue-response`: the "where things live" map lists the agents
and guides that exist today.
- `lemonade-client-patterns`: `agent.py` imports `DEFAULT_MODEL_NAME`,
the ctx helpers and `CONNECTION_FAILURE_RE` at module level. The skill
now describes that accurately instead of forbidding what is already
there. `gaia audio` now reads "audio transcription".
- `weekly-audit-patterns`: the published agents are email and the
flagship. The audit prompt itself is updated in the review-automation
PR.
- How the refs were checked: a script resolved every backticked path,
`gaia <cmd>` subcommand, `--flag`, `gaia.*` module and code symbol in
both skill sets against `git ls-files`, the argparse definitions, and
the `@tool`-registered names. Flags it raised that turned out to be
relative paths or harness tools (`SendUserFile`) were dropped.
`testing-the-gaia-agent` and `adding-eval-scorecard` are left alone
because open PRs amd#4461 and amd#4056 edit them.
</details>

## Test plan

- [x] `pytest tests/unit/test_ai_doc_paths_exist.py
tests/unit/test_no_stale_agent_paths.py
tests/unit/test_starter_skills.py tests/unit/test_skills_format.py
tests/unit/test_skills_drift.py
tests/unit/test_skills_audit_no_false_positives.py
tests/unit/test_skills_audit_instructions.py
tests/unit/test_skill_sets.py tests/unit/test_flagship_ci.py
tests/unit/test_skills_manager.py tests/unit/test_adaptive_skills.py`
(961 passed, 16 skipped)
- [x] `gaia skill audit hub/skills/<each>` returns ALLOW for all 16

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Closing as superseded — thanks @itomek. Since this was drafted, the flagship gets measured another way: every eval scenario now scores the flagship by default, and eval_flagship.yml compares each run to a committed flagship baseline (#4629), so the separate *_gaia scenarios here would double-count. The release gate is the part left: the SCORECARD.md on main still describes flagship 0.1.1, and a gate that fails on a stale card would block the next flagship npm release. That work stays tracked in #2983 (still open, as this PR intended): regenerate the card from a real nightly, then add the gate to release_agent_gaia.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps/infrastructure changes documentation Documentation changes eval Evaluation framework changes performance Performance-critical changes ready_for_ci Run CI workflows on draft PR without requesting review sidecar Agent sidecar contract / harness tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants