Skip to content

fix(tui): request root sessions in session dialog#26432

Open
codeg-dev wants to merge 1 commit intoanomalyco:devfrom
codeg-dev:fix/session-dialog-root-query
Open

fix(tui): request root sessions in session dialog#26432
codeg-dev wants to merge 1 commit intoanomalyco:devfrom
codeg-dev:fix/session-dialog-root-query

Conversation

@codeg-dev
Copy link
Copy Markdown

@codeg-dev codeg-dev commented May 9, 2026

Issue for this PR

Closes #16270
Related: #13877, #25897, #23276

Type of change

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

What does this PR do?

The session switch dialog was rendering root sessions from the shared mixed session bootstrap list. In projects with many recent child/subagent sessions, the server-side limit can be filled before the dialog filters out child sessions, so root sessions disappear from /sessions even though opencode session list can still show them.

This keeps the shared sync.data.session bootstrap unchanged, because other TUI flows use it for parent/child navigation. The dialog now has its own root-session query for both the default picker and search results, preserving the current scope/path filter while passing roots: true.

The default dialog query asks for the latest 100 root sessions instead of reusing the bootstrap 30-day window. Search asks for the latest 30 matching root sessions. Delete and workspace recovery paths refetch the dialog root-session resource so the picker stays current.

How did you verify your code works?

  • bun test test/cli/tui/dialog-session-list.test.ts test/server/session-list.test.ts test/server/httpapi-sdk.test.ts --timeout 30000
  • bun run typecheck
  • bun run build
  • Manual driver: imported createDialogSessionListQuery and verified the default picker query is { scope: "project", roots: true, limit: 100 } with no start/search, and the search query preserves path filters with roots: true, limit: 30, and search.

Screenshots / recordings

N/A. This changes the session query used by the TUI dialog, not the rendered UI layout.

Checklist

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

Authorship disclosure: prepared with AI assistance.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

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

Based on my search, I found a related PR that should be reviewed:

PR #23276: fix(tui): request root sessions in switch session dialog
#23276

This PR appears to be a prior/related fix addressing a very similar issue with requesting root sessions in the session dialog. It's referenced in the current PR's description under "Related: #13877, #25897, #23276". The current PR (26432) may be building upon or refining the approach from #23276.

This should be cross-referenced to understand if there's overlapping logic or if the current PR supersedes the previous approach.

@codeg-dev
Copy link
Copy Markdown
Author

Context on #23276 overlap:

This is intentionally close to #23276's narrow-dialog approach, but it adds two differences that should help avoid the earlier stale/template/design problems:

  1. The default dialog query does not include the bootstrap 30-day start filter. It asks for the latest 100 root sessions directly, which better matches the CLI root-session behavior and addresses reports where older root sessions are hidden.
  2. The root-query construction is covered by test/cli/tui/dialog-session-list.test.ts, so the dialog-specific scope is explicit and protected.

It still keeps the important design constraint from the #24383 discussion: the shared sync.data.session bootstrap remains mixed and unchanged for parent/child navigation.

Authorship disclosure: prepared with AI assistance.

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.

/sessions TUI only shows recent sessions, ignores historical ones

1 participant