GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): prevent the local plugin to break the built-in openai auth plugin by cynicalight · Pull Request #22026 · anomalyco/opencode

Conversation

@cynicalight

@cynicalight cynicalight commented Apr 11, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #18582

Type of change

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

What does this PR do?

This PR fixes a regression where the built-in OpenAI ChatGPT subscription auth flow could be silently replaced by another openai auth plugin(many people in that issue may have different plugins installed, in my case it seems that the non-auth plugin would also break down the built-in auth method, pretty weird). That caused providers login and the TUI connect flow to skip the ChatGPT Pro/Plus options and fall straight to manual API key entry. The change updates provider auth resolution to preserve the built-in openai auth hook instead of letting later plugins overwrite it, and adds a regression test proving that external OpenAI auth hooks no longer hide the built-in ChatGPT login methods.

How did you verify your code works?

I verified it in two ways:

  1. I added a regression test in packages/opencode/test/plugin/auth-override.test.ts that reproduces the bug by installing a local plugin with auth.provider = "openai". Before the fix, that test failed because the built-in ChatGPT Pro/Plus methods disappeared. After the fix, it passes and confirms the built-in OpenAI auth methods are preserved.
  2. I re-ran the nearby auth-related tests: bun test test/plugin/auth-override.test.ts, bun test test/cli/tui/sync-provider.test.tsx.
  3. final test: i test my own gpt subscription. It works with the same local config which broke the auth before.

Screenshots / recordings

NO UI CHANGE.

Checklist

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI review requested due to automatic review settings April 11, 2026 11:17
Copilot started reviewing on behalf of cynicalight April 11, 2026 11:18
View session
Copilot AI reviewed Apr 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression in provider auth resolution where an externally loaded (e.g., local) plugin declaring auth.provider = "openai" could override the built-in OpenAI (ChatGPT subscription) auth hook, causing the login flow to skip ChatGPT Pro/Plus options.

Changes:

  • Adjust provider auth hook resolution to preserve the first registered OpenAI auth hook instead of allowing later plugins to overwrite it.
  • Add a regression test ensuring a user plugin with provider: "openai" cannot hide the built-in ChatGPT Pro/Plus auth methods.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/opencode/src/provider/auth.ts Changes auth hook mapping to prevent external OpenAI auth hooks from overwriting the built-in one.
packages/opencode/test/plugin/auth-override.test.ts Adds regression coverage for OpenAI auth override behavior via a local plugin.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/opencode/src/provider/auth.ts
Comment on lines 120 to +131
const plugins = yield* plugin.list()

const hooks: Record<ProviderID, Hook> = {}

for (const item of plugins) {
const auth = item.auth
if (!auth?.provider) continue

const id = ProviderID.make(auth.provider)
if (id === "openai" && hooks[id]) continue
hooks[id] = auth
}

Copilot AI Apr 11, 2026

Copy link

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new hook-resolution loop no longer uses Arr or Result, but packages/opencode/src/provider/auth.ts still imports them from effect. Please remove the unused imports to avoid TS/lint failures and keep the module tidy.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot uses AI. Check for mistakes.

@cynicalight cynicalight Apr 11, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@YumaKakuya YumaKakuya mentioned this pull request Apr 11, 2026
e2e (linux) and e2e (windows) jobs flaky/broken on dev — ~98% fail today #22051
Closed
@cynicalight
cynicalight force-pushed the fix/openai-auth-missing branch from 936bf57 to 12ced58 Compare April 12, 2026 10:28
@cynicalight cynicalight changed the title fix: prevent the local plugin to break the built-in openai auth plugin fix(tui): prevent the local plugin to break the built-in openai auth plugin Apr 13, 2026
@cynicalight
fix: prevent the local plugin to break the built-in openai auth plugin
147857c
@cynicalight
cynicalight force-pushed the fix/openai-auth-missing branch from 12ced58 to 147857c Compare April 13, 2026 03:33
@cynicalight
Merge branch 'dev' into fix/openai-auth-missing
3d3eb21
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
cynicalight added 2 commits April 27, 2026 10:07
@cynicalight
Merge branch 'dev' into fix/openai-auth-missing
bb1f435
@cynicalight
Merge branch 'dev' into fix/openai-auth-missing
2a6ef58
@cynicalight cynicalight closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

OpenAI Auth - ChatGPT Subscription option not available to use

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cynicalight
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.