Skip to content

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

TypeScript

adapt(desktop-app): re-apply agent displayName to dev's rebuilt GFS access UI

Diego Zacarias6bcdcc076e6b
diff --git a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
index 681c7ad92..44721cf45 100644
--- a/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
+++ b/desktop-app/ui/src/gfs/GfsGrantList/index.tsx
@@ -22,7 +22,9 @@ function subjectLabel(
): string {
if (subject.type === 'host' && subject.id) {
const agent = agents.find(candidate => candidate.id === subject.id)
- if (agent) return agent.name
+ // Visible agent name (spec.displayName); fall back to the id-based `name`
+ // when the displayName is absent or blank/whitespace-only.
+ if (agent) return (agent.displayName ?? '').trim() || agent.name
}
if ((subject.type === 'user' || subject.type === 'team') && subject.id) {
const match = subjects.find(
diff --git a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
index e9989c5a5..141395364 100644
--- a/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
+++ b/desktop-app/ui/src/gfs/__tests__/GfsGrantList.test.tsx
@@ -63,6 +63,28 @@ describe('GfsGrantList', () => {
expect(screen.getByText('1st:mcp-host/unknown')).toBeTruthy()
})
+ it('labels a host subject by its displayName, falling back to the identifier when blank', () => {
+ render(
+ <GfsGrantList
+ agents={[
+ { id: '1st:mcp-host/withdisplay', name: 'withdisplay', displayName: 'Support Bot' },
+ { id: '1st:mcp-host/blankdisplay', name: 'blankdisplay', displayName: ' ' },
+ ]}
+ items={[
+ grantItem({ id: 'g-1', subject: { type: 'host', id: '1st:mcp-host/withdisplay' } }),
+ grantItem({ id: 'g-2', subject: { type: 'host', id: '1st:mcp-host/blankdisplay' } }),
+ ]}
+ onRevoke={vi.fn()}
+ subjects={subjects}
+ />
+ )
+
+ // Present displayName wins over the identifier.
+ expect(screen.getByText('Support Bot')).toBeTruthy()
+ // A whitespace-only displayName must NOT render a blank label — fall back to the id-based name.
+ expect(screen.getByText('blankdisplay')).toBeTruthy()
+ })
+
it('fires the revoke callback from the row button with an accessible name', () => {
const onRevoke = vi.fn()
const item = grantItem({ id: 'grant-1' })
diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsx
index 8431e852a..d21ef6b0b 100644
--- a/desktop-app/ui/src/pages/FilesPage.tsx
+++ b/desktop-app/ui/src/pages/FilesPage.tsx
@@ -181,7 +181,10 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:
...agentSubjects.map(agent => ({
type: 'host' as const,
id: agent.id,
- label: agent.name,
+ // Visible agent name (spec.displayName); the id-based `name` is the
+ // last-resort label for a blank/whitespace-only displayName so a
+ // selectable subject never renders an empty label.
+ label: (agent.displayName ?? '').trim() || agent.name,
description: 'Agent',
badge: 'Agent',
})),