Repository navigation
feat: opencode reads its key from the opencode cli login (0.0.91) - #123
Merged
Merged
Conversation
… var is unset reads the opencode-go api key that opencode auth login writes to $XDG_DATA_HOME/opencode/auth.json (default ~/.local/share/opencode/auth.json) when OPENCODE_GO_API_KEY is unset or blank, passes it to the codex child, and never writes the store.
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
OPENCODE_GO_API_KEYor, when that is unset or blank, from theopencode-goentry thatopencode auth loginwrites to$XDG_DATA_HOME/opencode/auth.json(default~/.local/share/opencode/auth.json), so one login configures the lane and a rotation needs no env var editauthwith the login hint. the key reaches the codex child asOPENCODE_GO_API_KEYand still never lands in args, job records, or tool subprocessesplugins/opencode/scripts/lib/opencode-provider.mjs(resolveApiKey,opencodeAuthFile); the rest is the contract, troubleshooting, skill wording, and teststest plan
already verified
node --test tests/opencode-*.test.mjs: 36/36, including env over store precedence, theXDG_DATA_HOMEpath, rejected entry shapes, and an end to end task whose stored key reaches the codex child and the Go API stub but no arg or job recordnpm test: 3182 tests, 3179 pass, 3 skipped, 0 fail;node shared/sync.mjs --checkandclaude plugin validatefor opencode, fusion, and the root pass/opencode:setupwith a store holding a valid Go key reports ready andquota --jsonreads 4/1/0 percent; with this machine's stale stored key it reports HTTP 401; with no store it prints theopencode auth loginhintreviewer should verify
opencode auth loginfor OpenCode Go and withOPENCODE_GO_API_KEYunset,/opencode:setupreports ready