Skip to content

fix(auth): fix opencode auth provider metadata URL (#50593) - #52673

Closed
JerryLiu369 wants to merge 1 commit into
anomalyco:devfrom
JerryLiu369:fix/50593-autofix
Closed

JerryLiu369 wants to merge 1 commit into
anomalyco:devfrom
JerryLiu369:fix/50593-autofix

Conversation

@JerryLiu369

@JerryLiu369 JerryLiu369 commented Oct 2, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #50593

Type of change

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

What does this PR do?

  • Prevents bare provider identifiers (e.g. opencode auth login opencode) from being treated as enterprise well-known URLs.
  • Restricts well-known enterprise auth metadata fetches to valid http:/https: URLs via isWellKnownLoginUrl. When a non-URL provider name is passed positionally, it falls through to the standard provider authentication flow rather than attempting fetch("opencode/.well-known/opencode") which throws fetch() URL is invalid.
  • Validates enterprise metadata structure (auth.command and auth.env) to ensure missing configuration fails gracefully.
  • Adds comprehensive regression unit tests in @opencode-ai/opencode verifying login URL validation and provider fall-through.

How did you verify your code works?

  • Tested with bun test test/cli/help/help-snapshots.test.ts test/cli/providers-login-url.test.ts. All 8 tests pass cleanly.

Screenshots / recordings

N/A

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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.

1.18 CLI: fresh 'opencode run' fails 'Invalid credential'; 'auth login opencode' fails 'fetch() URL is invalid'

2 participants