Skip to content

fix(opencode): support auth provider aliases for copilot subscriptions - #17664

Closed
raf1hh wants to merge 5 commits into
anomalyco:devfrom
raf1hh:feat/auth-provider-alias
Closed

raf1hh wants to merge 5 commits into
anomalyco:devfrom
raf1hh:feat/auth-provider-alias

Conversation

@raf1hh

@raf1hh raf1hh commented Mar 15, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #6217

Related: #5391, #16866

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Problem: custom Copilot provider ids could not reuse Copilot auth behavior without losing provider identity, so multi-subscription setups were blocked.

Change: add provider.<id>.auth_provider aliasing. Aliased providers now reuse auth/login flow from the source provider, but keep their own provider id and stored auth entry. I updated provider loading, plugin auth resolution, and opencode auth login path so alias ids resolve correctly end-to-end.

Why it works: auth behavior resolves through alias mapping, while persisted auth still keys by the aliased provider id.

How did you verify your code works?

  • bun test test/cli/plugin-auth-picker.test.ts test/config/config.test.ts test/provider/auth.test.ts test/provider/provider.test.ts
  • bun typecheck

Both passed locally.

Screenshots / recordings

N/A (non-UI change)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@raf1hh

raf1hh commented Mar 16, 2026

Copy link
Copy Markdown
Author

Here is how a sample config the new props:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "my-custom-github-copilot": {
      "name": "My Custom GitHub Copilot",
      "auth_provider": "github-copilot",
      "npm": "@ai-sdk/github-copilot",
      "models": {
        "gpt-5": {},
        "claude-sonnet-4.5": {},
        "gemini-2.5-pro": {}
      }
    }
  }
}

@raf1hh
raf1hh force-pushed the feat/auth-provider-alias branch 3 times, most recently from a16ce02 to 8231d84 Compare March 18, 2026 00:12
@dotCipher

Copy link
Copy Markdown

+1 to this, would help my use case too

@raf1hh
raf1hh requested a review from adamdotdevin as a code owner March 20, 2026 03:19
@raf1hh
raf1hh force-pushed the feat/auth-provider-alias branch from 5be0e10 to 3514cf7 Compare March 20, 2026 04:30
@raf1hh raf1hh closed this Mar 20, 2026
@raf1hh

raf1hh commented Mar 20, 2026

Copy link
Copy Markdown
Author

Decided to move the functionality into a plugin

@onionhammer

Copy link
Copy Markdown

@raf1hh which plugin?

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.

Have multiple instances of the same provider

3 participants