Skip to content

[FEATURE]: let /tui/select-session move an attached TUI to the session's directory #53394

Description

@moritzWa

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

POST /tui/select-session can only open a session in the TUI's current directory. If the session belongs to another directory, the TUI shows it but keeps the old directory's agents, commands, file search and @ completions.

I'd like an optional targetDirectory on the request. When it's set and differs from the TUI's directory, the TUI points its SDK client at that directory, reloads its directory-scoped data, then shows the session. Omitting it keeps today's behavior.

Use case: one opencode serve with a single attached TUI used as a viewer, plus an external session picker (a dashboard listing sessions across all projects) that switches it between sessions in different repos. Today the only option is to kill the TUI and re-attach it in the new directory, which takes a few seconds and loses its state.

This builds on #52869 (the optional client id on the same endpoint) and is related to #45963 (selecting a session from plugins). The change is small: the event schema, context/sdk.tsx gets a setDirectory, and the tui.session.select handler in app.tsx. It also has to show the session before the new directory's session list arrives, which #53392 makes possible. I've been running it in my own build daily and can open a PR if this sounds good.

Activity

github-actions commented on Oct 5, 2026

@github-actions
Contributor

This issue might overlap with existing cross-project session-switching requests. Please check:

  • #31932: requests a runtime directory API for plugins to resume a session from another project without restarting.
  • #14406: requests switching between projects within the same running TUI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions