Skip to content

tui: session tabs are shared across TUIs connected to different servers #60887

Closed as duplicate

Description

@chriswritescode-dev

Description

Session tabs leak between TUIs connected to different servers. With a local TUI and a --server <remote> TUI open in the same directory, tabs from one server show up in the other, and tab titles duplicate/flip when switching tabs.

Cause: packages/tui/src/context/session-tabs.tsx persists tabs to the shared tui/tabs.json keyed only by global or cwd[paths.cwd], with no server identity. context/storage.tsx watches the state directory and reloads every store on any write, so each TUI picks up the other server's session IDs. It can't resolve them via data.session.get, falls back to the persisted title, and the normalize effect in each process rewrites the shared entry with its own view.

Suggested fix: include the server URL in the persisted key (e.g. cwd[\${server}\0${cwd}`], or a per-server level above global/cwd`).

Plugins

Local plugins (none touch tab storage); one plugin relaunches the TUI with --server, but the same happens with plain opencode --server.

OpenCode version

2.2.5 (also unchanged on current dev)

Steps to reproduce

  1. Config: "tabs": { "mode": "on", "scope": "cwd" }.
  2. In directory X, run opencode (local server) and open a session.
  3. In another terminal, in the same directory X, run opencode --server http://<remote>:4096 and open a session there.
  4. Switch tabs in either TUI: the other server's session appears in the tab list, and titles duplicate.

Screenshot

Local TUI sidebar showing a tab ("Flux container to GPU 0") that belongs to the remote server.

Operating System

macOS (Darwin 25.6.0 arm64)

Terminal

Warp

Activity

  1. opencodejr commented on Oct 31, 2026

    @opencodejr

    Thanks for the detailed analysis! I think this is a duplicate of #47998, which reports that saved session tabs in tui/tabs.json are shared between the local and --server TUIs because nothing in the key identifies the server. It has been reproduced on 2.2.0 and current dev. The duplicated or flipping titles you see with two TUIs open at once come from the same unscoped key.

    Possible duplicates and related issues, most likely first:

    If you have anything to add, such as the two-TUIs-at-once behaviour, please comment on #47998. The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. YidaWeng commented on Oct 31, 2026

    @YidaWeng

    This is a duplicate of #47998 ("tui: saved tabs are shared between local and remote servers"), which has the same reproduction and root cause.

    Your diagnosis matches the current dev code:

    • packages/tui/src/context/session-tabs.tsx persists { global, cwd } keyed only by scope/paths.cwd, with no server identity.
    • packages/tui/src/context/storage.tsx reloads every store when the state directory changes, so each TUI adopts the other server's session IDs and then normalizes the shared entry from its own view.

    There is prior implementation work in #47999 (per-server serverIdentity, per-server tab and terminal state, with tests), which was closed by automated cleanup rather than rejected. I've asked on #47998 whether the assignee is actively working on it and offered to revive that work rebased on dev.

    Closing this in favor of #47998 is fine from my side; I'll leave the actual close to the maintainers since it already carries the pending close label.

  3. opencodejr commented on Nov 1, 2026

    @opencodejr

    Closing this as a duplicate of #47998, since there hasn't been a reply in the past day. Both come from the same cause: tui/tabs.json doesn't record which server a tab belongs to, so local and --server TUIs share and overwrite each other's tabs. Please follow #47998 for updates. Your notes on two TUIs live-reloading each other's tabs and flipping titles would be useful there. If your problem turns out to be different, reply here and we can reopen.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions