Skip to content

feat(app): sign in to OpenCode Go and Console through the browser - #50267

Draft
Hona wants to merge 1 commit into
anomalyco:v2from
Hona:console-onboarding
Draft

Hona wants to merge 1 commit into
anomalyco:v2from
Hona:console-onboarding

Conversation

@Hona

@Hona Hona commented Sep 21, 2026

Copy link
Copy Markdown
Member

Desktop onboarding for OpenCode Go / OpenCode Console. Picking either provider now goes straight to the Console sign-in in the browser; the API key path is tucked behind Advanced.

flowchart LR
  A[Pick OpenCode Go / OpenCode] --> B[Opening your browser…]
  B --> C[Browser: Console → pick workspace → Authorize]
  B --> D[Desktop: waiting + code to verify]
  C --> E[Connected]
  D --> E
  E --> F[Models of the connection shown in picker]
  D -. Advanced .-> H[API key / service account]
Loading

Before → after

Before After
OpenCode Go opencode-go integration only has a key method → API key form, no Console option Uses the opencode Console device sign-in (consoleIntegration("opencode-go") → "opencode")
OpenCode title flashes Connect opencode-go / Connect Anomaly / OpenCode → method list → empty text input + Continue (hidden server field rendered) → code view Connect OpenCodeOpening your browser… → waiting view. Two states, no method list, no empty field
Browser user clicks "this link" platform.openExternal(url) as soon as the attempt starts (same as opencode auth login), plus an Open browser button
Device code shown as the main instruction shown to verify against the Console page ("Confirm this code matches the code shown in your app")
API key equal option in the method list Advanced → "Connect with an API key or service account instead"
Leaving the dialog server attempt left open integration.oauth.cancel on cleanup / method switch
After connecting new models hidden unless newest-per-family every model of providers linked to the integration is set to show. Console sign-in returns Go models inside the opencode provider, so Go models are included
/connect TUI only (Console setup steps say "Run /connect") desktop composer command provider.connect, slash connect

Controller (packages/app/src/providers/connect/controller.ts)

// One "busy" state until something useful can be shown: loading, auto-select pending, or connect in flight
busy: () =>
  integration.loading ||
  (store.methodIndex === undefined && !store.auto && autoIndex() !== undefined) ||
  store.state === "pending"

// Hidden form fields answer themselves; only visible fields open the form
const visible = (selected.form ?? []).some((field) => field.type === "external" || !field.hidden)
const merged = { ...hiddenDefaults(selected), ...answer }

The dialog passes autoSelect for Console providers so the oauth method starts without a menu; other providers keep the method list. Client ID becomes opencode-desktop for the Console URL on desktop, so the Console page reads "Authorize OpenCode Desktop".

Screenshots: I could not capture the review-pane tab (not visible), so none attached yet. Flow verified against the live server in the web app: two dialog states, browser tab opened to console/login?next=/console/device?user_code=…, Advanced → key → back returns to sign-in.

OpenCode Go and OpenCode (Zen) now start the Console device sign-in as soon as
they are picked, open the browser automatically, and keep the API key path
behind an Advanced toggle. The dialog holds one stable state until the
authorization URL is ready, hidden form fields no longer render as empty
inputs, abandoned attempts are cancelled, and models unlocked by the new
connection are shown in the picker. Adds a /connect command matching the TUI
and the Console setup steps.
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