Skip to content

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

Closed

Description

@raymelon

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

Activity

  1. raymelon commented on Oct 29, 2025

    @raymelon
    Author

    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.

  2. raymelon commented on Oct 29, 2025

    @raymelon
    Author

    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.

  3. rekram1-node commented on Oct 29, 2025

    @rekram1-node
    Contributor

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

  4. raymelon commented on Oct 30, 2025

    @raymelon
    Author

    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?

  5. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

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

  6. raymelon commented on Oct 30, 2025

    @raymelon
    Author

    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
    
  7. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    Hm yeah maybe that tripped up opencode

  8. raymelon commented on Oct 30, 2025

    @raymelon
    Author

    Hm yeah maybe that tripped up opencode

    Same thoughts

  9. raymelon commented on Oct 30, 2025

    @raymelon
    Author

    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

  10. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    @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

  11. raymelon commented on Oct 30, 2025

    @raymelon
    Author

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

  12. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    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 :)

  13. raymelon commented on Oct 30, 2025

    @raymelon
    Author

    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?

  14. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    Yes ofc!

  15. isaacharrisholt commented on Jan 5, 2026

    @isaacharrisholt

    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.

  16. KostaGorod commented on Jan 11, 2026

    @KostaGorod

    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.

  17. allisoneer commented on Jan 21, 2026

    @allisoneer

    This is from Claude:

    This issue has spawned several duplicates and PRs over time:

    Duplicates:

    Open PRs:

    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.

  18. github-actions commented on Mar 28, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 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

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions