Skip to content

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

TypeScript

fix(desktop-ui): rank unknown connector status below known ones (L1)

Diego Zacarias73025ac0be0d
diff --git a/desktop-app/ui/src/lib/__tests__/connectorRows.test.ts b/desktop-app/ui/src/lib/__tests__/connectorRows.test.ts
index b6fbf0805..0c14c6940 100644
--- a/desktop-app/ui/src/lib/__tests__/connectorRows.test.ts
+++ b/desktop-app/ui/src/lib/__tests__/connectorRows.test.ts
@@ -116,6 +116,26 @@ describe('deriveConnectorRows', () => {
expect(rows.map(r => r.agentName)).toEqual(['agent-alpha', 'agent-mid', 'agent-zeta'])
})
+ it('ranks an unknown server status below every known one, both orders (L1)', () => {
+ // Version-skew guard: if rpc-proxy ever ships a status absent from
+ // STATUS_RANK, `?? -1` keeps the fold total so a known 'authorized' still
+ // wins over the unknown regardless of iteration order. Without the guard the
+ // `x > undefined` comparison is always false, letting the FIRST-seen status
+ // win — which would hide an existing grant behind a stale unknown row.
+ const unknown = 'brand_new_status' as RpcConnector['status']
+ const authorizedFirst = deriveConnectorRows([
+ agent('agent-alpha', 'ctx-team', [connector({ name: 'monday', status: 'authorized' })]),
+ agent('agent-zeta', 'ctx-team', [connector({ name: 'monday', status: unknown })]),
+ ])
+ const unknownFirst = deriveConnectorRows([
+ agent('agent-alpha', 'ctx-team', [connector({ name: 'monday', status: unknown })]),
+ agent('agent-zeta', 'ctx-team', [connector({ name: 'monday', status: 'authorized' })]),
+ ])
+ // The unknownFirst case is the one that fails on the pre-guard head.
+ expect(authorizedFirst.every(r => r.connector.status === 'authorized')).toBe(true)
+ expect(unknownFirst.every(r => r.connector.status === 'authorized')).toBe(true)
+ })
+
it('keeps contextless (oauth-user) grants clickable per-agent and exposes both keys', () => {
const rows = deriveConnectorRows([
agent('agent-alpha', null, [connector({ name: 'monday' })]),
diff --git a/desktop-app/ui/src/lib/connectorRows.ts b/desktop-app/ui/src/lib/connectorRows.ts
index 9a439d700..8b3d21659 100644
--- a/desktop-app/ui/src/lib/connectorRows.ts
+++ b/desktop-app/ui/src/lib/connectorRows.ts
@@ -129,7 +129,14 @@ export function deriveConnectorRows(agents: RpcAgentConnectors[]): ConnectorRow[
for (const connector of agent.connectors) {
const grantKey = connectorRowKey(agent.contextRef, connector.name)
const current = canonicalStatus.get(grantKey)
- if (current === undefined || STATUS_RANK[connector.status] > STATUS_RANK[current]) {
+ // `?? -1` keeps the fold total if the server ever ships a status not in
+ // STATUS_RANK: an unknown status ranks below every known one instead of
+ // making the comparison `undefined` (always false), which would silently
+ // let the first-seen status win and could hide an existing grant.
+ if (
+ current === undefined ||
+ (STATUS_RANK[connector.status] ?? -1) > (STATUS_RANK[current] ?? -1)
+ ) {
canonicalStatus.set(grantKey, connector.status)
}
}