Sessions are now mixed with home directory session list, disregarding which directory you're in #2349

Open
opened 2026-02-16 17:35:15 -05:00 by yindo · 18 comments
Owner

Originally created by @raymelon on GitHub (Oct 29, 2025).

Description

So, directory A is mixing sessions with the terminal's home directory.
Sessions from home directory are listed despite us being in another directory.
Verified this by running /sessions command, and seeing the sessions from home directory.

What's concerning is the sessions from directory A are now showing up in home directory's session list as well.
Verified this by running opencode then /sessions on home directory.

OpenCode version

0.15.23

Steps to reproduce

  1. Run Warp
  2. Type wsl and press Enter, should land in home directory
  3. Go to another directory
  4. Type opencode and press Enter
  5. Run /sessions and check if the sessions from home directory also show up

Screenshot and/or share link

No response

Operating System

Windows 10 21H1

Terminal

Warp v0.2025.10.22.08.13.stable_02
WSL 1

Originally created by @raymelon on GitHub (Oct 29, 2025). ### Description So, directory A is mixing sessions with the terminal's home directory. Sessions from home directory are listed despite us being in another directory. Verified this by running `/sessions` command, and seeing the sessions from home directory. What's concerning is the sessions from directory A are now showing up in home directory's session list as well. Verified this by running `opencode` then `/sessions` on home directory. ### OpenCode version 0.15.23 ### Steps to reproduce 1. Run Warp 2. Type `wsl` and press Enter, should land in home directory 3. Go to another directory 4. Type `opencode` and press Enter 5. Run `/sessions` and check if the sessions from home directory also show up ### Screenshot and/or share link _No response_ ### Operating System Windows 10 21H1 ### Terminal Warp v0.2025.10.22.08.13.stable_02 WSL 1
yindo added the bug label 2026-02-16 17:35:15 -05:00
Author
Owner

@raymelon commented on GitHub (Oct 29, 2025):

Also, this warning shows up in Directory A, right before I run opencode.

`The command 'docker' could not be found in this WSL 1 distro.
We recommend to convert this distro to WSL 2 and activate
the WSL integration in Docker Desktop settings.

For details about using Docker Desktop with WSL 2, visit:

https://docs.docker.com/go/wsl2/`

I am using zsh and ohmyzsh, and this issue is from a plugin.

@raymelon commented on GitHub (Oct 29, 2025): Also, this warning shows up in Directory A, right before I run opencode. `The command 'docker' could not be found in this WSL 1 distro. We recommend to convert this distro to WSL 2 and activate the WSL integration in Docker Desktop settings. For details about using Docker Desktop with WSL 2, visit: https://docs.docker.com/go/wsl2/` I am using zsh and ohmyzsh, and this issue is from a plugin.
Author
Owner

@raymelon commented on GitHub (Oct 29, 2025):

Actually, if there's a way to move a session to another directory, it will be nice to know how.

I am willing with compromising as long as I can move the conversations to their respective directories. In my case, the supposed conversations of Directory A's.

@raymelon commented on GitHub (Oct 29, 2025): Actually, if there's a way to move a session to another directory, it will be nice to know how. I am willing with compromising as long as I can move the conversations to their respective directories. In my case, the supposed conversations of Directory A's.
Author
Owner

@rekram1-node commented on GitHub (Oct 29, 2025):

Sessions are tied to a project if we detect git, otherwise they are global

@rekram1-node commented on GitHub (Oct 29, 2025): Sessions are tied to a project if we detect git, otherwise they are global
Author
Owner

@raymelon commented on GitHub (Oct 30, 2025):

Sessions are tied to a project if we detect git, otherwise they are global

I see. Directory A has .git, does it mean that opencode fails to detect .git?

@raymelon commented on GitHub (Oct 30, 2025): > Sessions are tied to a project if we detect git, otherwise they are global I see. Directory A has `.git`, does it mean that opencode fails to detect `.git`?
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

Does it have commits in the directory? Did it have commits when u started opencode in it?

@rekram1-node commented on GitHub (Oct 30, 2025): Does it have commits in the directory? Did it have commits when u started opencode in it?
Author
Owner

@raymelon commented on GitHub (Oct 30, 2025):

Does it have commits in the directory? Did it have commits when u started opencode in it?

Yes, it's a forked repository.

It looks like the environment is failing to do git commands:

git add packages/server/src/routes/[redacted] packages/server/src/routes/index.ts
fatal: cannot chdir to
'C:/Users/[redacted]': No such
file or directory
@raymelon commented on GitHub (Oct 30, 2025): > Does it have commits in the directory? Did it have commits when u started opencode in it? Yes, it's a forked repository. It looks like the environment is failing to do git commands: ``` git add packages/server/src/routes/[redacted] packages/server/src/routes/index.ts fatal: cannot chdir to 'C:/Users/[redacted]': No such file or directory ```
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

Hm yeah maybe that tripped up opencode

@rekram1-node commented on GitHub (Oct 30, 2025): Hm yeah maybe that tripped up opencode
Author
Owner

@raymelon commented on GitHub (Oct 30, 2025):

Hm yeah maybe that tripped up opencode

Same thoughts

@raymelon commented on GitHub (Oct 30, 2025): > Hm yeah maybe that tripped up opencode Same thoughts
Author
Owner

@raymelon commented on GitHub (Oct 30, 2025):

Actually, if there's a way to move a session to another directory, it will be nice to know how.

I am willing with compromising as long as I can move the conversations to their respective directories. In my case, the supposed conversations of Directory A's.

Really curious though if this is possible

@raymelon commented on GitHub (Oct 30, 2025): > Actually, if there's a way to move a session to another directory, it will be nice to know how. > > I am willing with compromising as long as I can move the conversations to their respective directories. In my case, the supposed conversations of Directory A's. Really curious though if this is possible
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

@raymelon so if you have sessions tied to a git repo correctly, you can straight up delete the folder, git clone it in an entirely different parent directory under an entirely different name and it will have all your sessions from before

Outside of that, or if we fail to detect git, it is a lot more fragile, but we could improve that

@rekram1-node commented on GitHub (Oct 30, 2025): @raymelon so if you have sessions tied to a git repo correctly, you can straight up delete the folder, git clone it in an entirely different parent directory under an entirely different name and it will have all your sessions from before Outside of that, or if we fail to detect git, it is a lot more fragile, but we could improve that
Author
Owner

@raymelon commented on GitHub (Oct 30, 2025):

@raymelon so if you have sessions tied to a git repo correctly, you can straight up delete the folder, git clone it in an entirely different parent directory under an entirely different name and it will have all your sessions from before

Outside of that, or if we fail to detect git, it is a lot more fragile, but we could improve that

I see. The sessions I want moved are tied into the home directory though, and that directory is not a git repo.

If that's the case, there is really no other way to move a session around?

@raymelon commented on GitHub (Oct 30, 2025): > [@raymelon](https://github.com/raymelon) so if you have sessions tied to a git repo correctly, you can straight up delete the folder, git clone it in an entirely different parent directory under an entirely different name and it will have all your sessions from before > > Outside of that, or if we fail to detect git, it is a lot more fragile, but we could improve that I see. The sessions I want moved are tied into the home directory though, and that directory is not a git repo. If that's the case, there is really no other way to move a session around?
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

I mean the sessions are all on the file system so you can but we dont provide any mechanism for that out of the box, could be more pain than it is worth unless u really need those sessions :)

@rekram1-node commented on GitHub (Oct 30, 2025): I mean the sessions are all on the file system so you can but we dont provide any mechanism for that out of the box, could be more pain than it is worth unless u really need those sessions :)
Author
Owner

@raymelon commented on GitHub (Oct 30, 2025):

I mean the sessions are all on the file system so you can but we dont provide any mechanism for that out of the box, could be more pain than it is worth unless u really need those sessions :)

Got it. Maybe it's a nice feature to have in the future, if there's demand.

Let's leave the conversation open for now?

@raymelon commented on GitHub (Oct 30, 2025): > I mean the sessions are all on the file system so you can but we dont provide any mechanism for that out of the box, could be more pain than it is worth unless u really need those sessions :) Got it. Maybe it's a nice feature to have in the future, if there's demand. Let's leave the conversation open for now?
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

Yes ofc!

@rekram1-node commented on GitHub (Oct 30, 2025): Yes ofc!
Author
Owner

@gregzuro commented on GitHub (Dec 31, 2025):

A bit confuzzled re this design. I've orphaned a few sessions that I'd have rather kept.

Not having a global (-ly accessible) repository of sessions is a ... choice. Fine. But why keep sessions separate from their folder?

@gregzuro commented on GitHub (Dec 31, 2025): A bit confuzzled re this design. I've orphaned a few sessions that I'd have rather kept. Not having a global (-ly accessible) repository of sessions is a ... choice. Fine. But why keep sessions separate from their folder?
Author
Owner

@isaacharrisholt commented on GitHub (Jan 5, 2026):

This might be a separate issue, but OpenCode doesn't seem to let me run isolated instances for multiple checkouts of the same repo? They're all combined into a single project. I'd like to be able to run and manage them all from the web UI, ideally.

@isaacharrisholt commented on GitHub (Jan 5, 2026): This might be a separate issue, but OpenCode doesn't seem to let me run isolated instances for multiple checkouts of the same repo? They're all combined into a single project. I'd like to be able to run and manage them all from the web UI, ideally.
Author
Owner

@KostaGorod commented on GitHub (Jan 11, 2026):

Additional evidence: Failure to open sessions due to scope mismatch

This issue causes more than just "mixed session lists" - it also results in hard failures when trying to open sessions.

Evidence

Error in opencode-web service logs:

NotFoundError: Resource not found: /home/ai/.local/share/opencode/storage/session/global/ses_45347e7acffejeZlBTdxC4ZaOO.json

However, the session file DOES exist - just not in global/:

  • Found at: /home/ai/.local/share/opencode/storage/session/b947ba2c441b89fddec93f6f65057b2687f53d2e/ses_45347e7acffejeZlBTdxC4ZaOO.json
  • Also found in multiple other storage namespaces (agent-usage-reminder, session_diff, todo, etc.)

Session directory structure:

~/.local/share/opencode/storage/session/
├── global/                    # Empty for this session ID
└── b947ba2c441b89fddec93f6f65057b2687f53d2e/  # Session actually stored here (project-scoped)
    └── ses_45347e7acffejeZlBTdxC4ZaOO.json

Root Cause

The session resolver is looking in session/global/ but the session was created under a project-specific namespace (the hash directory b947ba2c...). This suggests:

  1. Session index/listing is global - Shows sessions across all scopes
  2. Session open/load is scoped - Tries to open using the current project's storage path (defaults to global/)

Impact

  • Non-fatal but noisy: Service continues running, but errors spam logs
  • User experience: Sessions from other projects appear in the list but fail to open
  • Severity: Medium - Doesn't crash, but breaks functionality for cross-project session access

Environment

  • opencode-ai@1.0.35
  • opencode-web service
  • Linux
  • Multiple storage namespaces (global + project-specific hash directories)

This is likely the same underlying "scope confusion" issue as the original report, but represents a concrete failure mode beyond just UI list mixing.

@KostaGorod commented on GitHub (Jan 11, 2026): ## Additional evidence: Failure to open sessions due to scope mismatch This issue causes more than just "mixed session lists" - it also results in **hard failures when trying to open sessions**. ### Evidence **Error in opencode-web service logs:** ``` NotFoundError: Resource not found: /home/ai/.local/share/opencode/storage/session/global/ses_45347e7acffejeZlBTdxC4ZaOO.json ``` **However, the session file DOES exist - just not in `global/`:** - Found at: `/home/ai/.local/share/opencode/storage/session/b947ba2c441b89fddec93f6f65057b2687f53d2e/ses_45347e7acffejeZlBTdxC4ZaOO.json` - Also found in multiple other storage namespaces (agent-usage-reminder, session_diff, todo, etc.) **Session directory structure:** ``` ~/.local/share/opencode/storage/session/ ├── global/ # Empty for this session ID └── b947ba2c441b89fddec93f6f65057b2687f53d2e/ # Session actually stored here (project-scoped) └── ses_45347e7acffejeZlBTdxC4ZaOO.json ``` ### Root Cause The session resolver is looking in `session/global/` but the session was created under a **project-specific namespace** (the hash directory `b947ba2c...`). This suggests: 1. **Session index/listing is global** - Shows sessions across all scopes 2. **Session open/load is scoped** - Tries to open using the current project's storage path (defaults to `global/`) ### Impact - **Non-fatal but noisy**: Service continues running, but errors spam logs - **User experience**: Sessions from other projects appear in the list but fail to open - **Severity**: Medium - Doesn't crash, but breaks functionality for cross-project session access ### Environment - opencode-ai@1.0.35 - opencode-web service - Linux - Multiple storage namespaces (global + project-specific hash directories) This is likely the same underlying "scope confusion" issue as the original report, but represents a **concrete failure mode** beyond just UI list mixing.
Author
Owner

@allisoneer commented on GitHub (Jan 21, 2026):

This is from Claude:

This issue has spawned several duplicates and PRs over time:

Duplicates:

  • #6098 - "sessions list seems to show all history"
  • #8836 - "session list is showing all sessions not only the ones scoped to the current dir"

Open PRs:

  • PR #8886 - client-side filtering (partial fix - only filters dialog display)
  • PR #6724 - server-side filtering with --all opt-out

I've added detailed analysis on #8836 comparing the approaches and proposing a more complete TUI-only fix that uses the existing GET /session?directory=<path> API parameter (which exists but was never wired up in the TUI).

Suggest consolidating discussion on #8836 as it's the most recent issue with the clearest problem statement.

@allisoneer commented on GitHub (Jan 21, 2026): This is from Claude: This issue has spawned several duplicates and PRs over time: **Duplicates:** - #6098 - "sessions list seems to show all history" - #8836 - "session list is showing all sessions not only the ones scoped to the current dir" **Open PRs:** - PR #8886 - client-side filtering (partial fix - only filters dialog display) - PR #6724 - server-side filtering with `--all` opt-out I've added detailed analysis on #8836 comparing the approaches and proposing a more complete TUI-only fix that uses the existing `GET /session?directory=<path>` API parameter (which exists but was never wired up in the TUI). Suggest consolidating discussion on #8836 as it's the most recent issue with the clearest problem statement.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2349