Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): disambiguate duplicate agent display names in the access tabs (review R1-H1)
M9f253a1fbbec
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex 09fa5bc92..063caa832 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -9082,6 +9082,24 @@ td.cu-registry-description {border-bottom: none;}+/* Review R1-H1: agent rows in the member/team Agents tabs lead with the+ * display name (spec.host) and stack the immutable slug underneath whenever+ * the two differ — display names are not unique, the slug is the stable+ * identity for navigation, grants, and revoke. */+.cu-access-agent-copy {+ display: grid;+ gap: var(--cu-space-0);+ justify-items: start;+}++.cu-access-agent-id {+ color: var(--cu-text-muted);+ font-family: var(--cu-font-mono);+ font-size: var(--cu-font-size-xs);+ line-height: var(--cu-line-height-tight);+ overflow-wrap: anywhere;+}+.cu-table-actions {display: flex;gap: 0.15rem;diff --git a/control-ui/app/profile-admin/teams/[teamId]/page.tsx b/control-ui/app/profile-admin/teams/[teamId]/page.tsxindex ad4b5f4e2..92e23a0e6 100644--- a/control-ui/app/profile-admin/teams/[teamId]/page.tsx+++ b/control-ui/app/profile-admin/teams/[teamId]/page.tsx@@ -989,18 +989,31 @@ export default function TeamDetailsPage() {// Rename propagation: display name (spec.host) — same// resolution as the add-agent picker on this page. Links// and actions stay keyed by the immutable slug.+ // Review R1-H1: display names are not unique, so the slug+ // stays visible as secondary identity whenever it differs,+ // and the action label carries it to keep duplicates+ // distinguishable and correctly targeted.const agentDisplayName = getAgentDisplayName(agentName, hosts)+ const agentRowLabel =+ agentDisplayName === agentName+ ? agentDisplayName+ : `${agentDisplayName} (${agentName})`return (<RecordListRow key={agentName} className="cu-access-row">- <button- type="button"- className="cu-link"- onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}- >- {agentDisplayName}- </button>+ <div className="cu-access-agent-copy">+ <button+ type="button"+ className="cu-link"+ onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}+ >+ {agentDisplayName}+ </button>+ {agentDisplayName !== agentName ? (+ <span className="cu-access-agent-id">{agentName}</span>+ ) : null}+ </div><RowActionMenu- ariaLabel={`Actions for agent ${agentDisplayName}`}+ ariaLabel={`Actions for agent ${agentRowLabel}`}actions={[{key: 'view',diff --git a/control-ui/app/profile-admin/users/[userId]/page.tsx b/control-ui/app/profile-admin/users/[userId]/page.tsxindex 969495860..e826cfa49 100644--- a/control-ui/app/profile-admin/users/[userId]/page.tsx+++ b/control-ui/app/profile-admin/users/[userId]/page.tsx@@ -1131,21 +1131,34 @@ export default function UserDetailsPage() {// the same resolution the add-agent picker above uses — so// a newly created or renamed agent reads by its name, not// its immutable slug. Links/actions stay keyed by the slug.+ // Review R1-H1: display names are not unique, so the slug+ // stays visible as secondary identity whenever it differs,+ // and the action label carries it to keep duplicates+ // distinguishable and correctly targeted.const agentDisplayName = getAgentDisplayName(agentName, hosts)+ const agentRowLabel =+ agentDisplayName === agentName+ ? agentDisplayName+ : `${agentDisplayName} (${agentName})`return (<tr key={agentName}><td>- <button- type="button"- className="cu-link"- onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}- >- {agentDisplayName}- </button>+ <div className="cu-access-agent-copy">+ <button+ type="button"+ className="cu-link"+ onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}+ >+ {agentDisplayName}+ </button>+ {agentDisplayName !== agentName ? (+ <span className="cu-access-agent-id">{agentName}</span>+ ) : null}+ </div></td><td className="cu-table__cell-actions"><RowActionsMenu- ariaLabel={`Actions for ${agentDisplayName}`}+ ariaLabel={`Actions for ${agentRowLabel}`}actions={[{key: 'view',diff --git a/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx b/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsxindex 9e3ba9f98..1f3029a5b 100644--- a/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx+++ b/control-ui/components/__tests__/ProfileAdminAgentCompatibility.test.tsx@@ -171,6 +171,68 @@ describe('profile-admin agent compatibility access', () => {expect(screen.queryByRole('button', { name: 'agent-alpha' })).not.toBeInTheDocument()})+ // Review R1-H1: display names are not unique. Two agents sharing one display+ // name must stay distinguishable in the member Agents tab — slug visible as+ // secondary identity, action labels disambiguated — and revoking one row's+ // access must still target exactly that row's slug.+ it('distinguishes duplicate member agent display names by their slug', async () => {+ vi.mocked(api.getHosts).mockResolvedValue({+ items: [+ {+ metadata: { name: 'agent-dup-a' },+ spec: { contextRef: 'ctx-alpha', host: 'Duplicate Bot' },+ },+ {+ metadata: { name: 'agent-dup-b' },+ spec: { contextRef: 'ctx-beta', host: 'Duplicate Bot' },+ },+ ],+ })+ vi.mocked(api.getAdminUserContexts).mockResolvedValue({+ userId: 'user-1',+ contextIds: ['ctx-alpha', 'ctx-beta'],+ })+ vi.mocked(api.getAdminUserAgents).mockResolvedValue({+ userId: 'user-1',+ agentNames: ['agent-dup-a', 'agent-dup-b'],+ deletedAgentNames: [],+ deletedHistoryLimit: 10,+ })+ vi.mocked(api.updateAdminUserAgents).mockResolvedValue({+ userId: 'user-1',+ agentNames: ['agent-dup-b'],+ deletedAgentNames: ['agent-dup-a'],+ deletedHistoryLimit: 10,+ })+ vi.mocked(api.updateAdminUserContexts).mockResolvedValue({+ userId: 'user-1',+ contextIds: ['ctx-beta'],+ })++ renderUserDetails()++ // Same display name twice, each row carrying its own immutable slug.+ expect(await screen.findAllByRole('button', { name: 'Duplicate Bot' })).toHaveLength(2)+ expect(screen.getAllByText('agent-dup-a', { selector: '.cu-access-agent-id' })).toHaveLength(1)+ expect(screen.getAllByText('agent-dup-b', { selector: '.cu-access-agent-id' })).toHaveLength(1)++ // The action menu of the first row is labeled with its slug; revoking it+ // removes exactly agent-dup-a and keeps agent-dup-b.+ fireEvent.click(screen.getByRole('button', { name: 'Actions for Duplicate Bot (agent-dup-a)' }))+ fireEvent.click(screen.getByRole('menuitem', { name: 'Revoke access' }))+ const confirmDialog = await screen.findByRole('alertdialog')+ expect(confirmDialog).toHaveTextContent('agent-dup-a')+ fireEvent.click(confirmDialog.querySelector('.cu-btn--danger')!)++ await waitFor(() => {+ expect(api.updateAdminUserAgents).toHaveBeenCalledWith(+ 'user-1',+ ['agent-dup-b'],+ expect.arrayContaining(['agent-dup-a', 'agent-dup-b'])+ )+ })+ expect(api.updateAdminUserContexts).toHaveBeenCalledWith('user-1', ['ctx-beta'])+ })// Same rename propagation on the team Agents tab.it('shows agent display names in the team Agents tab, falling back to the identifier', async () => {vi.mocked(api.getHosts).mockResolvedValue({@@ -200,6 +262,67 @@ describe('profile-admin agent compatibility access', () => {expect(screen.queryByRole('button', { name: 'agent-alpha' })).not.toBeInTheDocument()})+ // Review R1-H1 on the team Agents tab: duplicate display names stay+ // distinguishable via the visible slug, and revoking one row targets+ // exactly that row's slug.+ it('distinguishes duplicate team agent display names by their slug', async () => {+ vi.mocked(api.getHosts).mockResolvedValue({+ items: [+ {+ metadata: { name: 'agent-dup-a' },+ spec: { contextRef: 'ctx-alpha', host: 'Duplicate Bot' },+ },+ {+ metadata: { name: 'agent-dup-b' },+ spec: { contextRef: 'ctx-beta', host: 'Duplicate Bot' },+ },+ ],+ })+ vi.mocked(api.getAdminTeamContexts).mockResolvedValue({+ teamId: 'team-1',+ contextIds: ['ctx-alpha', 'ctx-beta'],+ })+ vi.mocked(api.getAdminTeamAgents).mockResolvedValue({+ teamId: 'team-1',+ agentNames: ['agent-dup-a', 'agent-dup-b'],+ deletedAgentNames: [],+ deletedHistoryLimit: 10,+ })+ vi.mocked(api.updateAdminTeamAgents).mockResolvedValue({+ teamId: 'team-1',+ agentNames: ['agent-dup-b'],+ deletedAgentNames: ['agent-dup-a'],+ deletedHistoryLimit: 10,+ })+ vi.mocked(api.updateAdminTeamContexts).mockResolvedValue({+ teamId: 'team-1',+ contextIds: ['ctx-beta'],+ })++ renderTeamDetails()++ expect(await screen.findAllByRole('button', { name: 'Duplicate Bot' })).toHaveLength(2)+ expect(screen.getAllByText('agent-dup-a', { selector: '.cu-access-agent-id' })).toHaveLength(1)+ expect(screen.getAllByText('agent-dup-b', { selector: '.cu-access-agent-id' })).toHaveLength(1)++ fireEvent.click(+ screen.getByRole('button', { name: 'Actions for agent Duplicate Bot (agent-dup-a)' })+ )+ fireEvent.click(screen.getByRole('menuitem', { name: 'Revoke agent access' }))+ const confirmDialog = await screen.findByRole('alertdialog')+ expect(confirmDialog).toHaveTextContent('agent-dup-a')+ fireEvent.click(confirmDialog.querySelector('.cu-btn--danger')!)++ await waitFor(() => {+ expect(api.updateAdminTeamAgents).toHaveBeenCalledWith(+ 'team-1',+ ['agent-dup-b'],+ expect.arrayContaining(['agent-dup-a', 'agent-dup-b'])+ )+ })+ expect(api.updateAdminTeamContexts).toHaveBeenCalledWith('team-1', ['ctx-beta'])+ })+it('removes only owned Context grants when a member loses final agent access', async () => {vi.mocked(api.getAdminUserContexts).mockResolvedValueOnce({ userId: 'user-1', contextIds: ['ctx-alpha', 'ctx-unrelated'] })diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 6e19a7ac7..03eccd756 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.576",+ "version": "0.1.577","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.576",+ "version": "0.1.577","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/frontend-components": "file:../packages/frontend-components",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 3d70dd5e1..3028160ce 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.576",+ "version": "0.1.577","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",