Skip to content

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

TypeScript

fix(ui): gate Codex agent assignment on loaded capability

Alfredo Lopez2569508b252d
diff --git a/control-ui/components/CodexAgentAssignment/index.tsx b/control-ui/components/CodexAgentAssignment/index.tsx
index 1b4cad18d..0c401c06f 100644
--- a/control-ui/components/CodexAgentAssignment/index.tsx
+++ b/control-ui/components/CodexAgentAssignment/index.tsx
@@ -13,7 +13,11 @@ import {
startCodexDeviceConnect,
syncCodexSubscriptionCatalog,
} from '@lib/codexSubscription'
-import { isCodexSubscriptionUiEnabled } from '@lib/codexSubscriptionFeature'
+import {
+ type CodexSubscriptionCapability,
+ isCodexSubscriptionUiEnabled,
+ loadCodexSubscriptionCapability,
+} from '@lib/codexSubscriptionFeature'
import {
mapConnectionStatus,
statusLabel,
@@ -46,9 +50,15 @@ export function CodexAgentAssignment({
const [creating, setCreating] = useState(false)
const [displayName, setDisplayName] = useState('')
const [busy, setBusy] = useState(false)
+ const [capability, setCapability] = useState<CodexSubscriptionCapability | null>(null)
+ const enabled = isCodexSubscriptionUiEnabled(capability)
+
+ useEffect(() => {
+ void loadCodexSubscriptionCapability().then(setCapability)
+ }, [])
const load = useCallback(async () => {
- if (!isCodexSubscriptionUiEnabled()) return
+ if (!enabled) return
const rows = await listCodexSubscriptionConnections()
setConnections(rows)
const current = rows.find(row => row.connectionKey === connectionRef) ?? null
@@ -59,7 +69,7 @@ export function CodexAgentAssignment({
} else {
onModelsChange?.([])
}
- }, [connectionRef, onModelsChange])
+ }, [connectionRef, enabled, onModelsChange])
useEffect(() => {
void load().catch(err => {
@@ -171,7 +181,7 @@ export function CodexAgentAssignment({
}
}
- if (!isCodexSubscriptionUiEnabled()) return null
+ if (!enabled) return null
const uiStatus = selected ? mapConnectionStatus(selected.status) : 'disconnected'
diff --git a/control-ui/components/__tests__/CodexAgentAssignment.test.tsx b/control-ui/components/__tests__/CodexAgentAssignment.test.tsx
index 06c6ae7e9..e82ed6573 100644
--- a/control-ui/components/__tests__/CodexAgentAssignment.test.tsx
+++ b/control-ui/components/__tests__/CodexAgentAssignment.test.tsx
@@ -19,7 +19,9 @@ vi.mock('@components/ConfirmDialog', () => ({
}))
vi.mock('@lib/codexSubscriptionFeature', () => ({
- isCodexSubscriptionUiEnabled: () => true,
+ isCodexSubscriptionUiEnabled: (capability?: { enabled?: boolean } | null) =>
+ capability?.enabled === true,
+ loadCodexSubscriptionCapability: async () => ({ enabled: true }),
}))
vi.mock('@lib/codexSubscription', async importOriginal => {
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index e1f64bb94..5037093b5 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"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.json
index b9acd05fc..40c5592f7 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.448",
+ "version": "0.1.449",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",