Skip to content

Connect your AI: inside OpenBot Desktop, Claude and ChatGPT finish their sign-in with no paste - #2039

Merged
davidmckayv merged 2 commits into
mainfrom
app/sign-in-redirect-in-desktop
Nov 22, 2026
Merged

davidmckayv merged 2 commits into
mainfrom
app/sign-in-redirect-in-desktop

Conversation

@davidmckayv

@davidmckayv davidmckayv commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Signing in to a Claude or ChatGPT plan from Connect your AI made the person copy and paste: Claude's code, or the address of ChatGPT's page that won't load. Inside OpenBot Desktop it no longer does. Desktop listens on the person's own computer for the provider's redirect, as other apps do, and the app sends what arrives on to the server, which keeps the sign-in exactly as before.

What changes

  • Claude: Desktop picks a port (begin_sign_in_redirect), the server is told it (loopbackPort, from API: a Claude sign-in can redirect to OpenBot Desktop's loopback port #2035) and sends Claude's redirect there, and the code and state that arrive go on with finishPersonalAiSignIn as code#state.
  • ChatGPT: inside Desktop the browser sign-in comes first. Its redirect is always localhost:1455/auth/callback, where Desktop listens, and the address built from what arrived goes on as a person would have pasted it. The code sign-in stays as the other way.
  • While it waits: no paste box and no "This site can't be reached" warning. Approve in the browser and OpenBot finishes on its own; the link to open the page again stays. Cancel sign-in, Back, another provider or way, and leaving the screen each stop Desktop listening (cancel_sign_in_redirect).
  • Fallbacks, always to what the person gets today: for Claude, its code paste, when Desktop lacks the commands or a free port, the server refuses loopbackPort (400, retried without it), or the sign-in page doesn't send the browser to Desktop. For ChatGPT, when Desktop lacks the commands or port 1455 is busy, its code sign-in starts at once as the first way, with the address paste still the other way; never the address paste first.
  • Plain browser: unchanged. Claude's paste, and ChatGPT's code first.
  • OpenBot (Self-Contained): Desktop's own plan sign-in is untouched.

It does not depend on the Desktop commands being released: an older Desktop rejects them and the chooser falls back to today's sign-in.

Where

  • app/src/lib/ai-connection/sign-in-redirect.ts: typed wrappers for the three Desktop commands, and the rules (when the redirect is taken, what is sent, each fallback).
  • app/src/lib/ai-connection/mutations.ts: startPersonalSignIn takes loopbackPort.
  • app/src/components/settings/ai-connection-chooser.tsx: the flow and the screens.

Tests

  • app/tests/sign-in-redirect.test.ts: the rules, against the provider pages the server builds: Desktop vs browser, code#state vs the whole address, a decline, a timeout, and each fallback (Desktop refuses, 400 on the port, a page not sent to Desktop).
  • app/tests/connect-your-ai.test.tsx: in a real browser, with a Desktop stub answering the three commands and the server's sign-in endpoints answered as the server answers them. Claude and ChatGPT reach signed in with no paste box ever shown, the server receives code#state and the whole address, cancel and leaving stop Desktop listening, and each fallback lands on today's paste. The plain-browser tests are unchanged and pass. Run in Chromium and WebKit; red on the base branch (10 of 10 Desktop tests fail), green here.

…eir sign-in with no paste

Signing in to a Claude or ChatGPT plan from Connect your AI made the person copy and paste: Claude's
code, or the address of ChatGPT's page that won't load. Inside OpenBot Desktop it no longer does.
Desktop listens on the person's own computer for the provider's redirect, as other apps do, and the
app sends what arrives on to the server, which keeps the sign-in exactly as before.

- Claude: Desktop picks a port (begin_sign_in_redirect), the server is told it (loopbackPort) and
  sends Claude's redirect there, and the code and state that arrive go on as code#state.
- ChatGPT: the browser sign-in comes first inside Desktop. Its redirect is always
  localhost:1455/auth/callback, where Desktop listens, and the address built from what arrived goes
  on as a person would have pasted it. The code sign-in stays as the other way.
- While it waits there is no paste box and no "This site can't be reached" warning: approve in the
  browser and OpenBot finishes on its own. Cancel, Back, another provider or way, and leaving the
  screen each stop Desktop listening (cancel_sign_in_redirect).
- Anything that stops it falls back to today's paste: an OpenBot Desktop without the commands or
  with no free port, a server that refuses loopbackPort (400, retried without it), or a sign-in
  page that doesn't send the browser to Desktop.
- In a plain browser nothing changes: Claude's paste, and ChatGPT's code first.

The Desktop commands' wrappers and the rules (when the redirect is taken, what is sent, each
fallback) are in app/src/lib/ai-connection/sign-in-redirect.ts, with unit tests. The browser test of
Connect your AI drives each flow against a Desktop stub that answers the three commands and the
server's sign-in endpoints as the server answers them, in Chromium and WebKit.
…rst, as it does today

Where Desktop can't take ChatGPT's redirect (a Desktop without the commands, or port 1455 busy),
the chooser fell back to the browser sign-in's address paste. That changed the first way for
someone on an older Desktop, who today signs in with a code. It now falls back to exactly that:
the code sign-in starts at once with today's screens, and the address paste stays the other way.
Claude's fallback is unchanged, since its code paste is what it does today.
@davidmckayv
davidmckayv force-pushed the app/sign-in-redirect-in-desktop branch from 7aaaec2 to 764d54d Compare November 22, 2026 19:57
@davidmckayv
davidmckayv merged commit b463291 into main Nov 22, 2026
22 checks passed
@davidmckayv
davidmckayv deleted the app/sign-in-redirect-in-desktop branch November 22, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant