Repository navigation
Description
Summary
In Session mode (the --resume chat surface), sending a message that triggers a long stretch of agent work surfaces a "Failed to send message" error in the UI even though the backend execution is running normally and completes successfully — the assistant reply lands in the DB and appears on a later refresh, contradicting the failure shown to the user.
This is the same class of false-failure as the previously-fixed #759 (bug(session-tab): shows 'failed to send' on return navigation while execution is still running), but for the stay-on-page, long-running turn path rather than the navigate-away-and-return path. Both existing mitigations are in place yet the symptom still reproduces, so this is filed as a distinct bug.
Context
The Session-tab turn endpoint (POST /api/agents/{name}/sessions/{id}/message) is synchronous — the browser holds the HTTP request open for the full duration of the agent's turn. Two mitigations already exist:
- HTTP-timeout ceiling match — the axios call in
src/frontend/src/stores/sessions.jssetstimeout: 7260000(~121 min) to match the backend execution cap (TIMEOUT-001, 7200s + slack). The inline comment there describes exactly this symptom as the old behavior the ceiling was meant to remove. - Reattach on return navigation (bug(session-tab): shows 'failed to send' on return navigation while execution is still running #759) — a Redis in-flight sentinel (
session_inflight:{session_id}) surfaces asturn_in_progress=trueon the session GET; the frontendstartPolling()reattaches and shows a "running" indicator instead of a failure.
Despite both, users with heavy/long turns still see the false failure. The most likely remaining causes:
- A reverse-proxy read timeout shorter than the axios ceiling (e.g. nginx
proxy_read_timeout, or a Cloudflare ~100s edge timeout) severs the synchronous socket before the backend finishes. The 121-min axios ceiling cannot help if an intermediary closes the connection first — axios sees a network error and thecatchinsendMessagerenders "Failed to send message". - The stay-on-page error path does not reattach: the
catchblock insendMessage(src/frontend/src/stores/sessions.js) setserrorBySession[sessionId]unconditionally on any thrown error. Unlike the navigation path, it never checksturn_in_progress/ the latest assistant message before declaring failure. The poll-reattach (startPolling) only fires ononActivated(KeepAlive return), and is itself capped atMAX_ATTEMPTS = 60(~22 min), so a turn longer than ~22 min on the polling path also gives up.
Steps to Reproduce
- Open an agent's Session tab (session mode ON).
- Send a message that triggers a long stretch of work (many tool calls / large task), longer than the deployment's reverse-proxy read timeout.
- Stay on the page.
- Observe: UI shows "Failed to send message" while the agent is still working.
- Wait / refresh: the assistant reply appears — the turn actually succeeded.
Expected Behavior
A long-running Session-mode turn must never surface "Failed to send message" while the backend execution is still running or has already succeeded. On a client-side request error, the UI should check whether the turn is still in progress (or whether an assistant reply has landed) and reattach to the in-flight/completed turn rather than rendering a failure.
Acceptance Criteria
- A Session-mode turn that outlives any intermediary connection timeout never shows a false "failed to send" while the execution is running or has succeeded.
- On a client-side error from the synchronous turn request,
sendMessagechecksturn_in_progress/ latest assistant message and reattaches (poll/stream) instead of unconditionally settingerrorBySession. - The reattach/poll path is not capped below the agent's max execution timeout (or polling falls back cleanly so a >22-min turn isn't abandoned).
- If a reverse-proxy read timeout is severing the synchronous socket, it is identified and either raised to match the execution cap or the turn is made resilient to a dropped synchronous connection.
- A genuine backend failure still surfaces a real error (no regression of true-failure reporting).
Technical Notes
- Frontend false-failure path: the
catchinsendMessage—src/frontend/src/stores/sessions.js. - Existing reattach machinery to reuse:
turn_in_progressflag +startPolling()(src/frontend/src/stores/sessions.js),SessionPanel.vueonActivatedreattach. - Backend: synchronous turn endpoint +
session_inflight:{session_id}sentinel insrc/backend/routers/sessions.py. - Related (fixed) prior art: bug(session-tab): shows 'failed to send' on return navigation while execution is still running #759 (return-navigation variant). This bug is the stay-on-page / proxy-timeout variant.
- Check deployment proxy config (
proxy_read_timeout/ Cloudflare edge timeout) against the TIMEOUT-001 execution cap.
Activity
AndriiPasternak31 commentedon Jun 29, 2026
/claim
github-actions commentedon Jun 29, 2026
Claimed by @AndriiPasternak31. Label
status-in-progressadded.Next steps:
feature/1376-<short-slug>Fixes #1376fix(session): reconcile severed long turns against server state — no …
fix(test): session-tab e2e — reach session mode via ?tab=session (#1378…
feat(workspace): absorb the Session surface, with continuity parity (…
fix(assistant): the sign-in exchange is person-pinned, audited and an…
feat(assistant): connect Claude by pasting a token from claude setup-…