Skip to content

fix(desktop): ⌘K session search honours renames and groups pinned sessions first - #120925

Merged
OutThisLife merged 2 commits into
mainfrom
bb/session-search-titles
Sep 24, 2026
Merged

OutThisLife merged 2 commits into
mainfrom
bb/session-search-titles

Conversation

@OutThisLife

Copy link
Copy Markdown

What does this PR do?

⌘K session search was showing stale titles and ignoring pins.

Renames / archives. The palette fetched its own 200-row page through react-query with the client's 60s staleTime, and nothing ever invalidated it: a rename, pin, or archive lands in the sidebar's session stores while the palette is unmounted, so ⌘K kept the old title (or a just-archived row) for up to a minute, and painted it stale-first even after that. The two session queries now revalidate on every open (staleTime: 0; the cached page still paints instantly), and the sidebar's live stores ($sessions / $cronSessions / $messagingSessions) are overlaid on the fetched page by id, so title and pin come from what the sidebar already knows and ids in $removedSessionIds are dropped.

Pins. pinned was never read: pinned sessions sat in Sessions with no group, icon, or ranking advantage. They are now resolved the same way the sidebar's Pinned section resolves them (resolvePinnedSessions: local pin order, then server-flagged pins, minus in-flight unpins) and listed under a Pinned heading ahead of Sessions with the Pin icon. rankGroups is a stable sort, so on equal scores a pin wins the tie.

Also folds the three copies of the session keyword array into one sessionKeywords helper.

Related Issue

None filed; found while using the app.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • apps/desktop/src/app/command-palette/index.tsx
    • staleTime: 0 on the ['command-palette', 'sessions' | 'archived'] queries
    • liveRows: fetched page overlaid with the sidebar stores' title/pin, minus removed ids
    • pinnedSessions via buildSessionByAnyId + resolvePinnedSessions; new Pinned group before Sessions
    • sessionKeywords helper shared by Pinned / Sessions / Archived rows

How to Test

Verified in a live dev instance over CDP against real ~/.hermes data:

  1. Rename a session from the sidebar context menu, open ⌘K, type part of the new name: the row shows the new title immediately (previously up to 60s stale). Rename back, same.
  2. Pin a session from the sidebar, open ⌘K, search it: it moves to a Pinned group at the top with the pin icon. Unpin: back under Sessions.
  3. Type triage with several matching sessions: Pinned lists Triage (exact) above Review hermes-triage …, then Projects, then Sessions; the Pinned rows match the sidebar's Pinned section exactly.
  4. Archive a session, open ⌘K: it no longer appears under Sessions.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass — N/A, renderer-only; tsc -p ., eslint and prettier pass on the touched file
  • I've added tests for my changes — the palette body has no existing unit harness; verified live as above
  • I've tested on my platform: macOS 26.6

Documentation & Housekeeping

  • I've updated relevant documentation — N/A
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — N/A (renderer logic only)
  • I've updated tool descriptions/schemas — N/A

…tely

The palette fetched its own 200-row page through react-query with the
client's 60s staleTime, and nothing invalidated it: a rename, pin, or
archive lands in the sidebar's session stores while the palette is
unmounted, so ⌘K kept showing the old title (or an archived row) for up
to a minute, and painted it stale-first even after.

Revalidate on every open (staleTime 0; the cached page still paints
instantly) and overlay the sidebar's live stores on the fetched page by
id, so title and pin come from what the sidebar already knows and rows
the user just archived or deleted are dropped.
Pinned sessions were mixed into Sessions with no group, icon, or ranking
advantage. Resolve them the way the sidebar's Pinned section does
(resolvePinnedSessions: local pin order, then server-flagged pins, minus
in-flight unpins) and list them under a Pinned heading ahead of Sessions;
rankGroups' stable sort then lets a pin win a tie on equal scores.
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

૮ >ﻌ< ა ci review

ran on 3fd4960 — feat(desktop): ⌘K groups pinned sessions first

debug info

CI timings

CI timings · View report · View job

Wall time 3m37s vs 5m30s (-34.2%). 4 job(s) slower, 3 faster,

  • JS & TS checks / JS & TS checks: +31.0s
  • Check no committed infographics / check-no-committed-infographics: +9.0s
  • Check no case-colliding filenames / check-case-collisions: +3.0s
  • Profile artifact check / Reject profile archives: -1.0s
  • Detect affected areas: +1.0s

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Sep 24, 2026
@OutThisLife
OutThisLife merged commit fcd6e78 into main Sep 24, 2026
32 checks passed
@OutThisLife
OutThisLife deleted the bb/session-search-titles branch September 24, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants