Skip to content

docs(email): give the 120 s undo window in the npm docs - #6879

Merged
kovtcharov-amd merged 2 commits into
amd:mainfrom
wasiulhaque:docs/email-undo-window-120s
Nov 7, 2026
Merged

kovtcharov-amd merged 2 commits into
amd:mainfrom
wasiulhaque:docs/email-undo-window-120s

Conversation

@wasiulhaque

Copy link
Copy Markdown
Contributor

Summary

The email agent's npm docs said an archive or quarantine can be undone for 30 s; the agent keeps the window open for 120 s by default (GAIA_EMAIL_UNDO_WINDOW_SECONDS changes it). This PR fixes that and two smaller places where the npm docs contradict the code.

Why

Integrators size UI timers and retry logic from SPEC.md and SKILL.md. With the docs saying 30 s, they hide the undo button 90 s early, and the docs never mention that the window can be changed. The EVALUATION.md line made the email eval look like it still runs nightly, so readers would treat SCORECARD.md as continuously refreshed, and the checkVersion comment promised that a higher MINOR is always backward-compatible, which CONTRACT.md says is not true (2.3 was breaking).

Linked issue

Refs #4429

This covers the undo window and the first two "smaller contradictions". The third one (adding the 400/404/409/500/502 responses to the /query route decorators and regenerating openapi.email.json + specification.html) touches Python and generated files, so it can go in a separate PR; I'm happy to take it next.

Changes

Test plan

  • grep -rn "30s\|30 s" hub/agents/email/npm --include=*.md --include=*.ts --exclude-dir=node_modules only finds the unrelated 30 s client timeout (lifecycle.ts:668) and two historical CHANGELOG entries.
  • Compared against hub/agents/email/python/gaia_agent_email/config.py:75 (_DEFAULT_UNDO_WINDOW_SECONDS = 120) and .github/workflows/test_email_agent_eval.yml (schedule removed at :88, if: false at :243).
  • cd hub/agents/email/npm && npm ci && npm run build && npm test on Node 22: build clean, 132 passed / 6 skipped (the .ts changes are comments only).
  • python util/lint.py --all passes.

Evidence

N/A for every surface: this PR changes only Markdown docs and two TypeScript comments, so no Agent UI, MCP, CLI or HTTP API behaviour changes.

Checklist

  • I have linked a GitHub issue above (Closes #N / Fixes #N / Refs #N).
  • I have described why this change is being made, not just what changed.
  • I have run linting and tests locally (python util/lint.py --all, pytest tests/unit/).
  • I have attached real-world evidence matched to the surface I changed (see Evidence above), or marked each surface N/A.
  • I have updated documentation if user-visible behavior changed (see CONTRIBUTING.md).

The npm SPEC and SKILL docs said archive/quarantine can be undone for 30 s; the agent defaults to 120 s and GAIA_EMAIL_UNDO_WINDOW_SECONDS changes it. Also mark the email eval workflow as disabled in EVALUATION.md and stop calling a higher MINOR backward-compatible.

Refs amd#4429
@github-actions github-actions Bot added the agent::email Email agent changes label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

The email agent's npm docs now say the right thing: archive and quarantine can be undone for 120 seconds by default, and the window can be changed with an environment variable. They no longer call the nightly email eval live, and they stop promising that every minor API version is backward-compatible. I checked each new claim against the code and they all hold. I found no other doc still saying 30 seconds.

One small fix is worth making: the new version-check note sends npm readers to "CONTRACT.md", but that file isn't in the npm package, so they have nothing to open. Linking it on GitHub fixes that.

Real-world evidence

N/A: this PR changes only docs and code comments. The verdict rests on reading the changes against the code.

🔍 Technical details

Checked against the code

  • The undo window defaults to 120 and reads GAIA_EMAIL_UNDO_WINDOW_SECONDS (python/gaia_agent_email/config.py:74-75).
  • test_email_agent_eval.yml has no schedule and its job is if: false (lines 88 and 243), with the feat(email,skills): absorb inbox triage into the flagship agent so the email agent can be decommissioned #3329 reason.
  • python/CONTRACT.md:42,51 records that 2.3 was a breaking MINOR.
  • Drift grep: no "30s" / "30 seconds" undo claim is left in hub/agents/email/** (outside tests and past CHANGELOG entries), docs/guides/email.mdx or docs/sdk/. The higher-MINOR claim appears only in the two places this PR edits.

Issues

🟢 The CONTRACT.md pointer can't be followed from the npm package (npm/SPEC.md:550, npm/src/lifecycle.ts:336). CONTRACT.md lives in python/ and isn't in package.json files, so an npm reader can't find it. SPEC.md:81 already links sibling docs by full GitHub URL. Use the same style here:

- `checkVersion(client, { expectedApiVersion })` → throws `VersionMismatchError` if the sidecar's apiVersion **MAJOR** differs (a higher MINOR is accepted, but MINOR bumps can be breaking; see [CONTRACT.md's version history](https://github.com/amd/gaia/blob/main/hub/agents/email/python/CONTRACT.md)).

🟢 The new prose in SKILL.md:139 and SPEC.md:290 runs well past the column the rest of those paragraphs wrap at. It renders fine, but re-wrapping would keep the source diffs readable.

Strengths

  • Each corrected claim names the override, GAIA_EMAIL_UNDO_WINDOW_SECONDS, so integrators learn the window can be changed.
  • The scope is tight, and the PR explains why historical CHANGELOG entries were left alone and why the OpenAPI responses fix is a separate PR.

Address review: CONTRACT.md isn't shipped in the npm package, so link it on GitHub instead of naming it.

Refs amd#4429
@wasiulhaque

Copy link
Copy Markdown
Contributor Author

Both suggestions are applied:

  • SPEC.md and the checkVersion comment in src/lifecycle.ts now link CONTRACT.md's version history by its GitHub URL, since CONTRACT.md isn't part of the npm package.
  • SPEC.md:290 and SKILL.md:139 are rewrapped to match the rest of their paragraphs.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Nov 7, 2026
Merged via the queue into amd:main with commit 02fd58f Nov 7, 2026
14 checks passed
kovtcharov-amd pushed a commit to huong8373tt-beep/gaia that referenced this pull request Nov 7, 2026
…tract (amd#6910)

## Summary

`openapi.email.json` listed only 200 and 422 for the three `/query`
routes, although they also return 400, 404, 409, 500 and 502. This PR
declares those statuses on the route decorators, regenerates
`openapi.email.json` and `specification.html`, and adds a test that
fails if a `/query` route raises a status the spec doesn't list.

## Why

`openapi.email.json` is the contract the npm client and generated
clients are built from. A client generated from it had no typed path for
a stale `needs_input` answer (409), a busy session (409), or an agent
that failed to start (502), even though `npm/SPEC.md` already documents
them in prose. This is the last item of amd#4429; the docs part landed in
amd#6879.

## Linked issue

Closes amd#4429

## Changes

- `query_routes.py`: `POST /v1/email/query` declares 400, 409, 500 and
502 next to its SSE 200; `/query/{run_id}/cancel` declares 404;
`/query/{run_id}/respond` declares 404 and 409. Each description says
when that status is returned. No handler logic changed.
- `openapi.email.json`: regenerated with `python -m
gaia_agent_email.export_openapi`.
- `spec_html.py` / `specification.html`: the `/query` block is
hand-written and listed no errors, so it gets one paragraph naming them
(cancel and respond already did); regenerated with `python -m
gaia_agent_email.spec_html`.
- `tests/test_rest_contract.py`:
`test_query_routes_document_every_status_they_raise` reads every
`HTTPException(status_code=...)` in each `/query` handler from the
source and asserts the spec lists it, so a new status added without a
`responses` entry fails CI.
- `CHANGELOG.md`: an Unreleased "Fixed" entry.
- No `SCHEMA_VERSION` bump: no request or response shape changed and no
operation was added. I followed amd#3002, which also only added to what the
OpenAPI document declares and did not bump. Happy to bump to 2.16 if
you'd rather treat this as a contract change.

## Test plan

- [x] `python -m gaia_agent_email.export_openapi --check` and `python -m
gaia_agent_email.spec_html --check` both report up to date after
regenerating (the OpenAPI check failed before).
- [x] `pytest hub/agents/email/python/tests
tests/test_email_openapi_conformance.py`: 2378 passed, 3 skipped (Python
3.12, `.[dev,api,publish]` + the email package, as in
`test_email_agent_unit.yml`).
- [x] Removed the 409 from `/respond`'s responses on purpose: the new
test failed with `POST /v1/email/query/{run_id}/respond raises ['409']
undocumented`, then passed again once restored.
- [x] `python util/lint.py --all`: everything passes except two Pylint
E1120 errors in `src/gaia/utils/awake_clock.py:47` and
`src/gaia/utils/terminal.py:109`, files this PR doesn't touch.

## Evidence

- [ ] **Agent exposed in the Agent UI**: N/A, no UI change.
- [ ] **MCP tools / servers**: N/A, no MCP change.
- [ ] **CLI**: N/A, no CLI change.
- [x] **HTTP API / REST**: real requests through the routers the sidecar
mounts (`export_openapi.build_app()` in a `TestClient`), next to what
the regenerated spec now lists:

```
$ POST /v1/email/query/{run_id}/cancel  -> 404 {'detail': "No in-flight run for run_id '0f5caf10-…'."}
  openapi.email.json lists: ['200', '404', '422']
$ POST /v1/email/query/{run_id}/respond  -> 404 {'detail': "No in-flight run for run_id '0f5caf10-…'. It has already finished or been cancelled, so there is nothing to answer."}
  openapi.email.json lists: ['200', '404', '409', '422']
$ POST /v1/email/query  (provider: "openai") -> 400 {'detail': "provider 'openai' is not supported: the email agent runs local inference only. Omit 'provider' or set it to 'lemonade'."}
  openapi.email.json lists: ['200', '400', '409', '422', '500', '502']
```

Before this PR, all three listed only `['200', '422']`.

## Checklist

- [x] I have linked a GitHub issue above (`Closes #N` / `Fixes #N` /
`Refs #N`).
- [x] I have described **why** this change is being made, not just what
changed.
- [ ] I have run linting and tests locally (`python util/lint.py --all`,
`pytest tests/unit/`).
- [x] I have attached **real-world evidence matched to the surface I
changed** (see Evidence above), or marked each surface N/A.
- [x] I have updated documentation if user-visible behavior changed (see
[CONTRIBUTING.md](../CONTRIBUTING.md)).
@kovtcharov-amd kovtcharov-amd mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants