Repository navigation
fix: opencode reads the opencode 2 credential database (0.0.92) - #124
Merged
Merged
Conversation
opencode 2.3 keeps logins in the credential table of opencode.db, not auth.json, so the companion read a stale key and got HTTP 401. it now takes the active opencode-go key row read only in a child process, then falls back to auth.json.
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 auth logincredentials in thecredentialtable of~/.local/share/opencode/opencode.db, not inauth.json, so 0.0.91 read a stale June key from the old file and every Go request returned HTTP 401 on a freshly logged in machineopencode-gorow whose value is{ "type": "key", "key": ... }, then falls back to the opencode 1auth.json;OPENCODE_GO_API_KEYstill wins over bothnode:sqlitein a child Node process started with--disable-warning=ExperimentalWarning(Node 22 prints an experimental warning otherwise); the key returns over stdout, never args, and neither store is ever writtentest plan
already verified
node --test tests/opencode-*.test.mjs: 37/37 on Node 26, and the provider and companion suites pass on Node 22.23.2; new cases cover active row over inactive and over the legacy file, non key and other integration rows ignored, a malformed database, and an end to end task whose database key reaches the codex child and the Go API stub but no arg or job recordnpm test: 3183 tests, 3180 pass, 3 skipped, 0 fail; sync check and plugin validation pass/opencode:setupreports ready, where 0.0.91 returned HTTP 401reviewer should verify
OPENCODE_GO_API_KEYunset,/opencode:setupreports ready