Skip to content

Stop ⌘K and notification clicks stealing the main tab - #74445

Merged
OutThisLife merged 3 commits into
mainfrom
bb/cmdk-session-tab
Jul 29, 2026
Merged

Stop ⌘K and notification clicks stealing the main tab#74445
OutThisLife merged 3 commits into
mainfrom
bb/cmdk-session-tab

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

Opening a chat from ⌘K or a native notification took over the main tab, discarding whatever conversation was loaded there.

Both surfaces went through openSession — the shared door — but passed the sidebar's in-place intent. That intent means "focus it if it's on screen, otherwise load it into main," which is right for a row clicked in a list you're already looking at and wrong for a chat opened from outside the workspace. Neither surface had a home of its own, so both spent the one you were using.

This adds a stack intent for openers with no surface to come from. It focuses the session when it's already open, takes over an unused "New session" tab when one exists, and falls back to main only while main is itself a blank draft. Modifiers are unchanged: ⌘/⌃ still forces a new tab, ⇧⌘ still pops a window.

newSessionOpensTab answered the same question the new intent needed, so it moved into the door as mainChatOccupied and the sidebar "+" now shares that one definition.

Test plan

  • ⌘K a session with a chat loaded in main → opens beside it, main untouched
  • ⌘K a session that's already an open tile → jumps to that tile
  • ⌘K with one blank "New session" tab open → takes over that tab instead of adding a second
  • ⌘K on a fresh window (main is a blank draft) → loads into main, matching the sidebar
  • ⌘-Enter and ⇧⌘-select still force a tab / window
  • Click a native notification while another chat is loaded → opens beside it
  • Sidebar rows and "+" behave exactly as before

newSessionOpensTab answers a question that isn't specific to the sidebar
"+" — is there a conversation on main that must not be discarded — and the
palette needs the same answer. Fold it into open-session as
mainChatOccupied so both callers share one definition.
An unused draft tab is the one a user would have typed into, so give the
tile store a way to name it (blankDraftTile) and hand it to another
session in place (reuseBlankDraftTile). A blank-but-busy tab has its
first turn in flight and an unbound tile is unknown rather than empty, so
neither is a candidate.
Both surfaces passed the sidebar's in-place intent, which means "load it
into main when it isn't already on screen" — right for a row you clicked
in a list you were looking at, wrong for a chat opened from outside the
workspace. Neither had a surface of its own, so they took the one you
were using.

Add a stack intent for that case. It focuses the session when it's
already open, spends an unused draft tab when there is one, and only
falls back to main while main is itself a blank draft. Modifiers still
force a tab or window.
@OutThisLife
OutThisLife enabled auto-merge July 29, 2026 23:18
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/desktop Electron desktop app (apps/desktop/*) area/sessions Session lifecycle, resume, persistence, history sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 29, 2026
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 93e5413

ℹ️ Info

Desktop E2E visual evidence · View test artifacts · View job

1 visual diff.

inline evidence is publishing...

@OutThisLife
OutThisLife merged commit 5010b94 into main Jul 29, 2026
33 checks passed
@OutThisLife
OutThisLife deleted the bb/cmdk-session-tab branch July 29, 2026 23:25
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
…on-tab

Stop ⌘K and notification clicks stealing the main tab
33hodl pushed a commit to 33hodl/hermes-agent that referenced this pull request Aug 12, 2026
…on-tab

Stop ⌘K and notification clicks stealing the main tab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/sessions Session lifecycle, resume, persistence, history 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