Skip to content

fix: show OpenCode Go accounts signed in with OpenCode Console OAuth - #62

Merged
MaxAnderson95 merged 1 commit into
mainfrom
fix/opencode-go-console-oauth
Oct 19, 2026
Merged

MaxAnderson95 merged 1 commit into
mainfrom
fix/opencode-go-console-oauth

Conversation

@MaxAnderson95

Copy link
Copy Markdown
Owner

After removing OpenCode Go and reconnecting it through OpenCode's OAuth sign-in instead of an API key, the Account disappeared from Tally.

OpenCode stores that sign-in as an "OpenCode Console account": integration_id = 'opencode', an OAuth value with methodID: "device", and Console metadata (server, accountID, orgID, orgName). Tally only read opencode-go API-key rows, so it skipped the credential. Go's usage endpoint (https://opencode.ai/zen/go/v1/usage) accepts the Console access token as a Bearer credential: it returned the rolling, weekly, and monthly meters with the real token and HTTP 401 with no token or a bogus one.

Changes

  • OpenCodeInventory reads opencode OAuth rows with the device method as opencode-go Accounts. Console API keys under opencode stay excluded because they alias Zen keys. OAuth expiry is carried through, so an expired token waits for OpenCode to refresh it like the other OAuth providers.
  • StoredCredential records the OpenCode integration that owns the row. OpenCodeSelection uses it for api/integration/<id>, so switching to a Console Account queries opencode rather than opencode-go. The local OpenCode service lists the row under /api/integration/opencode.
  • The Go 401 message says "credential" instead of "key".
  • docs/SPEC.md names Console OAuth sign-ins as a Go usage source.

Verification

  • SDKROOT=.../MacOSX26.sdk bash scripts/test-swift.sh --build-system native: 103 tests passed locally (Command Line Tools toolchain, not CI-equivalent).
  • discoversReadOnlyGoInventory covers an included Console device row and an excluded Console row with another method. accountSelectionUsesAuthenticatedOpenCodeAPIAndChecksDatabase covers switching to a Console Account.
  • A throwaway test against the real OpenCode database listed the sign-in as an active opencode-go Account and collected its Go usage windows. The test file was deleted.

Not verified: warm-up message sends with a Console token. Model listing on zen/go/v1/models works with it, but OpenCode routes Console inference through https://opencode.ai/inference/go/openai/v1, so warm-up may need that endpoint. A Console sign-in without a Go subscription will appear as a Go Account and is expected to report an entitlement error.

Originally created in OpenCode session ID: ses_eaa9b13a4ffe3y8cnB5oTsHncf using model: anthropic/claude-opus-5-5

OpenCode stores a Console OAuth sign-in under the `opencode` integration with the `device` method instead of as an `opencode-go` API key, so Tally dropped the Account. Inventory now reads those rows as OpenCode Go Accounts and keeps excluding Console API keys, which alias Zen keys. The Go usage endpoint accepts the Console access token as a Bearer credential. Each stored credential records its OpenCode integration so Account switching queries the integration that owns the row.

OpenCode session ID: ses_eaa9b13a4ffe3y8cnB5oTsHncf using model: anthropic/claude-opus-5-5

@MaxAnderson95 MaxAnderson95 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review by OpenCode using GPT-6 Astra

Pull Request Review

No actionable defects found in the reviewed SHA. Reviewed all five changed files, inventory filtering and identity reconciliation, credential expiry handling, Account activation, downstream Go collection and warm-up routing, and the added synthetic test coverage against the repository instructions, glossary, specification, and ADRs. No earlier review findings were present.

The Console integration/method and OAuth expiry representation match OpenCode v2.0.32. Its packages/console/app/src/lib/inference-proxy.ts also forwards the legacy Go usage and Responses routes to /go/v1/usage and /go/openai/v1/responses, preserving bearer authentication. The legacy warm-up URL alone therefore does not establish an endpoint defect.

Verification: git diff --check origin/main...6f4f2aad passed. I did not rerun Swift tests or make live credential, provider-message, or reset requests. Console warm-up behavior remains unverified at runtime; the author's reported test and live usage results are not independent verification by this review.

Confidence Score: 4/5

Originally created in OpenCode session ID: ses_eaa94669bffei7hctcbDYbTX3l using model: openai/gpt-6-astra

@MaxAnderson95
MaxAnderson95 merged commit 91855ae into main Oct 19, 2026
5 checks passed
@MaxAnderson95
MaxAnderson95 deleted the fix/opencode-go-console-oauth branch October 19, 2026 18:40
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