Skip to content

session list is showing all sessions not only the ones scopes to the curent dir #8836

Closed as not planned

Description

@luisrudge

Description

see title

Plugins

opencode-anthropic-auth, @franlol/opencode-md-table-formatter

OpenCode version

1.1.23

Steps to reproduce

open opencode anywhere and type /sessions
it should load only sessions from that directory, but lists all my sessions

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jan 16, 2026

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

  2. allisoneer commented on Jan 21, 2026

    @allisoneer

    This is from Claude:

    I've done some research on this issue and wanted to share findings on the existing PRs and a potentially more complete approach.

    Existing PR Analysis

    PR #8886 (client-side filtering in dialog only):

    • Only filters the session list dialog UI display
    • Does NOT filter the bootstrap session list fetch (initial load still fetches all sessions)
    • Does NOT filter real-time session.updated events (cross-directory sessions can still appear via SSE)
    • Does NOT filter session search results
    • Result: Sessions from other directories can still leak through via bootstrap, search, or real-time events

    PR #6724 (server-side default filtering):

    • Changes Session.list() default behavior for ALL clients (web UI, API consumers, CLI)
    • Requires new --all flag and ?all=true query param for opt-out
    • More invasive change that affects the API contract
    • Web UI and other consumers may want cross-directory visibility by default

    Proposed Alternative: TUI-only, use existing API

    The API already supports GET /session?directory=<path> (exact match filter) - it's just never wired up in the TUI. A more complete TUI-only fix would:

    1. Pass directory param to bootstrap session.list call in sync.tsx
    2. Pass directory param to session search in dialog-session-list.tsx
    3. Filter session.updated real-time events by directory (early break if mismatch)
    4. Pass directory: cwd to tui() call for SDK context

    Why this approach?

    • Uses existing API infrastructure (no server changes, no new flags)
    • Filters ALL entry points: bootstrap, search, AND real-time events
    • No behavior change for web UI or other API consumers
    • Purely additive - doesn't change any defaults or require opt-out mechanisms

    Known limitation: Uses exact directory match (existing API behavior). Sessions created from a subdirectory won't appear when TUI is launched from repo root. This is acceptable for the worktree use case and could be improved later with prefix matching if needed.

    I have a working implementation of this approach and happy to submit a PR if maintainers prefer this direction over the existing PRs.

  3. rekram1-node commented on Jan 21, 2026

    @rekram1-node
    Contributor

    Is this a git project? because in git projects it is scoped, everything else is global

  4. allisoneer commented on Feb 5, 2026

    @allisoneer

    Is this a git project? because in git projects it is scoped, everything else is global

    It is a git project! I want scoped to each worktree in that git project instead of just scoped to the git project as a whole.

  5. alexprudhomme commented on Feb 5, 2026

    @alexprudhomme

    I have the same issue when working with worktrees. When using the --continue flag, it resumes the last session in whatever worktree. Ideally it would resume the session in that particular worktree.

  6. alexprudhomme commented on Feb 5, 2026

    @alexprudhomme

    Is this a git project? because in git projects it is scoped, everything else is global

    Hi @rekram1-node, I am having the same issue because of git worktrees. I am available to work on this if you can provide some instructions regarding where the fix should be. Should the fix be on the server and affect all clients or should this be a fix only for the TUI ? Let me know and I can provide a PR.

  7. added 2 commits that reference this issue on Feb 20, 2026
    44a0842
    2a6b871
  8. ejj commented on Mar 17, 2026

    @ejj

    Would there be any interest in PRs to make the scoping configurable? In my use case at least, I want a separate session list per worktree rather than a global one for the entire git repo. I tend to use a worktree to contain a particular thread of work so scoping them that way is much more clear for my workflow. I'm sure others might want it directory scoped or have other ideas.

    Happy to file an issue and a PR if that sounds desirable more broadly.

  9. luisrudge commented on Mar 17, 2026

    @luisrudge
    Author
  10. marcodiniz commented on Mar 19, 2026

    @marcodiniz

    Also an issue for me. If at least it could show the working dir for the session in the session list, what would help

  11. added a commit that references this issue on Mar 26, 2026
    20d96a4
  12. removed
    bugSomething isn't working
    on May 3, 2026
  13. rodrigojimenezdencker commented on May 22, 2026

    @rodrigojimenezdencker

    Adding a current reproduction from OpenCode 1.15.9 because this still affects the new OPENCODE_EXPERIMENTAL=1 + /warp worktree workflow.

    Steps:

    1. Launch OpenCode in a git repo with multiple worktrees/workspaces.
    2. Use /warp to switch between worktrees.
    3. Open /sessions from each worktree.

    Actual: sessions from all worktrees for the same git project are mixed together.

    Expected: the TUI defaults to sessions for the current workspace/worktree, with a visible "show all" escape hatch or filter indicator so users do not think sessions disappeared.

    Why this matters: a worktree is usually one isolated thread of work. Mixing sessions across worktrees defeats the main reason to use /warp in the terminal, especially now that the web UI already makes workspace-specific sessions feel separate.

    The existing API/schema looks like it has enough metadata to support this without changing project identity: sessions expose directory and workspaceID, and session list endpoints accept workspace/path-style filters. So the useful fix seems to be TUI scoping/UX rather than changing projectID.

  14. github-actions commented on Jul 22, 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