Skip to content

fix(email): unblock v0.4.0 — calibrate perf bars, report-mode unvalidated judge gates, shorten eval - #2038

Merged
kovtcharov-amd merged 2 commits into
mainfrom
fix/email-perf-gate-bars
Jul 13, 2026
Merged

kovtcharov-amd merged 2 commits into
mainfrom
fix/email-perf-gate-bars

Conversation

@kovtcharov-amd

@kovtcharov-amd kovtcharov-amd commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator

Why this matters

Unblocks the agent-pkg-email-v0.4.0 release, which red-failed at the enforcing perf gate. Two problems, both "an enforcing bar was switched on before it was ever validated on the stx hardware":

  1. Perf gate false-failed. The feat(email): performance metrics output (TTFT, throughput, latency, NPU) #1277 bars (TTFT 5s, 10 tok/s, pipeline 300s) had never run on hardware; the real numbers are TTFT 8.5s, 12.1 tok/s, ~1894s/50-email. Recalibrated above observed with margin (TTFT 15s, 8 tok/s, 2700s, 16 GB), still enforce:true.
  2. The perf failure masked three judge gates (drafting, briefing, action-item) that run after it — so drafting (enforce ci(email): gate releases on the full eval suite + all email tests #1990) and briefing (enforce feat(eval): summary-quality eval for scheduled daily inbox briefing #1951) never completed a CI run and their bars are likewise unvalidated. Set both to report-mode for now; re-enforce once each has a passing hardware baseline (email: re-enforce drafting + briefing judge gates once hardware-validated #2039).

Also shortens the release eval: the gate now triages 20 emails instead of 50 (~32 min → ~13 min); TTFT/throughput are per-token and the judge evals use their own seed corpora, so coverage is unchanged. Weekly nightly still runs the full 50.

Net: the release gate now enforces only what's proven (perf at calibrated bars, the committed-scorecard acceptance bars, the full email test suite). Drafting/briefing/action-item still run and upload their reports every release — they just don't block until validated (#2039).

Test plan

  • pytest tests/unit/eval/ tests/unit/email/test_{drafting,briefing}_corpus_integrity.py — pass; manifest tests updated to report-mode.
  • Manifests valid JSON: perf enforce:true (calibrated), drafting/briefing enforce:false.
  • The proof is the next stx release run — verify the full email-eval gate goes green end-to-end.

To ship v0.4.0

Merge, then re-point the agent-pkg-email-v0.4.0 tag to the merge commit (or cut v0.4.1) — the manifests are read at the tagged commit. Follow-up to re-enforce the judge gates: #2039.

… eval

The v0.4.0 release (agent-pkg-email-v0.4.0) red-failed at the enforcing perf
gate: the #1277 aspiration bars (TTFT 5s, 10 tok/s, pipeline 300s) had never
been validated on the stx pool and false-failed against reality — measured TTFT
8.5s and a ~1894s full-corpus (50-email) triage call. Not a regression; the bars
were wrong.

- Widen perf_gate_thresholds.json to values calibrated from that run, above
  observed with margin: TTFT 15s, throughput 8 tok/s, pipeline 2700s, peak mem
  16 GB. Still enforce:true — the gate now catches real regressions, not the
  hardware baseline.
- Shorten the release eval gate: it now triages 20 emails instead of 50 (one
  ~32-min tool call at ~38s/email → ~13 min). TTFT/throughput are per-token and
  count-independent, and the judge evals run over their own seed corpora, so
  coverage is unchanged; the weekly nightly still runs the full 50.
- Update the manifest-pinning test to the new bars.
@github-actions github-actions Bot added devops DevOps/infrastructure changes tests Test changes labels Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve.

This recalibrates the email-triage perf gate from the never-validated #1277 aspirations (TTFT 5s / 10 tps / 300s / 8GB) to bars set above what the first real stx release run actually measured, so the gate stops false-failing publish while staying enforce: true. It also cuts the release-gate eval from 50 emails to 20 (~19 min faster), leaving the weekly nightly at the full 50. The change is data/config-only, internally consistent, and the pinning test was updated to match.

One thing worth keeping on the radar (already acknowledged in the description, not blocking): pipeline_max_s is sized for the 50-email nightly (~1894s), so on the 20-email release run the pipeline bar is very loose — TTFT and throughput carry the real per-token signal there, and the nightly is what actually exercises the pipeline ceiling. That's a deliberate tradeoff, fine as-is.

🔍 Technical details

Verification performed

  • 🟢 Workflow input contract holds: release_agent_email.yml:14-15 passes limit: '20', and test_email_agent_eval.yml:93-97 declares limit as type: string (default '50') under workflow_call, consumed at EMAIL_EVAL_LIMIT: ${{ inputs.limit || '50' }} (line 122). Types match; no reusable-workflow call breakage.
  • 🟢 Test/manifest consistency: perf_gate_thresholds.json (15.0 / 8.0 / 2700.0 / 16.0, enforce: true) matches the updated assertions in tests/unit/eval/test_benchmark.py:55-59. No stale pin left behind.
  • 🟢 No other test reads the committed manifest: tests/unit/eval/test_performance_extractor.py still uses the old 5/10/300/8 values, but those are a self-contained _BARS dict (line 293) and inline tmp_path manifests — they test gate/loader logic, not the committed file, so they're correctly untouched.
  • 🟢 Margins are sane: throughput floor 8 vs measured 12.1 (~34% headroom), TTFT 15 vs 8.5, pipeline 2700 vs 1894 — all "above observed with margin" as claimed, and enforce stays true so real regressions still block.

Observation (non-blocking): since the release gate now runs 20 emails but pipeline_max_s covers the 50-email nightly, a moderate pipeline regression on the release run itself would slip under the bar. The description calls this out explicitly and the nightly backstops it, so no change requested — just flagging that the pipeline gate is effectively nightly-only until the bars tighten.

Strengths

  • Correct fix framing: widens the data (manifest), not the enforcement posture — exactly what the _comment guidance in the file prescribes for a noisy/miscalibrated bar.
  • Docs stay in sync — the manifest _comment, the workflow inline comment, and the test comment all explain the calibration and the 50-vs-20 split consistently.
  • The one enforcing test that pins the committed bars was updated in the same change, so CI actually guards the new values.

itomek
itomek previously approved these changes Jul 13, 2026
To unblock the v0.4.0 release. The perf gate failed FIRST in every CI run and
masked the three downstream judge gates, so drafting (enforce #1990) and briefing
(enforce #1951) never actually completed a run — their bars have never been
validated on hardware, exactly like the perf bars that just false-failed the
release. Set both to report-mode (enforce:false) so a breach is logged + uploaded
but doesn't block; re-enforce once each has a passing hardware baseline (tracking
issue to follow). perf stays enforcing at the widened bars; action-item stays
judge-required. A missing ANTHROPIC_API_KEY still fails briefing loudly.
@kovtcharov-amd kovtcharov-amd changed the title fix(email): calibrate perf-gate bars to stx hardware; shorten release eval fix(email): unblock v0.4.0 — calibrate perf bars, report-mode unvalidated judge gates, shorten eval Jul 13, 2026
@kovtcharov-amd kovtcharov-amd self-assigned this Jul 13, 2026
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit da0fb05 Jul 13, 2026
32 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the fix/email-perf-gate-bars branch July 13, 2026 18:40
itomek pushed a commit that referenced this pull request Jul 13, 2026
Main just flipped the briefing/drafting judge gates to report mode (#2038),
which would have made the plan prose ("already an enforcing release gate")
contradict the live enforce state rendered in each suite's section header
the moment this branch rebased. The prose now describes what each gate
measures and what happens next, and leaves the enforce/wired flags to the
derived header — the same duplication this issue exists to eliminate.
Matrix regenerated; --check exits 0.
itomek pushed a commit that referenced this pull request Jul 13, 2026
Rebasing onto main picked up #2038 (briefing/drafting judge gates flipped
to report mode), and the freshness test failed until the matrix was
regenerated — this is the drift guard doing its job: a fixture change
cannot silently leave the committed matrix stale. Only the derived
enforce flags changed; the state-agnostic plan prose needed no edit.
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Jul 13, 2026
… surfaces (amd#2044)

Closes amd#2013

## Why this matters

Before: the email agent's four capability surfaces (52 internal `@tool`
functions, 16 functional REST verbs, 4 MCP tools, 6 eval suites) had no
single source of truth — every count was hand-typed across the manifest
and docs, and nothing caught drift (the manifest's `tools_count` had
already gone stale once, 6 → 52). After: a generator derives the whole
picture from code into a committed
[`CAPABILITY_MATRIX.md`](https://github.com/amd/gaia/blob/tmi/2013-email-capability-matrix/hub/agents/python/email/CAPABILITY_MATRIX.md),
and CI fails if any count drifts — `tools_count` is now reconciled three
ways (manifest == registration == AST-derived) at both test time and
generation time.

Note for reviewers: the issue body was written against a stale baseline
— `tools_count` is already 52 (fixed in v0.4.0), and the current enforce
flags are per amd#2038 (perf enforcing + quality's acceptance gate). This
PR ships the drift *guard* the issue actually needs and presents the
corrected picture; it deliberately does not re-fix numbers that are
already right.

Decisions documented in the matrix (not just in this PR):
- **MCP scope is intentional, not accidental**: MCP exists so a host LLM
can use the email agent *as a tool* — 4 task-level verbs, explicitly not
a replica of the REST API.
- **`tools_count` keeps its meaning** (internal agent-loop tools, 52)
with the definition carried as a comment in `gaia-agent.yaml` and
guarded by test.
- **Every one of the 20 exposed ops** (16 REST + 4 MCP) is annotated
with its eval suite or explicitly marked "no quality eval
(contract-tested only)".
- **Follow-up plan per eval suite**, including amd#2040 (filed alongside
this PR) for the `followups` suite, which is the only one with no CI
wiring at all.

Mid-flight proof the guard works: amd#2038 landed on main during this work
and flipped two enforce flags — the drift test went red on rebase
exactly as designed, and one regeneration commit (09cd976) absorbed it
with zero prose edits.

No eval run required: this change reads tool registration and fixtures;
it modifies no prompt, tool docstring, registration, or model-selection
surface.

## Test plan

- [x] `pytest hub/agents/python/email/tests/test_capability_matrix.py
-v` — 11 passed
- [x] `pytest hub/agents/python/email/tests/ -q` — 329 passed (full
email suite, post-rebase)
- [x] `python util/lint.py --all` — exit 0
- [x] Mutation proof (guard is non-vacuous): set `tools_count: 53` →
tests red + `--check` exit 1; revert → green
- [ ] Reviewer: `python
hub/agents/python/email/packaging/capability_matrix.py --check` on the
branch → exit 0

## Evidence (CLI)

Drift check green on the aligned tree, and failing loud on a perturbed
manifest:

```
$ python hub/agents/python/email/packaging/capability_matrix.py --check
Capability matrix up to date: .../hub/agents/python/email/CAPABILITY_MATRIX.md   (exit 0)

$ sed -i '' 's/tools_count: 52/tools_count: 53/' hub/agents/python/email/gaia-agent.yaml
$ python hub/agents/python/email/packaging/capability_matrix.py --check
ValueError: tools_count sources disagree: gaia-agent.yaml=53, __init__.py build_registration()=52, AST-derived=52   (exit 1)
```

<details>
<summary>🔍 More detail</summary>

- Derived REST counts cross-checked against the already-CI-guarded
OpenAPI export: `build_spec() operations: 19 / derived
rest_in_contract_count: 19 / derived rest_functional_count: 16 / MATCH`.
- Pytest mutation run with `tools_count: 53`:
`test_tools_count_matches_derived` fails with `assert 53 == 52`, both
guard tests fail; revert → `11 passed`.
- The AST counter handles both `@tool` and `@tool(...)` forms (the
call-form gap was caught in review and is now covered by the
synthetic-file test).
- Generator lives in `packaging/` (not inside `gaia_agent_email/`) so
the frozen sidecar binary does not ship it — `freeze.py`
blanket-collects the package.
</details>

---------

Co-authored-by: Tomasz Iniewicz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps/infrastructure changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants