Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-ui): round-4 #3 guard empty agentName in in-drawer notification wrap

Diego Zacariasa28753c9d41b
diff --git a/desktop-app/ui/src/App.tsx b/desktop-app/ui/src/App.tsx
index de1c4c0ea..cffbcfaa0 100644
--- a/desktop-app/ui/src/App.tsx
+++ b/desktop-app/ui/src/App.tsx
@@ -465,6 +465,10 @@ export function App() {
chatDrawerAvailableRef.current &&
notification.kind !== 'workflow_completed' &&
notification.kind !== 'sdk_notification' &&
+ // Mirror the controller's `if (!targetAgent) return`: an agent-less
+ // conversation notification has nothing to load, so it never surfaces —
+ // opening the drawer for it would leave it up with a blank composer.
+ String(notification.agentName || '').trim() !== '' &&
(!notification.teamId || notification.teamId === vm.getCurrentTeamId())
if (surfacesInDrawer) {
setChatDrawerOpen(true)
diff --git a/desktop-app/ui/src/__tests__/App.chatDrawer.test.tsx b/desktop-app/ui/src/__tests__/App.chatDrawer.test.tsx
index 8f0e6f26c..148056919 100644
--- a/desktop-app/ui/src/__tests__/App.chatDrawer.test.tsx
+++ b/desktop-app/ui/src/__tests__/App.chatDrawer.test.tsx
@@ -538,6 +538,51 @@ describe('App chat drawer — reopen preserves the last-viewed chat', () => {
})
expect(sandboxUiPageHarness.props?.chatDrawerOpen).toBe(false)
})
+
+ // An agent-conversation notification with an empty agentName has nothing to
+ // load — the controller bails on `if (!targetAgent) return`. The in-drawer wrap
+ // re-encodes that routing, so it must mirror the same guard; otherwise it opens
+ // the drawer and passes keepNavItem for a gesture that loads nothing, leaving the
+ // drawer up with a blank composer.
+ it('does not open the drawer for a conversation notification with an empty agentName', async () => {
+ currentController = makeController({
+ selectedAgent: 'alpha',
+ activeChatId: null,
+ navItem: DESKTOP_ROUTES.chat,
+ chatList: CHAT_LIST,
+ } as Partial<AppController>)
+ const { rerender } = render(<App />)
+
+ // Launch from the picker (no origin) → app live, apps route, drawer CLOSED.
+ act(() => {
+ sidebarHarness.props?.onOpenSandboxUiApp?.({
+ appRef: 'ns/app',
+ label: 'App',
+ defaultPath: '/',
+ })
+ })
+ expect(currentController.navItem).toBe(DESKTOP_ROUTES.apps)
+ expect(sandboxUiPageHarness.props?.chatDrawerOpen).toBe(false)
+
+ // Conversation notification whose agentName is blank → nothing to surface.
+ await act(async () => {
+ await appHeaderHarness.openNotification?.({
+ id: 'n3',
+ kind: 'approval_required',
+ agentName: ' ',
+ chatId: 'chat-2',
+ } as unknown as Parameters<NonNullable<typeof appHeaderHarness.openNotification>>[0])
+ })
+ act(() => rerender(<App />))
+
+ // The drawer never opened, and the gesture ran through the plain path WITHOUT
+ // keepNavItem (the controller itself will then no-op on the empty agent).
+ expect(sandboxUiPageHarness.props?.chatDrawerOpen).toBe(false)
+ expect(currentController.handleOpenNotification).toHaveBeenCalledWith(
+ expect.objectContaining({ agentName: ' ' }),
+ undefined
+ )
+ })
})
// Mini-spec 05: below the minimum panel width the drawer is SUPPRESSED (hidden,