Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): complete subscription gating and dropdown focus after dev merge
M5822a7c6499a
diff --cc control-ui/app/globals.cssindex c35cabf57,90fb9afd5..18baffb41--- a/control-ui/app/globals.css+++ b/control-ui/app/globals.css@@@ -6780,13 -6769,6 +6780,18 @@@ td.cu-registry-descriptionoutline: none;}+.cu-agent-select__option[data-active='true'] {+ color: var(--cu-text);+ background: var(--cu-option-selected-bg);+ box-shadow: inset 0 0 0 1px var(--cu-accent);+ outline: none;+}+++.cu-agent-select__option:focus-visible {++ outline: 2px solid var(--cu-focus);++ outline-offset: 2px;++}++.cu-agent-select__empty {display: block;padding: 0.6rem 0.65rem;@@@ -7019,13 -7002,6 +7024,18 @@@outline: none;}+.cu-selection-dropdown__option[data-selected='true'] {+ color: var(--cu-text);+ background: var(--cu-option-selected-bg);+ box-shadow: inset 0 0 0 1px var(--cu-accent);+ outline: none;+}+++.cu-selection-dropdown__option:focus-visible {++ outline: 2px solid var(--cu-focus);++ outline-offset: 2px;++}++.cu-selection-dropdown__option-leading {display: inline-flex;align-items: center;diff --cc control-ui/components/CodexSubscriptionHub/index.tsxindex 367e28f23,c37750a47..ad255c6f9--- a/control-ui/components/CodexSubscriptionHub/index.tsx+++ b/control-ui/components/CodexSubscriptionHub/index.tsx@@@ -674,13 -674,6 +674,13 @@@ export function CodexSubscriptionHub()const offeredDefaults = editModels.filter(row => row.enabled && !row.stale).map(row => row.model)const initialLoad = loading && connections.length === 0const uiStatus = editing ? mapConnectionStatus(editing.status) : 'disconnected'+ // The sign-in action and the status badge above it share this one status+ // source, so they can never disagree: a connected grant shows the signed-in+ // indicator instead of the sign-in button, and only a grant that expired- // (reauth-required) surfaces the explicit reconnect action. The- // create/setup flow keeps the plain sign-in button throughout.- const connectedGrant = editing !== null && !setupNew && uiStatus === 'connected'++ // (reauth-required) surfaces the explicit reconnect action. This includes++ // first-time setup once its device sign-in completes.++ const connectedGrant = editing !== null && uiStatus === 'connected'+ const needsReconnect = editing !== null && !setupNew && uiStatus === 'reauth-required'const dialogBroker: HubBroker = editing?.broker ?? createBrokerconst dialogCopy = HUB_PROVIDER_COPY[dialogBroker]// Table-level copy stays ChatGPT-specific while Grok is off (unchanged Codexdiff --cc control-ui/components/__tests__/CodexSubscriptionHub.test.tsxindex 2b59874e0,e51bc31a9..34e6d32de--- a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx+++ b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx@@@ -505,113 -471,6 +505,119 @@@ describe('CodexSubscriptionHub', () =>vi.useRealTimers()}})++ // BUG-138: the status badge and the sign-in action share one status source,+ // so a CONNECTED badge can never sit next to a "Sign in with ChatGPT" button.+ it('replaces the sign-in button with the connected indicator for a connected grant', async () => {+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ fireEvent.click(+ await screen.findByRole('button', { name: 'Actions for ChatGPT subscription Team A' })+ )+ fireEvent.click(await screen.findByRole('menuitem', { name: 'Update' }))+ const dialog = await screen.findByRole('dialog', {+ name: 'Update ChatGPT subscription Team A',+ })+ expect(await within(dialog).findByText('Connected')).toBeInTheDocument()+ expect(within(dialog).getByTestId('codex-signin-connected')).toHaveTextContent(+ 'Signed in with ChatGPT'+ )+ expect(+ within(dialog).queryByRole('button', { name: 'Sign in with ChatGPT' })+ ).not.toBeInTheDocument()+ expect(+ within(dialog).queryByRole('button', { name: 'Reconnect ChatGPT' })+ ).not.toBeInTheDocument()+ })++ it('surfaces the reconnect action only for a grant that needs reauthorization', async () => {+ vi.mocked(listCodexSubscriptionConnections).mockResolvedValue([+ connection({+ connectionKey: 'codex-aaa',+ displayName: 'Team A',+ status: 'reauth_required',+ }),+ ])+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ fireEvent.click(+ await screen.findByRole('button', { name: 'Actions for ChatGPT subscription Team A' })+ )+ fireEvent.click(await screen.findByRole('menuitem', { name: 'Update' }))+ const dialog = await screen.findByRole('dialog', {+ name: 'Update ChatGPT subscription Team A',+ })+ expect(await within(dialog).findByText('Reauthorization required')).toBeInTheDocument()+ expect(+ await within(dialog).findByRole('button', { name: 'Reconnect ChatGPT' })+ ).toBeInTheDocument()+ expect(+ within(dialog).queryByRole('button', { name: 'Sign in with ChatGPT' })+ ).not.toBeInTheDocument()+ expect(within(dialog).queryByTestId('codex-signin-connected')).not.toBeInTheDocument()+ })+- it('keeps the sign-in button through the new-subscription setup flow even after it connects', async () => {++ it('replaces sign-in with the connected indicator after new-subscription setup connects', async () => {+ vi.stubGlobal(+ 'open',+ vi.fn(() => ({}))+ )+ vi.mocked(createCodexSubscriptionConnection).mockResolvedValue(+ connection({+ connectionKey: 'codex-bbb',+ displayName: 'New team',+ status: 'disconnected',+ defaultModel: null,+ })+ )+ vi.mocked(startCodexDeviceConnect).mockResolvedValue({+ userCode: 'ABCD-1234',+ verificationUri: CODEX_DEVICE_VERIFICATION_URI,+ intervalSeconds: 0.3,+ state: 'state-1',+ intent: 'connect',+ })+ vi.mocked(pollCodexDevice).mockResolvedValue({+ status: 'connected',+ connection: connection({ connectionKey: 'codex-bbb', displayName: 'New team' }),+ })+ vi.mocked(listCodexConnectionModels).mockResolvedValue([+ { model: 'gpt-5.1', enabled: true, stale: false },+ ])+ render(+ <ToastProvider>+ <CodexSubscriptionHub />+ </ToastProvider>+ )+ expect(await screen.findByText('Team A')).toBeInTheDocument()+ fireEvent.click(screen.getByRole('button', { name: 'Add subscription' }))+ fireEvent.change(screen.getByRole('textbox', { name: 'Name' }), {+ target: { value: 'New team' },+ })+ fireEvent.click(screen.getByRole('button', { name: 'Sign in with ChatGPT' }))- // Wait for the handshake to land: the grant flips to connected while the- // setup dialog is still open, and the setup flow keeps the sign-in entry.++ // The setup dialog remains open after the handshake, but the sign-in++ // action must follow the same connected state as the badge.+ await waitFor(() => {+ expect(listCodexConnectionModels).toHaveBeenCalledWith('codex-bbb')+ })+ await waitFor(() => {+ expect(screen.getByRole('button', { name: 'Finish setup' })).toBeInTheDocument()+ })- expect(screen.getByRole('button', { name: 'Sign in with ChatGPT' })).toBeInTheDocument()- expect(screen.queryByTestId('codex-signin-connected')).not.toBeInTheDocument()++ const dialog = screen.getByRole('dialog', { name: 'New ChatGPT subscription' })++ expect(within(dialog).getByText('Connected')).toBeInTheDocument()++ expect(within(dialog).getByTestId('codex-signin-connected')).toHaveTextContent(++ 'Signed in with ChatGPT'++ )++ expect(++ within(dialog).queryByRole('button', { name: 'Sign in with ChatGPT' })++ ).not.toBeInTheDocument()+ })})describe('CodexSubscriptionHub with Grok enabled', () => {diff --cc control-ui/package-lock.jsonindex a7466dcb2,6a11d5f01..ccb1960d9--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@@ -143,7 -143,7 +143,6 @@@"integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==","dev": true,"license": "MIT",-- "peer": true,"dependencies": {"@babel/helper-validator-identifier": "^7.28.5","js-tokens": "^4.0.0",@@@ -159,7 -159,7 +158,6 @@@"integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==","dev": true,"license": "MIT",-- "peer": true,"engines": {"node": ">=6.9.0"}@@@ -294,6 -294,6 +292,7 @@@}],"license": "MIT",++ "peer": true,"engines": {"node": ">=20.19.0"},@@@ -342,6 -342,6 +341,7 @@@}],"license": "MIT",++ "peer": true,"engines": {"node": ">=20.19.0"}@@@ -1032,6 -1032,6 +1032,7 @@@"integrity": "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==","devOptional": true,"license": "Apache-2.0",++ "peer": true,"dependencies": {"playwright": "1.59.1"},@@@ -1456,8 -1456,8 +1457,7 @@@"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz","integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==","dev": true,-- "license": "MIT",-- "peer": true++ "license": "MIT"},"node_modules/@types/chai": {"version": "5.2.3",@@@ -1594,6 -1594,6 +1594,7 @@@"integrity": "sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==","dev": true,"license": "MIT",++ "peer": true,"dependencies": {"undici-types": "~7.16.0"}@@@ -1615,6 -1615,6 +1616,7 @@@"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.28.tgz","integrity": "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==","license": "MIT",++ "peer": true,"dependencies": {"@types/prop-types": "*","csstype": "^3.2.2"@@@ -1626,6 -1626,6 +1628,7 @@@"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==","dev": true,"license": "MIT",++ "peer": true,"peerDependencies": {"@types/react": "^18.0.0"}@@@ -1833,7 -1833,7 +1836,6 @@@"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==","dev": true,"license": "MIT",-- "peer": true,"engines": {"node": ">=8"}@@@ -1844,7 -1844,7 +1846,6 @@@"integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==","dev": true,"license": "MIT",-- "peer": true,"engines": {"node": ">=10"},@@@ -2319,8 -2319,8 +2320,7 @@@"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz","integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==","dev": true,-- "license": "MIT",-- "peer": true++ "license": "MIT"},"node_modules/entities": {"version": "8.0.0",@@@ -2451,6 -2451,6 +2451,7 @@@"version": "2.3.2","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz","integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",++ "dev": true,"hasInstallScript": true,"license": "MIT","optional": true,@@@ -2955,6 -2955,6 +2956,7 @@@"integrity": "sha512-0+MoQNYyr2rBHqO1xilltfDjV9G7ymYGlAUazgcDLQaUf8JDHbuGwsxN6U9qWaElZ4w1B2r7yEGIL3GdeW3Rug==","dev": true,"license": "MIT",++ "peer": true,"dependencies": {"@acemir/cssom": "^0.9.31","@asamuzakjp/dom-selector": "^6.8.1",@@@ -3289,7 -3289,7 +3291,6 @@@"integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==","dev": true,"license": "MIT",-- "peer": true,"bin": {"lz-string": "bin/bin.js"}@@@ -4327,6 -4327,6 +4328,7 @@@"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==","dev": true,"license": "MIT",++ "peer": true,"engines": {"node": ">=12"},@@@ -4400,7 -4400,7 +4402,6 @@@"integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==","dev": true,"license": "MIT",-- "peer": true,"dependencies": {"ansi-regex": "^5.0.1","ansi-styles": "^5.0.0",@@@ -4415,8 -4415,8 +4416,7 @@@"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz","integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==","dev": true,-- "license": "MIT",-- "peer": true++ "license": "MIT"},"node_modules/property-information": {"version": "7.1.0",@@@ -4460,6 -4460,6 +4460,7 @@@"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz","integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==","license": "MIT",++ "peer": true,"dependencies": {"loose-envify": "^1.1.0"},@@@ -4472,6 -4472,6 +4473,7 @@@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz","integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==","license": "MIT",++ "peer": true,"dependencies": {"loose-envify": "^1.1.0","scheduler": "^0.23.2"@@@ -4519,6 -4519,6 +4521,7 @@@"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz","integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==","license": "MIT",++ "peer": true,"dependencies": {"@types/use-sync-external-store": "^0.0.6","use-sync-external-store": "^1.4.0"@@@ -4585,7 -4585,7 +4588,8 @@@"version": "5.0.1","resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz","integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",-- "license": "MIT"++ "license": "MIT",++ "peer": true},"node_modules/redux-thunk": {"version": "3.1.0",@@@ -5462,6 -5462,6 +5466,7 @@@"integrity": "sha512-lhZBVvEHefgE+HQZC9O7EBJgCU/nVzFNl7vkS4RE0APtWLP02/8QVIkQtzBxPquh7lq5/78NHipTj7ODQ6XuyQ==","dev": true,"license": "MIT",++ "peer": true,"dependencies": {"lightningcss": "^1.33.0","picomatch": "^4.0.7",@@@ -5736,6 -5736,6 +5741,7 @@@"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz","integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==","license": "ISC",++ "peer": true,"bin": {"yaml": "bin.mjs"},