Uh oh!
There was an error while loading. Please reload this page.
feat(session): filter sessions by current directory - #6724
Conversation
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
harshav167
commented
Jan 13, 2026
Bumping this with a fresh force-push that now sits on v1.1.16 plus the three session-filtering files. Ran • Packages in scope: @opencode-ai/app, @opencode-ai/console-app, @opencode-ai/console-core, @opencode-ai/console-function, @opencode-ai/console-mail, @opencode-ai/console-resource, @opencode-ai/desktop, @opencode-ai/enterprise, @opencode-ai/function, @opencode-ai/plugin, @opencode-ai/script, @opencode-ai/sdk, @opencode-ai/slack, @opencode-ai/ui, @opencode-ai/util, @opencode-ai/web, opencode Tasks: 12 successful, 12 total installed @opentui/core@0.1.72 [209.00ms] done installed @parcel/watcher@2.5.1 [113.00ms] done |
harshav167
commented
Jan 14, 2026
Rebased this branch onto the latest (includes commit ), reinstalled dependencies, and reran • Packages in scope: @opencode-ai/app, @opencode-ai/console-app, @opencode-ai/console-core, @opencode-ai/console-function, @opencode-ai/console-mail, @opencode-ai/console-resource, @opencode-ai/desktop, @opencode-ai/enterprise, @opencode-ai/function, @opencode-ai/plugin, @opencode-ai/script, @opencode-ai/sdk, @opencode-ai/slack, @opencode-ai/ui, @opencode-ai/util, @opencode-ai/web, opencode Tasks: 12 successful, 12 total |
allisoneer
commented
Jan 21, 2026
This is from Claude: Thanks for the thorough PR! I wanted to share some considerations about the server-side approach vs a TUI-only alternative. Concerns with server-side default change:
Alternative: TUI-only fix using existing API The API already supports
This keeps the server behavior unchanged (always returns all sessions unless explicitly filtered) while giving the TUI the scoped behavior users expect. See my comment on #8836 for the full analysis. Happy to discuss which approach maintainers prefer! |
f1ae801 to
08fa7f7CompareClosing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Summary
This PR adds directory-based filtering to session listing, so sessions are scoped to the current working directory by default rather than showing all sessions across the entire project.
Problem
Currently, when running
ocin different directories within the same git repository, all sessions from all directories are visible. This creates noise and confusion - for example, runningoc session listin/project/frontendshows sessions created in/project/backend,/project/docs, etc.This is a common workflow issue for developers working on monorepos or projects with multiple subdirectories.
Solution
Session.list()now filters to only return sessions wheresession.directorymatches the current working directory (Instance.directory){ all: true }to get all sessions (previous behavior)--all/-aflag tooc session list?all=truequery parameter to/sessionendpointPrior Art
This behavior aligns with how Codex and Claude Code handle session visibility - they scope sessions to the current working directory rather than globally across the machine or project. This provides better isolation when:
Changes
src/session/index.tsListOptionsinterface, modifiedlist()to filter by directorysrc/cli/cmd/session.ts--allflag tosession listcommandsrc/server/server.ts?all=truequery param supportTesting
oc session listreturns empty when no sessions match current directoryoc session list --allreturns all sessions (previous behavior)--helpshows the new flag correctly