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
Design: Treat session tabs as containers, not session views #541
PR #525 implements session tab persistence, but the current model conflates tabs and sessions. This issue proposes a design where tabs are containers and sessions are content, similar to Neovim's window/buffer relationship.
Design Proposal
Core principle: Persist the tab (container), not the session (content).
Neovim
opencode.nvim
Role
window
session tab
Container, persists independently
buffer
agent session
Content, can be created/deleted
Operation Semantics
Operation
Container Effect
Content Effect
<M-c> (new tab)
New container created
New session created and filled
<C-a> (select session)
Container unchanged
Swap to existing session
<C-n> (new session)
Container unchanged
Replace with new session
Key: <M-c> creates container + fills it so user can chat immediately. <C-a>/<C-n> only change what the container holds.
Bugs Found in Current Implementation
Bug 1: Tabs created before panel open are lost
Open Neovim, do NOT open panel
Press <M-c> 3 times, send messages
:q, reopen — only 1 tab restored
Cause: M.save() iterates groups, but groups is empty unless M.restore() was called (panel opened).
Bug 2: Empty tabs not persisted
Open panel, press <M-c>, do NOT send message
:q, reopen — tab missing
Cause: save_group() skips tabs where active_session == nil.
Bug 3: <C-a> session switch not persisted
Tab 2 shows Session A
Press <C-a>, switch to Session B
:q, reopen — Tab 2 shows Session A again
Cause: M.set_active() updates global store but not the tab's active_session field.
Proposed Behavior
Scenario
Current
Proposed
Empty tab after restart
Lost
Restored as empty container
Session deleted server-side
Tab shows "N/A"
Tab becomes empty container
<C-a> switch
Ephemeral
Persisted
Questions
Agree with "tab as container, session as content" model?
Should empty tabs be persistent?
Should <C-a> switching be durable across restarts?
Should <M-c> auto-fill with new session (so user can chat immediately)?
@sudo-tee Thanks for merging PR #525! The project-scoped tab groups work great. These are follow-up refinements I discovered during deeper testing, not criticisms of the original implementation. I appreciate your quick iterations on this feature.
For the container, you can already reuse a tab to see another session
leader oI does that and the session picker also use the current tab. leader oN create a new tab (with a new session for the moment) but the PR I sent in my other message is fixing this . It will be a draft session
On Tue, Oct 20, 2026 at 7:26 AM wzj-zz ***@***.***> wrote:
*wzj-zz* left a comment (sudo-tee/opencode.nvim#541)
<#541 (comment)>
Thanks for clarifying the <leader>oI and session picker behaviors.
However, I realize my use case with <C-a> is different from both:
*My <C-a> workflow:*
- I'm on Tab 1 showing Session A
- I press <C-a> to open the session picker
- I select existing Session B
- *Tab 1 directly switches to show Session B* (no new tab, no jumping
away)
*This differs from:*
- <leader>oI: Stays in current tab, but creates a *new* session
- Session picker: Selects existing session, but *jumps to its tab* or *creates
new tab*
*The bug I encountered:*
- After switching with <C-a>, Tab 1 correctly shows Session B
- But after restarting Neovim, Tab 1 restores showing Session A, not
Session B
- The switch was not persisted
*Questions:*
1. Is this the intended behavior, or a bug?
2. If I want to switch the current tab to an existing session (without
creating a new tab), which operation should I use?
For context, I have <C-a> mapped to select_session which calls
session_runtime.select_session.
—
Reply to this email directly, view it on GitHub
<#541?email_source=notifications&email_token=AACTQXVNOLP3SNAM5DP465L5U5DVVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMMRYHE3TQMZZGA4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-6289783908>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACTQXXPL7XVW6E4MITHCCD5U5DVVAVCNFSNUABGKJSXA33TNF2G64TZHMYTAMBZGY3TCNRZGM5US43TOVSTWNJZGAZTMNBUGU2DPILWAI>
.
You are receiving this because you were mentioned.Message ID:
<sudo-tee/opencode.nvim/issues/541/6289783908 ***@***.***
com>
Activity
wzj-zz commentedon Oct 17, 2026
@sudo-tee Thanks for merging PR #525! The project-scoped tab groups work great. These are follow-up refinements I discovered during deeper testing, not criticisms of the original implementation. I appreciate your quick iterations on this feature.
sudo-tee commentedon Oct 20, 2026
I think this MR can help with this workflow
#543
It will not persist tabs with a session and no prompt sent.
sudo-tee commentedon Oct 20, 2026
For the container, you can already reuse a tab to see another session
leader oIdoes that and the session picker also use the current tab.leader oNcreate a new tab (with a new session for the moment) but the PR I sent in my other message is fixing this . It will be a draft sessionNot sure what is missing
wzj-zz commentedon Oct 20, 2026
Thanks for clarifying the
<leader>oIand session picker behaviors. However, I realize my use case with<C-a>is different from both:My
<C-a>workflow:<C-a>to open the session pickerThis differs from:
<leader>oI: Stays in current tab, but creates a new sessionThe bug I encountered:
<C-a>, Tab 1 correctly shows Session BQuestions:
For context, I have
<C-a>mapped toselect_sessionwhich callssession_runtime.select_session.sudo-tee commentedon Oct 20, 2026
sudo-tee commentedon Oct 21, 2026
@wzj-zz
I am not able to reproduce the issue if I use the session picker on a tab it properly switch and is restored with the new session.
Can you give it a try with latest changes or record a video if you are still able to reproduce ?
wzj-zz commentedon Oct 21, 2026
@sudo-tee Here is the video demonstrating the
<C-a>session switch persistence issue.Video:
issue541_compressed.mp4
What the video shows:
<C-a>, select "Test message 222" (Session B)Environment:
The session switch works in the current instance, but is not persisted across restarts.
fix(session): fix snapshot write failure on Windows
fix(session): fix snapshot write failure on Windows
fix(session): fix snapshot write failure on Windows