From b16f1f894479ffb1b96831ad31cb436f07a6a141 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Thu, 8 Oct 2026 15:49:11 -0400
Subject: [PATCH 1/3] fix(commands): broadcast location catalog events to all
stream clients
Location-scoped command, agent and skill catalog events were only delivered to clients subscribed to the originating directory, so a client attached to another location never saw a catalog change and its slash menu stayed on the builtin commands. Route command.updated, agent.updated and skill.updated through the resolved-event broadcast so every connected client receives them.
---
backend/src/services/sse-aggregator.ts | 7 +++-
backend/test/services/sse-aggregator.test.ts | 43 ++++++++++++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/backend/src/services/sse-aggregator.ts b/backend/src/services/sse-aggregator.ts
index 1692fbeb..2aa2d9aa 100644
--- a/backend/src/services/sse-aggregator.ts
+++ b/backend/src/services/sse-aggregator.ts
@@ -34,6 +34,7 @@ type ReplayEventType = 'permission.asked' | 'form.created' | 'session.status'
const { RECONNECT_DELAY_MS, MAX_RECONNECT_DELAY_MS } = DEFAULTS.SSE
const MULTILINE_PATTERN = /[\r\n]/
+const LOCATION_CATALOG_EVENT_TYPES = new Set(['command.updated', 'agent.updated', 'skill.updated'])
function serializeEnvelope(directory: string | null, payloadJson: string): string {
return '{"directory":' + JSON.stringify(directory) + ',"payload":' + payloadJson + '}'
@@ -434,7 +435,11 @@ class SSEAggregator {
}
if (directory) {
- this.deliverEvent(directory, event, payloadJson)
+ if (LOCATION_CATALOG_EVENT_TYPES.has(event.type)) {
+ this.deliverResolvedEvent(directory, event, payloadJson)
+ } else {
+ this.deliverEvent(directory, event, payloadJson)
+ }
return
}
diff --git a/backend/test/services/sse-aggregator.test.ts b/backend/test/services/sse-aggregator.test.ts
index 0fe3d2b6..f4545f41 100644
--- a/backend/test/services/sse-aggregator.test.ts
+++ b/backend/test/services/sse-aggregator.test.ts
@@ -797,3 +797,46 @@ describe('SSEAggregator directory-less session event routing', () => {
expect(seen).toEqual([{ directory: '/r', type: 'session.execution.succeeded', sessionID: 'ses_fork' }])
})
})
+
+describe('SSEAggregator location-scoped catalog event broadcast', () => {
+ beforeEach(() => {
+ sseAggregator.shutdown()
+ sseAggregator.setPendingActionsFetcher(null)
+ sseAggregator.setScheduledSessionsResolver(() => [])
+ })
+
+ it.each(['command.updated', 'agent.updated', 'skill.updated'])(
+ 'broadcasts a location-scoped %s catalog event to every client without leaking other location-scoped events',
+ (type) => {
+ const subscribed = createCapturingClient()
+ const unsubscribed = createCapturingClient()
+ sseAggregator.addClient('catalog-a', subscribed.callback, subscribed.writeFrame, ['/repo-a'])
+ sseAggregator.addClient('catalog-b', unsubscribed.callback, unsubscribed.writeFrame, [])
+
+ const seen: Array<{ directory: string; type: string }> = []
+ sseAggregator.onEvent((directory, event) => {
+ seen.push({ directory, type: event.type })
+ })
+
+ emitRawEvent({ id: 'evt_catalog', type, location: { directory: '/repo-c' }, data: {} })
+
+ const expected = {
+ directory: null,
+ payload: { id: 'evt_catalog', created: 1, type, location: { directory: '/repo-c' }, data: {} },
+ }
+ expect(subscribed.frames.map(parseFrame)).toEqual([expected])
+ expect(unsubscribed.frames.map(parseFrame)).toEqual([expected])
+ expect(seen).toEqual([{ directory: '/repo-c', type }])
+
+ emitRawEvent({
+ id: 'evt_status',
+ type: 'session.status',
+ location: { directory: '/repo-c' },
+ data: { sessionID: 'ses-1', status: { type: 'busy' } },
+ })
+
+ expect(subscribed.frames).toHaveLength(1)
+ expect(unsubscribed.frames).toHaveLength(1)
+ },
+ )
+})
From 79d6ba2f7e1901e6df726e14b895fc499c169f05 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Thu, 8 Oct 2026 16:16:51 -0400
Subject: [PATCH 2/3] fix(commands): load each location's commands instead of
trusting the builtin seed
The commands query seeded every new directory key with the builtin commands as initialData. With the app's 10s staleTime, React Query treated that seed as freshly fetched data, so switching to a session in another project never requested that location's commands and the slash menu showed only the builtins until some later invalidation.
Mark the seed as stale with initialDataUpdatedAt: 0 so each directory fetches its commands on mount.
---
frontend/src/hooks/useCommands.test.tsx | 21 +++++++++++++++++++++
frontend/src/hooks/useCommands.ts | 1 +
2 files changed, 22 insertions(+)
diff --git a/frontend/src/hooks/useCommands.test.tsx b/frontend/src/hooks/useCommands.test.tsx
index fb1e97c7..faec4757 100644
--- a/frontend/src/hooks/useCommands.test.tsx
+++ b/frontend/src/hooks/useCommands.test.tsx
@@ -130,6 +130,27 @@ describe('useCommands', () => {
})
})
+ it('loads commands for a newly selected directory even when queries have a stale time', async () => {
+ vi.mocked(listCommands).mockImplementation(async (directory) => [
+ { name: directory === '/repo-b' ? 'from-b' : 'from-a', description: '' },
+ ])
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: 60_000 } } })
+ const wrapper = ({ children }: { children: React.ReactNode }) => (
+ {children}
+ )
+
+ const { result, rerender } = renderHook(({ directory }) => useCommands({ directory }), {
+ wrapper,
+ initialProps: { directory: '/repo-a' },
+ })
+ await waitFor(() => expect(result.current.findCommand('from-a')).toBeDefined())
+
+ rerender({ directory: '/repo-b' })
+
+ await waitFor(() => expect(result.current.findCommand('from-b')).toBeDefined())
+ expect(listCommands).toHaveBeenCalledWith('/repo-b')
+ })
+
it('finds only exact command names, ignoring case', () => {
const { result } = renderHook(() => useCommands({ enabled: false }), { wrapper: createWrapper() })
diff --git a/frontend/src/hooks/useCommands.ts b/frontend/src/hooks/useCommands.ts
index 5c4dc09f..bdc0f2ab 100644
--- a/frontend/src/hooks/useCommands.ts
+++ b/frontend/src/hooks/useCommands.ts
@@ -33,6 +33,7 @@ export function useCommands(options: UseCommandsOptions = {}) {
},
enabled,
initialData: SORTED_BUILTIN_COMMANDS,
+ initialDataUpdatedAt: 0,
})
const searchCommands = useCallback((query: string) => rankByMatch(commands, query, {
From 7fedab6815533f65c13d5a8ce4db70865476f344 Mon Sep 17 00:00:00 2001
From: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Date: Thu, 8 Oct 2026 16:20:38 -0400
Subject: [PATCH 3/3] fix(prompt): drop the command icon from the slash menu
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The slash menu prefixed every command with the Command (⌘) glyph, which the leading "/" already conveys and which only consumed horizontal space. Render the kind icon only for kinds that have one, so command rows start at the label while agent, skill and file rows keep theirs.
---
.../message/PromptSuggestions.test.tsx | 12 ++++++++++++
.../components/message/PromptSuggestions.tsx | 19 ++++++++++---------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/frontend/src/components/message/PromptSuggestions.test.tsx b/frontend/src/components/message/PromptSuggestions.test.tsx
index c1b585bd..3ec65e14 100644
--- a/frontend/src/components/message/PromptSuggestions.test.tsx
+++ b/frontend/src/components/message/PromptSuggestions.test.tsx
@@ -70,6 +70,18 @@ describe('PromptSuggestions', () => {
expect(handlers.onSelect).not.toHaveBeenCalled()
})
+ it('omits the icon for commands but keeps it for other kinds', () => {
+ renderList({
+ items: [
+ { key: 'review', value: 'review', kind: 'command', label: '/review', ranges: [] },
+ { key: 'build', value: 'build', kind: 'agent', label: '@build', ranges: [] },
+ ],
+ })
+
+ expect(rowButton('/review').querySelector('svg')).toBeNull()
+ expect(rowButton('@build').querySelector('svg')).not.toBeNull()
+ })
+
it('renders nothing without items', () => {
renderList({ items: [] })
diff --git a/frontend/src/components/message/PromptSuggestions.tsx b/frontend/src/components/message/PromptSuggestions.tsx
index 6a05a4f1..1f91747c 100644
--- a/frontend/src/components/message/PromptSuggestions.tsx
+++ b/frontend/src/components/message/PromptSuggestions.tsx
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from 'react'
-import { Bot, Command, FileText, Sparkles, Play } from 'lucide-react'
+import { Bot, FileText, Sparkles, Play, type LucideIcon } from 'lucide-react'
import { SWIPE_COMMIT_DISTANCE, useTouchTapSelect } from '@/hooks/useTouchTapSelect'
import type { MatchRange } from '@/lib/fuzzyMatch'
@@ -28,8 +28,7 @@ interface PromptSuggestionsProps {
const TAKEOVER_TOP_GAP_PX = 8
const TAKEOVER_MIN_HEIGHT_PX = 160
-const KIND_ICONS: Record = {
- command: Command,
+const KIND_ICONS: Partial> = {
agent: Bot,
skill: Sparkles,
file: FileText,
@@ -111,12 +110,14 @@ export function PromptSuggestions({
: takeover ? 'bg-background border-transparent hover:bg-muted text-foreground' : 'hover:bg-muted text-foreground'
}`}
>
-
-
-
+ {Icon && (
+
+
+
+ )}
{renderHighlighted(item.label, item.ranges)}