feat(web): onboarding offers Codex and xAI sign-in again (CL-8589) - #942
Merged
Merged
Conversation
Codex and xAI are subscription providers with no API key, so the provider step now offers "Continue with Codex" and "Continue with xAI" beside the key and local options. Clicking one starts a login on the hub, opens the authorize URL in a new tab, polls the login, and then mints the offering over the credential the hub stored -- the same catalog chain the API-key path walks, differing only in where the secret came from. The hub mounts @corbits/oauth-core's new hub subpath inside the Corbits block and registers the two providers out of the already-pinned provider packages, so the loopback PKCE flow, the callback listener and the token exchange all stay in the hub process and the browser never holds a token. The sidecar needs the matching Responses adapters to serve inference with those credentials: .env.example now carries the manifest, the process provisioner forwards it to every sidecar it spawns, and docs/local-dev.md says what the flow needs and that nothing refreshes an expired token yet.
TheGreatAxios
force-pushed
the
cl-8589-oauth-onboarding
branch
from
September 18, 2026 19:34
6934ca6 to
63332ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings back "Continue with Codex" and "Continue with xAI" in onboarding. Both are subscription providers with no API key, so they sign in instead of taking one. The hub runs the whole loopback PKCE flow in its own process; the browser only ever sees an authorize URL, a login id, and the id of the credential the hub stored.
Design
@corbits/oauth-core's new server-only./hubsubpath, mounted once inside the hub's Corbits block. It registers start/poll/cancel routes on the tenant router, behind the hub's own grant middleware. Providers are registered by the host as aname -> { oauthConfig, exchange, metadata? }map out of the already-pinned@corbits/codex-providerand@corbits/xai-provider, so the library depends on neither.oauth_tokencredential — the same row shape, AAD-boundsecret/refreshSecretencryption and creator grant the platform's ownPOST /credentialswrites. Codex's ChatGPT account id rides in metadata; no rawid_tokenis ever stored.useMutationstarts the login and opens the authorize URL, auseQuerypolls it and, on completion, mints the offering throughshadowOffering— the exact catalog chain the API-key path walks.ShadowOfferingInput's secret became a union of "here is a key" and "here is the credential the hub already stored", so there is one mint chain rather than two.SIDECAR_ADAPTER_MANIFESTbefore, and the process provisioner did not forward it, so both are added: the manifest lands in.env.exampleand the provisioner passes it to every sidecar it spawns.Onboarding's provider step is the only caller of this form; Settings has no separate inference connect form to share it with.
Follow-up: nobody refreshes an expired
oauth_tokenInterchange has the seam (
ServingRefreshinvendor/intx/db/src/model-source-resolution.ts, threaded throughrun-source-resolutionandhub-sessions' credential push), but nothing in Workbench supplies it — the code that did was deleted with@corbits/connections. Neither stock credential resolution nor the adapter refreshes, so an expired Codex or xAI credential fails at inference until the person signs in again. The provider packages already shiprefreshCodexTokens/refreshXaiTokens; wiring one of them into that seam is a separate change, not invented here.docs/local-dev.mdsays so plainly.Changes
apps/hub/src/server.ts— mountmountOAuthLoginin the Corbits block (that block only)apps/hub/package.json— pin@corbits/oauth-coreapps/hub/src/provisioners/process.ts— forwardSIDECAR_ADAPTER_MANIFESTto spawned sidecarsapps/web/src/onboarding/provider-connect-step.tsx— the two sign-in options and the login flowapps/web/src/settings/inference/{oauth-login.ts,api.ts,index.ts}— the login routes' client and the credential union.env.example,docs/local-dev.mdTesting
bun run checkgreen (typecheck, lint, format, 611 web tests). The library pin points atcorbitsdev/corbits-oauth-core'shub-login-mountbranch head (eb97fa7) until corbitsdev/corbits-oauth-core#6 merges; it should be re-pinned to the merge commit then.Not verified live: the running dev stack serves the main checkout, not this worktree, and restarting it was out of scope. A real sign-in cannot complete here regardless.