Repository navigation
fix(core): restore ChatGPT model discovery for token sharing - #64528
Open
rekram1-node wants to merge 1 commit into
Open
rekram1-node wants to merge 1 commit into
rekram1-node wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
The change looks sound. I couldn't test discovery live (no ChatGPT credentials). The plugin tests pass (29/29, and 145/145 over 5 repeat runs) and tsc -b for packages/core passes.
I read the restored refresh path closely:
- Late answers are dropped when the credential or cache key changed while the request was pending.
- Failures, timeouts, bad bodies and empty or filtered-to-empty lists keep the current list and save nothing. A failure only logs a warning.
- The new
models:<credential>:<client>key prevents one account's list from showing under another account that reuses the same client ID. - Not seeding the old
models:<clientID>snapshot during migration matches the stated intent.
The trade-off you call out is the main risk: for accounts whose /v1/models list leaves out a model they can still use (the #52878 case), that model disappears again until OpenAI lists it. Config-defined models stay visible, so users have a workaround.
A small side effect: entries under the old models:<clientID> key are no longer read but stay in plugin storage.
Public API: unchanged. The plugin storage keys are internal.
Related: #52878
This branch has not been deployed
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.
Issue for this PR
Related: #52878 (sync turned off in #53466 while OpenAI's
/v1/modelsleft out models some accounts could use)Type of change
What does this PR do?
Sign in with ChatGPT shows only a fixed model list right now, so a new model like
gpt-6.2-solneeds a release (#64508). This turns the account model sync back on, using the code that was commented out.A token-sharing token sent to
GET https://api.openai.com/v1/modelsreturned 200 twice today: 13 models, 10 withvisibility: "list"andsupported_in_api, includinggpt-6.2-solandgpt-6.2-astra. The response matched the existing schema.Beyond the old commented code:
models:<credential>:<client>). Today "add account" can reuse the same client ID (fix(core): isolate ChatGPT account registrations #56302), so a client-only key could show one account's list under another. Lists under the oldmodels:<clientID>key come from the period when the endpoint was leaving models out, so they're not read.chatgpt-browserno longer seeds that old saved snapshot. It still moves the method ID and stripsmodelsfrom metadata.Trade-off: when discovery succeeds, the account list decides what shows up again. If OpenAI leaves out a model the account can still use, which is the bug from #52878, it disappears until the list includes it. For example, the probed account's list no longer has
gpt-5.5, so that model would stop showing for this account. A fallback is used only when there is no usable list. I didn't merge the account list with the fixed list because that would show models the account may not be able to use.How did you verify your code works?
packages/core/test/plugin/provider-chatgpt.test.ts, with controlled HTTP responses and the test clock:gpt-6.2-soland an unknowngpt-6.3-nova. Hidden and non-API models are filtered out, and only the filtered list is saved.Mutation checks: a client-only key, no stale-answer guard, no empty-list rejection, and no timeout each make a test fail. The file passes with
--rerun-each 10(290/290).bun typecheckinpackages/corepasses.bun run checkstops at an@opencode/apptype error (PluginListOutput.readyinpackages/app/src/settings/providers/extensions.tsx), which this PR doesn't touch. Prettier and oxlint pass on the changed files. Prettier also reformatted a few existing lines in the test file.Not tested: a live run of this build against a ChatGPT account.
Checklist
Added by the opencode bot (AI-generated).
Related: #52878