Skip to content

feat(tui): prototype missing location recovery - #42353

Merged
kitlangton merged 12 commits into
v2from
recovery-panel
Aug 13, 2026
Merged

feat(tui): prototype missing location recovery#42353
kitlangton merged 12 commits into
v2from
recovery-panel

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What

Add a persistent recovery surface when a session's location cannot initialize.

The transcript remains readable, the durable model identity remains visible in existing message chrome, and the normal composer is replaced with a focused Choose directory action using the same question-panel pattern as permissions.

Before / After

Before

  1. A session's directory is deleted.
  2. Location-scoped reads fail.
  3. The durable session and transcript still exist, but the TUI presents secondary symptoms such as an unavailable model.
  4. The user has no clear recovery action in the composer.

After

  1. The session route retains the failed location synchronization state.
  2. The transcript remains mounted.
  3. The composer is replaced with Session location unavailable, the abbreviated path, and Choose directory.
  4. The action opens the existing Move session dialog, scoped to cataloged directories for the same project.
  5. An unavailable current directory is not synthesized into the picker.
  6. A successful destination sync clears the recovery state and restores the composer.

How

  • packages/tui/src/context/location.tsx retains the latest location synchronization error and clears it before each retry.
  • packages/tui/src/routes/session/permission.tsx exposes the existing question-panel shell as SessionQuestion without changing permission behavior.
  • packages/tui/src/routes/session/location-missing.tsx renders the recovery prompt through that shared shell.
  • packages/tui/src/component/dialog-move-session.tsx treats the project directory catalog as authoritative and flattens category headers while searching.
  • Storybook mounts the production recovery panel and move dialog with fixture directories.

Scope

  • The client currently knows only that location initialization failed. It cannot prove the directory is missing rather than config, plugin, or catalog initialization failing. Typed server-side location status remains follow-up work.
  • This PR does not fix orphaned-session move semantics, absolute /cd handling, or CLI HTTP error exits.
  • The Storybook fixture handles the final selection locally; it does not call the server move endpoint.

Testing

  • bun typecheck from packages/tui
  • bun run test test/new-session-location.test.ts from packages/tui (3 passing)
  • bun run test test/cli/tui/data.test.tsx was attempted twice; 22 event-stream tests timed out with the fixture stuck in reconnecting
  • Commit hook: bun turbo typecheck --concurrency=3 (34 tasks passing)
  • OpenCode Drive walkthrough of the production recovery panel and project-scoped picker

Demo

recording-9aefae1b-1e09-43ae-b96c-0fb83d0833c5.mp4

Project-scoped recovery directory picker

Flow

flowchart TD
  A[Open durable session] --> B{Location sync succeeds?}
  B -- Yes --> C[Normal composer]
  B -- No --> D[Keep transcript visible]
  D --> E[Show recovery panel]
  E --> F[Open Move session]
  F --> G{Destination sync succeeds?}
  G -- Yes --> C
  G -- No --> E
Loading

@kitlangton

Copy link
Copy Markdown
Contributor Author

The OpenCode Drive recording is now attached in the PR body. The control timeout was a real simulation bug: an unfocused ui.state response contained nested undefined, so JSON-RPC encoding defected before sending a response. The focused fix and regression test are in #42360.

@kitlangton

Copy link
Copy Markdown
Contributor Author

Updated the prototype to follow the existing permission/question-panel pattern. Storybook now mounts the actual production SessionLocationMissing component instead of redrawing the recovery flow. The PR body has a replacement OpenCode Drive recording and screenshot.

@kitlangton
kitlangton marked this pull request as ready for review August 13, 2026 17:24
@kitlangton
kitlangton enabled auto-merge (squash) August 13, 2026 17:35
@kitlangton
kitlangton disabled auto-merge August 13, 2026 20:39
@kitlangton
kitlangton merged commit 7b89f06 into v2 Aug 13, 2026
11 of 12 checks passed
@kitlangton
kitlangton deleted the recovery-panel branch August 13, 2026 20:39
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