Skip to content

bug(workspace): "lost track of this turn" is a dead end — the reply lands but the UI never recovers (no poll, no badge, no push) #2319

Description

@trinity-ability

Context

The #2120 → #2133 → #2214 chain (shipped in v0.9.0) made the Workspace wait for a reply on the server's own budget: the 202 carries wait_budget_seconds = 2 × (execution_timeout_seconds + 10 + 300) + 60 (≈2h11m for the 3600s default), the in-flight marker gets the same TTL, and reattach rides the marker's remaining TTL. That fixed the pre-v0.9.0 behavior where every Workspace turn longer than ~21 minutes ended in:

Still no reply — we've lost track of this turn. It may still finish; check the conversation shortly.

The residual

When the client does reach the lost state, it is a terminal dead end:

  • awaitPersistedReply returns {lost: true} and all watching stops (PortalConversation.vue:754-760). No slow background poll, nothing.
  • The message tells the user to "check the conversation shortly", but the UI never does that itself: when the reply later persists, the open thread never renders it, and the sidebar unread badge never appears — sessions-changed is only emitted from the very closure that just gave up, and per bug: Agent Detail and Workspace over-fetch on load (21 redundant requests, N+1 roster) #2198 the thread list is purely event-driven (no interval, no visibilitychange handler, no portal-facing WS/SSE push). The user has to manually switch threads or reload.
  • The wording is the same regardless of what the server says at the deadline. The client's last history read knows whether in_flight_execution_id is still set — "your task is still running, the reply will appear here" and "we genuinely lost it" are different situations rendered with one pessimistic message.
  • The lost state is still reachable routinely for a new client against a pre-bug: Workspace chat turns are hard-capped at 300s, ignoring the agent's configured execution timeout #2214 backend: resolveWaitBudgetMs deliberately under-waits at the frozen 1280s fallback (documented in portalUtils.js — correct, but it makes graceful post-lost handling matter more, since mixed-version fleets will show this exact message on every >21min turn).

Suggested handling

Any subset; the constraint that must survive is never offer Retry for a turn that may have run (#2120's double-billing hazard):

  1. Post-lost slow poll: after lost, keep polling history at a wide interval (30–60s) bounded by the marker: while the server still reports the turn in-flight, render a "still working — taking longer than expected" state instead of the terminal message; when the marker clears, one final read either renders the reply or reports the honest no-answer.
  2. Word by marker state at the deadline: marker alive → "still running"; marker gone + no reply → today's message.
  3. Badge recovery: refreshThreads on visibilitychange/thread re-open so the unread badge surfaces a reply that landed after the client stopped watching.

Acceptance criteria

Ops note (not part of this issue)

The common cause of the message today is version skew, not this residual: instances must run v0.9.0 on both backend and frontend to get the per-agent budget, and agents that legitimately run long need execution_timeout_seconds raised (PUT /api/agents/{name}/timeout, 60–7200) — the Workspace budget follows it.

Related: #2120, #2133, #2214, #2198, abilityai/trinity-enterprise#286, abilityai/trinity-enterprise#358

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-mediumComplexity: medium (board points 5-8)priority-p2Importantstatus-readyGreenlit and ready for development (vetted; counterpart to status-incubating)theme-ui-uxTheme: UI/UXtype-bugBug fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions