Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-ui): hide context leaks in agent experience (Phase 0 / Category E)
Miguelon Peluchon187b7787f7d5
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex c2e50ff5e..c3ebfe0df 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -6182,7 +6182,7 @@ textarea.cu-input {font-weight: 600;}-.cu-agent-context-mcp-summary {+.cu-agent-connectors-summary {display: grid;gap: var(--cu-space-2);padding: var(--cu-space-3);@@ -6191,7 +6191,7 @@ textarea.cu-input {background: var(--cu-bg-elevated);}-.cu-agent-context-mcp-summary__head {+.cu-agent-connectors-summary__head {display: flex;align-items: center;justify-content: space-between;@@ -6203,7 +6203,7 @@ textarea.cu-input {text-transform: uppercase;}-.cu-agent-context-mcp-summary__head > span:last-child {+.cu-agent-connectors-summary__head > span:last-child {display: inline-grid;place-items: center;min-width: 1.5rem;@@ -6215,7 +6215,7 @@ textarea.cu-input {font-variant-numeric: tabular-nums;}-.cu-agent-context-mcp-summary__list {+.cu-agent-connectors-summary__list {display: flex;flex-wrap: wrap;gap: var(--cu-space-1);@@ -6224,7 +6224,7 @@ textarea.cu-input {list-style: none;}-.cu-agent-context-mcp-summary__list li {+.cu-agent-connectors-summary__list li {max-width: 100%;padding: 0.2rem var(--cu-space-2);overflow: hidden;@@ -6238,7 +6238,7 @@ textarea.cu-input {white-space: nowrap;}-.cu-agent-context-mcp-summary > .cu-muted {+.cu-agent-connectors-summary > .cu-muted {margin: 0;font-size: 0.8125rem;}@@ -7499,21 +7499,16 @@ textarea.cu-input {gap: var(--cu-space-4);}-.cu-host-context-select {- width: min(36rem, 100%);-}--/* Hover card on the Context column — shows the same MCP-server list as the- agent-wizard's `cu-agent-context-mcp-summary` block. The wrapper is the- positioning context so the absolutely-positioned card sits just below the- link instead of clipping against the table cell. */-.cu-host-context-hover {+/* Hover card on the Connectors column — shows the agent's MCP-server list.+ The wrapper is the positioning context so the absolutely-positioned card+ sits just below the link instead of clipping against the table cell. */+.cu-host-connectors-hover {position: relative;display: inline-flex;max-width: 100%;}-.cu-host-context-count {+.cu-host-connectors-count {display: inline-grid;place-items: center;min-width: 1.75rem;@@ -7527,7 +7522,7 @@ textarea.cu-input {line-height: 1.2;}-.cu-host-context-hover > .cu-agent-context-mcp-summary {+.cu-host-connectors-hover > .cu-agent-connectors-summary {position: absolute;top: calc(100% + var(--cu-space-1));left: 0;diff --git a/control-ui/app/hosts/page.tsx b/control-ui/app/hosts/page.tsxindex a1a96e45f..216714508 100644--- a/control-ui/app/hosts/page.tsx+++ b/control-ui/app/hosts/page.tsx@@ -104,10 +104,7 @@ export default function HostsPage() {<HostTableitems={hosts}onOpen={host => router.push(CONTROL_ROUTES.agents.tab(host.name, 'overview'))}- onOpenContext={contextName => {- const trimmed = contextName.trim()- if (trimmed) router.push(CONTROL_ROUTES.contexts.connectors(trimmed))- }}+ onOpenConnectors={host => router.push(CONTROL_ROUTES.agents.tab(host.name, 'connectors'))}onDelete={handleDeleteHost}deletingKey={deletingKey}onRefresh={loadAll}diff --git a/control-ui/components/HostTable.tsx b/control-ui/components/HostTable.tsxindex 39f9b3372..d0730fadb 100644--- a/control-ui/components/HostTable.tsx+++ b/control-ui/components/HostTable.tsx@@ -15,7 +15,7 @@ import { IconRefresh } from './icons'const HOST_COLUMNS: TableHeaderColumn[] = [{ key: 'name', label: 'Name' },- { key: 'context', label: 'Connectors', width: '14%' },+ { key: 'connectors', label: 'Connectors', width: '14%' },{ key: 'providers', label: 'Providers', minWidth: '8rem' },{ key: 'actions', width: '3.5rem', align: 'right', ariaLabel: 'Actions' },]@@ -41,32 +41,31 @@ export function collectProviderIds(spec: Record<string, unknown>): string[] {return out}-// Hover card over the context cell. Mirrors the `cu-agent-context-mcp-summary`-// block the create wizard shows for the selected context — the operator gets-// the same list of attached MCP servers without navigating away. The card is-// keyboard-accessible (focus + blur mirror hover) and `role="tooltip"` keeps-// screen readers in sync with what's visible.-function ContextMcpHoverCard({- contextRef,- mcpServers,- onOpenContext,+// Hover card over the connectors cell. The agent's private connector context+// is an implementation detail, so the card shows a neutral "Connectors"+// heading plus the attached MCP-server names — never the context slug. The+// card is keyboard-accessible (focus + blur mirror hover) and `role="tooltip"`+// keeps screen readers in sync with what's visible.+function ConnectorCountHoverCard({+ hostKey,+ servers,+ onOpenConnectors,}: {- contextRef: string- mcpServers: string[] | undefined- onOpenContext: (contextRef: string) => void+ hostKey: string+ servers: string[]+ onOpenConnectors: () => void}) {const [open, setOpen] = useState(false)- const servers = Array.isArray(mcpServers) ? mcpServers : []const hasServers = servers.length > 0- const cardId = `ctx-mcp-${contextRef}`+ const cardId = `agent-connectors-${hostKey}`const trigger = (<buttontype="button"- className="cu-link cu-host-context-count"+ className="cu-link cu-host-connectors-count"onClick={e => {e.stopPropagation()- onOpenContext(contextRef)+ onOpenConnectors()}}onKeyDown={e => e.stopPropagation()}aria-describedby={hasServers && open ? cardId : undefined}@@ -79,7 +78,7 @@ function ContextMcpHoverCard({return (<span- className="cu-host-context-hover"+ className="cu-host-connectors-hover"onMouseEnter={() => setOpen(true)}onMouseLeave={() => setOpen(false)}onFocus={() => setOpen(true)}@@ -87,12 +86,12 @@ function ContextMcpHoverCard({>{trigger}{open ? (- <div role="tooltip" id={cardId} className="cu-agent-context-mcp-summary">- <div className="cu-agent-context-mcp-summary__head">- <span>{contextRef}</span>+ <div role="tooltip" id={cardId} className="cu-agent-connectors-summary">+ <div className="cu-agent-connectors-summary__head">+ <span>Connectors</span><span>{servers.length}</span></div>- <ul className="cu-agent-context-mcp-summary__list">+ <ul className="cu-agent-connectors-summary__list">{servers.map(server => (<li key={server} title={server}>{server}@@ -108,7 +107,7 @@ function ContextMcpHoverCard({export function HostTable({items,onOpen,- onOpenContext,+ onOpenConnectors,onDelete,deletingKey,onRefresh,@@ -119,16 +118,16 @@ export function HostTable({}: {items: HostItem[]onOpen: (host: HostRef) => void- onOpenContext: (contextName: string) => void+ onOpenConnectors: (host: HostRef) => voidonDelete: (host: HostRef) => Promise<void>deletingKey: string | nullonRefresh: () => voidonCreateHost: () => voidrefreshing: booleanloading?: boolean- // contextRef (host.spec.contextRef) → list of attached MCP server names. The- // page passes this from the same `/api/v1/admin/contexts` payload the- // creation wizard consumes, so the operator sees the same attribution here.+ // Private contextRef (host.spec.contextRef) → list of attached MCP server+ // names. Internal enrichment from the same `/api/v1/admin/contexts` payload+ // the creation wizard consumes; the context itself is never rendered.contextsByRef?: Record<string, string[]>}) {const [searchQuery, setSearchQuery] = useState('')@@ -152,10 +151,9 @@ export function HostTable({if (!normalizedSearch) return rowsreturn rows.filter(({ name, displayName, namespace, item }) => {const spec = item.spec || {}- const contextRef = String(spec.contextRef || '').trim()const providers = collectProviderIds(spec)const providerLabels = providers.map(id => getProviderLabel(id)).join(' ')- return [name, displayName, namespace, contextRef, providerLabels]+ return [name, displayName, namespace, providerLabels].join(' ').toLowerCase().includes(normalizedSearch)@@ -227,9 +225,8 @@ export function HostTable({<tbody>{filteredRows.map(({ key, namespace, name, displayName, item }) => {const rawContext = String(item.spec?.contextRef || '').trim()- const contextRef = rawContext || '-'- const contextServers = contextsByRef?.[rawContext]- const contextClickable =+ const contextServers = rawContext ? contextsByRef?.[rawContext] : undefined+ const showHoverCard =Boolean(rawContext) && Array.isArray(contextServers) && contextServers.length > 0const providers = collectProviderIds(item.spec || {})const openAgent = () => onOpen({ namespace, name })@@ -254,11 +251,11 @@ export function HostTable({) : null}</td><td>- {contextClickable ? (- <ContextMcpHoverCard- contextRef={contextRef}- mcpServers={contextServers}- onOpenContext={onOpenContext}+ {showHoverCard ? (+ <ConnectorCountHoverCard+ hostKey={key}+ servers={contextServers as string[]}+ onOpenConnectors={() => onOpenConnectors({ namespace, name })}/>) : rawContext ? (<span className="cu-table__cell-muted">0</span>diff --git a/control-ui/components/HostWizard/index.tsx b/control-ui/components/HostWizard/index.tsxindex 3650ef0de..1f59c6c56 100644--- a/control-ui/components/HostWizard/index.tsx+++ b/control-ui/components/HostWizard/index.tsx@@ -572,7 +572,7 @@ export function HostWizard({const generatedContextName = await createPrivateContext(normalizedHostName,Array.from(new Set(selectedMcp)),- 'The agent connector context could not be created — please try again.'+ 'We couldn’t finish setting up this agent’s connectors — please try again.')created.push({ kind: 'context', name: generatedContextName })diff --git a/control-ui/components/__tests__/HostTable.test.tsx b/control-ui/components/__tests__/HostTable.test.tsxindex a3493cebf..2fbc5c689 100644--- a/control-ui/components/__tests__/HostTable.test.tsx+++ b/control-ui/components/__tests__/HostTable.test.tsx@@ -8,7 +8,7 @@ function renderHostTable(items: HostItem[], contextsByRef?: Record<string, strin<HostTableitems={items}onOpen={vi.fn()}- onOpenContext={vi.fn()}+ onOpenConnectors={vi.fn()}onDelete={vi.fn().mockResolvedValue(undefined)}deletingKey={null}onRefresh={vi.fn()}@@ -227,16 +227,17 @@ describe('HostTable display name column (UT-9)', () => {})})-// Hover card on the Context column — when the page supplies a `contextsByRef`-// map, hovering (or keyboard-focusing) the context pill reveals the same-// MCP-server list the create wizard shows for the selected context. The cell-// shows the count; the tooltip shows the context name + count + names.-describe('HostTable context MCP hover card', () => {+// Hover card on the Connectors column — when the page supplies a+// `contextsByRef` map, hovering (or keyboard-focusing) the count pill reveals+// the agent's MCP-server list. The cell shows the count; the tooltip shows a+// neutral "Connectors" heading + count + server names. The private context+// slug must never render (Category E1 invariant).+describe('HostTable connectors hover card', () => {function contextPill(row: HTMLElement, count: string): HTMLElement {return within(row).getByRole('button', { name: count })}- it('reveals the MCP server list on hover and lists every server', () => {+ it('reveals the MCP server list on hover without exposing the context slug', () => {renderHostTable([hostWithContext('chatllm', 'context1')], {context1: ['github', 'linear', 'slack'],})@@ -250,16 +251,40 @@ describe('HostTable context MCP hover card', () => {fireEvent.mouseEnter(pill)const card = within(row).getByRole('tooltip')- expect(card).toHaveTextContent('context1')+ expect(card).toHaveTextContent('Connectors')expect(card).toHaveTextContent('3')expect(within(card).getByText('github')).toBeInTheDocument()expect(within(card).getByText('linear')).toBeInTheDocument()expect(within(card).getByText('slack')).toBeInTheDocument()+ // E1: the raw private-context slug never surfaces.+ expect(card).not.toHaveTextContent('context1')fireEvent.mouseLeave(pill)expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()})+ it('opens the agent’s own connectors tab when the count is clicked', () => {+ const onOpenConnectors = vi.fn()+ render(+ <HostTable+ items={[hostWithContext('chatllm', 'context1')]}+ onOpen={vi.fn()}+ onOpenConnectors={onOpenConnectors}+ onDelete={vi.fn().mockResolvedValue(undefined)}+ deletingKey={null}+ onRefresh={vi.fn()}+ onCreateHost={vi.fn()}+ refreshing={false}+ contextsByRef={{ context1: ['github'] }}+ />+ )++ fireEvent.click(+ within(screen.getByLabelText('Open agent chatllm')).getByRole('button', { name: '1' })+ )+ expect(onOpenConnectors).toHaveBeenCalledWith({ namespace: 'mcp-host', name: 'chatllm' })+ })+it('reveals the card on keyboard focus (accessible path)', () => {renderHostTable([hostWithContext('chatllm', 'context1')], {context1: ['github'],@@ -277,7 +302,7 @@ describe('HostTable context MCP hover card', () => {expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()})- it('renders the bare count without a tooltip when the context has no MCP servers', () => {+ it('renders the bare count without a tooltip when the agent has no connectors', () => {renderHostTable([hostWithContext('chatllm', 'context1')], {context1: [],})@@ -307,7 +332,7 @@ describe('HostTable — row actions kebab', () => {<HostTableitems={[hostWithContext('chatllm', 'context1')]}onOpen={onOpen}- onOpenContext={vi.fn()}+ onOpenConnectors={vi.fn()}onDelete={onDelete}deletingKey={null}onRefresh={vi.fn()}@@ -334,7 +359,7 @@ describe('HostTable — row actions kebab', () => {<HostTableitems={[hostWithContext('chatllm', 'context1')]}onOpen={onOpen}- onOpenContext={vi.fn()}+ onOpenConnectors={vi.fn()}onDelete={vi.fn().mockResolvedValue(undefined)}deletingKey={null}onRefresh={vi.fn()}@@ -354,7 +379,7 @@ describe('HostTable — row actions kebab', () => {<HostTableitems={[hostWithContext('chatllm', 'context1')]}onOpen={vi.fn()}- onOpenContext={vi.fn()}+ onOpenConnectors={vi.fn()}onDelete={onDelete}deletingKey="mcp-host/chatllm"onRefresh={vi.fn()}diff --git a/control-ui/components/__tests__/HostWizard.test.tsx b/control-ui/components/__tests__/HostWizard.test.tsxindex d3af99092..c097eea36 100644--- a/control-ui/components/__tests__/HostWizard.test.tsx+++ b/control-ui/components/__tests__/HostWizard.test.tsx@@ -717,7 +717,9 @@ describe('HostWizard — create-only seam + compensation (R5-C1/R5-B1, V-1, V-7)// Observable (T4): the friendly per-resource collision message is shown —// NOT the raw K8s AlreadyExists text.await waitFor(() => {- expect(screen.getByText(/agent connector context could not be created/i)).toBeInTheDocument()+ expect(+ screen.getByText(/couldn.t finish setting up this agent.s connectors/i)+ ).toBeInTheDocument()})expect(vi@@ -849,7 +851,7 @@ describe('HostWizard — create-only seam + compensation (R5-C1/R5-B1, V-1, V-7)})// The friendly collision text must NOT appear (coded 409 is not a collision).expect(- screen.queryByText(/agent connector context could not be created/i)+ screen.queryByText(/couldn.t finish setting up this agent.s connectors/i)).not.toBeInTheDocument()// Boundary rule still applies: the secret created before the failing context// is compensated (host never created), but nothing beyond that.diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 22ebfb978..9371562e4 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.457",+ "version": "0.1.458","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.457",+ "version": "0.1.458","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 2c1ef70e0..6feb28a82 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.457",+ "version": "0.1.458","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/docs/features/control-ui-context-removal.md b/docs/features/control-ui-context-removal.mdindex cdb3963ba..0a61e4fc7 100644--- a/docs/features/control-ui-context-removal.md+++ b/docs/features/control-ui-context-removal.md@@ -191,6 +191,7 @@ Tests updated in the same commit: `HostTable.test.tsx` (hover card now asserts a| Date | Phase | Entry || --- | --- | --- || 2026-08-26 | — | Document created; baseline verified at `a584c259a`; research inventories completed (surfaces + test impact) |+| 2026-08-26 | 0 | E1/E2/E3 implemented: hover card shows neutral "Connectors" heading (no slug), click opens the agent's own Connectors tab (`onOpenConnectors`), wizard failure copy reworded, error mapping verified interceptor-covered. CSS family renamed (`cu-agent-connectors-summary*`, `cu-host-connectors-*`; dead `cu-host-context-select` removed). Tests: `HostTable.test.tsx` (+slug-never-renders invariant, +click-navigation), `HostWizard.test.tsx` copy. `tsc --noEmit` + full vitest green (1743 passed). No backend changes. |## 11. Open questions / follow-ups (non-blocking)diff --git a/package-lock.json b/package-lock.jsonindex 1d6c79b45..c8b9cd37d 100644--- a/package-lock.json+++ b/package-lock.json@@ -13,39 +13,6 @@"prettier": "^3.0.0"}},- "mcp-servers/doc-generator": {- "name": "@clerum/doc-generator-mcp",- "version": "1.0.0",- "extraneous": true,- "dependencies": {- "@modelcontextprotocol/sdk": "^1.12.1",- "exceljs": "^4.4.0",- "express": "^4.21.2",- "markdown-it": "^14.1.0"- },- "devDependencies": {- "@types/express": "^5.0.0",- "@types/markdown-it": "^14.1.2",- "@types/node": "^22.13.0",- "tsx": "^4.19.0",- "typescript": "^5.7.0"- }- },- "mcp-servers/web-search": {- "name": "@clerum/web-search-mcp",- "version": "1.0.0",- "extraneous": true,- "dependencies": {- "@modelcontextprotocol/sdk": "^1.12.1",- "express": "^4.21.2"- },- "devDependencies": {- "@types/express": "^5.0.0",- "@types/node": "^22.13.0",- "tsx": "^4.19.0",- "typescript": "^5.7.0"- }- },"node_modules/@babel/code-frame": {"version": "7.29.7","resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",@@ -1532,22 +1499,6 @@"url": "https://github.com/sponsors/sindresorhus"}},- "tests/e2e/fixtures": {- "name": "@clerum/e2e-test-fixtures",- "version": "1.0.0",- "extraneous": true,- "dependencies": {- "@kubernetes/client-node": "^1.0.0"- },- "devDependencies": {- "@types/node": "^20.10.0",- "typescript": "^5.3.0",- "vitest": "^4.0.18"- },- "peerDependencies": {- "vitest": ">=4.0.0"- }- },"tests/e2e/fixtures/mock-mcp-server": {"version": "0.1.0","extraneous": true,@@ -1588,25 +1539,6 @@"@types/node": "^22.0.0","typescript": "^5.6.0"}- },- "tests/e2e/playwright": {- "name": "clerum-playwright-tests",- "version": "0.1.0",- "extraneous": true,- "devDependencies": {- "@playwright/test": "^1.50.0",- "@types/node": "^22.0.0"- }- },- "workflow-recipes/tests/e2e": {- "name": "workflow-recipes-e2e",- "version": "0.1.0",- "extraneous": true,- "devDependencies": {- "@types/node": "^20.10.0",- "typescript": "^5.3.0",- "vitest": "^3.0.0"- }}}}