Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(codex): keep catalog-sync failures typed and bind Create to the new grant
Alfredo Lopez1a4b7d1726b9
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex bfc68805f..be373522a 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.521",+ "version": "0.1.522","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.521",+ "version": "0.1.522","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/image-policy": "file:../packages/image-policy",diff --git a/control-api/package.json b/control-api/package.jsonindex 9b045fb78..f1c4b8132 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.521",+ "version": "0.1.522","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/routes/admin/codexSubscription.ts b/control-api/src/routes/admin/codexSubscription.tsindex 145653649..4c324e876 100644--- a/control-api/src/routes/admin/codexSubscription.ts+++ b/control-api/src/routes/admin/codexSubscription.ts@@ -29,6 +29,7 @@ import {type CodexOAuthDeps,CodexSubscriptionOAuthError,getCodexSubscriptionConnection,+ isCodexOAuthErrorCode,pollCodexDevice,refreshCodexSubscriptionConnection,revokeCodexSubscription,@@ -417,6 +418,11 @@ export function createAdminCodexSubscriptionRouter()if (sync.connection) {result = { ...result, connection: sync.connection }+ } else if (!sync.ok) {+ result = {+ ...result,+ connection: { ...result.connection, catalogStatus: sync.catalogStatus },+ }}if (await publishRuntimeAllowlistOrFail(res)) return}@@ -461,26 +467,16 @@ export function createAdminCodexSubscriptionRouter(})return}- if (synced.reason === 'no_grant') {- res.status(404).json({ error: 'no_grant' })+ if (synced.reason === 'no_grant' || synced.reason === 'disabled') {+ res.status(404).json({ error: synced.reason })return}if (synced.reason === 'stale_revision') {res.status(409).json({ error: 'stale_revision' })return}- if (synced.reason === 'disabled') {- res.status(404).json({ error: 'disabled' })- return- }- if (synced.reason !== 'catalog_sync_failed' && synced.reason !== 'unavailable') {- sendOAuthError(- res,- new CodexSubscriptionOAuthError(- synced.reason as ConstructorParameters<typeof CodexSubscriptionOAuthError>[0],- synced.reason- )- )+ if (isCodexOAuthErrorCode(synced.reason)) {+ sendOAuthError(res, new CodexSubscriptionOAuthError(synced.reason, synced.reason))return}if (await publishRuntimeAllowlistOrFail(res)) returndiff --git a/control-api/src/services/codexSubscriptionOAuth.ts b/control-api/src/services/codexSubscriptionOAuth.tsindex f92bc9f56..453ec369c 100644--- a/control-api/src/services/codexSubscriptionOAuth.ts+++ b/control-api/src/services/codexSubscriptionOAuth.ts@@ -81,6 +81,27 @@ export type CodexOAuthErrorCode =| 'fingerprint_in_use'| 'connection_mismatch'+const CODEX_OAUTH_ERROR_CODES: ReadonlySet<CodexOAuthErrorCode> = new Set([+ 'disabled',+ 'not_connected',+ 'state_replayed',+ 'state_expired',+ 'state_cancelled',+ 'replacement_required',+ 'stale_revision',+ 'refresh_in_flight',+ 'provider_unavailable',+ 'no_grant',+ 'invalid_callback',+ 'browser_oauth_unregistered',+ 'fingerprint_in_use',+ 'connection_mismatch',+])++export function isCodexOAuthErrorCode(value: string): value is CodexOAuthErrorCode {+ return CODEX_OAUTH_ERROR_CODES.has(value as CodexOAuthErrorCode)+}+export class CodexSubscriptionOAuthError extends Error {readonly code: CodexOAuthErrorCode@@ -160,7 +181,7 @@ export type CodexCatalogSyncResult =| {ok: falsecatalogStatus: Extract<CodexCatalogOutcome, 'auth-rejected' | 'unavailable'> | 'never_synced'- reason: string+ reason: CodexOAuthErrorCode | 'catalog_sync_failed'added?: numberrefreshed?: numberstaled?: number@@ -631,12 +652,8 @@ export async function runCodexCatalogSync({ err, event: 'codex_catalog_auto_sync_failed', connectionKey: key },'automatic catalog sync after grant failed')- const reason =- err instanceof CodexSubscriptionOAuthError- ? err.code- : err instanceof Error- ? err.message- : 'catalog_sync_failed'+ const reason: CodexOAuthErrorCode | 'catalog_sync_failed' =+ err instanceof CodexSubscriptionOAuthError ? err.code : 'catalog_sync_failed'return { ok: false, catalogStatus: 'never_synced', reason }}}diff --git a/control-api/test/routes.admin.codexSubscription.test.ts b/control-api/test/routes.admin.codexSubscription.test.tsindex d9a8a9672..f3ea9ab2e 100644--- a/control-api/test/routes.admin.codexSubscription.test.ts+++ b/control-api/test/routes.admin.codexSubscription.test.ts@@ -369,17 +369,34 @@ describe('admin Codex subscription routes', () => {oauth.runCatalogSync.mockResolvedValue({ok: false,catalogStatus: 'never_synced',- reason: 'reauth_required',+ reason: 'provider_unavailable',})const res = await request(makeAuthedApp(makeGateway(materialize))).post('/admin/llm/providers/codex-subscription/connections/codex-aaa/catalog/sync')expect(res.status).toBe(400)- expect(res.body.error).toBe('reauth_required')+ expect(res.body.error).toBe('provider_unavailable')expect(materialize).not.toHaveBeenCalled()assertNoLeak(res.body)})+ it('returns 503 catalog_sync_failed for an untyped catalog failure and never echoes the raw reason', async () => {+ const materialize = vi.fn(async () => {})+ oauth.runCatalogSync.mockResolvedValue({+ ok: false,+ catalogStatus: 'never_synced',+ reason: 'proxy down',+ })+ const res = await request(makeAuthedApp(makeGateway(materialize))).post(+ '/admin/llm/providers/codex-subscription/connections/codex-aaa/catalog/sync'+ )+ expect(res.status).toBe(503)+ expect(res.body.error).toBe('catalog_sync_failed')+ expect(JSON.stringify(res.body)).not.toContain('proxy down')+ expect(materialize).toHaveBeenCalledTimes(1)+ assertNoLeak(res.body)+ })+it('returns 503 when catalog sync cannot publish the runtime ConfigMap', async () => {const materialize = vi.fn(async () => {throw new Error('apiserver down')@@ -555,10 +572,45 @@ describe('admin Codex subscription routes', () => {expect(res.body.status).toBe('connected')expect(res.body.connection.catalogStatus).toBe('ready')expect(oauth.runCatalogSync).toHaveBeenCalledTimes(1)+ expect(oauth.runCatalogSync).toHaveBeenCalledWith(+ expect.objectContaining({ connectionKey: 'codex-aaa' }),+ 'codex-aaa',+ expect.anything()+ )expect(callOrder).toEqual(['sync', 'publish'])assertNoLeak(res.body)})+ it('overlays this-attempt catalogStatus when connected poll sync fails without a connection', async () => {+ const materialize = vi.fn(async () => {})+ oauth.pollDevice.mockResolvedValue({+ status: 'connected',+ connection: {+ connectionKey: 'codex-aaa',+ status: 'connected',+ catalogStatus: 'ready',+ },+ })+ oauth.runCatalogSync.mockResolvedValue({+ ok: false,+ catalogStatus: 'never_synced',+ reason: 'catalog_sync_failed',+ })+ const res = await request(makeAuthedApp(makeGateway(materialize))).get(+ '/admin/llm/providers/codex-subscription/connections/codex-aaa/device/poll'+ )+ expect(res.status).toBe(200)+ expect(res.body.status).toBe('connected')+ expect(res.body.connection.catalogStatus).toBe('never_synced')+ expect(oauth.runCatalogSync).toHaveBeenCalledWith(+ expect.objectContaining({ connectionKey: 'codex-aaa' }),+ 'codex-aaa',+ expect.anything()+ )+ expect(materialize).toHaveBeenCalledTimes(1)+ assertNoLeak(res.body)+ })+it('keeps a connected device poll at 200 when automatic catalog sync fails', async () => {const materialize = vi.fn(async () => {})oauth.pollDevice.mockResolvedValue({diff --git a/control-api/test/routes.auth.codexSubscriptionCallback.test.ts b/control-api/test/routes.auth.codexSubscriptionCallback.test.tsindex fd3627a85..52ed15c3e 100644--- a/control-api/test/routes.auth.codexSubscriptionCallback.test.ts+++ b/control-api/test/routes.auth.codexSubscriptionCallback.test.ts@@ -99,6 +99,11 @@ describe('GET /auth/codex-subscription/callback', () => {)expect(res.headers['set-cookie']).toBeUndefined()expect(oauth.runCatalogSync).toHaveBeenCalledTimes(1)+ expect(oauth.runCatalogSync).toHaveBeenCalledWith(+ expect.objectContaining({ connectionKey: 'codex-aaa' }),+ 'codex-aaa',+ expect.anything()+ )assertNoLeak(res.text)})diff --git a/control-api/test/services.codexSubscriptionOAuth.test.ts b/control-api/test/services.codexSubscriptionOAuth.test.tsindex dee277011..b3780e961 100644--- a/control-api/test/services.codexSubscriptionOAuth.test.ts+++ b/control-api/test/services.codexSubscriptionOAuth.test.ts@@ -798,6 +798,31 @@ describe('codex subscription OAuth broker', () => {const result = await runCodexCatalogSync(deps(vi.fn()), 'team-plus', {listModels: async () => ({ outcome: 'unavailable' }),})- expect(result).toEqual({ ok: false, catalogStatus: 'never_synced', reason: 'proxy down' })+ expect(result).toEqual({+ ok: false,+ catalogStatus: 'never_synced',+ reason: 'catalog_sync_failed',+ })+ })++ it('returns a typed OAuth reason when catalog sync throws CodexSubscriptionOAuthError', async () => {+ repos.loadSecrets.mockResolvedValue({+ refreshToken: 'refresh-secret',+ accessToken: 'access-secret',+ accessTokenExpiresAt: new Date(Date.now() + 60_000),+ chatgptAccountId: 'acct',+ credentialRevision: 1,+ })+ catalog.sync.mockRejectedValue(+ new CodexSubscriptionOAuthError('provider_unavailable', 'chatgpt down')+ )+ const result = await runCodexCatalogSync(deps(vi.fn()), 'team-plus', {+ listModels: async () => ({ outcome: 'unavailable' }),+ })+ expect(result).toEqual({+ ok: false,+ catalogStatus: 'never_synced',+ reason: 'provider_unavailable',+ })})})diff --git a/control-ui/app/globals.css b/control-ui/app/globals.cssindex 6146dbd60..a875b905d 100644--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@ -11283,6 +11283,11 @@ textarea.cu-input {gap: var(--cu-space-2);}+.cu-codex-device-code a {+ text-decoration: underline;+ overflow-wrap: anywhere;+}+.cu-codex-device-code__row {display: flex;flex-wrap: wrap;diff --git a/control-ui/components/CodexSubscriptionHub/index.tsx b/control-ui/components/CodexSubscriptionHub/index.tsxindex d0cd01b01..7d6bf0443 100644--- a/control-ui/components/CodexSubscriptionHub/index.tsx+++ b/control-ui/components/CodexSubscriptionHub/index.tsx@@ -48,6 +48,7 @@ export function CodexSubscriptionHub() {const [error, setError] = useState('')const [searchQuery, setSearchQuery] = useState('')const [busyKey, setBusyKey] = useState<string | null>(null)+ const [deviceConnecting, setDeviceConnecting] = useState(false)const [creating, setCreating] = useState(false)const [createName, setCreateName] = useState('')const [editing, setEditing] = useState<CodexSubscriptionConnectionView | null>(null)@@ -92,6 +93,12 @@ export function CodexSubscriptionHub() {.finally(() => setLoading(false))}, [capability, enabled, load])+ useEffect(() => {+ return () => {+ connectEpoch.current += 1+ }+ }, [])+const filtered = useMemo(() => {const q = searchQuery.trim().toLowerCase()const rows = connections.filter(row => row.status !== 'revoked')@@ -135,6 +142,7 @@ export function CodexSubscriptionHub() {async function openEdit(row: CodexSubscriptionConnectionView) {connectEpoch.current += 1setBusyKey(null)+ setDeviceConnecting(false)setEditing(row)setEditName(grantLabel(row))setEditDefault(row.defaultModel ?? '')@@ -157,12 +165,16 @@ export function CodexSubscriptionHub() {function closeEdit() {connectEpoch.current += 1setBusyKey(null)+ setDeviceConnecting(false)setEditing(null)setEditName('')setEditDefault('')setEditModels([])setUserCode(null)setVerificationUri(null)+ void load().catch(err => {+ setError(err instanceof Error ? err.message : 'Failed to load ChatGPT subscriptions')+ })}async function handleSaveEdit() {@@ -187,6 +199,7 @@ export function CodexSubscriptionHub() {async function startDeviceConnect(row: CodexSubscriptionConnectionView) {const epoch = ++connectEpoch.currentsetBusyKey(row.connectionKey)+ setDeviceConnecting(true)try {const started = await startCodexDeviceConnect(row.status === 'connected' ? 'reconnect' : 'connect',@@ -234,7 +247,10 @@ export function CodexSubscriptionHub() {setVerificationUri(null)setError(err instanceof Error ? err.message : 'ChatGPT sign-in failed')} finally {- if (epoch === connectEpoch.current) setBusyKey(null)+ if (epoch === connectEpoch.current) {+ setBusyKey(null)+ setDeviceConnecting(false)+ }}}@@ -607,7 +623,7 @@ export function CodexSubscriptionHub() {</button></div>{userCode ? (- <div className="cu-codex-device-code">+ <div className="cu-codex-device-code" role="status"><p className="cu-field__hint">Enter this code at{' '}{verificationUri ? (@@ -689,7 +705,7 @@ export function CodexSubscriptionHub() {onClick={() => void handleSaveEdit()}disabled={Boolean(busyKey)}>- {busyKey ? 'Saving…' : 'Update subscription'}+ {busyKey && !deviceConnecting ? 'Saving…' : 'Update subscription'}</button></div></div>diff --git a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsxindex 05b819808..b0b6e94da 100644--- a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx+++ b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx@@ -137,7 +137,9 @@ describe('CodexSubscriptionHub', () => {await waitFor(() => {expect(createCodexSubscriptionConnection).toHaveBeenCalledWith({ displayName: 'New team' })})+ expect(await screen.findByRole('dialog')).toBeInTheDocument()expect(await screen.findByRole('button', { name: 'Sign in with ChatGPT' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Sync catalog' })).toBeInTheDocument()await waitFor(() => {expect(startCodexDeviceConnect).toHaveBeenCalledWith('connect', 'codex-bbb')})@@ -145,6 +147,38 @@ describe('CodexSubscriptionHub', () => {expect(revokeCodexSubscription).not.toHaveBeenCalled()})+ it('keeps the Add subscription dialog when Create is rejected', async () => {+ vi.mocked(createCodexSubscriptionConnection).mockRejectedValue(new Error('name taken'))+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ fireEvent.click(await screen.findByRole('button', { name: 'Add subscription' }))+ fireEvent.change(screen.getByRole('textbox', { name: 'Name' }), {+ target: { value: 'Taken name' },+ })+ fireEvent.click(screen.getByRole('button', { name: 'Create' }))+ expect(await screen.findByText('name taken')).toBeInTheDocument()+ expect(screen.getByRole('dialog', { name: 'Add subscription' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'Create' })).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Sign in with ChatGPT' })).not.toBeInTheDocument()+ expect(startCodexDeviceConnect).not.toHaveBeenCalled()+ })++ it('does not POST when Create is clicked with an empty name', async () => {+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ fireEvent.click(await screen.findByRole('button', { name: 'Add subscription' }))+ fireEvent.click(screen.getByRole('button', { name: 'Create' }))+ expect(await screen.findByText('Subscription name is required.')).toBeInTheDocument()+ expect(createCodexSubscriptionConnection).not.toHaveBeenCalled()+ expect(startCodexDeviceConnect).not.toHaveBeenCalled()+ })+it('renders a ChatGPT verification link and copies the device code', async () => {const writeText = vi.fn().mockResolvedValue(undefined)Object.assign(navigator, { clipboard: { writeText } })@@ -170,6 +204,12 @@ describe('CodexSubscriptionHub', () => {expect(link).toHaveAttribute('href', 'https://auth.openai.com/codex/device')expect(link).toHaveAttribute('target', '_blank')expect(link.getAttribute('rel') ?? '').toContain('noopener')+ expect(link.getAttribute('rel') ?? '').toContain('noreferrer')+ expect(screen.getByTestId('codex-device-code').closest('[role="status"]')).toHaveTextContent(+ 'ABCD-1234'+ )+ expect(screen.getByRole('button', { name: 'Update subscription' })).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Saving…' })).not.toBeInTheDocument()expect(screen.getByTestId('codex-device-code')).toHaveTextContent('ABCD-1234')fireEvent.click(screen.getByRole('button', { name: 'Copy code' }))await waitFor(() => {@@ -272,10 +312,38 @@ describe('CodexSubscriptionHub', () => {).toBeInTheDocument()})+ it('renders the ChatGPT verification link from the pencil Sign in path', async () => {+ vi.mocked(startCodexDeviceConnect).mockResolvedValue({+ userCode: 'WXYZ-9876',+ verificationUri: 'https://auth.openai.com/codex/device',+ intervalSeconds: 0.001,+ state: 'state-pencil',+ intent: 'reconnect',+ })+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ fireEvent.click(+ await screen.findByRole('button', { name: 'Update ChatGPT subscription Team A' })+ )+ fireEvent.click(await screen.findByRole('button', { name: 'Sign in with ChatGPT' }))+ const link = await screen.findByTestId('codex-device-verification-link')+ expect(link).toHaveAttribute('href', 'https://auth.openai.com/codex/device')+ expect(link.getAttribute('rel') ?? '').toContain('noopener')+ expect(link.getAttribute('rel') ?? '').toContain('noreferrer')+ expect(screen.getByTestId('codex-device-code').closest('[role="status"]')).toHaveTextContent(+ 'WXYZ-9876'+ )+ expect(screen.getByRole('button', { name: 'Update subscription' })).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Saving…' })).not.toBeInTheDocument()+ })+it('opens the grant modal for Sign in, Sync, and model toggles without binding hosts', async () => {vi.mocked(startCodexDeviceConnect).mockResolvedValue({userCode: 'ABCD-1234',- verificationUri: 'https://chatgpt.com/device',+ verificationUri: 'https://auth.openai.com/codex/device',intervalSeconds: 1,state: 'state-1',intent: 'connect',diff --git a/control-ui/lib/__tests__/codexSubscription.sanitize.test.ts b/control-ui/lib/__tests__/codexSubscription.sanitize.test.tsindex 4b419e82d..bba63687d 100644--- a/control-ui/lib/__tests__/codexSubscription.sanitize.test.ts+++ b/control-ui/lib/__tests__/codexSubscription.sanitize.test.ts@@ -1,9 +1,11 @@import { describe, expect, it } from 'vitest'import {+ CODEX_DEVICE_VERIFICATION_URI,type CodexSubscriptionConnectionView,isAssignableCodexGrant,sanitizeCodexConnection,sanitizeCodexDevicePoll,+ sanitizeCodexDeviceStart,} from '../codexSubscription'function connected(@@ -42,6 +44,35 @@ describe('sanitizeCodexConnection', () => {})})+describe('sanitizeCodexDeviceStart', () => {+ it('keeps the canonical ChatGPT verification URI', () => {+ expect(+ sanitizeCodexDeviceStart({+ userCode: 'ABCD-1234',+ verificationUri: CODEX_DEVICE_VERIFICATION_URI,+ intervalSeconds: 5,+ state: 'state-1',+ intent: 'connect',+ })+ ).toMatchObject({+ userCode: 'ABCD-1234',+ verificationUri: CODEX_DEVICE_VERIFICATION_URI,+ })+ })++ it('rejects a non-canonical verification URI', () => {+ expect(() =>+ sanitizeCodexDeviceStart({+ userCode: 'ABCD-1234',+ verificationUri: 'https://chatgpt.com/device',+ intervalSeconds: 5,+ state: 'state-1',+ intent: 'connect',+ })+ ).toThrow(/verification URI is not allowed/)+ })+})+describe('sanitizeCodexDevicePoll', () => {it('keeps catalogStatus when present and defaults when the backend omits it', () => {const ready = sanitizeCodexDevicePoll({diff --git a/control-ui/lib/codexSubscription.ts b/control-ui/lib/codexSubscription.tsindex 4ff61bc91..5fb0cdff7 100644--- a/control-ui/lib/codexSubscription.ts+++ b/control-ui/lib/codexSubscription.ts@@ -2,6 +2,9 @@ import { apiGet, apiSend } from './api'export const CODEX_SUBSCRIPTION_API_BASE = '/api/v1/admin/llm/providers/codex-subscription'+/** Canonical ChatGPT device verification page. Reject any other href from device/start. */+export const CODEX_DEVICE_VERIFICATION_URI = 'https://auth.openai.com/codex/device'+export type CodexConnectionStatus =| 'disconnected'| 'connecting'@@ -196,6 +199,9 @@ export function sanitizeCodexDeviceStart(raw: unknown): CodexDeviceStartView {if (!userCode || !verificationUri || !state) {throw new Error('Codex device start is incomplete')}+ if (verificationUri !== CODEX_DEVICE_VERIFICATION_URI) {+ throw new Error('Codex device start verification URI is not allowed')+ }return {userCode,verificationUri,diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex c6c1e8790..ce4b311a3 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.476",+ "version": "0.1.477","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.476",+ "version": "0.1.477","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 bcf1f477a..18018e778 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.476",+ "version": "0.1.477","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 eb7365a61..f38ac081a 100755--- a/scripts/tests/test-codex-subscription-t0.sh+++ b/scripts/tests/test-codex-subscription-t0.sh@@ -216,6 +216,7 @@ run_group "workflow-recipes" "workflow-recipes" \run_group "control-ui" "control-ui" \"components/__tests__/CodexSubscriptionHub.test.tsx" \+ "lib/__tests__/codexSubscription.sanitize.test.ts" \"components/__tests__/LlmProviderConfig.test.tsx" \"lib/__tests__/llm.codexGrantModel.test.ts" \"lib/__tests__/llmCredentialSelect.test.ts" \diff --git a/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts b/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.tsindex 87c8381e9..f02220553 100644--- a/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts+++ b/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts@@ -123,16 +123,21 @@ test.describe('Codex subscription connection', () => {const grantKey = await hub.createGrant(displayName)const deviceRes = await deviceStartexpect(deviceRes.status(), `device start must return 200, got ${deviceRes.status()}`).toBe(200)+ expect(new URL(deviceRes.url()).pathname).toBe(+ `/api/v1/admin/llm/providers/codex-subscription/connections/${grantKey}/device/start`+ )const deviceBody = (await deviceRes.json()) as {userCode?: stringverificationUri?: string}- expect(deviceBody.userCode).toEqual(expect.any(String))+ expect(deviceBody.userCode).toBeTruthy()+ expect(deviceBody.verificationUri).toBe('https://auth.openai.com/codex/device')const link = page.getByTestId('codex-device-verification-link')- await expect(link).toHaveAttribute('href', 'https://auth.openai.com/codex/device')+ await expect(link).toHaveAttribute('href', String(deviceBody.verificationUri))await expect(link).toHaveAttribute('target', '_blank')await expect(link).toHaveAttribute('rel', /noopener/)+ await expect(link).toHaveAttribute('rel', /noreferrer/)await expect(page.getByTestId('codex-device-code')).toHaveText(String(deviceBody.userCode))await page.getByRole('button', { name: 'Copy code' }).click()diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.jsonindex 454f3db77..c86c12c7d 100644--- a/tests/e2e/playwright/package-lock.json+++ b/tests/e2e/playwright/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-playwright-tests",- "version": "0.1.36",+ "version": "0.1.37","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-playwright-tests",- "version": "0.1.36",+ "version": "0.1.37","devDependencies": {"@playwright/test": "^1.50.0","@types/node": "^22.0.0"diff --git a/tests/e2e/playwright/package.json b/tests/e2e/playwright/package.jsonindex 8bcb11369..7558f2976 100644--- a/tests/e2e/playwright/package.json+++ b/tests/e2e/playwright/package.json@@ -1,6 +1,6 @@{"name": "clerum-playwright-tests",- "version": "0.1.36",+ "version": "0.1.37","private": true,"description": "Playwright E2E tests for Control UI and Desktop App","scripts": {diff --git a/tests/e2e/playwright/pages/codex-subscription.ts b/tests/e2e/playwright/pages/codex-subscription.tsindex 0f10e3221..f721766e1 100644--- a/tests/e2e/playwright/pages/codex-subscription.ts+++ b/tests/e2e/playwright/pages/codex-subscription.ts@@ -174,7 +174,7 @@ export class SecretsLlmSubscriptionsPage {const response = await createdexpect(response.status(), `create grant must return 201, got ${response.status()}`).toBe(201)const body = (await response.json()) as { connectionKey?: string }- expect(body.connectionKey).toEqual(expect.any(String))+ expect(body.connectionKey).toBeTruthy()await this.expectConnectModal()return String(body.connectionKey)}