Skip to content

fix(tui): recover safely from invalid session routes - #1937

Open
jnhu76 wants to merge 1 commit into
XiaomiMiMo:mainfrom
jnhu76:fix/session-resume-invalid-id
Open

fix(tui): recover safely from invalid session routes#1937
jnhu76 wants to merge 1 commit into
XiaomiMiMo:mainfrom
jnhu76:fix/session-resume-invalid-id

Conversation

@jnhu76

@jnhu76 jnhu76 commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Fix the TUI black screen caused by failed session-route loads.

This covers two entry paths:

  • mimo -c, where the TUI previously started on a fabricated sessionID: "dummy" route.
  • Malformed or nonexistent mimo -s <session-id> values, where a failed session load could leave the TUI stuck on an unloadable route.

Fixes #1809.
Fixes #1936.

Root cause

The --continue path used "dummy" as its initial session route while waiting to resolve a real session.

The session page then called session.get() with throwOnError: true from an asynchronous SolidJS effect without a complete rejection boundary. A 400, 404, network failure, or another rejection could therefore leave the route pointing at a session that could never load, resulting in a black screen.

The same missing recovery path could be reached through malformed or nonexistent values supplied using --session/-s.

Changes

app.tsx

  • Remove the fabricated "dummy" initial route for --continue.
  • Start on Home and navigate only after resolving a real resumable session.
  • Give an explicit --session value priority over --continue.
  • Mark the continue decision as complete when no resumable session exists, preventing a session created later from being resumed unexpectedly.
  • Show a visible notification when there is no previous session to continue.

routes/session/index.tsx

  • Call sdk.client.session.get() without throwOnError: true, allowing ordinary HTTP failures to be handled as results.
  • Show Session not found for 404 responses and a generic load error otherwise, then navigate back to Home.
  • Add a final catch boundary for unexpected fetch, parsing, interceptor, or session-sync rejections.
  • Check that the route is still current after session fetch, workspace bootstrap, and session sync before applying additional effects.
  • Prevent stale asynchronous work from scrolling, navigating, or showing errors on a newly selected route.
  • Avoid echoing the raw user-supplied session value in terminal notifications.

Scope

  • Two production files changed.
  • One commit.
  • No new session-ID regex or global identifier contract.
  • No changes to thread.ts, attach.ts, or the lockfile.

Verification

  • All 21 existing TUI test files: PASS (121 tests)
  • bun typecheck: PASS
  • Local workspace typecheck via Turbo (12 packages): PASS

Fault injection and renderer-level CPU profiling were not automated. The change ensures that failed session loads terminate in a visible and recoverable Home-route state.

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

Labels

None yet

Projects

None yet

1 participant