Repository navigation
fix(models): use provider options apiKey for discovery and explain fallback (#152) - #161
Draft
justin-carper wants to merge 2 commits into
Draft
justin-carper wants to merge 2 commits into
justin-carper wants to merge 2 commits into
Conversation
…llback (#152) The config hook and provider.models route ignored provider.cursor.options.apiKey, so users with the key only there got the 4-model static fallback while chat worked. Discovery now reads it (and provider.key), and a one-time toast explains any fallback, waiting for the auth loader's keyed refresh before deciding.
…s; skip under CI Review follow-ups for #152: when options.apiKey/CURSOR_API_KEY fails but the stored login key works, warn about the config key instead of advising a restart that would not help. Notice timers are unref'd and skipped under CI. Tests cover loader-before-config and restore all touched env vars.
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.
Fixes #152.
Cause
A key set only in
provider.cursor.options.apiKey(README-documented) reached the provider for chat, but model discovery never saw it:confighook calleddiscoverModels({})(env var or cache only)provider.modelsroute used onlyctx.authSo the picker showed the 4-model static fallback (
src/fallback-models.ts), the exact list in the issue screenshot. Every discovery failure (no key, invalid key, network) also fell back silently: the warning was dropped.Fix
confighook passesoptions.apiKeyto discovery;provider.modelsroute also readsprovider.key/provider.options.apiKey.opencode auth loginkey that works yields "restart to see all models" instead of a false "no key". If the config key fails but the stored key works, it names the config key. Timers unref'd; skipped underCI.Not covered (tracked)
src/plugin/v2.ts:345) has the equivalent gap and no notice.Verification
test/issue-152-discovery-key.test.ts(12 cases) incl. loader-before-config and bad-config-key/good-stored-key.npm run prepublishOnly: 668 tests pass, typecheck + build clean.Cursor.models.list()behaves the same under Bun 1.4.1 and Node 26 (both reach Cursor's auth check).