Skip to content

prototype: one OpenCode row in /connect - #57918

Draft
kitlangton wants to merge 4 commits into
devfrom
prototype-one-opencode-row
Draft

kitlangton wants to merge 4 commits into
devfrom
prototype-one-opencode-row

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Prototype for Dax's decision (D-1 "One OpenCode Row"). Draft only; not for merge as-is. Related: #57155 (offers OpenCode account sign-in on the Go row and reorders the rows). This is built on dev, not on #57155.

What it shows

/connect lists one OpenCode row instead of separate OpenCode Go and OpenCode Console rows. Go is an OpenCode account with a subscription, so picking OpenCode offers:

  • TUI: Sign in with your OpenCode account · Use a Zen API key · Use a Go API key
  • Desktop: Continue in the browser (sign in) · Have an API key? Zen API key · Go API key
Before (dev) After (this branch)
TUI https://problems.kitlangton.com/media/T0cRe4fXnsquvAB2eebAPQ.mp4 https://problems.kitlangton.com/media/2KV59NSJUue3mWdVZ9twyg.mp4
Desktop https://problems.kitlangton.com/media/6RTHlPfpxhDsngr8qIxMog.mp4 https://problems.kitlangton.com/media/PRX7zQfLWFKwD1v6dE2fXA.mp4

Recordings are the real app: the TUI from a hermetic dev build (fresh data dir, private server), Desktop from a production build of packages/app against the e2e fixture server. No real accounts.

How

  • TUI (dialog-integration.tsx, dialog-select.tsx, +54/−10): foldOpenCode merges opencode-go into the opencode row ("OpenCode"), relabels its methods, appends Go's key method, and folds in Go's saved credentials so they stay manageable from the one row. A WeakMap routes the Go key method to the opencode-go integration, so a Go key is still stored under opencode-go exactly as today. Each integration in the row keeps its own active-account marker (a new optional per-option current on DialogSelect).
  • Desktop (connect/dialog.tsx, accounts.ts, en.ts, +69/−31): the picker hides opencode-go unless a Go API key is already saved (that row is where the key is managed today), names the row "OpenCode", and the Console intro offers Zen and Go API keys. The Go key goes to opencode-go through the existing keyProvider hook, and only while a key attempt is in progress.
  • No server, schema or protocol change.

Size

Real code +123/−41 (TUI +54/−10, Desktop +69/−31). Tests +374/−8.

Tests

  • packages/tui: integration-options.test.ts, dialog-integration.test.tsx, dialog-select.test.tsx (55 pass): one OpenCode row, method order, Go key posts to /api/integration/opencode-go/connect/key, hovering the Go key method picks Go, and the Console and Go active markers stay independent. The two new regression tests fail on the previous commit.
  • packages/app: settings/providers/accounts.test.ts (2 pass): picker folds Go unless a Go key is saved.
  • e2e/regression/settings.spec.ts: the 5 changed/new tests pass in one hermetic run (static build + fixture server): new copy, Zen key → opencode and Go key → opencode-go, a provider with no integration never joins the connection, and Go key → Back → sign in posts OAuth to opencode and lists only the Console workspace's models.
  • tsc -b clean in packages/tui and packages/app; settings.spec.ts typechecks (other e2e files already fail typecheck:e2e on dev).

Not done / open

  • Follow-up: Desktop users with a saved Go API key still see a separate Go row in the picker (the TUI folds it in). Folding it means the Desktop accounts view has to list and route both integrations' accounts, which is more than a small change for a prototype. Settings → Providers is unchanged.
  • Other locales keep their existing strings; only en changed.
  • Self-review fixed one real bug (an unset Go key provider matched every provider without an integration).

Review (Astra, openai/gpt-6-astra#high): changes needed → addressed

  1. Bug (TUI): the Zen and Go key methods shared the option value "key", so both highlighted and hovering Go then Enter picked Zen. Fixed: method options use their position as the value. Test: hover the Go method, Enter, the key posts to opencode-go.
  2. Bug (TUI): the merged row kept one active marker, so activating a Go key never showed as active next to a Console account. Fixed: activeCredentialIDs keeps the first (active) credential per integration, shown through a per-option current. Tests: unit test, plus a dialog test that switches Go keys and keeps the Console marker.
  3. Bug (Desktop): Go key → Back → sign in kept the Go key provider, so an existing Go provider satisfied the Console catalog check early. Fixed: the key provider only applies while the current method is the key method, which covers Back, reset and every OAuth path. The dialog has no unit harness, so this is covered by the e2e below.
  4. Risk (e2e): the e2e only checked links were visible. Added the Zen/Go key endpoint, Go → Back → OAuth, and no-integration-provider assertions (CI).
  5. Nit (Desktop): a saved Go key brings back a second row. Left as a follow-up (above); it needs more than ~30 lines.

Re-review of 06d43f4: production fixes correct; DialogSelect change safe for other callers. One bug in the new e2e fixture: the Go and integration-less providers existed before connecting, and any listed provider with models counts as an existing connection, so the "Connected to" step never showed. Fixed: before connecting only the keyless opencode catalog exists; the key submission or OAuth completion adds the Go, integration-less and workspace providers in the refresh that follows. The three new tests and the two edited Console-intro tests now pass (5/5).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant