Skip to content

Session list missing in TUI mode #20238

Closed as not planned
Closed as not planned

Description

@JohnYehyo

Description

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.

Plugins

oh my opencode

OpenCode version

1.3.9

Steps to reproduce

No response

Screenshot and/or share link

Image Image

Operating System

macOS 14.6.1

Terminal

Ghostty, iTerm2

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Mar 31, 2026
  2. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    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.

  3. ohtyap commented on Mar 31, 2026

    @ohtyap

    @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?

  4. added a commit that references this issue on Mar 31, 2026
    5f20bd9
  5. OverHash commented on Mar 31, 2026

    @OverHash

    @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.

    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:

    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 (

    if (input?.directory) {
    conditions.push(eq(SessionTable.directory, input.directory))
    }
    ), so my behavior of allowing sub-directory sessions is no longer supported.

    Happy to contribute a fix if you think this is a break in behavior

    edit: also just to mention that I am in the tui, though I think this was a change that was done for desktop performance based on what you work on?

    .. and now I'm working on adding a regression test for this, under the assumption that it is a bug.

  6. OverHash commented on Mar 31, 2026

    @OverHash

    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:

    const sessions = [...Session.list({ roots: true, limit: args.maxCount })]

  7. ohtyap commented on Mar 31, 2026

    @ohtyap

    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 😅

  8. OverHash commented on Mar 31, 2026

    @OverHash

    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.

  9. JohnYehyo commented on Apr 1, 2026

    @JohnYehyo
    Author

    @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

  10. added a commit that references this issue on Apr 2, 2026
    dfdf88f
  11. OverHash commented on Apr 9, 2026

    @OverHash

    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.

  12. ohtyap commented on Apr 20, 2026

    @ohtyap

    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)

  13. OverHash commented on Apr 29, 2026

    @OverHash

    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.

  14. removed
    bugSomething isn't working
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  15. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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