Repository navigation
Conversation
Removes all in-process EmailTriageAgent wiring from the Agent UI and replaces it with a thin bridge that calls EmailTriageService directly — the same object the mounted /v1/email/triage route uses — so no live OAuth or inbox scan is required for a chat turn. - _session_mail_provider() removed; mail_provider= kwarg dropped from both registry.create_agent() call sites (non-streaming + streaming paths). - pre_scan_inbox removed from SSEOutputHandler._RENDER_TOOL_TO_LANG (map is now empty; EmailPreScanCard remains dormant per #1778 follow-up). - sessions.py evict trigger: mail_provider is not None condition dropped; agent eviction still fires on agent_type/device changes. - _parse_email_from_text + _email_rest_bridge added to _chat_helpers.py; both streaming and non-streaming paths intercept agent_type=="email" and route through the bridge before the agent cache / registry dispatch. - Tests: test_session_mail_provider.py deleted; TestStructuredRenderInjection rewritten to guard the mechanism (not the removed pre_scan entry); test_email_rest_bridge.py added (16 tests covering parse, bridge, error surfaces, rip-out canaries).
- Remove dead AGENT_NOT_GRANTED exception branch: EmailTriageService.triage_request never raises 403 (no grant check in the triage path). Replaced with fail-loud re-raise for unexpected errors (no silent swallowing). - Replace fabricated 403 mock test with test_unexpected_service_error_propagates which verifies fail-loud behavior for real unexpected errors. - Use result.category.value instead of result.category to render the bare enum string without the Python repr wrapper. - Move deferred imports (LLMTriageError, EmailSummarizeError) outside the try block so ImportError is a startup crash, not a silent mishandled exception.
Review: rip out in-process email agent → REST bridge (#1653)Summary Clean, well-tested rip-out: the in-process The one thing to fix before merge: the non-streaming email path runs a blocking LLM triage call directly on the asyncio event loop, while every other slow path here defers to a worker thread. Separately, Issues 🟡 Non-streaming bridge blocks the event loop ( 🟡 Stale user-facing docs ( 🟡 Broad 🟢 Docstring overstates grant handling ( 🟢 Permissive keyword set ( 🟢 Private-symbol coupling — importing Strengths
Verdict: Request changes — the event-loop block and the stale email guide are the two items to resolve; the rest are minor. Nice, disciplined rip-out otherwise. |
…tion) itomek closed #1767/#1785 because mixing an npm package requiring Node.js into the Python-backed Agent UI is too dirty. Remove that entirely: the Python backend fetches the binary itself (verified SHA-256 download, no npx), spawns it, and proxies over HTTP. No Node runtime, no npm package in the UI's path. The npm package remains the external Node-integrator channel only.
…modes (amd#1882) ## Why this matters Improving the email agent and getting the fix into the Agent UI today means a freeze → \`npm publish\` → version-bump → re-integrate loop — slow, and a wall of patches just to test a change. This plan removes that loop and lets the UI triage **personal Gmail** through two modes over one shared REST contract: - **User mode** runs the exact **frozen sidecar published to the Agent Hub** (pinned via \`binaries.lock.json\`), lazily downloaded on first email use — so the Agent UI **validates the shipped product**, keeps the core install **lightweight** (no email deps), and gets crash isolation. - **Dev mode** runs the same contract from local Python source via \`uvicorn --reload\` — edit a \`.py\` and the next chat action hits new code, no freeze/publish/patch. Both read the same \`~/.gaia\` Google grant, so personal Gmail works identically in each; the mode only swaps which process answers the calls. This PR is **docs-only** — the implementation plan, for review before any code lands. It went through an independent architecture review and was corrected twice: the original draft wrongly assumed the renderer calls a REST sidecar (it's actually chat-loop + SSE cards, in-process today), and it has to be **sequenced behind the in-flight REST capability build-out** (inbox pre-scan + amd#1779/amd#1780/amd#1781) since the sidecar contract is triage/draft/send-only right now. ## Decision needed before build This **pivots from epic amd#1767's in-process-mount decision** (whose capstone PR amd#1785 was closed unmerged 2026-06-26). Needs maintainer + @itomek sign-off to supersede it, plus confirmation to remove the redundant in-process \`/v1/email\` mount (amd#1768). ## Test plan - [ ] Review \`docs/plans/email-sidecar-agent-ui.md\` — architecture, the user↔dev seam, fail-loud handling - [ ] Confirm the sidecar-over-in-process rationale (product validation + lightweight core + isolation) is the direction we want - [ ] Confirm the precondition/sequencing on the REST build-out (amd#1779/amd#1780/amd#1781 + pre-scan) is correct - [ ] Confirm the amd#1767 supersede and amd#1768 mount-removal calls with @itomek
Closes #1653. The Path-2 capstone for the email-in-Agent-UI epic #1767.
Why this matters
Before: the Agent UI's email experience was a legacy in-process chat-loop agent embedded in the UI backend. After: the in-process email path is gone entirely — an
agent_type:"email"interaction routes through a thinEmailRestBridgeto the packaged email agent's triage service (the samegaia_agent_emailservice the/v1/emailREST surface serves, #1768). No in-processEmailTriageAgent, nomail_provider→create_agentdispatch.Option C (agreed): the UI keeps triage/draft/send; pre-scan/archive/calendar/search were agent-loop-only and are deferred to #1778/#1779/#1780/#1781.
mail_providercolumn, connector grant flow, and the (now dormant) frontend cards are kept.Evidence
_session_mail_provider→ 0 occurrences;_RENDER_TOOL_TO_LANG["pre_scan_inbox"]mapping removed;test_session_mail_provider.pydeleted._chat_helpers._email_rest_bridgeparses an email from the user's message and callsgaia_agent_email's triage service in-process (no HTTP round-trip), formats the schema-2.0 result as markdown.python -m pytest tests/unit/chat/ui/test_email_rest_bridge.py tests/unit/chat/ui/test_sse_handler.py -q→ 213 passed (16 new bridge tests + rewritten render-injection suite). Frontendnpm run buildclean;util/lint.py --allclean.Test plan
python -m pytest tests/unit/chat/ui/test_email_rest_bridge.py tests/unit/chat/ui/test_sse_handler.py -v→ greenagent_type:"email"→ paste an email → triage output;"run a pre-scan"→ guide (in-process scan removed)