Skip to content

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

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

fix: list all sessions regardless of git context (#15678)#15716
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
  • New feature
  • Refactor / code improvement
  • Documentation

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

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

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, I found one potentially related PR:

Related PR:

This PR (#15716) appears to be the primary fix for issue #15678, with no exact duplicates found. The change directly addresses the root cause by switching from project-scoped session listing to global session listing by default.

@lightrao
Copy link

lightrao commented Mar 2, 2026

"Thank you @zoe531 for the rapid response and for implementing the global list fix!

Switching to Session.listGlobal() perfectly addresses the root cause I identified regarding the ProjectID shift during the initial Git commit. This change will significantly improve the experience for developers who iterate quickly from local ideas to Git repositories.

Looking forward to seeing this merged!"

@zoe531
Copy link
Author

zoe531 commented Mar 2, 2026

Hi, I have updated the PR description to follow the template. Could you please re-review? The CI test failures (test linux, e2e windows) appear to be pre-existing issues unrelated to this fix (which only changes 2 lines of code - Session.list to Session.listGlobal).

@zoe531
Copy link
Author

zoe531 commented Mar 2, 2026

Update: The failing CI tests (test linux, e2e windows) appear to be pre-existing issues on the dev branch, not caused by this change. This PR only modifies 2 lines of code (Session.list -> Session.listGlobal). Could a maintainer please review and potentially approve despite the compliance label? Thank you!

@zoe531
Copy link
Author

zoe531 commented Mar 2, 2026

Update: Local tests pass ✅

test/server/session-list.test.ts: 5 pass
test/permission/next.test.ts: 62 pass

All tests pass locally. Please 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

2 participants