Skip to content

feat: navigate to sessions by ID from the command palette - #67779

Merged
gsimone merged 2 commits into
devfrom
palette-session-id
Dec 2, 2026
Merged

gsimone merged 2 commits into
devfrom
palette-session-id

Conversation

@gsimone

@gsimone gsimone commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

N/A

Type of change

  • New feature
  • Refactor / code improvement

What does this PR do?

Makes navigating to a session by its ID (e.g. ses_dc99b02a4ffewLjRLvd2CpSsmr or @session:ses_...) work consistently from the command palette in both Desktop/Web and the TUI, while removing duplicated palette and session-search plumbing:

  • Desktop/Web (packages/app):
    • Extracted createAllServerSessionEntries in packages/app/src/shell/commands/palette.ts so DialogCommandPalette and DialogSessionSearch share the same multi-server session search across all online visible servers (matching Inbox, Recent sessions, and Projects).
    • Removed HomeCommandPalette (packages/app/src/home/start/command-palette.tsx) and Home's duplicate palette registration in packages/app/src/home/sessions/controller.tsx: DialogCommandPalette now reads FileContext optionally, including file search when mounted inside a session/draft and omitting it on Home/Settings.
    • Removed unused filesOnly, onOpenFile, rootFileEntries, and createCommandPaletteFileOpener code from palette.ts.
    • Matched session.id synchronously against known sessions, skipped the 150ms search debounce for exact session IDs, and allowed exact archived session ID matches to surface dimmed.
  • TUI (packages/tui):
    • Added session ID lookup and navigation (preserving session.location) to CommandPaletteDialog (packages/tui/src/component/command-palette.tsx) and DialogSessionList (packages/tui/src/component/dialog-session-list.tsx).
  • Shared ID parsing (packages/util):
    • Added parseSessionID in packages/util/src/session-mention.ts and reused it across Desktop/Web and TUI session pickers.

No feature flag is needed: this aligns the command palette with existing Search sessions / Quick Open behavior and simplifies internal wiring.

How did you verify your code works?

  • packages/util: bun test ./src/session-mention.test.ts (9 pass) and bun run typecheck:tsc
  • packages/app: bun run typecheck:tsc, browser unit tests (command-palette.test.ts, command-palette-search.test.ts, search-machine.test.ts — 15 pass), and built Playwright e2e (command-palette.spec.ts cross-server ID test, 10/10 passes with --repeat-each=10 --workers=5 --retries=0)
  • packages/tui: bun test --timeout 30000 ./test/cli/tui/command-palette.test.tsx ./test/cli/tui/dialog-session-list.test.tsx ./test/cli/tui/dialog-open.test.tsx (27 pass) and bun run typecheck:tsc
  • Repo-wide lint: bun run lint and bun run lint:changed HEAD^1 (0 problems)

Screenshots / recordings

N/A

Checklist

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

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. In the TUI, typing a session ID into the command palette showed 'No results found' on the base; with this PR it lists the session and Enter opens it (screenshots below). The util and TUI tests you added or changed pass, and typecheck:tsc is clean for packages/app and packages/tui. I didn't run the Desktop/Web side, only read it and type-checked it:

  • The removed filesOnly, onOpenFile, rootFileEntries and createCommandPaletteFileOpener have no remaining callers.
  • The shell-level command.palette registration still covers Home after Home's own registration is removed.
  • File search still appears inside sessions, because the dialog renders under the opener's context, where FileContext is available.

Public API: unchanged. parseSessionID and the newly exported TUI/app contexts are internal.

One behaviour change worth a maintainer's nod: inside a session, the Desktop palette used to search only the current server's sessions. It now searches every online visible server, like Search sessions. With several servers connected, each search goes to all of them, and the recent-sessions list mixes servers. This seems intended by the description, so it isn't blocking.

No other concerns. The new tests wait on the rendered frame and route instead of sleeping, so they don't look flaky.

Before

After

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new commit looks right. Rows from another server now keep their server name whenever registry.tag() returns one, which also covers the case where the local server is offline and filtered out. Rows with no project text now show just the server name instead of · Remote. tag() already handles the single-server and current-server cases, so dropping the servers.length < 2 check doesn't add a label anywhere it shouldn't. I type-checked packages/app (clean) but didn't run Desktop or the e2e test. Public API: unchanged. No new concerns.

@gsimone
gsimone merged commit f563c1f into dev Dec 2, 2026
10 checks passed
@gsimone
gsimone deleted the palette-session-id branch December 2, 2026 16:15
@amrkmn amrkmn mentioned this pull request Dec 3, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant