Skip to content

fix: list all sessions regardless of git context (#15678)#15733

Closed
zoe531 wants to merge 1 commit intoanomalyco:devfrom
zoe531:fix/session-list-global
Closed

fix: list all sessions regardless of git context (#15678)#15733
zoe531 wants to merge 1 commit intoanomalyco:devfrom
zoe531:fix/session-list-global

Conversation

@zoe531
Copy link

@zoe531 zoe531 commented Mar 2, 2026

Issue for this PR

Closes #15678

Type of change

  • Bug fix

What does this PR do?

Fixes issue #15678 where opencode session list returns empty results when run inside a Git repository.

The bug was caused by using Session.list() which filters by current project ID. When running inside a Git repo, it only shows sessions for that specific project. Changed to Session.listGlobal() which shows all sessions regardless of current project/git context.

How did you verify this code works?

Analyzed the code and confirmed:

  1. Session.list() filters by project.id - causes the bug
  2. Session.listGlobal() does not filter by project - fixes the bug

Local tests pass:

test/server/session-list.test.ts: 5 pass

Screenshots / recordings

N/A - This is a CLI fix, no UI changes.

Checklist

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

Use Session.listGlobal instead of Session.list to show all sessions
regardless of current project/git context.
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 2, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

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

Based on my search results, I found one potentially related PR:

Related PR:

The searches also returned #15733 (the current PR itself) and #13960 "fix: scope session list and children to current worktree" which is about scoping to worktrees rather than making sessions global.

The most relevant is #15178 since both PRs deal with the ability to view all sessions regardless of context, though they take different approaches (your PR makes it the default behavior vs. that PR adds an optional flag).

@zoe531
Copy link
Author

zoe531 commented Mar 2, 2026

Hi, I have resubmitted this fix. The fix changes Session.list() to Session.listGlobal() to show all sessions regardless of current project context.

Local tests pass:

test/server/session-list.test.ts: 5 pass

Could you please review? Thank you!

@zoe531
Copy link
Author

zoe531 commented Mar 2, 2026

Friendly bump! This fix is ready for review. Thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 2, 2026
@github-actions github-actions bot closed this Mar 2, 2026
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.

opencode sessions command fails to list historical sessions when run inside a Git repository

1 participant