feat(tui): add session migration dialog#23250
Open
sim590 wants to merge 17 commits intoanomalyco:devfrom
Open
Conversation
# Conflicts: # packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx # packages/opencode/src/config/config.ts # packages/opencode/src/server/routes/instance/session.ts # packages/opencode/src/session/index.ts
Use a getter for gutter JSX to fix reactivity loss after filtering. Add ctrl+d keybind to delete sessions with double-press confirmation. Add orphan legend (!) indicator in the bottom bar.
# Conflicts: # packages/opencode/src/config/config.ts # packages/opencode/src/config/keybinds.ts # packages/opencode/src/config/provider.ts # packages/opencode/src/util/effect-zod.ts # packages/opencode/test/util/effect-zod.test.ts
Author
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Issue for this PR
Closes #23249
Type of change
What does this PR do?
Adds a session migration dialog accessible via
ctrl+ofrom the session list. This allows users to:Recover orphaned sessions — When a project directory is renamed or moved (Sessions become orphaned when project directory is renamed #23248, Session lookup fails with NotFoundError when PTY spawned from non-git directory context #8538), sessions become invisible because their
directoryfield points to a path that no longer exists. The migration dialog shows all sessions across all projects, marks orphaned ones with a yellow!indicator, and allows moving them to the correct project.Intentionally migrate sessions between projects — When work was started in the wrong project, users can move the session (with its full conversation history) to another project rather than starting over.
Delete orphaned sessions — Since orphaned sessions don't appear in the normal
/sessionslist, the migration dialog is the only place where they can be found and deleted (ctrl+dwith double-press confirmation).How it works:
/experimental/session(bypassing the SDK's automatic directory filtering) and identifies orphans via a newGET /session/orphansendpoint.project_idanddirectoryon the session and its children (sub-agents) via a newPOST /session/:sessionID/migrateroute.Files changed:
dialog-session-migrate.tsx— New migration dialog componentdialog-session-rescue.tsx— New destination picker componentdialog-session-list.tsx— Addedctrl+okeybind to open migration dialogkeybinds.ts— Addedsession_migratekeybind (default:ctrl+o)session/session.ts— AddedlistOrphans()andmigrate()functionsserver/routes/instance/session.ts— Added orphans and migrate routessdk/js/src/v2/gen/— Regenerated SDK with new endpointsNote: This does not fix the root cause of orphaned sessions (#23248). An automatic fix in
fromDirectory()to update session directories when a project worktree changes would still be valuable, but involves subtleties (e.g. multiple clones of the same repository sharing a project ID).Possible future improvements:
How did you verify your code works?
Tested manually on Linux (Alacritty terminal):
!indicator appears and persists after filtering)/sessionsimmediatelybun typecheckpasses with zero errorsScreenshots / recordings
Migration dialog showing all sessions with orphaned ones marked with
!:Destination picker after selecting a session:
Checklist