Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(ui): persist ChatGPT assignment only on Host save
Alfredo Lopez99416948dd41
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsxindex 6f2e1a12c..b4acf4315 100644--- a/control-ui/app/hosts/[name]/page.tsx+++ b/control-ui/app/hosts/[name]/page.tsx@@ -1133,13 +1133,6 @@ export default function HostDetailsPage() {connectionRef={connectionRefDraft}hostName={routeName}onConnectionRefChange={setConnectionRefDraft}- onAssignmentPersisted={connectionRef => {- savedModelRef.current = {- ...savedModelRef.current,- connectionRef,- }- setConnectionRefDraft(connectionRef)- }}onModelsChange={setCodexModels}disabled={busy}/>diff --git a/control-ui/components/CodexAgentAssignment/index.tsx b/control-ui/components/CodexAgentAssignment/index.tsxindex 8f914f352..10a8833d3 100644--- a/control-ui/components/CodexAgentAssignment/index.tsx+++ b/control-ui/components/CodexAgentAssignment/index.tsx@@ -29,7 +29,6 @@ export type CodexAgentAssignmentProps = {connectionRef: stringhostName?: stringonConnectionRefChange: (connectionKey: string) => void- onAssignmentPersisted?: (connectionKey: string) => voidonModelsChange?: (models: string[]) => voiddisabled?: boolean}@@ -38,7 +37,6 @@ export function CodexAgentAssignment({connectionRef,hostName,onConnectionRefChange,- onAssignmentPersisted,onModelsChange,disabled = false,}: CodexAgentAssignmentProps) {diff --git a/control-ui/components/__tests__/CodexAgentAssignment.test.tsx b/control-ui/components/__tests__/CodexAgentAssignment.test.tsxindex 2ac27a284..a6eda5b56 100644--- a/control-ui/components/__tests__/CodexAgentAssignment.test.tsx+++ b/control-ui/components/__tests__/CodexAgentAssignment.test.tsx@@ -58,21 +58,15 @@ function connection(}}-function renderAssignment(- connectionRef: string,- onConnectionRefChange = vi.fn(),- onAssignmentPersisted = vi.fn()-) {+function renderAssignment(connectionRef: string, onConnectionRefChange = vi.fn()) {return {onConnectionRefChange,- onAssignmentPersisted,...render(<ToastProvider><CodexAgentAssignmentconnectionRef={connectionRef}hostName="chatllm"onConnectionRefChange={onConnectionRefChange}- onAssignmentPersisted={onAssignmentPersisted}/></ToastProvider>),@@ -197,7 +191,7 @@ describe('CodexAgentAssignment', () => {connection({ connectionKey: 'team-plus', displayName: 'Team Plus' }),])confirmMock.mockResolvedValue(true)- const { onConnectionRefChange, onAssignmentPersisted } = renderAssignment('team-plus')+ const { onConnectionRefChange } = renderAssignment('team-plus')await waitFor(() => {expect(screen.getByRole('button', { name: 'Remove from this agent' })).toBeEnabled()})@@ -205,6 +199,21 @@ describe('CodexAgentAssignment', () => {await waitFor(() => {expect(onConnectionRefChange).toHaveBeenCalledWith('unassigned')})- expect(onAssignmentPersisted).not.toHaveBeenCalled()+ })++ it('drafts a selected grant and does not persist until Save', async () => {+ vi.mocked(listCodexSubscriptionConnections).mockResolvedValue([+ connection({ connectionKey: 'team-plus', displayName: 'Team Plus' }),+ connection({ connectionKey: 'personal-pro', displayName: 'Personal Pro' }),+ ])+ const { onConnectionRefChange } = renderAssignment('team-plus')+ await waitFor(() => {+ expect(screen.getByRole('option', { name: 'Personal Pro' })).toBeInTheDocument()+ })+ fireEvent.change(screen.getByLabelText('ChatGPT subscription'), {+ target: { value: 'personal-pro' },+ })+ expect(onConnectionRefChange).toHaveBeenCalledWith('personal-pro')+ expect(onConnectionRefChange).toHaveBeenCalledTimes(1)})})diff --git a/control-ui/components/__tests__/HostWizard.test.tsx b/control-ui/components/__tests__/HostWizard.test.tsxindex 7a514fc09..7f08f0a5c 100644--- a/control-ui/components/__tests__/HostWizard.test.tsx+++ b/control-ui/components/__tests__/HostWizard.test.tsx@@ -855,6 +855,21 @@ describe('HostWizard — broker-backed Codex authoring', () => {).toBe(false)}, 15_000)+ it('blocks Next until a ChatGPT subscription is chosen', async () => {+ await renderWizard()+ await walkToModelStep({ agentName: 'codex-needs-grant' })+ await selectCodexSubscription()+ expect(screen.getByRole('button', { name: 'Next' })).toBeDisabled()+ expect(screen.getByText('Choose a ChatGPT subscription before continuing.')).toBeInTheDocument()+ fireEvent.click(screen.getByRole('button', { name: 'Assign test grant' }))+ await waitFor(() => {+ expect(screen.getByRole('button', { name: 'Next' })).toBeEnabled()+ })+ expect(+ screen.queryByText('Choose a ChatGPT subscription before continuing.')+ ).not.toBeInTheDocument()+ }, 15_000)+it('seeds the first offered grant model when switching to a ChatGPT subscription', async () => {await renderWizard()await walkToModelStep({ agentName: 'codex-keep-model' })diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 9371562e4..c7cda9813 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.458",+ "version": "0.1.459","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.458",+ "version": "0.1.459","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 6feb28a82..29e399255 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.458",+ "version": "0.1.459","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",