Skip to content

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

TypeScript

fix(desktop-app): show agent display name across workspace surfaces (R1-M3)

Diego Zacariasa7983746a4e4
diff --git a/desktop-app/ui/src/components/agents/AgentWorkspace.tsx b/desktop-app/ui/src/components/agents/AgentWorkspace.tsx
index 888fd4703..b63e24589 100644
--- a/desktop-app/ui/src/components/agents/AgentWorkspace.tsx
+++ b/desktop-app/ui/src/components/agents/AgentWorkspace.tsx
@@ -75,9 +75,10 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
loading: contextsLoading,
error: contextsError,
} = useContextsDataController()
- const { agentContextByName, selectedAgentMcpServers } = useMcpServersDataController({
- selectedAgent,
- })
+ const { agentContextByName, agentDisplayByName, selectedAgentMcpServers } =
+ useMcpServersDataController({
+ selectedAgent,
+ })
const { sessionStateByChatId, activeChatId } = useChatListContext()
const activeSessionState = activeChatId ? sessionStateByChatId[activeChatId] : undefined
const { hostRuntimeStatus } = useMcpRuntimeContext()
@@ -98,6 +99,13 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
const selectedAgentContext = selectedAgent
? String(agentContextByName[selectedAgent] || '').trim()
: ''
+ // Visible agent name (spec.host) for the workspace hero title. `selectedAgent`
+ // is always a catalog agent, so `agentDisplayByName` is total over it — the
+ // single sanctioned fallback (Decision #6) keeps the id if a display is
+ // missing. Display-only: lookups/actions keep using `selectedAgent`.
+ const selectedAgentDisplay = selectedAgent
+ ? (agentDisplayByName[selectedAgent] ?? selectedAgent)
+ : null
const visibleContextIds = useMemo(
() =>
selectedAgentContext
@@ -131,8 +139,14 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
: 'Workspace status and queue details for this agent.'
const agentOptions = useMemo(
- () => agentNames.map(agentName => ({ id: agentName, label: agentName })),
- [agentNames]
+ // id stays the identifier (drives selection/matching); label shows the
+ // display name (spec.host) with the single sanctioned fallback (Decision #6).
+ () =>
+ agentNames.map(agentName => ({
+ id: agentName,
+ label: agentDisplayByName[agentName] ?? agentName,
+ })),
+ [agentNames, agentDisplayByName]
)
const routeOptions = useMemo(
() => AGENT_ROUTE_OPTIONS.map(route => ({ id: route, label: AGENT_ROUTE_LABELS[route] })),
@@ -150,7 +164,7 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
emptyLabel="No agents"
options={agentOptions}
selectedId={selectedAgent ?? ''}
- selectedLabel={selectedAgent ?? ''}
+ selectedLabel={selectedAgentDisplay ?? ''}
onSelectAgent={agentName => {
if (isChatMode) {
onSelectChatAgent(agentName, { selectLatest: false })
@@ -223,11 +237,11 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
// row, so the breadcrumb there shows only the root "Chat" item.
const agentBreadcrumbLabel = isChatMode ? (
<span className="agent-workspace-agent-breadcrumb-actions">
- {selectedAgent || 'Agent'}
+ {selectedAgentDisplay || 'Agent'}
{isChatMode && activeChatId ? chatAgentRouteMenu : null}
</span>
) : (
- selectedAgent || 'Agent'
+ selectedAgentDisplay || 'Agent'
)
const agentBreadcrumbItem: PageBreadcrumbItem =
mode === 'agents' && selectedAgent
@@ -336,7 +350,7 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
>
{!isChatMode && selectedAgentRoute === 'mcp-servers' && (
<section className="agent-mcp-panel" aria-label="Agent connectors">
- <AgentHero agentName={selectedAgent} subtitle={routeSubtitle} />
+ <AgentHero agentName={selectedAgentDisplay} subtitle={routeSubtitle} />
<McpServerHealthTable
hostRef={selectedAgent ?? ''}
@@ -350,7 +364,7 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
{!isChatMode && selectedAgentRoute === 'contexts' && (
<section className="agent-workspace-panel" aria-label="Agent contexts">
- <AgentHero agentName={selectedAgent} subtitle={routeSubtitle} />
+ <AgentHero agentName={selectedAgentDisplay} subtitle={routeSubtitle} />
{contextsLoading && !visibleContextIds.length ? (
<EmptyState title="Loading" body="Fetching authorized contexts..." />
@@ -407,7 +421,7 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
{!isChatMode && selectedAgentRoute === 'shared-files' && (
<section className="agent-workspace-panel" aria-label="Agent files">
- <AgentHero agentName={selectedAgent} subtitle={routeSubtitle} />
+ <AgentHero agentName={selectedAgentDisplay} subtitle={routeSubtitle} />
{selectedAgentContext ? (
<SharedFilesTab contextId={selectedAgentContext} />
@@ -426,7 +440,7 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
aria-label="Agent details"
>
<AgentHero
- agentName={selectedAgent}
+ agentName={selectedAgentDisplay}
subtitle="Agent details"
subtitleTone="eyebrow"
/>
@@ -489,7 +503,7 @@ export function AgentWorkspace({ mode = 'agents', scrollContainerRef }: AgentWor
{!isChatMode && selectedAgentRoute === 'activity' && (
<section className="agent-workspace-panel" aria-label="Agent activity">
- <AgentHero agentName={selectedAgent} subtitle={routeSubtitle} />
+ <AgentHero agentName={selectedAgentDisplay} subtitle={routeSubtitle} />
<ActivityDashboard />
</section>
diff --git a/desktop-app/ui/src/components/agents/__tests__/AgentWorkspace.displayName.test.tsx b/desktop-app/ui/src/components/agents/__tests__/AgentWorkspace.displayName.test.tsx
index f03f92a28..2131dc804 100644
--- a/desktop-app/ui/src/components/agents/__tests__/AgentWorkspace.displayName.test.tsx
+++ b/desktop-app/ui/src/components/agents/__tests__/AgentWorkspace.displayName.test.tsx
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import { afterEach, describe, expect, it, vi } from 'vitest'
-import { cleanup, render, screen } from '@testing-library/react'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { AgentWorkspace } from '../AgentWorkspace'
// UT-11 (spec §5, F3 desktop-app) — Context display with the single sanctioned
@@ -15,8 +15,21 @@ const contextsMock = vi.hoisted(() => ({
contextDisplayById: {} as Record<string, string>,
}))
+const mcpMock = vi.hoisted(() => ({
+ agentDisplayByName: {} as Record<string, string>,
+}))
+
+const navMock = vi.hoisted(() => ({
+ selectedAgent: 'product-agent' as string | null,
+ selectedAgentRoute: 'contexts' as string,
+}))
+
+const agentsMock = vi.hoisted(() => ({
+ agentNames: ['product-agent'] as string[],
+}))
+
vi.mock('@hooks/domain/useAgentsDataController', () => ({
- useAgentsDataController: () => ({ agentNames: ['product-agent'] }),
+ useAgentsDataController: () => ({ agentNames: agentsMock.agentNames }),
}))
vi.mock('@hooks/domain/useContextsDataController', () => ({
@@ -31,14 +44,15 @@ vi.mock('@hooks/domain/useContextsDataController', () => ({
vi.mock('@hooks/domain/useMcpServersDataController', () => ({
useMcpServersDataController: () => ({
agentContextByName: {},
+ agentDisplayByName: mcpMock.agentDisplayByName,
selectedAgentMcpServers: [],
}),
}))
vi.mock('@contexts/NavigationContext', () => ({
useNavigationContext: () => ({
- selectedAgent: 'product-agent',
- selectedAgentRoute: 'contexts',
+ selectedAgent: navMock.selectedAgent,
+ selectedAgentRoute: navMock.selectedAgentRoute,
handleBackToAgents: vi.fn(),
handleOpenAgentWorkspace: vi.fn(),
handleSelectChatAgent: vi.fn(),
@@ -56,11 +70,20 @@ vi.mock('@contexts/McpRuntimeContext', () => ({
vi.mock('@hooks/useClickOutside', () => ({ useClickOutside: vi.fn() }))
+// Chat-mode children pull in a web of chat/composer contexts that are irrelevant
+// to the title-selector label under test; stub them so the selector renders in
+// isolation.
+vi.mock('../ComposerPanel', () => ({ ComposerPanel: () => null }))
+vi.mock('../ChatThread', () => ({ ChatThread: () => null }))
+
describe('AgentWorkspace context rows — visible name (UT-11)', () => {
afterEach(() => {
cleanup()
contextsMock.contextIds = []
contextsMock.contextDisplayById = {}
+ mcpMock.agentDisplayByName = {}
+ navMock.selectedAgent = 'product-agent'
+ navMock.selectedAgentRoute = 'contexts'
vi.clearAllMocks()
})
@@ -77,3 +100,100 @@ describe('AgentWorkspace context rows — visible name (UT-11)', () => {
expect(screen.getByText('ctx-plain')).toBeTruthy()
})
})
+
+// R1-M3 (desktop-app): the workspace hero title must show the agent DISPLAY name
+// (spec.host, arriving as agentDisplayByName[name]) — not the raw identifier
+// (metadata.name) the tables map to a display elsewhere. Single sanctioned
+// fallback `agentDisplayByName[name] ?? name` (Decision #6): the id shows only
+// when no display exists. The hero renders on the details route.
+describe('AgentWorkspace hero + breadcrumb — visible agent name (R1-M3)', () => {
+ afterEach(() => {
+ cleanup()
+ mcpMock.agentDisplayByName = {}
+ navMock.selectedAgent = 'product-agent'
+ navMock.selectedAgentRoute = 'contexts'
+ agentsMock.agentNames = ['product-agent']
+ vi.clearAllMocks()
+ })
+
+ it('renders the agent display name in the hero AND the breadcrumb when a display differs from the id', () => {
+ navMock.selectedAgent = 'alpha'
+ navMock.selectedAgentRoute = 'details'
+ mcpMock.agentDisplayByName = { alpha: 'Alpha Host' }
+
+ render(<AgentWorkspace scrollContainerRef={{ current: null }} />)
+
+ // Hero title uses .agent-details-name; it must carry the display, not the id.
+ const hero = document.querySelector('.agent-details-name')
+ expect(hero?.textContent).toBe('Alpha Host')
+ // The raw identifier must not be the visible hero title.
+ expect(hero?.textContent).not.toBe('alpha')
+
+ // Agents-mode breadcrumb renders the agent item as a clickable button whose
+ // visible label must be the display, not the id.
+ expect(screen.getByRole('button', { name: 'Alpha Host' })).toBeTruthy()
+ expect(screen.queryByRole('button', { name: 'alpha' })).toBeNull()
+ })
+
+ it('falls back to the identifier in the hero AND the breadcrumb when no display exists', () => {
+ navMock.selectedAgent = 'alpha'
+ navMock.selectedAgentRoute = 'details'
+ mcpMock.agentDisplayByName = {}
+
+ render(<AgentWorkspace scrollContainerRef={{ current: null }} />)
+
+ const hero = document.querySelector('.agent-details-name')
+ expect(hero?.textContent).toBe('alpha')
+ expect(screen.getByRole('button', { name: 'alpha' })).toBeTruthy()
+ })
+})
+
+// R1-M3 (class extension): the chat-mode title-row agent selector must also show
+// the DISPLAY name — both in the collapsed trigger (selectedLabel) and in each
+// dropdown option row (option.label). The identifier still drives selection
+// (selectedId / option.id), so switching remains keyed on the id.
+describe('AgentWorkspace title selector — visible agent name (R1-M3)', () => {
+ afterEach(() => {
+ cleanup()
+ mcpMock.agentDisplayByName = {}
+ navMock.selectedAgent = 'product-agent'
+ navMock.selectedAgentRoute = 'contexts'
+ agentsMock.agentNames = ['product-agent']
+ vi.clearAllMocks()
+ })
+
+ it('shows the display in the collapsed trigger and in the dropdown option row', () => {
+ navMock.selectedAgent = 'alpha'
+ agentsMock.agentNames = ['alpha']
+ mcpMock.agentDisplayByName = { alpha: 'Alpha Host' }
+
+ // Chat mode with no active chat renders the greeting title-row selector.
+ render(<AgentWorkspace mode="chat" scrollContainerRef={{ current: null }} />)
+
+ // Collapsed trigger label = the display.
+ const triggerLabel = document.querySelector('.agent-title-selector-trigger-label')
+ expect(triggerLabel?.textContent).toBe('Alpha Host')
+
+ // Open the dropdown and assert the option row renders the display, not the id.
+ fireEvent.click(screen.getByRole('button', { name: 'Switch chat agent' }))
+ const optionRow = document.querySelector('.agent-title-selector-row-label')
+ expect(optionRow?.textContent).toBe('Alpha Host')
+ // The 3-dots aria-label is derived from the visible label too.
+ expect(screen.getByRole('menuitem', { name: 'Open Alpha Host sections' })).toBeTruthy()
+ })
+
+ it('falls back to the identifier in the trigger when no display exists', () => {
+ navMock.selectedAgent = 'alpha'
+ agentsMock.agentNames = ['alpha']
+ mcpMock.agentDisplayByName = {}
+
+ render(<AgentWorkspace mode="chat" scrollContainerRef={{ current: null }} />)
+
+ const triggerLabel = document.querySelector('.agent-title-selector-trigger-label')
+ expect(triggerLabel?.textContent).toBe('alpha')
+
+ fireEvent.click(screen.getByRole('button', { name: 'Switch chat agent' }))
+ const optionRow = document.querySelector('.agent-title-selector-row-label')
+ expect(optionRow?.textContent).toBe('alpha')
+ })
+})