Skip to content

Fix model picker breaking when Cursor CLI is unavailable#117

Merged
Emanuele-web04 merged 1 commit into
Emanuele-web04:codex/fixesssfrom
Zeus-Deus:feature/103-bug-retry-models-when-cursor-cli-is-not-available
May 14, 2026
Merged

Fix model picker breaking when Cursor CLI is unavailable#117
Emanuele-web04 merged 1 commit into
Emanuele-web04:codex/fixesssfrom
Zeus-Deus:feature/103-bug-retry-models-when-cursor-cli-is-not-available

Conversation

@Zeus-Deus
Copy link
Copy Markdown

Fixes #103

When the Cursor CLI isn't installed or authenticated, Cursor's model discovery fails — and that failure was rejecting the whole models query, leaving the model picker stuck in a loading/error state for every provider.

Changes

  • providerModelsQueryOptions now catches discovery failures and resolves to an empty result instead of rejecting. A failing CLI degrades only that provider; every other provider keeps its models.
  • The Cursor/Kilo discovery skeleton is gated on isLoading instead of isFetching, so background refetches don't re-blank the picker once discovery has settled.
  • Added tests covering a single provider failing without affecting the others, plus a missing kilo key in an existing test fixture.

Testing

  • bun lint and bun run test pass.
  • Verified in the app: with Cursor's binary path pointed at a missing binary, the picker opens normally, Cursor falls back to its static model list, and every other provider works as usual.

Note: bun typecheck still reports one pre-existing, unrelated error in composerDraftStore.ts (Pi provider), and two server tests fail for environment reasons — both already present on main and untouched here.

Model discovery runs per provider, but a failing CLI rejected the
whole query and left the shared model picker stuck in a loading/error
state instead of degrading only that provider.

- Catch discovery failures in providerModelsQueryOptions and resolve
  to an empty result, so one provider's failure no longer blanks the
  picker. Every other provider keeps its own models.
- Gate the Cursor/Kilo discovery skeleton on isLoading so background
  refetches don't re-blank the picker once discovery has settled.
- Add coverage proving a single provider failure doesn't affect the
  others, and fix a missing kilo key in an existing test fixture.

Fixes Emanuele-web04#103
@github-actions github-actions Bot added size:M vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels May 14, 2026
@Emanuele-web04 Emanuele-web04 changed the base branch from main to codex/fixesss May 14, 2026 21:43
@Emanuele-web04 Emanuele-web04 merged commit 13c6162 into Emanuele-web04:codex/fixesss May 14, 2026
6 of 7 checks passed
@Marve10s
Copy link
Copy Markdown
Contributor

Thanks for working on this. I reviewed the bug path and the issue is real: when Cursor model discovery rejects because the CLI is missing/unauthenticated/unavailable, the shared model picker can end up in the discovery error path instead of degrading Cursor only.

Please tighten this PR before merge:

  1. Clean up the added explanatory comments. Keep only comments that are necessary for non-obvious behavior.
  2. Keep the PR scoped to the model-discovery failure bug. Do not add unrelated edits, formatting churn, or extra test expansion beyond what is needed for this bug.
  3. Apply the proper fix for the loading-state issue in the current patch. providerModelsQueryOptions uses placeholderData, and with TanStack Query the first unresolved fetch can report isLoading: false, isFetching: true, and isPlaceholderData: true. Changing Cursor/Kilo discovery pending from isLoading || isFetching to only isLoading means initial discovery may no longer show the loading state and can expose fallback static models while discovery is still running. Please distinguish the initial placeholder fetch from later background refetches, and add/adjust focused coverage for that behavior.

@Zeus-Deus
Copy link
Copy Markdown
Author

Addressed all 3 points in #121. Loading state now uses isFetching && isPlaceholderData so the initial fetch is caught but background refetches aren't, plus a test for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Retry models, When cursor CLI is not available.

3 participants