Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(codex): drop Sync catalog and model toggles from the grant modal
Alfredo Lopezd21b0f2ad966
diff --git a/control-ui/components/CodexSubscriptionHub/index.tsx b/control-ui/components/CodexSubscriptionHub/index.tsxindex b7b691063..e089eb941 100644--- a/control-ui/components/CodexSubscriptionHub/index.tsx+++ b/control-ui/components/CodexSubscriptionHub/index.tsx@@ -7,12 +7,10 @@ import {createCodexSubscriptionConnection,listCodexConnectionModels,listCodexSubscriptionConnections,- patchCodexCatalogModel,patchCodexSubscriptionConnection,pollCodexDevice,revokeCodexSubscription,startCodexDeviceConnect,- syncCodexSubscriptionCatalog,} from '@lib/codexSubscription'import {type CodexSubscriptionCapability,@@ -227,7 +225,7 @@ export function CodexSubscriptionHub() {if (latest.catalogStatus === 'ready') {showToast('Connected — catalog synced', { tone: 'success' })} else {- showToast('Connected, but catalog sync failed — use Sync catalog to retry', {+ showToast('Connected, but catalog sync failed. Sign in again to retry.', {tone: 'error',})}@@ -267,43 +265,6 @@ export function CodexSubscriptionHub() {setError('Could not copy the verification code')}- async function handleSync(row: CodexSubscriptionConnectionView) {- if (row.status !== 'connected') return- setBusyKey(row.connectionKey)- try {- const synced = await syncCodexSubscriptionCatalog(row.connectionKey)- if (synced.outcome !== 'ready') {- setError(`Catalog sync ${synced.outcome}`)- return- }- const models = await listCodexConnectionModels(row.connectionKey)- setEditModels(models)- await load()- showToast(`Catalog synced: ${grantLabel(row)}`, { tone: 'success' })- } catch (err) {- setError(err instanceof Error ? err.message : 'Catalog sync failed')- } finally {- setBusyKey(null)- }- }-- async function handleToggleModel(- row: CodexSubscriptionConnectionView,- model: string,- enabledNext: boolean- ) {- setBusyKey(row.connectionKey)- try {- const models = await patchCodexCatalogModel(row.connectionKey, model, enabledNext)- setEditModels(models)- if (editDefault === model && !enabledNext) setEditDefault('')- } catch (err) {- setError(err instanceof Error ? err.message : 'Could not update model')- } finally {- setBusyKey(null)- }- }-async function handleRevoke(row: CodexSubscriptionConnectionView) {const confirmed = await confirm({title: 'Delete ChatGPT subscription',@@ -615,14 +576,6 @@ export function CodexSubscriptionHub() {disabled={Boolean(busyKey)}>Sign in with ChatGPT- </button>{' '}- <button- type="button"- className="cu-btn cu-btn--ghost cu-btn--sm"- onClick={() => void handleSync(editing)}- disabled={Boolean(busyKey) || editing.status !== 'connected'}- >- Sync catalog</button></div>{userCode ? (@@ -659,25 +612,6 @@ export function CodexSubscriptionHub() {</div></div>) : null}- {editModels.length > 0 ? (- <fieldset className="cu-field">- <legend className="cu-field__label">Enabled models</legend>- {editModels.map(model => (- <label key={model.model} className="cu-field" style={{ display: 'block' }}>- <input- type="checkbox"- checked={model.enabled}- disabled={Boolean(busyKey) || model.stale}- onChange={e =>- void handleToggleModel(editing, model.model, e.target.checked)- }- />{' '}- {model.model}- {model.stale ? ' (stale)' : ''}- </label>- ))}- </fieldset>- ) : null}<div className="cu-field"><label htmlFor="codex-edit-default">Default model</label><SelectionDropdowndiff --git a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsxindex 0f06b01c3..b54b60610 100644--- a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx+++ b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx@@ -5,7 +5,6 @@ import {createCodexSubscriptionConnection,listCodexConnectionModels,listCodexSubscriptionConnections,- patchCodexCatalogModel,patchCodexSubscriptionConnection,pollCodexDevice,revokeCodexSubscription,@@ -38,7 +37,6 @@ vi.mock('@lib/codexSubscription', async importOriginal => {listCodexConnectionModels: vi.fn(),createCodexSubscriptionConnection: vi.fn(),patchCodexSubscriptionConnection: vi.fn(),- patchCodexCatalogModel: vi.fn(),startCodexDeviceConnect: vi.fn(),pollCodexDevice: vi.fn(),syncCodexSubscriptionCatalog: vi.fn(),@@ -139,7 +137,8 @@ describe('CodexSubscriptionHub', () => {})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()+ expect(screen.queryByRole('button', { name: 'Sync catalog' })).not.toBeInTheDocument()+ expect(screen.queryByRole('group', { name: 'Enabled models' })).not.toBeInTheDocument()await waitFor(() => {expect(startCodexDeviceConnect).toHaveBeenCalledWith('connect', 'codex-bbb')})@@ -386,7 +385,7 @@ describe('CodexSubscriptionHub', () => {expect(screen.queryByRole('button', { name: 'Saving…' })).not.toBeInTheDocument()})- it('opens the grant modal for Sign in, Sync, and model toggles without binding hosts', async () => {+ it('opens the grant modal for Sign in and default model without a Sync catalog control', async () => {vi.mocked(startCodexDeviceConnect).mockResolvedValue({userCode: 'ABCD-1234',verificationUri: 'https://auth.openai.com/codex/device',@@ -394,17 +393,6 @@ describe('CodexSubscriptionHub', () => {state: 'state-1',intent: 'connect',})- vi.mocked(syncCodexSubscriptionCatalog).mockResolvedValue({- outcome: 'ready',- added: 1,- refreshed: 0,- staled: 0,- connection: connection({ connectionKey: 'codex-aaa', displayName: 'Team A' }),- })- vi.mocked(patchCodexCatalogModel).mockResolvedValue([- { model: 'gpt-5.1', enabled: true, stale: false },- { model: 'gpt-5.3-codex', enabled: true, stale: false },- ])vi.mocked(patchCodexSubscriptionConnection).mockResolvedValue(connection({ connectionKey: 'codex-aaa', displayName: 'Team A', defaultModel: 'gpt-5.1' }))@@ -417,16 +405,10 @@ describe('CodexSubscriptionHub', () => {await screen.findByRole('button', { name: 'Update ChatGPT subscription Team A' }))expect(await screen.findByRole('button', { name: 'Sign in with ChatGPT' })).toBeInTheDocument()- expect(screen.getByRole('button', { name: 'Sync catalog' })).toBeInTheDocument()+ expect(screen.queryByRole('button', { name: 'Sync catalog' })).not.toBeInTheDocument()+ expect(screen.queryByRole('group', { name: 'Enabled models' })).not.toBeInTheDocument()expect(listCodexConnectionModels).toHaveBeenCalledWith('codex-aaa')- fireEvent.click(screen.getByRole('button', { name: 'Sync catalog' }))- await waitFor(() => {- expect(syncCodexSubscriptionCatalog).toHaveBeenCalledWith('codex-aaa')- })- fireEvent.click(screen.getByLabelText('gpt-5.3-codex'))- await waitFor(() => {- expect(patchCodexCatalogModel).toHaveBeenCalledWith('codex-aaa', 'gpt-5.3-codex', true)- })+ expect(syncCodexSubscriptionCatalog).not.toHaveBeenCalled()fireEvent.click(screen.getByRole('button', { name: 'Update subscription' }))await waitFor(() => {expect(patchCodexSubscriptionConnection).toHaveBeenCalledWith('codex-aaa', {diff --git a/control-ui/package.json b/control-ui/package.jsonindex ee6d9dd88..79200bdfe 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.478",+ "version": "0.1.479","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts b/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.tsindex f02220553..2007a8f39 100644--- a/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts+++ b/tests/e2e/playwright/control-ui/codex-subscription-connection.spec.ts@@ -148,22 +148,12 @@ test.describe('Codex subscription connection', () => {const grant = (await listConnections()).find(row => row.connectionKey === grantKey)expect(grant, 'created grant must be listed').toBeTruthy()- const sync = page.getByRole('dialog').getByRole('button', { name: 'Sync catalog' })- if (grant?.status === 'connected') {- const syncResPromise = page.waitForResponse(- response =>- new RegExp(- `/api/v1/admin/llm/providers/codex-subscription/connections/${grantKey}/catalog/sync$`- ).test(new URL(response.url()).pathname) && response.request().method() === 'POST'- )- await sync.click()- const syncRes = await syncResPromise- expect(syncRes.ok(), `manual catalog sync retry must succeed, got ${syncRes.status()}`).toBe(- true- )- } else {- await expect(sync, 'Sync stays disabled until the grant is connected').toBeDisabled()- }+ await expect(+ page.getByRole('dialog').getByRole('button', { name: 'Sync catalog' })+ ).toHaveCount(0)+ await expect(+ page.getByRole('dialog').getByRole('group', { name: 'Enabled models' })+ ).toHaveCount(0)await hub.closeConnectModal()await shell.openAgents()@@ -173,7 +163,7 @@ test.describe('Codex subscription connection', () => {await model.expectOneCredentialSelect()})- test('J5 enable and default PATCH, then reopen matches GET models', async ({ page }) => {+ test('J5 default-model PATCH, then reopen matches the selected default', async ({ page }) => {const shell = new ControlUiShell(page)const hub = new SecretsLlmSubscriptionsPage(page)await loginFromHome(page)@@ -191,25 +181,10 @@ test.describe('Codex subscription connection', () => {)await hub.openGrant(displayName)await modelsGet- const firstToggle = page.getByRole('dialog').locator('input[type="checkbox"]').first()- await expect(firstToggle, 'grant modal must list catalog models').toBeVisible()- const modelName = (- (await firstToggle.evaluate(node => node.closest('label')?.textContent)) ?? ''- )- .replace('(stale)', '')- .trim()- expect(modelName).toMatch(/\S/)-- const patchModel = page.waitForResponse(- response =>- new RegExp(- `/api/v1/admin/llm/providers/codex-subscription/connections/${grantKey}/models/`- ).test(new URL(response.url()).pathname) && response.request().method() === 'PATCH'- )- const wasEnabled = await firstToggle.isChecked()- await firstToggle.click()- const patchRes = await patchModel- expect(patchRes.ok(), `model PATCH must succeed, got ${patchRes.status()}`).toBe(true)+ await expect(+ page.getByRole('dialog').getByRole('button', { name: 'Sync catalog' })+ ).toHaveCount(0)+ await expect(page.getByRole('dialog').locator('input[type="checkbox"]')).toHaveCount(0)await page.getByLabel('Default model').click()const defaultOption = page.getByRole('option').first()@@ -235,12 +210,7 @@ test.describe('Codex subscription connection', () => {).test(new URL(response.url()).pathname) && response.request().method() === 'GET')await hub.openGrant(displayName)- const modelsRes = await reopened- const modelsBody = (await modelsRes.json()) as {- models?: Array<{ model?: string; enabled?: boolean }>- }- const toggled = modelsBody.models?.find(row => row.model === modelName)- expect(toggled?.enabled).toBe(!wasEnabled)+ await reopenedif (defaultName) {await expect(page.getByLabel('Default model')).toContainText(defaultName)}diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.jsonindex c86c12c7d..997dd85e7 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.37",+ "version": "0.1.38","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-playwright-tests",- "version": "0.1.37",+ "version": "0.1.38","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 7558f2976..3ca70203d 100644--- a/tests/e2e/playwright/package.json+++ b/tests/e2e/playwright/package.json@@ -1,6 +1,6 @@{"name": "clerum-playwright-tests",- "version": "0.1.37",+ "version": "0.1.38","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 f721766e1..0ebbd9274 100644--- a/tests/e2e/playwright/pages/codex-subscription.ts+++ b/tests/e2e/playwright/pages/codex-subscription.ts@@ -149,7 +149,8 @@ export class SecretsLlmSubscriptionsPage {const dialog = this.page.getByRole('dialog')await expect(dialog).toBeVisible()await expect(dialog.getByRole('button', { name: 'Sign in with ChatGPT' })).toBeVisible()- await expect(dialog.getByRole('button', { name: 'Sync catalog' })).toBeVisible()+ await expect(dialog.getByRole('button', { name: 'Sync catalog' })).toHaveCount(0)+ await expect(dialog.getByRole('group', { name: 'Enabled models' })).toHaveCount(0)}async closeConnectModal() {