GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): request root sessions in switch session dialog by jiwangyihao · Pull Request #23276 · anomalyco/opencode

Conversation

@jiwangyihao

@jiwangyihao jiwangyihao commented Apr 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #16270

Related: #13877

Type of change

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

What does this PR do?

Switch Session was asking for a mixed session list and then filtering root sessions in the dialog. In projects with many recent child sessions, that meant root sessions could get pushed out of the first page even though opencode session list still showed them.

This change keeps the fix scoped to the dialog path instead of making the shared bootstrap session store roots-only, because other TUI flows still use the shared session store for parent / child session navigation.

It updates the dialog to request root sessions directly for both the default list and search results, while preserving the current session-list scope/path filter, and it refetches that root-session list after delete / workspace recovery so the dialog stays current.

How did you verify your code works?

I reproduced the bug against a local OpenCode database where the missing session was rank 4 among root sessions but rank 152 among all sessions because 148 newer child sessions came first.

I then verified the dialog's previous query shape (session.list({ start, limit: 100 }) followed by client-side parentID === undefined filtering) could exclude that root session, while the patched query shape (session.list({ start, roots: true, limit: 100 })) keeps it in the returned default list.

I also verified that search now requests roots: true, so recent child sessions cannot crowd root sessions out of search results, and that the delete / workspace recovery flows refetch the same root-session resource afterward.

After resolving the latest dev merge conflict, I ran bun typecheck from packages/opencode.

Screenshots / recordings

N/A. This changes the session query used by the TUI dialog rather than the rendered UI itself.

Checklist

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

EdgarSedov reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@jiwangyihao
fix(tui): request root sessions in switch session dialog
fe0d7fc
Only fetching the latest mixed session list lets recent child sessions crowd root sessions out of Switch Session. Querying root sessions directly keeps recent root sessions visible and makes dialog refetches stay in sync after delete or workspace recovery.
@github-actions

github-actions Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Apr 18, 2026
@github-actions

github-actions Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

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

I found one potentially related PR from the recent results:

feat(tui): add session migration dialog (#23250)
#23250

This PR is recent (nearby PR number) and also involves TUI session-related functionality. While it's about session migration rather than the switch session dialog specifically, it may be related work in the same area.

Otherwise, the search results show various TUI and session-related PRs but none appear to be direct duplicates of fixing the switch session dialog's root session filtering behavior. The closest match was #14267 about preserving input drafts when switching sessions, but that's a different concern.

Would you like me to do additional searches with different keywords to be thorough?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Apr 18, 2026
@github-actions

github-actions Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Apr 18, 2026
TUI /sessions picker only shows recent sessions #13877
Closed
/sessions TUI only shows recent sessions, ignores historical ones #16270
Closed
@github-actions github-actions Bot mentioned this pull request Apr 25, 2026
fix: move session roots filter from client-side to SQL layer #24383
Closed
3 tasks done
@jiwangyihao
Merge remote-tracking branch 'origin/dev' into fix/switch-session-roo…
73fe251
…t-filter

# Conflicts:
#	packages/opencode/src/cli/cmd/tui/component/dialog-session-list.tsx
@github-actions github-actions Bot mentioned this pull request May 5, 2026
fix(tui): list root sessions in session picker #25898
Closed
@codeg-old codeg-old mentioned this pull request May 9, 2026
fix(tui): request root sessions in session dialog #26432
Closed
3 of 6 tasks
@github-actions

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this May 18, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label May 18, 2026
@CasualDeveloper CasualDeveloper mentioned this pull request Jun 6, 2026
fix(tui): load root sessions safely in dialogs #31132
Closed
3 of 6 tasks
@5h4d0wn1k 5h4d0wn1k mentioned this pull request Sep 26, 2026
fix(core): treat an empty session subpath as no subpath #51514
Closed
3 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

/sessions TUI only shows recent sessions, ignores historical ones

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jiwangyihao
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.