fix(tui): request root sessions in switch session dialog#23276
fix(tui): request root sessions in switch session dialog#23276jiwangyihao wants to merge 1 commit intoanomalyco:devfrom
Conversation
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.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
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) 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? |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Issue for this PR
Closes #16270
Related: #13877
Type of change
What does this PR do?
Switch Sessionwas 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 thoughopencode session liststill 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, 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-sideparentID === undefinedfiltering) 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.Screenshots / recordings
N/A. This changes the session query used by the TUI dialog rather than the rendered UI itself.
Checklist