Skip to content

feat(email-eval): run the follow-up eval in CI (report script + workflow step) - #6589

Closed
hussain-alsaibai wants to merge 3 commits into
amd:mainfrom
hussain-alsaibai:feat/2040-followups-eval-ci
Closed

hussain-alsaibai wants to merge 3 commits into
amd:mainfrom
hussain-alsaibai:feat/2040-followups-eval-ci

Conversation

@hussain-alsaibai

@hussain-alsaibai hussain-alsaibai commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds packaging/eval_followup_report.py and a report-mode step in the email scorecard refresh workflow, so the follow-up detection eval runs in CI like the other five suites. Registers followup_gate so the job summary renders a titled row, and regenerates CAPABILITY_MATRIX.md to followups: wired=True.

Why

Six eval suites had committed gate manifests, but followups was the only one with no CI presence at all: its bars shipped in tests/fixtures/email/followups_gate_thresholds.json and its quality module in gaia.eval.followup_quality, with nothing in the pipeline reading either. CAPABILITY_MATRIX.md had said followups: wired=False since #2013.

This closes the wiring gap only. It makes the eval measurable; deciding the bars is still #1950's job.

Linked issue

Closes #2040

Changes

  • hub/agents/email/python/packaging/eval_followup_report.py (new) -- mirrors eval_drafting_report.py / eval_action_item_report.py: loads the committed manifest (no inlined bars), runs the real detector over the corpus, prints the report, writes eval-out/followups_report.json, and honours the manifest's enforce flag for its exit code. Adds a small argparse surface so --help is usable and --corpus / --out-dir / --model are overridable.
  • .github/workflows/email_scorecard_refresh.yml -- a "Follow-up detection eval (report mode)" step after the briefing eval, in the same self-contained-block style.
  • packaging/eval_summary.py -- registers followup_gate, so the job summary renders a titled row and a missing verdict is flagged as missing rather than silently absent.
  • CAPABILITY_MATRIX.md regenerated -- followups: wired=True. The module's stale "# confirmed absent -- Align email agent tool surfaces: MCP / REST / internal tools / evals are out of sync #2013" comment and the now-obsolete trailing "Wire the followups email eval into CI (report script + workflow step) #2040 tracks wiring" line are gone.
  • Tests -- new test_eval_followup_report.py; test_capability_matrix.py now pins every suite as wired (per-suite, so a regression names the suite); test_eval_summary.py covers the new gate.

Two deliberate differences from its siblings (both stated in the script)

  • No judge credential. The follow-up detector is deterministic, so unlike drafting/action-item/briefing this suite needs no Claude judge and must not fail when one is absent.
  • EMAIL_EVAL_MODEL is optional, defaulting to deterministic-followup-detector. The judged suites require the Lemonade model id; this one only records a scorecard label.

enforce stays false. Per the manifest's own _comment there is no real baseline yet and the shipped heuristic has a known false-positive gap on courtesy/FYI notes, so this makes the eval measurable without blocking merges.

A zero-verdict run now fails

The first version of this script exited 0 when the detector produced nothing at all -- a broken install or an unreadable corpus would have looked exactly like a clean run, and the summary would have said "no verdict produced" without anyone noticing. main() now returns 1 when produced == 0, before scoring and before the report is written, and prints the per-case errors so the cause is visible in the job log.

The workflow step moved

This PR originally added its step to .github/workflows/test_email_agent_eval.yml. While it was open, upstream deleted that workflow as dead config (it had a single if: false job) and moved the email evals into email_scorecard_refresh.yml. The step now lands in the workflow that actually runs, with if: always() preserved -- the step is offline and deterministic, so a missing judge credential or a failed Lemonade eval above must not be able to skip it.

Test plan

  • Full email-agent suite: pytest hub/agents/email/python/tests/ -> 2376 passed, 3 skipped
  • New report-script tests: pytest hub/agents/email/python/tests/test_eval_followup_report.py -> 10 passed
    • bars come from load_followup_thresholds(default_followup_thresholds_path()) (the manifest), never inlined
    • enforce=false + breach -> exit 0, report still written
    • enforce=true + breach (should_fail) -> exit 1
    • zero verdicts produced -> exit 1, with the per-case errors printed
    • runs and scores with no judge credential and no claude on PATH
    • --out-dir override, --model/EMAIL_EVAL_MODEL precedence, skipped-gate variant
  • python hub/agents/email/python/packaging/capability_matrix.py --check -> "Capability matrix up to date"
  • Drift test proven to fail: editing the committed CAPABILITY_MATRIX.md flips test_committed_capability_matrix_is_up_to_date red, and restoring it goes green
  • ruff check and ruff format --check clean on the new and changed files
  • Workflow parses (yaml.safe_load) and the step appears in the expected pipeline position with if: always()
  • No enforce flipped, no corpus or followup_quality.py change, no new dependencies

Notes for the reviewer

  • The branch was rebased onto current main (335 commits ahead of where it started) to resolve a conflict with the workflow deletion, and the thresholds loader was renamed upstream while this was open (load_default_followup_thresholds() -> load_followup_thresholds(path)). The call site and its test follow the new API.
  • enforce remains false by design. feat(eval): detection-quality eval for email follow-up tracking #1950 owns deciding the bars once a real baseline exists.

@github-actions github-actions Bot added devops DevOps/infrastructure changes agent::email Email agent changes sidecar Agent sidecar contract / harness labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This PR wires the follow-up detection eval into the email eval workflow, the last of the six suites to get a CI step, and updates the capability matrix to match. The wiring is clean. One problem: if the eval can't run at all, the step still goes green.

  • A run that scores nothing still passes. If the email agent package fails to import, or every case errors, each case's failure is caught and logged on its own. The gate then reports itself "skipped" and the script exits 0. The script's own docstring says a missing email agent package fails loudly, and the briefing sibling does fail on a zero-case run, but this one doesn't. A new test pins the skipped-gate exit-0 path as expected behaviour. Fix: exit 1 when no case produced a verdict or the gate came back skipped, whatever the enforce setting, as eval_briefing_report.py does, and change that test to expect 1.

Real-world evidence

N/A: no evidence bundle was produced for this run. The change touches only a CI eval script, its workflow step and tests, with no user-facing CLI, API, MCP or UI surface. I couldn't run the script or the tests here (the runner has no gaia or pytest installed), so this verdict rests on reading the code alone.

🔍 Technical details

Issues

🟡 A zero-verdict run passes as a report (hub/agents/email/python/packaging/eval_followup_report.py:239-300)
_default_detector raises RuntimeError on a failed gaia_agent_email import. But it runs inside generate_detections' per-case try/except Exception (src/gaia/eval/followup_quality.py:~609), so every case ends up with predicted=None. summarize_followups then returns {"skipped": True, "should_fail": False} (followup_quality.py:409-418), and main() returns 0. That contradicts the module docstring ("an unavailable email agent package … raise") and CLAUDE.md's fail-loudly rule. The sibling eval_briefing_report.py:90-104,140-151 returns 1 on produced == 0 and on gate["skipped"]. Suggested guard after the produced print:

    produced = sum(1 for g in generations if g.get("predicted") is not None)
    print(f"[FOLLOWUP-EVAL] detected for {produced}/{len(generations)} cases")
    if produced == 0:
        errors = sorted({g.get("error", "") for g in generations if g.get("error")})
        print(
            f"[FOLLOWUP-EVAL] ERROR: 0/{len(generations)} cases produced a verdict "
            f"from {corpus_path} — nothing to score. Check the email agent is "
            f"installed and the corpus loads. Errors: {errors[:3]}",
            file=sys.stderr,
        )
        return 1

Also return 1 on gate.get("skipped") before the should_fail check. Then update test_skipped_gate_variant_returns_0 in tests/test_eval_followup_report.py:561 to expect 1, and add a test where every generation has predicted=None.

🟢 Workflow comment overstates independence (.github/workflows/test_email_agent_eval.yml:~531)
The comment says the step "is not gated on the preflight". But the step has no if:, so it only runs when every earlier step succeeded, including the judge preflight and the Lemonade evals. A missing judge credential will therefore skip it too, and the summary will just show "no verdict produced". Either reword the comment or add if: always(). Running whatever happened earlier is defensible here, since the step is offline and deterministic.

Strengths

  • Thresholds come only from the committed manifest, and the tests assert that, so there's still one place the bars live.
  • Deriving the missing-gate count from GATE_LABELS in test_eval_summary.py removes a literal that broke every time a suite was added.
  • The per-suite wired is True assertion names exactly which suite lost its report script.

@hussain-alsaibai

Copy link
Copy Markdown
Contributor Author

Addressed both findings in 6e30fd7.

🟡 A zero-verdict run now fails. main() returns 1 when produced == 0, before scoring and before the report is written, with the errors list on stderr — same contract as eval_briefing_report.py:90-104. It also returns 1 on gate.get("skipped"), placed before the should_fail check and before the report write, so a skipped gate cannot leave a followups_report.json the scorecard treats as a real scored run.

test_skipped_gate_variant_returns_0 is now test_skipped_gate_variant_returns_1 and asserts not _report_path().exists(). New test test_zero_verdicts_return_1_even_in_report_mode drives the all-predicted=None path (every case errored on import) and asserts the run returns 1 and never reaches score_generations.

🟢 Workflow comment corrected, and if: always() added. You were right that "not gated on the preflight" was false — the step had no if:, so it inherited the whole job's success. I took the second option: the comment now says always() keeps it off the preflight's outcome, and the step carries if: always(). Since it is offline and deterministic, it should still run when a judge credential is missing or a Lemonade eval above it failed.

Evidence

Ran the suite locally (Python 3.11, hub/agents/email/python):

  • tests/test_eval_followup_report.py: 11 passed
  • with tests/test_eval_briefing_report.py + tests/test_eval_summary.py: 33 passed

Mutation check on the fix itself — with the guards removed but the new tests in place:

FAILED tests/test_eval_followup_report.py::test_skipped_gate_variant_returns_1
FAILED tests/test_eval_followup_report.py::test_zero_verdicts_return_1_even_in_report_mode
2 failed, 9 deselected

So each assertion fails for the reason it names, not just for a missing attribute.

The workflow YAML was parsed after the edit (yaml.safe_load) and the step now reads {'name': 'Follow-up detection eval (report mode)', 'if': 'always()', ...} — valid YAML is not a valid workflow, so I asserted on the parsed step rather than reading the diff.

…low step)

Closes amd#2040.

The email agent has six eval suites, but `followups` was the only one with no
CI presence: its bars shipped in `followups_gate_thresholds.json` and its
quality module in `gaia.eval.followup_quality`, with nothing in the pipeline
reading either. `CAPABILITY_MATRIX.md` has said `followups: wired=False` since

- `packaging/eval_followup_report.py` — mirrors the drafting / action-item
  report scripts: loads the committed manifest (no inlined bars), runs the
  real detector over the corpus, prints the report, writes
  `eval-out/followups_report.json`, and honours the manifest's `enforce` flag
  for its exit code. Adds a small argparse surface so `--help` is usable and
  `--corpus` / `--out-dir` / `--model` are overridable.
- `.github/workflows/test_email_agent_eval.yml` — a report-mode step after the
  briefing eval, plus the manifest in the header's single-source index.
- `eval_summary.py` — registers `followup_gate` so the job summary renders a
  titled row and a missing verdict is reported as missing, not silently absent.
- `CAPABILITY_MATRIX.md` regenerated: `followups: wired=True`. The module's
  "confirmed absent" comment and its now-obsolete trailing "amd#2040 tracks
  wiring" line are gone.

Two deliberate differences from its siblings, both stated in the script:

- No judge credential. The follow-up detector is deterministic, so unlike
  drafting/action-item/briefing this suite needs no Claude judge and must not
  fail when one is absent — a test pins that.
- `EMAIL_EVAL_MODEL` is optional and defaults to a label naming the detector,
  rather than requiring the Lemonade model id the judged suites need.

`enforce` stays `false`: per the manifest, no real baseline exists yet and the
shipped detector has a known false-positive gap on courtesy/FYI notes. This
makes the eval measurable; amd#1950 owns deciding the bars.

Test plan:
- `pytest hub/agents/email/python/tests/` — 2337 passed, 3 skipped.
- `pytest .../test_eval_followup_report.py` — 10 tests: thresholds loaded from
  the manifest, enforce=false breach exits 0 and still writes the report,
  enforced breach exits 1, and the whole suite runs with no judge credential.
- `python .../capability_matrix.py --check` — up to date; the drift test was
  confirmed to fail when the committed artifact is edited.
- End-to-end: the script scores 16/16 cases offline (P 0.4545 / R 0.8333 /
  F1 0.5882, hard-negative correct 4/10), exits 0, and `eval_summary.py` picks
  the gate up as "Follow-up detection — BREACH (advisory)".
A run that scored nothing still passed. If the email-agent package fails to
import, or every case errors, generate_detections returns a predicted=None for
each case, summarize_followups reports the gate as skipped, and main() returns
0 — a green CI step for an eval that proved nothing. The module docstring and
CLAUDE.md both say a missing package must fail loudly, and the briefing sibling
already returns 1 on a zero-case run.

- return 1 when no case produced a verdict, regardless of the manifest's
  enforce flag
- return 1 on a skipped gate, before writing the report, so the scorecard
  cannot treat it as a real scored run
- test_skipped_gate_variant_returns_0 expected 0 for the skipped path; it now
  expects 1 and asserts no report is written
- new test covers the all-predicted=None path and proves it never reaches
  scoring
- workflow: add if: always() to the follow-up step and correct the comment —
  it is offline and deterministic, so it should not be skipped by a failed
  judge preflight above it

Both new assertions fail on the unpatched script (2 failed) and the suite is
11 passed with it.
Upstream renamed the loader while this PR was open:
`load_default_followup_thresholds()` became `load_followup_thresholds(path)`,
and the default path is now resolved by `default_followup_thresholds_path()`.
Port the call site and the test to the new shape.

Also fixes C405 in the test (set([...]) -> {...}).

The rebase onto current main (335 commits) hit a second upstream change:
the email-eval workflow this PR edited was deleted as dead config, and the
evals moved to `email_scorecard_refresh.yml`. The follow-up step now lands
there instead, with `if: always()` preserved -- the step is offline and
deterministic, so a missing judge credential or a failed Lemonade eval
above must not be able to skip it and leave the summary showing "no verdict
produced".

Verified: 2376 passed, 3 skipped across hub/agents/email/python/tests/;
ruff check and format clean; capability matrix drift check up to date.
@hussain-alsaibai
hussain-alsaibai force-pushed the feat/2040-followups-eval-ci branch from 6e30fd7 to 29b5e0b Compare November 10, 2026 07:53
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Thank you for this, @hussain-alsaibai. The wiring is careful, and making a run that produces no verdicts fail outright is exactly the loud failure we want. Unfortunately it can't merge: the standalone email agent it measures is being removed in #7108, along with email_scorecard_refresh.yml, the email eval modules and the follow-up detector this script runs. Mail now lives only in the flagship GAIA agent, through its mail tools and the inbox-triage skill.

The idea carries over well. The flagship already has a gaia_email eval category, and its list_waiting_on_you tool is where follow-up detection lives now. A PR that turns the follow-up corpus into a few gaia_email scenarios would plug straight into the flagship eval that runs on release candidates. Courtesy and FYI notes that must not be flagged would be good first cases. Happy to point you at the files if you'd like to take that on.

🔍 Technical details
  • Scenarios live in eval/scenarios/gaia_email/; email_t2_sender_filter_followups.yaml is the closest existing one.
  • Flagship evals run on release and RC tags or a manual dispatch of eval_flagship.yml, so a new scenario needs no workflow change.

@hussain-alsaibai

Copy link
Copy Markdown
Contributor Author

Superseded by #8089, re-targeted per @kovtcharov-amd's review.

Confirmed #7108 deletes every file this PR touched — email_scorecard_refresh.yml, eval_followup_report.py, its tests, followups_ground_truth.json, followups_gate_thresholds.json and src/gaia/eval/followup_quality.py — so rebasing would target deleted code. #8089 moves the same awaits_reply coverage into a gaia_email scenario instead.

kovtcharov-amd added a commit that referenced this pull request Nov 21, 2026
…8089)

Fixes #2040 (re-targeted per @kovtcharov-amd's review on #6589).

## Why this replaces #6589

#6589 wired the standalone email agent's follow-up eval into CI.
@kovtcharov-amd pointed out that the email agent is being removed in
#7108, along with `email_scorecard_refresh.yml` and the email eval
modules — so that PR's target no longer exists.

Verified, not assumed: #7108 deletes every file #6589 touches.

| #6589 touches | #7108 |
|---|---|
| `.github/workflows/email_scorecard_refresh.yml` | removed |
| `hub/agents/email/python/packaging/eval_followup_report.py` | removed
|
| `hub/agents/email/python/tests/test_eval_followup_report.py` | removed
|
| `tests/fixtures/email/followups_ground_truth.json` | removed |
| `tests/fixtures/email/followups_gate_thresholds.json` | removed |
| `src/gaia/eval/followup_quality.py` | removed |

Rebasing #6589 would produce a PR against deleted files, so this moves
the coverage instead.

## What this does

Adds one `gaia_email` scenario,
`eval/scenarios/gaia_email/email_t3_hung_thread_followups.yaml`, pinning
the same `awaits_reply` behaviour — but end to end against the surviving
corpus and the live agent, rather than offline against the deleted
detector.

Among the 42 inbox messages, exactly one thread has a person blocked on
the user's reply: Alex, *"Re: Project status - blocked on review"*. The
scenario requires the agent to:

1. Find that thread, and say he is blocked with a customer deadline.
2. Not count other deadline-bearing mail as awaiting a reply — the hard
negatives are exactly the ones the old detector scored as false
positives: the Boss Q4 budget request (a deliverable the user owes, not
a thread needing a reply), Sam's "design review moved" FYI, the HR
enrollment reminder (the action is enrolling, not replying), and Priya's
already-settled on-call swap.
3. Not mistake the Tue Sep 29 calendar invite for an answer to Alex —
the meeting being scheduled is not the review being done. The old
offline detector could not see this confusion at all.
4. Write a reply that commits to reviewing today **and asks what
specifically is blocking him** — an acknowledgment with no question is a
FAIL, since the point is to un-hang the thread.

## Validation

- `gaia.eval.runner.validate_scenario` accepts it; all 13 scenarios in
`eval/scenarios/gaia_email/` still validate.
- The validator was confirmed to reject malformed input (empty `turns`,
a turn with neither `ground_truth` nor `success_criteria`), so the pass
is not vacuous.
- Every factual claim in the scenario header was checked against
`tests/fixtures/gaia/email/eval_inbox.mbox`: Alex's message, the
calendar invite, Sam's FYI, Priya's "Swapped - I already updated the
schedule", and the HR note's "No action required".

Branched from `amd/gaia@75ef063`. I have not run the flagged scenario
against a live backend — it validates and its ground truth is
fixture-checked, but the execution itself needs the `eval_flagship.yml`
runner.

#6589 can be closed.

Co-authored-by: Kalin Ovtcharov <[email protected]>
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 sidecar Agent sidecar contract / harness tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire the followups email eval into CI (report script + workflow step)

2 participants