Skip to content

fix(session): scope default lists by directory - #38532

Open
samiralibabic wants to merge 1 commit into
anomalyco:devfrom
samiralibabic:fix/session-exact-directory
Open

fix(session): scope default lists by directory#38532
samiralibabic wants to merge 1 commit into
anomalyco:devfrom
samiralibabic:fix/session-exact-directory

Conversation

@samiralibabic

@samiralibabic samiralibabic commented Jul 23, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #38529
Replaces the implementation scope from #28972 and #18890.

Related to #31210. This is the current-dev implementation for #38529; unlike #31210, it intentionally makes exact-directory filtering the default in both Git and non-Git contexts while retaining project scope when directory filtering is disabled.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Non-git directories share the global project, so project-only session queries can mix unrelated directories.

The CLI now sends its exact instance directory when listing sessions. The TUI uses the same exact-directory filter by default and keeps project scope when directory filtering is disabled. Explicit recursive path behavior is unchanged, and directory queries retain the legacy path IS NULL fallback. Resume-time cwd handling is intentionally out of scope.

How did you verify your code works?

  • Focused CLI, TUI, and server session-list tests
  • bun typecheck in packages/opencode and packages/tui
  • pre-push bun turbo typecheck
  • Prettier and git diff --check

Screenshots / recordings

N/A. Query behavior only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found related PRs that address similar session scoping and directory filtering concerns:

  1. PR fix(tui): scope non-git sessions by directory, not hierarchical path #31210 - fix(tui): scope non-git sessions by directory, not hierarchical path

    • Directly related: already implements directory-based scoping for non-git sessions in the TUI
  2. PR fix(opencode): scope --continue to the current worktree directory #33521 - fix(opencode): scope --continue to the current worktree directory

    • Related: handles directory scoping for the continue command
  3. PR fix(acp): list known sessions across projects on empty cwd #33789 - fix(acp): list known sessions across projects on empty cwd

    • Related: addresses session listing behavior with directory context
  4. PR fix(sdk): avoid implicit directory filtering on /session list #20361 - fix(sdk): avoid implicit directory filtering on /session list

    • Related: directly addresses implicit directory filtering on session list endpoints
  5. PR fix(opencode): resolve directory when list sessions #22835 - fix(opencode): resolve directory when list sessions

    • Related: handles directory resolution during session listing

These PRs tackle similar problems around session scoping and directory-based filtering. PR #38532 appears to be consolidating these fixes into a comprehensive solution (as indicated by "Replaces the implementation scope from #28972 and #18890" in the description).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session list and TUI mix sessions from unrelated non-git directories

1 participant