cli: OpenCode Go uses Console credential instead of selected OpenCode Go credential

オープン
#66,855 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cli, typescript
領域
cli

調査の方向性

The bug is in how the opencode-go provider picks its credential, so start with the provider and auth code that reads the active credential from opencode.db and the /api/provider integration lookup. Reproduce by storing two Go credentials, switching with opencode auth switch opencode-go, then running a Go model and checking which x-opencode-org-id is sent. Done means the provider uses the active "OpenCode Go" credential rather than the Console one, and the switch takes effect without a restart.

索引モデルが issue の本文から書いたものです。

説明

area/auth inference/go platform/linux type/bug version/v2

Summary

The opencode-go provider ignores the active credential selected under "OpenCode Go" (opencode auth switch opencode-go <label>). It keeps billing requests to the workspace of the active "OpenCode Console" credential, so switching Go accounts has no effect and the user hits the other account's weekly Go limit.

Environment

  • opencode version: 2.1.3
  • OS: Linux 7.3.6-arch1-1 (x86_64)
  • Terminal: alacritty (TERM=xterm-256color, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: latest
  • Active plugins: opencode-screenshot-vision

Reproduction

  1. Have two OpenCode Go credentials stored (opencode auth list): "A" and "B", belonging to different workspaces.
  2. Have an active "OpenCode Console" credential that belongs to workspace B.
  3. Run opencode auth switch opencode-go A. The active flag in the DB for "OpenCode Go" becomes A.
  4. Run a Go model, e.g. opencode run -m opencode-go/glm-5.3-flash "hi".
  5. Observed: OpenCode Go usage limit reached (weekly...) with the workspace URL of B. GET /api/provider shows opencode-go with integrationID: "opencode" and x-opencode-org-id = workspace B.
  6. Calling the Go endpoint directly with A's key and workspace A's org header returns 200. With B's key it returns 429.
  7. Adding A's key under "OpenCode Console" and making it active fixes it without restarting the service.

Expected Behavior

The Go provider should use the active credential of the "OpenCode Go" integration.

Actual Behavior

The provider uses the active "OpenCode Console" credential. Switching the Go credential has no effect. --standalone and OPENCODE_API_KEY do not override it either.

Additional Context

  • Workspace IDs and key values are redacted.
  • In opencode.db, credential.active = 1 for "OpenCode Go / A", but the Go provider was billing workspace B.
  • Workaround: add the key under "OpenCode Console" and make it active.
主要言語
TypeScript
スター
230k
フォーク
31.3k
平均マージ
5時間 32分
マージ済み PR(30日)
453

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。