Skip to content

fix(email-agent): stop the hub scorecard from claiming stale currency - #3801

Merged
itomek merged 3 commits into
mainfrom
issue-2965
Sep 15, 2026
Merged

itomek merged 3 commits into
mainfrom
issue-2965

Conversation

@itomek

@itomek itomek commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

The email agent's published quality score never says which version it was measured on, so a user viewing the 0.6.0 hub listing sees "84.53/100" with no hint it was actually measured against 0.5.0. This makes that drift visible everywhere the score is shown, and adds a release-time check so package/scorecard version drift fails loudly instead of shipping silently.

  • The hub catalog and Agent UI now surface the scorecard's own measured version next to the score ("measured on v0.5.0 (current: v0.6.0)"), and the npm README's score line names the version too.
  • scorecard_gate.py gained --expected-version, wired into the email release workflow, so a release fails if SCORECARD.md's version doesn't match the package being released.
  • Regenerating the scorecard at release time was considered and rejected: the only automation for that (email_scorecard_refresh.yml) is a ~10.5h eval that has never completed in 100 dispatches (ci(email): scorecard-refresh has never completed — 90-min budget vs a ~2h workload #2094), so wiring it into the release path would either block every release or trigger a workflow with no track record of finishing. This PR makes the drift honest and loud instead.

Closes #2965

Test plan

  • python -m pytest tests/unit/eval/test_scorecard_gate.py -q → 38 passed (adds TestExpectedVersionGuard)
  • npm test in workers/agent-hub → 216 passed (adds eval_score_version coverage, including a case reproducing the real 0.6.0-package/0.5.0-scorecard drift)
  • npx tsc --noEmit in src/gaia/apps/webui → no errors
  • python util/lint.py --all --fix → clean (no diff produced; one pre-existing unrelated mypy error in src/gaia/factory/harvest/scan.py, confirmed present on main before this change)
  • Guard proven to fire, against the real committed files:
$ python -m gaia.eval.scorecard_gate --scorecard hub/agents/email/npm/SCORECARD.md --expected-version 0.6.0
ERROR: SCORECARD.md version does not match the release (#2965).
  hub/agents/email/npm/SCORECARD.md: agent.version = '0.5.0'
  Package being released: '0.6.0'
  ...
EXIT: 1

$ python -m gaia.eval.scorecard_gate --scorecard hub/agents/email/npm/SCORECARD.md --expected-version 0.5.0
PASS: No baseline provided. Presence check only.
  Candidate v0.5.0: aggregate.value = 84.53
EXIT: 0
🔍 Technical details
  • hub/agents/email/npm/README.md — score line now reads "measured on v0.5.0" instead of a bare number next to the v0.6.0 doc links.
  • workers/agent-hub/src/catalog.ts + types.ts — new parseScorecardVersion() derives eval_score_version from the scorecard's own agent.version front matter (independent of latest_version).
  • src/gaia/apps/webui/src/{types/index.ts,components/AgentDetailModal.tsx} — renders the measured version under the eval score, with a "(current: vX.Y.Z)" note when it differs from the installed/listed version.
  • src/gaia/eval/scorecard_gate.py — --expected-version fails the gate when agent.version in the candidate SCORECARD.md doesn't equal the value passed.
  • .github/workflows/release_agent_email.yml — the scorecard-gate job now resolves the package version from package.json and passes it to the gate.
  • stamp_version.py was deliberately left alone: it stamps derived references to match the package version, but the scorecard's version is not derived — it's an independent fact about what was measured, and must never be silently rewritten to match the package.

Correct the email agent's published scorecard to say plainly which
version it measured, and add a release-time guard that fails a
release when SCORECARD.md's version doesn't match the package
version.

- README.md's score line now names the measured version (v0.5.0)
  instead of stating a bare number next to v0.6.0 doc links.
- The hub catalog and Agent UI now surface eval_score_version (the
  scorecard's own agent.version), so a viewer sees which release the
  score actually covers instead of assuming it's current.
- scorecard_gate.py gained --expected-version, wired into
  release_agent_email.yml's scorecard-gate job, so a future
  package/scorecard version drift fails the release loudly instead of
  publishing silently.

Closes #2965
@github-actions github-actions Bot added devops DevOps/infrastructure changes eval Evaluation framework changes tests Test changes performance Performance-critical changes agent::email Email agent changes labels Sep 14, 2026
@itomek
itomek marked this pull request as ready for review September 14, 2026 20:44
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Skill audit

Skill Verdict Claimed tier Cleared tiers Findings Rules
hub/agents/email/npm ✅ ALLOW experimental experimental, community 2 medium, 1 info code.suppression, supply.undeclared_dependency

✅ 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

This makes the email agent's published quality score say which version it was measured on, and adds a release-time check so package/scorecard drift fails loudly. The release gate and the hub Worker both work as described — but the Agent UI half of the change is inert, and the "measured on" label will itself be wrong on a carry-forward release.

What needs fixing before merge:

  • The new "measured on vX" caption has no data to render from. The local backend route that feeds the Hub detail modal copies eval fields into its response by an explicit allowlist, and the new field isn't on it — so it's dropped between the hub catalog and the UI. The PR's own evidence run already caught this. Add the field to that allowlist (and a test, since nothing currently covers that passthrough).
  • A carried-forward score will claim the wrong measurement version. When a patch release reuses a prior eval's numbers, the scorecard records the new version up front and keeps the actually measured version in a separate field. Reading only the former means the hub will caption an inherited score as "measured on" the release it was never run against — the exact false-currency claim this PR exists to remove. Prefer the inherited value when it's present.

Worth a maintainer decision, not a blocker: as of this ref the next agent-pkg-email release is blocked by the new gate. The scorecard is at 0.5.0, the package at 0.6.0, carry-forward only covers patch bumps, and the refresh eval is the ~10.5h job that has never completed (#2094). The only path left is hand-restamping the scorecard's version — which is the thing the caption is supposed to make honest. Worth saying out loud in the issue before the next release hits it.

Real-world evidence

An evidence bundle ran on a no-inference runner and exercised the gate, both HTTP surfaces, and the workflow step. It is honest about what it found, including the gap above.

The gate fires on the real committed files, exactly as the workflow now invokes it:

$ python -m gaia.eval.scorecard_gate \
    --scorecard hub/agents/email/npm/SCORECARD.md \
    --baseline-ref agent-pkg-email-v0.5.0 --expected-version 0.6.0 \
    --min-aggregate 80.0 --min-urgent-recall 0.9
ERROR: SCORECARD.md version does not match the release (#2965).
  hub/agents/email/npm/SCORECARD.md: agent.version = '0.5.0'
  Package being released: '0.6.0'
exit=1

The Agent Hub Worker really does emit the new field on /index.json (package 0.6.0, scorecard stamped 0.5.0 — the exact drift shape):

HTTP 200 application/json; charset=utf-8
{
  "id": "email",
  "latest_version": "0.6.0",
  "eval_score": 84.53,
  "eval_score_version": "0.5.0",
  "eval_scorecard_url": "https://hub.amd-gaia.ai/agents/email/0.6.0/SCORECARD.md"
}

But the route the modal actually reads drops it — re-run against a local hub mirror that does serve the field:

$ curl -s "http://127.0.0.1:4200/api/agents/catalog?refresh=true"
HTTP 200   offline=false, total=5
email eval_* keys returned: {'eval_score': 84.53, 'eval_scorecard_url': '…/SCORECARD.md'}
'eval_score_version' present: False

The bundle also spot-checked sibling gate flags (--min-aggregate 90, --require-ctx-match, missing-card path) and sibling routes (/api/agents, install-status, gaia hub list) — all behaved as before. The rendered Agent UI screenshot is marked pending strix-halo lane (no inference on this runner); with the backend gap above it would render empty anyway. Eval/scorecard regeneration and the Worker deploy were not exercised. My verdict rests on this bundle plus static review; the screenshot surface is unverified here.

🔍 Technical details

🔴 eval_score_version never reaches the UI (src/gaia/hub/catalog.py:484)

merge_with_registry builds the merged entry as an explicit allowlist, so any key it doesn't name is dropped between index.json and GET /api/agents/catalog — which is the data path for AgentDetailModal (services/api.ts:173 → HubPage → modal). AgentDetailModal.tsx:206 therefore always sees undefined and the new block never renders.

        if "eval_score" in entry:
            merged["eval_score"] = entry["eval_score"]
        if "eval_scorecard_url" in entry:
            merged["eval_scorecard_url"] = entry["eval_scorecard_url"]
        if "eval_score_version" in entry:
            merged["eval_score_version"] = entry["eval_score_version"]

Two follow-ons:

  • Nothing in tests/ asserts the eval-field passthrough at all (grep -rn "eval_score" tests/ → no hits), which is why this slipped. A case in tests/unit/test_hub_catalog.py asserting all three keys survive merge_with_registry would pin it.
  • AgentDetailModal.tsx:212 gates the "(current: vX)" clause on agent.version, which is the installed version (fix(webui): show agent version in Hub Details modal #3784). On an Available card — the scenario in the PR description, a user browsing the 0.6.0 listing without having installed it — version is undefined, so the drift note silently degrades to a bare "measured on v0.5.0". Consider agent.version ?? agent.latest_version for the comparison.

🟡 Carry-forward releases will report the wrong measured version (workers/agent-hub/src/catalog.ts:145)

carry_forward() (src/gaia/eval/release_scorecard.py:521) is a supported release path for patch bumps: it rewrites agent.version to the new release and records the version the numbers actually came from in the top-level inherited_from field (present in the committed card as inherited_from: null, SCORECARD.md:195). parseScorecardVersion() reads only agent.version, so after a carry-forward eval_score_version equals latest_version, the UI's "(current: …)" clause disappears, and the hub captions an inherited score as freshly measured.

inherited_from is the honest source when set:

function parseScorecardVersion(markdown: string | null): string | undefined {
  if (!markdown) return undefined;
  const match = /^---\r?\n([\s\S]*?)\r?\n---/.exec(markdown);
  if (!match) return undefined;
  try {
    const fm = parseYaml(match[1]) as Record<string, unknown> | null;
    if (!fm || typeof fm !== "object") return undefined;
    // A carry-forward card stamps `agent.version` with the RELEASE version and
    // keeps the version the eval actually ran at in `inherited_from`.
    const inherited = fm.inherited_from;
    if (typeof inherited === "string" && inherited.length > 0) return inherited;
    const agentBlock = fm.agent as Record<string, unknown> | undefined;
    const version = agentBlock?.version;
    return typeof version === "string" && version.length > 0 ? version : undefined;
  } catch {
    return undefined;
  }
}

🟡 The gate leaves the email agent with no runnable path past a minor bump

--expected-version is correct and the workflow wiring is right (PKG_DIR is workflow-level env:, the tag trigger means package.json is already the released version, and the step order in scorecard-gate is fine). The consequence is what needs a decision: at 0.5.0-scorecard / 0.6.0-package, carry_forward refuses (major/minor changed → "re-run the eval"), and the re-run is email_scorecard_refresh.yml (#2094). The gate's own remediation text — restamp agent.version after confirming nothing eval-affecting changed — produces a card whose agent.version no longer reflects what was measured, which is what feeds the new caption. If restamping is the expected path, it should go through carry_forward-style provenance (inherited_from) rather than a hand edit, which also makes finding 2 load-bearing.

🟢 Nits

  1. hub/agents/email/npm/EVALUATION.md:22,44 still quote 84.53 / 100 and "the 84.53 triage score" with no version caveat, while README.md:171 now has one. Both render as sibling hub tabs, so the package ships the caveat in one tab and not the other (CLAUDE.md: a claim repeated across bundled docs gets corrected in all of them).
  2. No [Unreleased] entry in hub/agents/email/npm/CHANGELOG.md — the README score line is user-visible and ships in the npm tarball.
  3. parseScorecardVersion duplicates the front-matter regex + parseYaml of parseScorecardScore (catalog.ts:121). They already have to stay in sync on CRLF handling; one parseFrontMatter(markdown) helper feeding both would stop the next tweak from landing in only one.
  4. AgentDetailModal.test.tsx exists (added last week) but gained no case for the new caption — a render test for present/absent/equal-version would be three lines.

Strengths

  • The --expected-version guard is genuinely well-tested: match, mismatch, and the omitted-flag path proving existing callers are unaffected, plus a worker test that reproduces the real 0.6.0-package/0.5.0-scorecard shape rather than a synthetic one.
  • The PR states the rejected alternative (regenerate at release time) with a concrete reason — a 10.5h eval with 0/100 completions — instead of leaving a reviewer to wonder why the obvious fix wasn't taken.
  • Leaving stamp_version.py alone is the right call and the reasoning is correct: the scorecard's version is measured fact, not a derived reference.

…e UI

merge_with_registry copied eval_score/eval_scorecard_url onto merged catalog
entries by an explicit allowlist that never included eval_score_version, so
the "measured on vX" caption added in the prior commit had no data to render
from — confirmed missing via a live curl against gaia.ui.server.

Also make the worker's front-matter parser prefer inherited_from over
agent.version so a carry-forward release (patch bump reusing a prior eval)
reports the version the score was actually measured on, not the release
version it was stamped with.

Closes #2965
Adds a worker test exercising a carried-forward scorecard (agent.version
stamped with the release version, inherited_from holding the version
actually measured) to pin the new preference added for #2965.
@itomek

itomek commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the review: eval_score_version was dropped by merge_with_registry's explicit key allowlist in src/gaia/hub/catalog.py — added it alongside the existing eval_score/eval_scorecard_url entries.

Also fixed the carry-forward gap: the worker's parseScorecardVersion() now prefers inherited_from over agent.version when both are present, so a patch release that reuses a prior eval reports the version it was actually measured on, not the release version the card got stamped with.

Tests added:

  • tests/unit/test_hub_catalog.py::test_merge_propagates_eval_score_version_from_real_worker_payload_shape — feeds merge_with_registry the real field shape the worker's toIndexEntry emits (mirroring the committed hub/agents/email/npm/SCORECARD.md's actual agent.version/aggregate.value), so a future dropped field fails this test instead of only a hand-built fixture that already assumes the fix.
  • workers/agent-hub/test/routes.test.ts — new case publishing a carry-forward scorecard (agent.version: 0.2.0, inherited_from: 0.1.0) and asserting eval_score_version reports 0.1.0.

Real-world evidence — started a local gaia.ui.server pointed at a static file server serving a crafted index.json (GAIA_HUB_URL=http://127.0.0.1:8899) with the same shape a real hub build produces, then hit the actual UI backend route the modal reads from:

$ curl -s "http://127.0.0.1:4299/api/agents/catalog?refresh=true" | jq '.agents[] | select(.id=="email") | {latest_version, eval_score, eval_scorecard_url, eval_score_version}'
{
  "latest_version": "0.6.0",
  "eval_score": 84.53,
  "eval_scorecard_url": "https://hub.amd-gaia.ai/agents/email/0.6.0/SCORECARD.md",
  "eval_score_version": "0.5.0"
}

Before this fix eval_score_version was absent from that same response (reproduced against the pre-fix code) — confirms the field now reaches the route AgentDetailModal reads.

Test plan:

  • python -m pytest tests/unit/test_hub_catalog.py -q → 35 passed
  • npm test in workers/agent-hub → 217 passed
  • npm run typecheck in workers/agent-hub → clean
  • python util/lint.py --all → clean
  • Live curl against gaia.ui.server as above

@itomek
itomek added this pull request to the merge queue Sep 15, 2026
Merged via the queue into main with commit 791efbc Sep 15, 2026
49 of 50 checks passed
@itomek
itomek deleted the issue-2965 branch September 15, 2026 01:47
itomek added a commit that referenced this pull request Sep 23, 2026
The contract test's catalog fixture hand-listed the conditionally-emitted
eval keys, so #3801's eval_score_version left it stale and the test failed
on a field that is genuinely on the wire. The fixture now reads those keys
out of merge_with_registry's source, so a new conditional emit can't
reintroduce the same false positive.

Also hardens the TypeScript parser against two silent traps flagged in
review: a brace inside a trailing // comment no longer offsets the
interface's brace-depth counter, and field matching no longer assumes
exactly four spaces of indentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes devops DevOps/infrastructure 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.

fix(email): published eval score for 0.6.0 is the 0.5.0 measurement

1 participant