Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(desktop-app): resolve the display name in the approval toast body fallback (review P1)
M36f509805a18
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/useChatNotifications.test.tsx b/desktop-app/ui/src/hooks/domain/__tests__/useChatNotifications.test.tsxindex 5ed49bcf0..af22c6f89 100644--- a/desktop-app/ui/src/hooks/domain/__tests__/useChatNotifications.test.tsx+++ b/desktop-app/ui/src/hooks/domain/__tests__/useChatNotifications.test.tsx@@ -107,4 +107,30 @@ describe('useChatNotifications — reply first-materialization dedupe (§4.7.2)'expect.objectContaining({ kind: 'assistant_reply', agentName: 'agent-x' }))})++ // Review P1: the approval toast's BODY fallback must also resolve the+ // display name — an empty approval text used to degrade to the raw slug+ // while the title right above it showed the friendly name.+ it('uses the display name in the approval toast body fallback', () => {+ const params = makeParams()+ const { result } = renderHook(() => useChatNotifications(params))++ result.current.pushApprovalNotification({+ agentName: 'agent-x',+ chatId: 'chat-1',+ taskId: 'task-1',+ requestId: 'request-1',+ text: '',+ })++ expect(params.showDesktopNotification).toHaveBeenCalledWith(+ expect.objectContaining({+ title: 'Agent X needs authorization',+ body: 'Approval required for Agent X.',+ })+ )+ expect(params.pushNotification).toHaveBeenCalledWith(+ expect.objectContaining({ kind: 'approval_required', agentName: 'agent-x' })+ )+ })})diff --git a/desktop-app/ui/src/hooks/domain/useChatNotifications.ts b/desktop-app/ui/src/hooks/domain/useChatNotifications.tsindex 3d7bf496c..7cc6aaf11 100644--- a/desktop-app/ui/src/hooks/domain/useChatNotifications.ts+++ b/desktop-app/ui/src/hooks/domain/useChatNotifications.ts@@ -210,7 +210,12 @@ export function useChatNotifications({const deps = liveDepsRef.currentconst notificationTeamId = deps.currentTeamId || undefinedconst dedupeKey = `approval:${agentName}:${taskId}:${requestId}`- const desktopText = formatNotificationPreview(text, `Approval required for ${agentName}.`)+ // Body fallback resolves the display name too — the title next to it+ // already does, so an empty approval text never degrades to the raw slug.+ const desktopText = formatNotificationPreview(+ text,+ `Approval required for ${deps.agentDisplayName(agentName)}.`+ )deps.pushNotification({kind: 'approval_required',agentName,