Skip to content

[Bug]: Escape closes ChatGPT setup while the account is being added #39582

Closed as not planned

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open Settings → Providers for a backend on a slow connection.
  2. Click Add provider.
  3. Select Codex.
  4. Click Continue with ChatGPT.
  5. Enter an account name.
  6. Click Continue.
  7. Press Escape while the button says Adding account…

Expected behavior

The setup stays open until the account is created so sign-in can continue.

Actual behavior

The setup closes immediately and a successful save leaves the new account unsigned in.

escape during account creation

failure

Impact

Minor bug or occasional failure. People who press Escape during a slow account creation have to return to the provider to start sign-in.

Version or commit

main at d6cdb4f161. The cause is at apps/web/src/components/settings/AddCodexAccountDialog.tsx:89.

Environment

Linux x64 boat.dev default machine, a fresh checkout.

Logs or stack traces

ChatGPT account setup stays open while adding the account
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/scripts/scenarios/adding-chatgpt-account-keeps-setup-open.e2e.ts b/scripts/scenarios/adding-chatgpt-account-keeps-setup-open.e2e.ts
new file mode 100644
index 0000000000..e530372c88
--- /dev/null
+++ b/scripts/scenarios/adding-chatgpt-account-keeps-setup-open.e2e.ts
@@ -0,0 +1,80 @@
+/// <reference lib="dom" />
+import { expect } from "e2e";
+
+import { test, WEB } from "./t3.ts";
+
+declare global {
+  interface Window {
+    chatGptAccountSave?: {
+      readonly started: Promise<void>;
+      readonly release: () => void;
+    };
+  }
+}
+
+test(
+  "Escape leaves ChatGPT account setup open while the account is being added",
+  WEB,
+  async ({ t3, app, browser, screen }) => {
+    await t3.project("demo");
+    await browser.addInitScript(() => {
+      const gate = Promise.withResolvers<void>();
+      const started = Promise.withResolvers<void>();
+      window.chatGptAccountSave = { started: started.promise, release: gate.resolve };
+      const send = WebSocket.prototype.send;
+      WebSocket.prototype.send = function (data) {
+        if (typeof data !== "string") return send.call(this, data);
+        const parsed = JSON.parse(data);
+        const messages = [parsed].flat();
+        const accountSave = (message: {
+          _tag?: string;
+          tag?: string;
+          payload?: { patch?: { providerInstances?: Record<string, { displayName?: string }> } };
+        }) =>
+          message?._tag === "Request" &&
+          message.tag === "server.updateSettings" &&
+          Object.values(message.payload?.patch?.providerInstances ?? {}).some(
+            (instance) => instance.displayName === "ChatGPT - Slow account",
+          );
+        const saves = messages.filter(accountSave);
+        if (saves.length === 0) return send.call(this, data);
+        const other = messages.filter((message) => !saves.includes(message));
+        if (other.length > 0) send.call(this, JSON.stringify(other));
+        started.resolve();
+        void gate.promise.then(() =>
+          send.call(this, Array.isArray(parsed) ? JSON.stringify(saves) : data),
+        );
+      };
+    });
+    await t3.open("/settings/providers?instanceId=codex");
+    await screen.getByRole("button", "Add provider", { exact: true }).first().tap();
+    const addProvider = screen.getByRole("dialog", "Add provider", { exact: true });
+    await addProvider.getByRole("radio", "Codex", { exact: true }).tap();
+    await addProvider.getByRole("button", "Continue with ChatGPT", { exact: true }).tap();
+
+    const setup = screen.getByRole("dialog", "Add ChatGPT account", { exact: true });
+    await setup.getByRole("textbox", "Account name", { exact: true }).fill("Slow account");
+    try {
+      await setup.getByRole("button", "Continue", { exact: true }).tap();
+      const adding = browser
+        .locator('[data-slot="dialog-popup"][data-open]')
+        .getByRole("button", "Adding account…", { exact: true });
+      await adding.waitFor();
+      await browser.evaluate(async () => {
+        await window.chatGptAccountSave!.started;
+        return null;
+      });
+      await browser.keyboard.press("Escape");
+      await app.screenshot("escape-during-account-creation");
+      expect(
+        await adding.isVisible(),
+        "ChatGPT account setup stays open while adding the account",
+      ).toBe(true);
+    } finally {
+      await browser.evaluate(() => {
+        window.chatGptAccountSave?.release();
+        return null;
+      });
+    }
+  },
+);
pnpm scenarios:prove scripts/scenarios/adding-chatgpt-account-keeps-setup-open.e2e.ts --base main

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions