You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tui: session tabs are shared across TUIs connected to different servers #60887
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
Config: "tabs": { "mode": "on", "scope": "cwd" }.
In directory X, run opencode (local server) and open a session.
In another terminal, in the same directory X, run opencode --server http://<remote>:4096 and open a session there.
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.
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.
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.
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.
Activity
opencodejr commentedon Oct 31, 2026
Thanks for the detailed analysis! I think this is a duplicate of #47998, which reports that saved session tabs in
tui/tabs.jsonare shared between the local and--serverTUIs because nothing in the key identifies the server. It has been reproduced on 2.2.0 and currentdev. 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:
tabs.scope=globaloverwrites the shared tab strip on each launch.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.
YidaWeng commentedon Oct 31, 2026
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
devcode:packages/tui/src/context/session-tabs.tsxpersists{ global, cwd }keyed only by scope/paths.cwd, with no server identity.packages/tui/src/context/storage.tsxreloads 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 ondev.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 closelabel.opencodejr commentedon Nov 1, 2026
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.jsondoesn't record which server a tab belongs to, so local and--serverTUIs 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.