Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix: keep sign-in actionable before the subscription exists

Miguelon Peluchonbf1f5b35690b
diff --git a/control-ui/components/CodexSubscriptionHub/index.tsx b/control-ui/components/CodexSubscriptionHub/index.tsx
index 3ea20b5ee..47a5699f5 100644
--- a/control-ui/components/CodexSubscriptionHub/index.tsx
+++ b/control-ui/components/CodexSubscriptionHub/index.tsx
@@ -570,16 +570,20 @@ export function CodexSubscriptionHub() {
</p>
<div className="cu-form-inline">
<span
- title={editing ? undefined : 'Create the subscription first'}
+ title={editing || editName.trim() ? undefined : 'Type a name to get started'}
className="cu-hover-hint"
>
<button
type="button"
className="cu-btn cu-btn--ghost cu-btn--sm"
onClick={() => {
+ // Before the grant exists this creates it (with the
+ // typed name) and chains straight into sign-in, so
+ // the button never sits there dead.
if (editing) void handleConnect(editing)
+ else void handleCreate()
}}
- disabled={Boolean(busyKey) || !editing}
+ disabled={Boolean(busyKey)}
>
Sign in with ChatGPT
</button>
diff --git a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx
index dd8e1461b..0708c632b 100644
--- a/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx
+++ b/control-ui/components/__tests__/CodexSubscriptionHub.test.tsx
@@ -114,20 +114,15 @@ describe('CodexSubscriptionHub', () => {
expect(await screen.findByText('Team A')).toBeInTheDocument()
fireEvent.click(screen.getByRole('button', { name: 'Add subscription' }))
- // Before creating, the full form is shown but sign-in is gated and
- // nothing has been created yet.
+ // Before creating, the full form is shown and sign-in is live: clicking it
+ // creates the grant with the typed name and chains into sign-in.
expect(createCodexSubscriptionConnection).not.toHaveBeenCalled()
const nameInput = screen.getByRole('textbox', { name: 'Name' })
const signIn = screen.getByRole('button', { name: 'Sign in with ChatGPT' })
- expect(signIn).toBeDisabled()
- expect(signIn.closest('.cu-hover-hint')).toHaveAttribute(
- 'title',
- 'Create the subscription first'
- )
+ expect(signIn).toBeEnabled()
- // Creating the grant starts the device sign-in right away.
fireEvent.change(nameInput, { target: { value: 'New team' } })
- fireEvent.click(screen.getByRole('button', { name: 'Create and set up' }))
+ fireEvent.click(signIn)
await waitFor(() => {
expect(createCodexSubscriptionConnection).toHaveBeenCalledWith({ displayName: 'New team' })
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 41ee6ede4..4fd4e58c3 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.481",
+ "version": "0.1.482",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.481",
+ "version": "0.1.482",
"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.json
index c01e8feb6..08689fd75 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.481",
+ "version": "0.1.482",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",