Repository navigation
fix(email): a follow-up can name a thread shown last turn - #5811
Conversation
Find a thread, then ask who said what in it, and the second question failed: the host pushes back only the conversation's words, so the thread id never reached the next turn and the model invented one that Gmail 400'd. The session-scoped email agent now remembers the last 10 threads get_thread and summarize_thread showed (and their mailbox) and attaches them, fenced as untrusted, to the last user turn of the next request. Both tools refuse an id that cannot be a thread id before calling the mail API. Covers hosts that send session_id (the TUI); the Agent UI relay does not yet. Part of amd#2834
|
Verdict: Approve with suggestions Asking a follow-up about an email thread from the previous turn no longer fails in the TUI. The email agent now remembers the last 10 threads it showed and gives their ids back to the model on the next turn. A made-up id now gets a clear "call search_messages first" error before it reaches Gmail. The fix is in the right layer. It only affects sessions that send a session id, the copied history is changed without touching what the host sent, and subjects are flattened to one line and marked as untrusted. I found no correctness bugs.
Real-world evidenceN/A: no evidence bundle was produced for this run. This verdict rests on static review and the author's reported test results. The live follow-up path ( 🔍 Technical detailsIssues 🟡 No live evidence for the user-visible fix. This changes what 🟢 The regex comment cites the issue number ( Checked and fine
Strengths
|
## Why this matters v0.25.2 is a bug-fix release on top of v0.25.1: setup and install no longer stop at the first failed step, shell and file access handle Windows paths and text encodings, the Agent UI and desktop app stop showing misleading states, and document search, email and skills each lose a handful of rough edges. 55 commits since v0.25.1; notes are in `docs/releases/v0.25.2.mdx` and credit 15 outside contributors. ## Test plan - [x] `python util/validate_release_notes.py docs/releases/v0.25.2.mdx --tag v0.25.2` passes - [x] `mintlify validate` (from `docs/`) passes - [x] `python util/check_doc_links.py --internal-only`, `python util/check_doc_versions.py` and `node installer/version/bump-ui-version.mjs --check` pass - [x] `python util/check_component_core_api.py --release-version 0.25.2` passes - [x] `pytest tests/unit/test_docs_json_release.py tests/unit/test_check_component_core_api.py tests/unit/test_release_tag.py tests/unit/test_hub_core_version_gate.py`: 156 passed - [ ] CI green on the merge commit - [ ] `release_train_dryrun.yml` passes on that commit before the RC tag ## Evals to re-run on the RC tag LLM-affecting PRs merged without per-PR evals; run these on `v0.25.2-rc1`: - `gaia_shell` and shell/safety (amd#5794, amd#5751, amd#5768) - `gaia_honesty` (amd#5753) - `gaia_skills_tasks` and `gaia_skills_lifecycle` (amd#5422, amd#5755) - `rag_retrieval` and `rag_quality` (amd#5742, amd#5754, amd#5761, amd#5817, amd#5812) - email scenarios (amd#5767, amd#5811) - `tool_selection` and `error_recovery` (amd#5732) - Claude provider thinking replay (amd#5072) - memory categories (amd#5818 merged; amd#5756 has not) ## Release checklist - [ ] Freeze main, wait for green CI on the exact commit, pass `release_train_dryrun.yml`, then push `v0.25.2-rc1` - [ ] Extend the changelog if main gains commits before the tag
In the Agent UI, a follow-up about an email thread now reads the thread the previous turn found. Before, the email relay never sent the chat's session id, so each turn ran on a brand-new email agent. The thread ids that amd#5811 taught the agent to remember never reached the second turn, so the model invented an id and Gmail answered 400. The TUI already sends the session id. This closes the Agent UI half that amd#5811 left open. - **Older email binaries are safe.** The relay sends `session_id` only to an email sidecar at contract 2.12 or later. Its request model rejects unknown fields, so an older binary would otherwise fail every turn with a 422. - **Switching models mid-chat still works.** With turns now sharing one session agent, a later turn that picked another model would have silently kept the first one. The email sidecar now rebuilds the session's agent on the requested model, and a failed rebuild is a 502 that leaves the session usable. Fixes amd#2834 ## Test plan - [x] `python -m pytest tests/unit/chat/ui`: 2885 passed, 6 skipped. - [x] New relay and dispatch tests: email sends `session_id`; it is withheld from a 2.11 sidecar and sent at exactly 2.12; it is omitted when the chat has none or it is empty; a profile without the floor never sends it; malformed or missing versions make no claim. 11 of these fail on `main`. - [x] Email sidecar: `pytest hub/agents/email/python/tests/test_query_route.py test_thread_id_across_turns_2834.py test_email_agent_routes.py`: 119 passed. New tests: the same model keeps the session agent; a new model rebuilds on it and closes the old agent; an omitted model keeps the current agent; a failed rebuild returns 502, keeps the old agent and releases the session lock. - [x] black, isort, flake8, and the CI path-coverage check. - [ ] Live Agent UI against a real mailbox: run the issue's two turns ("Show me the thread about …", then "who said what"). The second `get_thread` should be `ok=true` in the sidecar log. - [ ] Before merge, dispatch `eval_flagship.yml` for the email/mail categories. The email agent's turn-2 request now carries the thread-reference block in the Agent UI path as well.
In the TUI, finding an email thread and then asking "who said what in it" failed every time. The host pushes back only the conversation's words, so the thread id never reached the second turn: the model made one up and Gmail answered 400. Now the email agent remembers the threads it showed and hands their ids back with the history, so the follow-up reads the right thread. A made-up id gets a clear "call search_messages first" error instead of an opaque API failure.
This covers hosts that keep a session (
session_id, which the TUI sends). The Agent UI's email relay doesn't send one yet, so it still has the bug. That's a separate change, so this is Part of #2834, not a close.Test plan
pytest hub/agents/email/python/tests/test_thread_id_across_turns_2834.py: 24 passed. It covers refusing a placeholder id before the API call, remembering threads from both tools, mailbox routing on the next turn, the cap and ordering, untrusted fencing of subjects, and attaching the ids to a realEmailTriageAgent's next request, including history trimmed down to an assistant turn.hub/agents/email/python/tests,tests/unit/agents/email): 2964 passed. Five fail identically on cleanmainon this machine and are unrelated (test_no_in_process_clicp1252 decode,test_npu_model_wiringenv URL,test_sdist_packaging_2934, two time-window phishing tests).python util/lint.py --allpasses.get_threadisok=true.🔍 Technical details
ReadToolsMixin(lazy per-instance map, capped at 10).EmailTriageAgent._history_for_requestappends it to the last string user turn. If trimming left none, it leads with a user turn so the message order stays valid. Otherwise it logs a warning rather than dropping the ids silently.[A-Za-z0-9+/=_-]{1,512}(fullmatch). That fits Gmail hex ids and GraphconversationIdbase64.displayedCardchange and asummarize_threadrender card were left out, per the issue's re-aimed scope: the fix belongs in the agent so every session-carrying host gets it.