Skip to content

docs(email): say the "connection is being saved" 502/503 is retryable - #5969

Merged
kovtcharov-amd merged 4 commits into
amd:mainfrom
burgulvedant:docs/5667-connection-busy-retry
Oct 29, 2026
Merged

kovtcharov-amd merged 4 commits into
amd:mainfrom
burgulvedant:docs/5667-connection-busy-retry

Conversation

@burgulvedant

Copy link
Copy Markdown
Contributor

Summary

The email agent's CONTRACT.md and its served spec page now say that the "connection is being saved" 502/503 is temporary and should be retried, not treated as a reason to reconnect.

Why

The npm SPEC.md, SKILL.md and both CHANGELOGs already tell integrators to retry. CONTRACT.md and the spec page did not, so an integrator reading only those would send the user to reconnect on a transient error. The docs bundled in one package contradicted each other.

Linked issue

Closes #5667

Changes

  • CONTRACT.md: new section "Transient connection errors, retry, don't reconnect". Mailbox routes answer 502, the agent routes answer 503 with a Retry-After header. Both are transient. A 403 is the one that means reconnect.
  • spec_html.py: the same paragraph in the generated spec page, before the Endpoints section.
  • specification.html: matches the generator output.

Test plan

Docs only, no behavior change.

  • python -m gaia_agent_email.spec_html --check from hub/agents/email/python

Evidence

Docs only change, so every surface below is N/A (no Agent UI, MCP, CLI or HTTP behavior changed). The spec drift check output:

specification.html up to date

  • Agent exposed in the Agent UI N/A, docs only
  • MCP tools / servers N/A, docs only
  • CLI N/A, docs only
  • HTTP API / REST N/A, docs only

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 docs already tell integrators to retry, but CONTRACT.md and the served spec page did not, so a consumer reading only those would send the user to reconnect.

Closes amd#5667
@github-actions github-actions Bot added the agent::email Email agent changes label Oct 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This brings the email agent's CONTRACT.md and its served spec page in line with the npm SPEC.md, SKILL.md and both CHANGELOGs: a "connection is being saved" error is temporary, so retry it instead of asking the user to reconnect. The 502/503 and Retry-After claims match what the code does. One sentence goes further than the code supports, so it's worth tightening before merge.

  • The new 403 sentence is too broad. It says a 403 "is the one that means the account needs reconnecting." But the same agent also returns 403 when a send/archive confirmation token is missing or invalid. An integrator who follows the sentence as written would send the user to reconnect when the real problem is a bad token. Limit the sentence to mailbox/connector errors.

Real-world evidence

N/A: docs-only change, so no CLI, API, MCP or Agent UI behavior changed. No evidence bundle was produced, and this verdict comes from static review alone. The PR description shows the spec drift check passing (specification.html up to date). I couldn't re-run it here because the runner has no pydantic, but the hand-edited specification.html hunk is byte-identical to the spec_html.py hunk.

🔍 Technical details

Issues

🟢 403 claim covers more than connector errors (hub/agents/email/python/CONTRACT.md:632, and the same sentence in gaia_agent_email/spec_html.py:1016 and specification.html)
The confirmation gate also returns 403 (api_routes.py:2747 _GATE_DETAIL, and the send/confirm token checks that CONTRACT.md:493/514 already document). The npm SPEC.md and SKILL.md don't make this claim, so it's new wording, not a sync.

mailbox: retry shortly and don't prompt the user to reconnect. A connector
`403` (missing scope or revoked grant) is what means the account needs
reconnecting; a `403` from a confirmation-gated route means a missing or
invalid token.

Make the same change in spec_html.py, then regenerate specification.html.

🟢 The section is nested under the Attention view endpoint (CONTRACT.md:626)
The new ### heading sits inside the ### Attention view — GET /v1/email/attention block, just before the ---, so it can read as specific to that endpoint. It applies to every mailbox route and the /v1/email/agent/* routes. Optional: promote it to ##, or move it next to the general error-handling text.

Verified against code

  • mailbox_state.py:252: detail text "is being saved by another GAIA operation" ✔
  • agent_routes.py:423: 503 with Retry-After: 1 ✔ (covered by tests/test_agent_routes_connection_busy.py)
  • The wording matches npm/SPEC.md:95-98 and npm/SKILL.md:444-447 ✔

Strengths

A 403 also comes back from confirmation-gated routes when the send or
archive token is missing or invalid, so telling integrators every 403
means reconnect would send users to re-link a working account. The
section is promoted to its own heading because it covers every mailbox
and agent route, not just the attention view it sat under.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Thanks @burgulvedant, good catch that CONTRACT.md and the spec page were the two places still telling integrators to reconnect on a transient error. I checked the 502/503 and Retry-After claims against the code, and they're right.

I pushed the review bot's one suggestion. A 403 also comes back when a send or archive confirmation token is missing or invalid, so the docs now say which 403 means reconnect. I also gave the section its own heading, since it covers every mailbox route and not just the attention view. Merged current main too.

🔍 Technical details
  • Verified: ConnectionBusyError detail "is being saved by another GAIA operation" (src/gaia/connectors/errors.py), mailbox routes fall through to 502 (_raise_calendar_connector_http and the send ladder), and /v1/email/agent/* returns 503 with Retry-After: 1 (agent_routes.py _connectors_error_to_http).
  • CONTRACT.md, spec_html.py and the regenerated specification.html carry the same wording. python -m gaia_agent_email.spec_html --check reports up to date.

No single 403 rule holds across the routes this section covers: the
agent routes answer 401 for a revoked, missing or re-auth-required
connection and 403 only for a missing scope, and a mailbox-route 403 can
also mean the agent isn't granted or the Microsoft tenant doesn't match.
The section now says only what the npm SPEC and SKILL say.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Correction to my earlier push: I've removed the 403 sentence. It wasn't right for every route this section covers. The agent routes answer 401 for a revoked or missing connection, and a mailbox-route 403 can also mean the agent isn't granted access or the Microsoft tenant doesn't match. The section now says what the npm SPEC and SKILL say, and the spec page is regenerated to match.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 29, 2026
Merged via the queue into amd:main with commit 7f9c9f9 Oct 29, 2026
27 of 28 checks passed
grtninja pushed a commit to grtninja/gaia that referenced this pull request Oct 29, 2026
The v0.25.2 notes stopped at the rc2 fixes, so the final would have
shipped without the update offers, the live work timeline, the new-chat
folder chip, and the memory, file-access and Agent UI fixes merged
since. The notes now cover every PR since v0.25.1, add four known issues
with workarounds (amd#5990, amd#6016, amd#6019, amd#6026), and credit all 20 outside
contributors by commit author, including @samjamm1, who wrote amd#5857 and
amd#5969 while @burgulvedant opened them. No version fields change.

**The changelog must be refreshed right before tagging.** It lists the
152 commits on main today. This PR, amd#6023 (flagship 0.3.2) and its
pin-lock PR add at least 3 more, and anything else that lands adds to
that. Regenerate the list and the count from `git log
v0.25.1..<final-sha>` on the commit being tagged.

## Test plan
- [x] `python util/validate_release_notes.py docs/releases/v0.25.2.mdx
--tag v0.25.2`
- [x] `(cd docs && npx -y mintlify@latest validate)`: build validation
passed
- [x] Narrative word budget: 181 of 350
- [x] Changelog count, listed lines and `git log v0.25.1..origin/main
--oneline | wc -l` all read 152; no unescaped `<` or `{`
- [x] `python util/lint.py --release-versions`
- [x] `pytest tests/unit/test_docs_json_release.py
tests/unit/test_doc_version_gate.py tests/unit/test_check_doc_links.py
tests/unit/test_amd_gaia_urls.py` (38 passed)
- [ ] Before tagging: regenerate the Full Changelog against the final
commit
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.

Email agent's served spec page and CONTRACT.md don't say the 'connection is being saved' 502/503 is retryable

3 participants