Skip to content

Relay plugin OAuth callbacks through Codevisor Cloud to the machine that started sign-in (851-4452) - #1462

Merged
dylanplayer merged 2 commits into
mainfrom
codevisor/crab
Nov 23, 2026
Merged

dylanplayer merged 2 commits into
mainfrom
codevisor/crab

Conversation

@dylanplayer

Copy link
Copy Markdown
Member

Relay plugin OAuth callbacks through Codevisor Cloud to the machine that started sign-in, so plugin sign-in finishes no matter which device the browser is on (851-4452).

  • Signed-in machines register each MCP or plugin-account sign-in with Cloud (POST /api/machine/oauth-flows; flow id = SHA-256 of the OAuth state, single use, 15 minutes, one device). The browser lands on /oauth/callback; Cloud seals code, state and issuer to that device through UserHub (queued 5 minutes when offline). The device checks state and redeems the code itself, then reports the outcome, so the page says "Signed in" only after the code is redeemed, and otherwise "Sign-in didn't finish", "Still finishing", or that the machine is offline.
  • Without Cloud, sign-in is unchanged (127.0.0.1 callback). MCP servers that reject the Cloud redirect at client registration, and user-configured clients, stay on loopback. Fixed-client providers switch only when their config lists the Cloud callback (installed.redirect_uris, or MANAGED_OAUTH_CLOUD_CALLBACK for Cloud-held clients). Linear's existing /oauth/plugins/callback relays too; unregistered states there still bounce to the app scheme for older clients.
  • A plugin that is already signed in gets Cloud's /oauth/signed-in page instead of a loopback link.
  • Pending plugin-account sign-ins are sealed and persisted across restarts, and agents can start plugin-account sign-in (plugins.account_oauth_start).

Tophatted with two dev machines on dev Cloud, a fake OAuth MCP and a fake account provider: sign-in started on the Linux machine and finished from a browser on the Mac, a browser with no Codevisor, the starting machine briefly offline, a rejected code, and the not-signed-in-to-Cloud loopback path.

🤖 Generated with Claude Code

dylanplayer and others added 2 commits November 23, 2026 12:57
…hat started sign-in (851-4452)

Plugin sign-in now finishes no matter which device the browser is on.
When a machine is signed in to Codevisor Cloud, MCP OAuth and
plugin-account OAuth use Cloud's callback:

- The machine registers the flow (POST /api/machine/oauth-flows, flow id
  = SHA-256 of the OAuth state) over its machine credential. Cloud keeps
  it for 15 minutes, for that device only.
- The browser lands on GET /oauth/callback. Cloud consumes the flow once
  and seals code, state and issuer to the device through UserHub,
  queued for 5 minutes when it is offline. The page says "Signed in",
  or honestly that the machine is offline, and links back to (or, when
  the app started it, opens) Codevisor.
- The device checks state against its own pending record and redeems the
  code as before; the PKCE verifier and client stay on it.

Without Cloud, sign-in is unchanged: the 127.0.0.1 callback on the same
machine. MCP servers that refuse the Cloud redirect at dynamic client
registration fall back to loopback, and user-configured clients keep
loopback. Fixed-client providers move only when their config says the
Cloud callback is registered: an installed client's redirect_uris, or
MANAGED_OAUTH_CLOUD_CALLBACK for Cloud-held clients. A client's fixed
redirect is relayed only if Cloud serves it, so Linear's existing
/oauth/plugins/callback relays too, while unregistered states still
bounce to the app scheme for older clients.

Pending plugin-account sign-ins are sealed with the machine's secret key
and kept in local machine settings, so a restart doesn't lose them, and
agents can start plugin-account sign-in (plugins.account_oauth_start).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eady signed-in plugins to Cloud (851-4452)

- The machine now reports each relayed sign-in's outcome in its inbox-ack.
  Cloud's callback page waits up to 10 seconds for it: "Signed in" (and
  opening the app) only once the code is redeemed, "Sign-in didn't
  finish" with the machine's reason when it fails, and "Still finishing"
  when an online machine doesn't answer in time. The offline page is
  unchanged.
- A plugin that already has a working credential no longer gets a
  loopback /v1/mcps/oauth/complete link when its machine is signed in to
  Cloud. It gets Cloud's /oauth/signed-in page, which any device can
  open. Without Cloud it keeps the local page, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dylanplayer
dylanplayer merged commit 4ecdba8 into main Nov 23, 2026
@dylanplayer
dylanplayer deleted the codevisor/crab branch November 23, 2026 21:00
dylanplayer added a commit that referenced this pull request Nov 23, 2026
…he chat's own machine (851-4462)

A bot's plugin setup card for a chat on another machine used the old flow:
the old Install sheet, which skipped the consent step and closed after
installing, so you had to press Connect again to start sign-in. That route
existed because sign-in callbacks only worked on the machine that started
them. Since #1462 relays every plugin sign-in callback through Codevisor
Cloud to that machine, the card now:

- Always opens the connect sheet. One button installs (recording consent)
  and starts sign-in. The old Install sheet is gone.
- Starts sign-in on the chat's own machine when it is this Mac or is
  signed in to Codevisor Cloud.
- Otherwise falls back: on macOS it signs in through this Mac's copy of
  the plugin, as before; on iOS it says to sign in from the Mac.
- Decides the route when you press the button, so a machine whose status
  loads late isn't stuck on the fallback.
- Opens the sign-in browser against the machine that starts the sign-in,
  so the fallback's handoff page no longer waits on the wrong machine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dylanplayer added a commit that referenced this pull request Nov 23, 2026
…e chat's own machine (851-4462) (#1466)

* Open the connect sheet from every plugin setup card, and sign in on the chat's own machine (851-4462)

A bot's plugin setup card for a chat on another machine used the old flow:
the old Install sheet, which skipped the consent step and closed after
installing, so you had to press Connect again to start sign-in. That route
existed because sign-in callbacks only worked on the machine that started
them. Since #1462 relays every plugin sign-in callback through Codevisor
Cloud to that machine, the card now:

- Always opens the connect sheet. One button installs (recording consent)
  and starts sign-in. The old Install sheet is gone.
- Starts sign-in on the chat's own machine when it is this Mac or is
  signed in to Codevisor Cloud.
- Otherwise falls back: on macOS it signs in through this Mac's copy of
  the plugin, as before; on iOS it says to sign in from the Mac.
- Decides the route when you press the button, so a machine whose status
  loads late isn't stuck on the fallback.
- Opens the sign-in browser against the machine that starts the sign-in,
  so the fallback's handoff page no longer waits on the wrong machine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Flip a remote chat's plugin setup card to Connected after a reconnect, and retry sign-in starts cut off by a dropped relay (851-4462)

A setup card shown outside a running turn lands in a new chat item on the
machine, while the app puts it in its own latest assistant item. When the
chat reloads after a reconnect (right after a machine restarts), the
reload brought the card in its server item and also carried the app's copy
back into the older item. The "connected" update then reached only the
newer copy, so the card on screen stayed on a disabled Connect until the
chat was reopened. A reload now leaves a live card where the server puts
it. This is in the shared session model, so main does the same.

Starting sign-in from the card now retries when the relay connection drops
(as it does right after a machine restarts), instead of showing "The
Codevisor Relay connection was interrupted."

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Close the macOS plugin connect sheet with an x at the top right instead of a Cancel link (851-4462)

The connect sheet on macOS drops the Cancel text button under its actions
and gets a small round close button in its top-right corner. Escape still
closes it. iOS keeps its toolbar Cancel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
dylanplayer added a commit that referenced this pull request Nov 24, 2026
…efuse loopback-only sign-ins started from another device (851-4463, 851-4464)

Since #1462 relays plugin sign-in callbacks through Codevisor Cloud, the
phone can start sign-in on any machine signed in to Cloud. Every place that
signs in to a plugin now decides where through one route
(PluginSignInRoute.resolve): Settings › Plugins, Browse, the plugin's page,
plugin links, and the chat card, on iPhone and Mac.

- Sign-in runs on the chosen machine when it is this Mac or signed in to
  Cloud. Otherwise a Mac signs in through its own copy of the plugin, and
  where there is no Mac the app says the machine isn't signed in to Cloud
  and what to do. "Sign in from your Mac" is gone.
- Browse and plugin links on iPhone no longer turn sign-in off; they use the
  same connect host as the Mac.
- A sign-in started from another device tells the machine
  (crossDevice=1). When that sign-in could only finish on the machine's
  127.0.0.1 callback (no Cloud, the user's own OAuth client, or a server
  that refuses Cloud's callback), the machine answers 409 with the reason
  instead of a link the browser can't finish. This covers MCP OAuth and
  plugin-account OAuth (851-4464).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dylanplayer added a commit that referenced this pull request Nov 24, 2026
…efuse sign-ins that could only finish on 127.0.0.1 (851-4463, 851-4464) (#1469)

* Sign in to plugins from iPhone through one shared sign-in path, and refuse loopback-only sign-ins started from another device (851-4463, 851-4464)

Since #1462 relays plugin sign-in callbacks through Codevisor Cloud, the
phone can start sign-in on any machine signed in to Cloud. Every place that
signs in to a plugin now decides where through one route
(PluginSignInRoute.resolve): Settings › Plugins, Browse, the plugin's page,
plugin links, and the chat card, on iPhone and Mac.

- Sign-in runs on the chosen machine when it is this Mac or signed in to
  Cloud. Otherwise a Mac signs in through its own copy of the plugin, and
  where there is no Mac the app says the machine isn't signed in to Cloud
  and what to do. "Sign in from your Mac" is gone.
- Browse and plugin links on iPhone no longer turn sign-in off; they use the
  same connect host as the Mac.
- A sign-in started from another device tells the machine
  (crossDevice=1). When that sign-in could only finish on the machine's
  127.0.0.1 callback (no Cloud, the user's own OAuth client, or a server
  that refuses Cloud's callback), the machine answers 409 with the reason
  instead of a link the browser can't finish. This covers MCP OAuth and
  plugin-account OAuth (851-4464).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Open a plugin link from a debug deeplink, so links can be tested on the simulator (851-4463)

Plugin links are universal links for codevisor.dev, which a development
build's bundle id can't claim, so the simulator opens them in Safari. In
DEBUG builds, codevisor-dev-…://diagnostic-plugin-link?url=<link> hands the
link to the same handler a tapped universal link reaches.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Move Report and Block Publisher into a ••• More menu on the iPhone plugin sheet and plugin page

The iPhone plugin connect sheet and an installed plugin's page in
Settings › Plugins now put Report… and Block Publisher… in a More menu
(ellipsis.circle) at the top right, instead of a section in the body. The
connect sheet keeps Cancel at the top left; the plugin page keeps Remove
Plugin in its body. The menu shows under the same rules as before: not for
first-party plugins, and on the plugin page not for built-in tools. Report
still opens the report sheet with its "Report sent" confirmation, and Block
still asks first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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