Skip to content

fix(tui): preserve session route on transient errors - #39419

Closed
kitlangton wants to merge 1 commit into
v2from
preserve-session-route
Closed

kitlangton wants to merge 1 commit into
v2from
preserve-session-route

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Keep the selected session route when session hydration fails for a transient reason. Existing sessions remain navigable after the managed background service reconnects instead of appearing to disappear.

Before / After

Before: Selecting an existing session started its hydration requests. If the background service was stopping or restarting, a transient transport error or undeclared 503 rejected hydration. The session route treated every rejection as if the session did not exist and immediately navigated home, so repeatedly selecting old sessions appeared to do nothing.

After: Only a decoded SessionNotFoundError navigates home. Other hydration failures still surface a toast, but the selected route remains intact. The existing connection-status effect can hydrate that same session when the event stream reconnects.

How

  • packages/tui/src/routes/session/index.tsx uses the generated isSessionNotFoundError guard before discarding the current route.
  • The actual not-found path is unchanged.

Scope

This PR does not retry arbitrary API mutations or change managed-service restart behavior. It only prevents transient session-load failures from being misclassified as missing sessions.

Testing

  • bun typecheck from packages/tui
  • bun run test test/cli/tui from packages/tui: 129 passed, 1 skipped
  • Push hook: bun turbo typecheck --concurrency=3: 33 packages passed

Demo

No recording attached. The visible failure depends on hitting the managed-service replacement window; the change preserves the route at the exact error boundary without simulating a successful server response.

Flow

sequenceDiagram
    participant User
    participant TUI
    participant Service

    User->>TUI: Select existing session
    TUI->>Service: Hydrate session
    Service-->>TUI: Transient failure during restart
    TUI->>TUI: Keep selected route and show error
    Service-->>TUI: Event stream reconnects
    TUI->>Service: Hydrate selected session again
    Service-->>TUI: Existing session
Loading

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant