Uh oh!
There was an error while loading. Please reload this page.
fix(core): resolve device verification URL - #44021
Merged
Merged
Conversation
kitlangton
enabled auto-merge (squash)
August 21, 2026 23:21
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
What
Fix OpenCode Console device authorization links when the Console API returns an origin-rooted verification path.
Before / After
Before: The Console API returns
/console/device?.... Since the default server ishttps://opencode.ai/console, the client stripped the leading slash and appended the response to that full base, producinghttps://opencode.ai/console/console/device?.... The Console did not recognize that route and redirected a signed-in user to their organization page instead of device approval.After: Verification URLs use standard URL resolution. Origin-rooted paths resolve against the server origin, relative paths resolve beneath the configured server base, and absolute HTTP(S) URLs remain unchanged. Malformed or non-HTTP(S) verification URLs fail as typed authorization errors instead of defects.
How
packages/core/src/plugin/provider/opencode.tsresolvesverification_uri_completewithnew URL(value, base)insideEffect.tryand retains the HTTP(S) protocol check.packages/core/test/plugin/provider-opencode.test.tsreproduces the production response shape, asserts that/consoleappears exactly once, and covers malformed verification responses.@opencode-ai/core.Scope
This does not change the Console API response or router. It only corrects client-side handling of the existing response contract.
Testing
bun run test test/plugin/provider-opencode.test.tsfrompackages/core: 13 passedbun typecheckfrompackages/corePOST https://opencode.ai/console/auth/device/code, which returned an origin-rooted/console/device?...verification URLFlow
Root Cause
Commit
40cd6989d2changed the default server fromhttps://console.opencode.aitohttps://opencode.ai/consolewithout updating the fallback path join or covering the production response shape in a test.