You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agent-email): /query error events carry raw exception text for Lemonade-down instead of actionable copy #2139
The sidecar's /v1/email/query loop emits str(exc) verbatim as the terminal error detail (query_routes.py error path). For the most common consumer failure — Lemonade Server not running/reachable — a raw exception repr reaches the client instead of the actionable "make sure Lemonade Server is running" guidance every other agent surface provides.
PR #2136 mitigates at the host boundary: the Agent UI relay appends an actionable hint when the detail matches connection/timeout-shaped patterns (never replacing the original text). The root fix belongs sidecar-side so ALL /query clients (CLI, gaia api, third-party) get actionable copy, not just the Agent UI: classify connection-shaped failures from the sidecar's own Lemonade client and emit the standard guidance in the error event detail, keeping the original exception text appended for debugging.
Acceptance: with Lemonade stopped, POST /v1/email/query returns a terminal error event whose detail leads with actionable guidance (what failed, what to do, where to look) and a test feeds a realistic ConnectionError (not a hand-written friendly string).
Ships via the agent release pipeline (hub/agents/python/email), independent of #2136.
Confirmed — this is a real gap, and the fix belongs sidecar-side as you describe. When the agent run fails, the terminal error carries the raw exception text with no actionable guidance, so a Lemonade-down failure reaches every /query client (CLI, gaia api, third-party) as an opaque repr rather than "what failed / what to do / where to look." PR #2136 only patches the Agent UI relay, so those other clients stay in the dark.
The right place to classify is where the exception is first caught and turned into the terminal error event, appending the original text for debugging rather than replacing it — exactly the shape your acceptance criteria call for. Good call insisting the test drive a realistic ConnectionError through the real path instead of asserting on a hand-written friendly string; that's the difference between proving the classifier fires and just proving a constant exists.
One thing to nail down: reuse the canonical Lemonade-unreachable copy the rest of GAIA already emits rather than writing new wording here, so the guidance is consistent across surfaces.
🔍 Technical details
Error path: hub/agents/python/email/gaia_agent_email/query_routes.py:346-348 — except Exception as exc: ... handler._emit({"type": "agent_error", "content": str(exc)}). That str(exc) is the raw repr that surfaces in the terminal error {detail} event (contract §3, canonical event set at query_routes.py:256-261).
Fix shape: classify connection/timeout-shaped failures from the sidecar's own Lemonade client at this catch site and lead the detail with actionable guidance, then append the original str(exc) for debugging. This keeps the "no silent fallback / fail loudly + name what to do" rule from CLAUDE.md and covers all clients, not just the Agent UI relay from feat(ui): route email chat through the sidecar /v1/email/query loop (V2-10) #2136.
Reuse existing copy: the canonical actionable pattern ("not reachable at …", "Run gaia init … or set LEMONADE_BASE_URL") lives in the core install/init paths (e.g. src/gaia/installer/init_command.py, and LemonadeClientError / LemonadeAuthError at src/gaia/llm/lemonade_client.py:496-500). Prefer classifying on the client's own exception types over string-matching the message.
Docs sync: per CLAUDE.md's bundled-doc rule, if the error contract is described in the email agent's CONTRACT.md / SPEC-equivalent / openapi.email.json, update the error-detail wording there in the same change.
Adjacent error-copy problem worth folding in: when a multi-step email turn exceeds the AgentUI→sidecar relay read-timeout (300s, src/gaia/ui/email_sidecar/relay.py:334) on slow inference, the user-facing error is "Email agent stream ended unexpectedly (the sidecar may have crashed). Check the sidecar log…" — but the sidecar had not crashed (still healthy, gaia daemon agents shows it running; the daemon log shows a clean Read timed out, not a crash). Reproduced 2× on t-win-acer-swft (iGPU ~12 tok/s) with "What meetings are being requested in my inbox?" (5-step loop). The message misattributes a timeout to a crash and sends the user log-hunting for a process that's fine. Root perf driver is the NPU FLM model not being downloaded (falls back to iGPU); but the message should say "timed out after 300s" not "may have crashed".
Repro on a second machine (no-NPU Ryzen 7 PRO 6850U, iGPU ~60–90s per agent step). Bulk triage of 15 messages via the Agent-UI stream surfaced an agent_error at ~317s while the sidecar kept triaging server-side — the log shows triage_decision / triage_dispatch entries continuing after the stream had already errored and closed. Matches the 300s relay read-timeout described here: the client sees a "failure" but the tool is still running to completion. No ctx-overflow was involved (that part completed fine).
Activity
github-actions commentedon Jul 16, 2026
Confirmed — this is a real gap, and the fix belongs sidecar-side as you describe. When the agent run fails, the terminal error carries the raw exception text with no actionable guidance, so a Lemonade-down failure reaches every
/queryclient (CLI,gaia api, third-party) as an opaque repr rather than "what failed / what to do / where to look." PR #2136 only patches the Agent UI relay, so those other clients stay in the dark.The right place to classify is where the exception is first caught and turned into the terminal error event, appending the original text for debugging rather than replacing it — exactly the shape your acceptance criteria call for. Good call insisting the test drive a realistic
ConnectionErrorthrough the real path instead of asserting on a hand-written friendly string; that's the difference between proving the classifier fires and just proving a constant exists.One thing to nail down: reuse the canonical Lemonade-unreachable copy the rest of GAIA already emits rather than writing new wording here, so the guidance is consistent across surfaces.
🔍 Technical details
hub/agents/python/email/gaia_agent_email/query_routes.py:346-348—except Exception as exc: ... handler._emit({"type": "agent_error", "content": str(exc)}). Thatstr(exc)is the raw repr that surfaces in the terminalerror {detail}event (contract §3, canonical event set atquery_routes.py:256-261).detailwith actionable guidance, then append the originalstr(exc)for debugging. This keeps the "no silent fallback / fail loudly + name what to do" rule from CLAUDE.md and covers all clients, not just the Agent UI relay from feat(ui): route email chat through the sidecar /v1/email/query loop (V2-10) #2136.gaia init… or setLEMONADE_BASE_URL") lives in the core install/init paths (e.g.src/gaia/installer/init_command.py, andLemonadeClientError/LemonadeAuthErroratsrc/gaia/llm/lemonade_client.py:496-500). Prefer classifying on the client's own exception types over string-matching the message.CONTRACT.md/SPEC-equivalent /openapi.email.json, update the error-detail wording there in the same change.hub/agents/python/email), as noted.itomek commentedon Jul 23, 2026
Adjacent error-copy problem worth folding in: when a multi-step email turn exceeds the AgentUI→sidecar relay read-timeout (300s,
src/gaia/ui/email_sidecar/relay.py:334) on slow inference, the user-facing error is "Email agent stream ended unexpectedly (the sidecar may have crashed). Check the sidecar log…" — but the sidecar had not crashed (still healthy,gaia daemon agentsshows it running; the daemon log shows a cleanRead timed out, not a crash). Reproduced 2× on t-win-acer-swft (iGPU ~12 tok/s) with "What meetings are being requested in my inbox?" (5-step loop). The message misattributes a timeout to a crash and sends the user log-hunting for a process that's fine. Root perf driver is the NPU FLM model not being downloaded (falls back to iGPU); but the message should say "timed out after 300s" not "may have crashed".itomek-amd commentedon Jul 23, 2026
Repro on a second machine (no-NPU Ryzen 7 PRO 6850U, iGPU ~60–90s per agent step). Bulk triage of 15 messages via the Agent-UI stream surfaced an
agent_errorat ~317s while the sidecar kept triaging server-side — the log showstriage_decision/triage_dispatchentries continuing after the stream had already errored and closed. Matches the 300s relay read-timeout described here: the client sees a "failure" but the tool is still running to completion. No ctx-overflow was involved (that part completed fine).fix(agent-email): actionable copy for Lemonade-down /query errors (am…
fix(email): don't misclassify timeouts as Lemonade-down (amd#2139 fol…
Release v0.23.0 (amd#2374)