Skip to content

ci(eval): wire the action-item extraction scorecard into the nightly email eval - #1964

Closed
kovtcharov wants to merge 2 commits into
mainfrom
eval/email-action-items
Closed

kovtcharov wants to merge 2 commits into
mainfrom
eval/email-action-items

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

#1962 shipped the extraction-quality eval (precision/recall/F1 over the hand-labeled corpus), but nothing runs it on a schedule — a regression in what the agent extracts would still reach users silently. This wires the eval into the nightly email-eval workflow as a report-mode step: the run prints an extraction scorecard and uploads action_items_report.json alongside the triage/perf/drafting reports, so a quality drop shows up in the nightly report instead of a user's task list.

After merging main (which landed #1962), this PR's net diff is the single workflow file. Generation drives the real triage path on the lemonade-eval runner (same serial slot as the other evals); borderline description matches use the Claude equivalence judge when the runner has ANTHROPIC_API_KEY, and fall back to token-overlap-only matching with the mode logged and recorded in the report. The gate follows the existing contract: enforce:false in the committed manifest, keyed off should_fail, so it reports and never blocks until a baseline confirms the bars.

Test plan

  • python -m pytest tests/unit/email/ -q — 171 passed
  • Workflow YAML parses; embedded step script compiles
  • Offline smoke of the step's exact code path (imports, manifest + corpus loaders, score_generations → summarize_extraction → gate) — gate reports should_fail=false
  • After merge: confirm the next nightly run prints the extraction report and uploads action_items_report.json

@github-actions github-actions Bot added devops DevOps/infrastructure changes eval Evaluation framework changes tests Test changes performance Performance-critical changes labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve.

This adds an offline, deterministic precision/recall/F1 eval for the email agent's action-item extractor, wired into the nightly email-eval workflow in report mode (no LLM, no gate failure) — a real regression signal for a feature that today reaches users' task lists untested. The design cleanly mirrors the existing triage FP/FN gate: same enforce-switch manifest contract, reused Confusion scoring, fail-loud loaders, and a genuinely measured baseline (P 0.89 / R 0.84 / F1 0.86). Test coverage is strong — corpus-integrity checks, hand-checked scorer cases, judge-path stubs, and an end-to-end offline run — and it's report-mode, so it can't break the build even on breach.

No blocking issues. Two small robustness notes below, neither merge-blocking.

🔍 Technical details

🟢 Minor

Metadata-key convention differs between scorer and tests (src/gaia/eval/action_item_metrics.py:156) — the scorer and load_action_item_ground_truth skip only the exact set {_meta, _comment, _metadata}, while test_action_item_eval.py:1087 uses startswith("_"). Today the corpus has only _meta, so they agree. But the sibling gate manifest already uses _baseline as a convention, so a future contributor adding a dict-valued _note/_baseline block to the corpus would have it treated as a case and hit the fail-loud no 'expected' list path. Aligning the module on the same startswith("_") rule the tests use would remove that footgun. Low risk — mentioning, not requiring.

Greedy fuzzy matching is heuristic, not optimal (action_item_metrics.py:240-256) — Pass 2 pairs best-similarity-first greedily rather than solving maximum bipartite matching. For multi-item emails this can occasionally mis-pair when two expected items are both near a single extraction. Acceptable for an eval at this corpus size and it's deterministic; worth a one-line note in the docstring if the corpus grows and pairings start looking off. No change needed now.

Strengths

  • Pattern reuse over reinvention — reuses quality_metrics.Confusion so the action_items block carries identical keys to the existing quality axes, and evaluate_action_item_gate returns the exact passed/breaches/enforce/should_fail shape CI already consumes. The report-mode enforce:false single-switch contract matches the triage gates precisely.
  • Correctness verified end-to-end — EmailTriageService() constructs with no args, Confusion guards every zero-denominator, the corpus items validate against the real ActionItem contract (test_expected_items_satisfy_action_item_contract), and the corpus deliberately includes cue-traps ("No action required…") and non-cue asks ("I need the NDA back…") to keep both precision and recall honest.
  • Fail-loud throughout — missing extraction for a labeled case, missing expected list, malformed manifest, and unparseable judge verdicts all raise with actionable messages rather than scoring a silent zero. The judge is opt-in and budget-capped, with over-budget skips reported (skipped_over_budget) and logged, never silent — consistent with the no-silent-fallbacks rule.
  • Duplicate-JSON-key guard in the test loader (_reject_duplicate_keys) catches a real corpus-maintenance hazard json.load would otherwise swallow.

Note: this is CI-internal eval infra (no new gaia subcommand), so no docs/reference/cli.mdx update is needed; the report-mode behavior is self-documented in the manifest _comment.

Action-item extraction (#1605, PR #1917) shipped with unit tests only —
nothing measured whether triage pulls the RIGHT action items, so an
extraction-quality regression would pass CI and reach users. This adds a
precision/recall/F1 eval over a hand-labeled 26-case corpus (19 expected
items, 10 hard negatives incl. cue traps like 'No action required'), in
the same report-mode gate pattern as the triage quality/perf gates.

- tests/fixtures/email/action_items_ground_truth.json: labeled seed
  corpus; labeling policy + counts documented in its _meta block.
- gaia.eval.action_item_metrics: sibling scorer to quality_metrics —
  set-based matching (normalized-exact, then difflib fuzzy >=0.80, then
  an opt-in budget-capped Claude judge for the ambiguity band), reusing
  Confusion so the action_items block matches the existing quality axes;
  gate manifest loader + evaluate gate with the same
  passed/breaches/enforce/should_fail contract.
- tests/fixtures/email/action_items_gate_thresholds.json: reported (NOT
  enforced) bars, enforce:false; measured deterministic baseline
  precision 0.8889 / recall 0.8421 / f1 0.8649 recorded in the manifest.
- test_email_agent_eval.yml: self-contained report-mode step (offline,
  no LLM — the extractor is deterministic) writing
  eval-out/action_items_report.json; keys off gate.should_fail exactly
  like the existing gates.
- tests/unit/email/test_action_item_eval.py: corpus integrity (dup-key
  rejection, ActionItem-contract validation, negative/link/due-hint
  coverage) + hand-checked scorer math + offline end-to-end run.

Closes #1949
@kovtcharov
kovtcharov force-pushed the eval/email-action-items branch from d4510c2 to 2096fba Compare July 9, 2026 00:33
itomek
itomek previously approved these changes Jul 9, 2026
…the workflow wiring

Main landed the action-item extraction eval via #1962 (action_item_quality.py
+ fixtures + corpus-integrity test), an independent implementation of what
this branch carried. Resolve the overlap by taking main's implementation
wholesale — this branch's action_item_metrics.py, its unit test, and its
fixture variants are dropped — and keep the one piece main lacks: the nightly
email-eval workflow step, rewritten against action_item_quality's real API
(live triage-path generation on the lemonade-eval runner, optional Claude
equivalence judge, report-mode gate keyed off should_fail).
@kovtcharov kovtcharov changed the title feat(eval): action-item extraction eval for the email agent (report mode) ci(eval): wire the action-item extraction scorecard into the nightly email eval Jul 9, 2026
kovtcharov-amd pushed a commit that referenced this pull request Jul 9, 2026
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Jul 10, 2026
… + release gates (amd#1964) (amd#1976)

amd#1962 shipped the extraction-quality eval (precision/recall/F1 over the
hand-labeled action-item corpus), but nothing ran it — so a regression
in *what* the agent extracts would reach a user's task list silently.
This PR runs the email eval suite where it matters: **nightly**,
**weekly** (with an auto-filed issue on failure), and as a **blocking
gate on every release** (email-agent and GAIA core).

## Threads

- **Nightly action-item eval** — a step in `test_email_agent_eval.yml`
drives the real triage/extraction path over the committed corpus, prints
a precision/recall/F1 scorecard, and uploads `action_items_report.json`
alongside the triage/perf/drafting reports.
- **Claude judge REQUIRED — no fuzzy fallback** — the borderline
equivalence judge is mandatory. If `ANTHROPIC_API_KEY` is absent or the
judge errors, the step **fails loudly** rather than degrading to
fuzzy-only matching (CLAUDE.md: No Silent Fallbacks — Fail Loudly).
- **Release gate (email agent + core)** — the email eval workflow is now
reusable (`workflow_call`) and is called as a blocking gate from
`release_agent_email.yml` (before the hub/npm publish) and `publish.yml`
(before the core publish approval). Both run on `[self-hosted,
lemonade-eval]` and share the `lemonade-eval` concurrency group, so a
release exercises the shipping agent on its corpus and stays strictly
serial with the nightly/refresh runs.
- **Weekly sweep + auto-issue** — `weekly_eval.yml` runs the same
reusable suite once a week and opens (or updates) a GitHub issue labeled
`eval-failure` if any eval fails, escalating a regression the nightly
only logs.

Report mode is preserved for the gate contract: the eval runs + uploads
on every release, and only *hard-blocks* when a `tests/fixtures/email/`
threshold manifest sets `enforce:true` (data, not code). Note this is
distinct from the judge requirement above — a missing judge always fails
the run regardless of `enforce`.

The general `gaia eval agent` gate is intentionally **not** wired into
the core release yet: that CI (`test_eval_rag.yml`) is disabled pending
amd#1315 (nonexistent runner label + a 90-min perf ceiling), so gating on
it now would fail every release. Fast-follow once amd#1315 lands (noted
inline in `publish.yml`).

## Test plan
- [x] All four workflow YAMLs parse (`yaml.safe_load`); every `needs:`
resolves; both release gates + the weekly issue job depend on
`email-eval`
- [x] Embedded step scripts compile; action-item imports from
`gaia.eval.action_item_quality` resolve; no `judge_fn=None` / fuzzy-only
path remains
- [x] `inputs.*` unification leaves the nightly `schedule` run
unchanged; no stray `github.event.inputs` refs
- [ ] After merge: dispatch `test_email_agent_eval.yml` +
`weekly_eval.yml` and confirm the action-item report uploads and (on an
injected failure) an `eval-failure` issue is filed
- [ ] On the next email-agent / core release: confirm the `email-eval`
gate runs on the self-hosted runner and blocks the publish approval

Closes amd#1964

---------

Co-authored-by: Ovtcharov <[email protected]>
kovtcharov-amd pushed a commit that referenced this pull request Jul 10, 2026
Resolve the test_email_agent_eval.yml conflict from main's two new eval
blocks (action-item extraction #1964, daily-briefing summary #1951) and the
reusable workflow_call trigger, keeping this branch's Windows stx + PowerShell
+ extracted-script conversion.

- Convert both new eval blocks from bash heredocs to the branch's pattern:
  new packaging/eval_action_item_report.py and eval_briefing_report.py, called
  from PowerShell steps (matching eval_gate_report.py / eval_drafting_report.py)
- Point the top-level env at inputs.* (not github.event.inputs.*) so model/limit
  propagate for the new workflow_call path as well as workflow_dispatch
- Keep per-step env minimal (ANTHROPIC_API_KEY only); the centralized top-level
  env supplies EMAIL_EVAL_MODEL/LIMIT/EXPERIMENTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants