Skip to content

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

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

fix: list all sessions regardless of git context (#15678)#15772
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 your code works?

Analyzed the code and confirmed the fix works.

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

Screenshots / recordings

N/A

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

  • PR feat(cli): add -a global mode for session list #15178 - feat(cli): add -a global mode for session list
    • This PR addresses a similar concern about listing sessions globally vs. in current context. It adds a -a flag for global mode, which is related to the issue this PR fixes (making global listing the default behavior).

However, PR #15178 and PR #15772 (current PR) appear to address the same underlying issue from different angles - one adds a flag option while the current PR changes the default behavior to always list globally.

No other duplicate PRs found that directly address the same fix.

@adiled
Copy link

adiled commented Mar 3, 2026

it's a feature, not bug

@zoe531
Copy link
Author

zoe531 commented Mar 3, 2026

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

Copy link
Author

@zoe531 zoe531 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix is ready. Please review.

@dinhphieu
Copy link

dinhphieu commented Mar 6, 2026

@adiled if this is a feature, is there a way to revert this change by showing all sessions regardless of context in a config file or something? This is painful for those who work multi-repos and start opencode in a common workspace folder

UPDATE: I think my issue is different, Created a PR and a related issue for it #16273

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

3 participants