Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(codex): drop Connected toast after Cancel and lock the device URI
Alfredo Lopezaa251896fb0a
diff --git a/control-ui/components/CodexSubscriptionHub/index.tsx b/control-ui/components/CodexSubscriptionHub/index.tsxindex 7d6bf0443..b7b691063 100644--- a/control-ui/components/CodexSubscriptionHub/index.tsx+++ b/control-ui/components/CodexSubscriptionHub/index.tsx@@ -220,8 +220,10 @@ export function CodexSubscriptionHub() {const latest = polled.connectionsetEditing(latest)const models = await listCodexConnectionModels(latest.connectionKey)+ if (epoch !== connectEpoch.current) returnsetEditModels(models)await load()+ if (epoch !== connectEpoch.current) returnif (latest.catalogStatus === 'ready') {showToast('Connected — catalog synced', { tone: 'success' })} else {@@ -238,6 +240,7 @@ export function CodexSubscriptionHub() {return}}+ if (epoch !== connectEpoch.current) returnsetUserCode(null)setVerificationUri(null)setError('ChatGPT sign-in timed out. Try again.')diff --git a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsxindex b0b6e94da..0f06b01c3 100644--- a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx+++ b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx@@ -264,6 +264,52 @@ describe('CodexSubscriptionHub', () => {expect(syncCodexSubscriptionCatalog).not.toHaveBeenCalled()})+ it('does not toast Connected after Cancel during the post-connect catalog load', async () => {+ let resolveModels!: (value: Array<{ model: string; enabled: boolean; stale: boolean }>) => void+ vi.mocked(listCodexConnectionModels).mockImplementation(+ () =>+ new Promise(resolve => {+ resolveModels = resolve+ })+ )+ vi.mocked(createCodexSubscriptionConnection).mockResolvedValue(+ connection({+ connectionKey: 'codex-bbb',+ displayName: 'New team',+ status: 'disconnected',+ catalogStatus: 'never_synced',+ })+ )+ vi.mocked(pollCodexDevice).mockResolvedValue({+ status: 'connected',+ connection: connection({+ connectionKey: 'codex-bbb',+ displayName: 'New team',+ catalogStatus: 'ready',+ }),+ })+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ fireEvent.click(await screen.findByRole('button', { name: 'Add subscription' }))+ fireEvent.change(screen.getByRole('textbox', { name: 'Name' }), {+ target: { value: 'New team' },+ })+ fireEvent.click(screen.getByRole('button', { name: 'Create' }))+ await waitFor(() => {+ expect(listCodexConnectionModels).toHaveBeenCalledWith('codex-bbb')+ })+ fireEvent.click(screen.getByRole('button', { name: 'Cancel' }))+ await waitFor(() => {+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument()+ })+ resolveModels([{ model: 'gpt-5.1', enabled: true, stale: false }])+ await new Promise(resolve => setTimeout(resolve, 20))+ expect(screen.queryByText('Connected — catalog synced')).not.toBeInTheDocument()+ })+it('keeps the sync modal open with Sign in when device/start fails after Create', async () => {vi.mocked(createCodexSubscriptionConnection).mockResolvedValue(connection({diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex ce4b311a3..ecb75d0c5 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.477",+ "version": "0.1.478","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.477",+ "version": "0.1.478","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 18018e778..ee6d9dd88 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.477",+ "version": "0.1.478","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/scripts/tests/test-codex-subscription-t0.sh b/scripts/tests/test-codex-subscription-t0.shindex f38ac081a..b23df29d4 100755--- a/scripts/tests/test-codex-subscription-t0.sh+++ b/scripts/tests/test-codex-subscription-t0.sh@@ -151,6 +151,21 @@ require_ci_matrix_entry "codex-llm-proxy"require_ci_matrix_entry "packages/llm-provider-attempt-contract"require_ci_matrix_entry "packages/codex-catalog-projection"+expected_device_uri='https://auth.openai.com/codex/device'+api_device_uri="$(+ sed -n "s/^export const CODEX_OAUTH_DEVICE_VERIFICATION_URI = '\\(.*\\)'$/\\1/p" \+ "${ROOT}/control-api/src/services/codexSubscriptionOAuth.ts"+)"+ui_device_uri="$(+ sed -n "s/^export const CODEX_DEVICE_VERIFICATION_URI = '\\(.*\\)'$/\\1/p" \+ "${ROOT}/control-ui/lib/codexSubscription.ts"+)"+if [[ "${api_device_uri}" == "${expected_device_uri}" && "${ui_device_uri}" == "${expected_device_uri}" ]]; then+ pass "device verification URI lock"+else+ fail "device verification URI lock (api=${api_device_uri:-missing} ui=${ui_device_uri:-missing})"+fi+run_group "shared-contract" "packages/llm-provider-attempt-contract" "index.test.cjs"run_group "codex-catalog-projection" "packages/codex-catalog-projection" "index.test.cjs"