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
the session list displayed by the /session command in TUI is incomplete, but the list under the CLI command opencode session list is complete
As shown in the figure, only four sessions are displayed in TUI mode.
Additionally, I've checked related issues, and most similar problems state that TUI only displays sessions from the last 30 days. However, my case is different - as shown in my first screenshot in TUI mode, the most recent session is from March 25th, but when I check the session list under CLI mode, I have multiple recent sessions from March 27th and also several from March 25th that are not displayed in TUI mode.
These issues all describe the same underlying problem: the TUI /sessions command applies an implicit filter or limit that causes it to show fewer sessions than opencode session list does via CLI. Please review these issues and consider whether this is the same bug before proceeding.
@JohnYehyo I am experiencing similar issues, but I was able to narrow it down to the usage of worktrees. When I am running a session in a worktree, these sessions (even if the worktree is linked to the same project in the sqlite db) are basically lost.
Is this the same issue you are experiencing?
@JohnYehyo I am experiencing similar issues, but I was able to narrow it down to the usage of worktrees. When I am running a session in a worktree, these sessions (even if the worktree is linked to the same project in the sqlite db) are basically lost. Is this the same issue you are experiencing?
Hi! I've been chasing down this bug. I've written the following in Discord:
I often have git worktrees for my project, so I'll have /project/, then Git worktrees of /project/.dmux/worktrees/a/.
Typically I'll be running OpenCode from cwd of the git worktrees, however in the past OpenCode would let me open those sessions even at /project/, which was very convenient.
This behavior no longer seems to be the case. Does anyone know what changed or why this may have changed?
This seems to match what you found. I investigated and found that rolling back to v1.3.1 and this is definitely a regression for me, the behavior works back there. It was supported in 1.3.3, and broke in 1.3.4.
Do you know if this was an intentional break in behavior for boosted performance? Or is this indeed a regression. By moving x-opencode-directory/x-opencode-workspace headers into URL query params, the GET /session endpoint treats that directory as an explicit filter in the db check (
The CLI works because opencode session list does not use the SDK/HTTP route at all (which is what broke in 1.3.4); it calls Session.list(...) directly:
Can confirm - works in 1.3.3 but is broken in 1.3.4 (and above)
From the linked commit, I agree, it sounds like a bug/not an intentional break. Thanks for the investigation!
To give also a bit of context, as I know from GitHub issues, there are several opinions on what sessions should be shown in the TUI: Currently, with this "bug", after closing the worktree, I have changes in my code base generated by the agent, but I can't access the sessions anymore that generated the changes in the first place. Of course, I could re-create a worktree with the same path, or extract the session based on DB queries directly - but I have to admit, having it in the TUI directly sounds more correct 😅
Reacted by OverHash, Mori, Kevin McBride and Louie Lee
Currently, with this "bug", after closing the worktree, I have changes in my code base generated by the agent, but I can't access the sessions anymore that generated the changes in the first place. Of course, I could re-create a worktree with the same path, or extract the session based on DB queries directly - but I have to admit, having it in the TUI directly sounds more correct 😅
I agree, this is the same problem that I have. I am frequently creating and deleting Git worktrees, however the sessions are still relevant for my entire project. Therefore, I prefer that the session picker lets me choose sessions that were created under worktrees.
In my case, it works quite well as I prefix session names with identifiers so I can 'choose' the correct session that way.
Also noting that OpenCode has had this behavior forever, so the change in behavior needs to be clarified by a maintainer if this is an intentional change OpenCode is making. obviously I'd be disappointed to hear so.
@JohnYehyo I am experiencing similar issues, but I was able to narrow it down to the usage of worktrees. When I am running a session in a worktree, these sessions (even if the worktree is linked to the same project in the sqlite db) are basically lost.我遇到了类似的问题,但最终发现问题出在工作树的使用上。当我在工作树中运行会话时,这些会话(即使该工作树链接到 SQLite 数据库中的同一个项目)基本上都会丢失。 Is this the same issue you are experiencing?你遇到的问题和这个一样吗?
In my case, it seems to be a different issue — I’m experiencing the same problem even when not using worktrees
Have heard from the great @rekram1-node that he might try and ask the team if the change was intentional, which will determine if this is a bug or an intentional change in behavior of OpenCode.
In the latest releases, this was fixed when using the OPENCODE_EXPERIMENTAL_WORKSPACES flag.
I'm not sure why this directory restriction was added in the first place, but with the flag (even if we don't require this functionality), it helps us with the session list issue. So it might be a workaround for some people (if you are able/want to enable the experimental feature)
With the release of #24849 in v1.14.30, I no longer believe this to be an issue. OpenCode will show all sessions under the current project, with the option to filter it to exact path via "session directory filtering" option in TUI.
Activity
github-actions commentedon Mar 31, 2026
This issue might be a duplicate of existing issues. Please check:
/sessionsonly shows sessions from last 30 days while CLIsession listshows all sessions (same TUI vs CLI discrepancy)/sessionspicker only shows recent sessions (same root cause - implicit time/limit filter in TUI session listing)/sessionsTUI only shows recent sessions, ignores historical onesThese issues all describe the same underlying problem: the TUI
/sessionscommand applies an implicit filter or limit that causes it to show fewer sessions thanopencode session listdoes via CLI. Please review these issues and consider whether this is the same bug before proceeding.ohtyap commentedon Mar 31, 2026
@JohnYehyo I am experiencing similar issues, but I was able to narrow it down to the usage of worktrees. When I am running a session in a worktree, these sessions (even if the worktree is linked to the same project in the sqlite db) are basically lost.
Is this the same issue you are experiencing?
fix: remove 30-day limit from TUI session list
OverHash commentedon Mar 31, 2026
Hi! I've been chasing down this bug. I've written the following in Discord:
This seems to match what you found. I investigated and found that rolling back to v1.3.1 and this is definitely a regression for me, the behavior works back there. It was supported in 1.3.3, and broke in 1.3.4.
I then got an LLM to investigate changes in 1.3.4 and came to the conclusion that @adamdotdevin had a change which appears to be the issue: https://github.com/anomalyco/opencode/pull/19288/changes#diff-4d007ffedbc7e49e787c5a936a9c0188f49e8ef495390101884117f06b91f9d0R76. I attempted to contact Adam in Discord but he has not responded so far. I asked the following:
.. and now I'm working on adding a regression test for this, under the assumption that it is a bug.
OverHash commentedon Mar 31, 2026
The CLI works because
opencode session listdoes not use the SDK/HTTP route at all (which is what broke in 1.3.4); it callsSession.list(...)directly:opencode/packages/opencode/src/cli/cmd/session.ts
Line 93 in 1812130
ohtyap commentedon Mar 31, 2026
Can confirm - works in
1.3.3but is broken in1.3.4(and above)From the linked commit, I agree, it sounds like a bug/not an intentional break. Thanks for the investigation!
To give also a bit of context, as I know from GitHub issues, there are several opinions on what sessions should be shown in the TUI: Currently, with this "bug", after closing the worktree, I have changes in my code base generated by the agent, but I can't access the sessions anymore that generated the changes in the first place. Of course, I could re-create a worktree with the same path, or extract the session based on DB queries directly - but I have to admit, having it in the TUI directly sounds more correct 😅
OverHash commentedon Mar 31, 2026
I agree, this is the same problem that I have. I am frequently creating and deleting Git worktrees, however the sessions are still relevant for my entire project. Therefore, I prefer that the session picker lets me choose sessions that were created under worktrees.
In my case, it works quite well as I prefix session names with identifiers so I can 'choose' the correct session that way.
Also noting that OpenCode has had this behavior forever, so the change in behavior needs to be clarified by a maintainer if this is an intentional change OpenCode is making. obviously I'd be disappointed to hear so.
JohnYehyo commentedon Apr 1, 2026
In my case, it seems to be a different issue — I’m experiencing the same problem even when not using worktrees
fix(sdk): avoid implicit session directory filtering
OverHash commentedon Apr 9, 2026
Have heard from the great @rekram1-node that he might try and ask the team if the change was intentional, which will determine if this is a bug or an intentional change in behavior of OpenCode.
ohtyap commentedon Apr 20, 2026
In the latest releases, this was fixed when using the
OPENCODE_EXPERIMENTAL_WORKSPACESflag.I'm not sure why this directory restriction was added in the first place, but with the flag (even if we don't require this functionality), it helps us with the session list issue. So it might be a workaround for some people (if you are able/want to enable the experimental feature)
OverHash commentedon Apr 29, 2026
With the release of #24849 in v1.14.30, I no longer believe this to be an issue. OpenCode will show all sessions under the current project, with the option to filter it to exact path via "session directory filtering" option in TUI.
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.