Skip to content

fix(web): default provider selection for users without Codex#4117

Open
mfazekas wants to merge 2 commits into
pingdotgg:mainfrom
mfazekas:fix/default-provider-instance
Open

fix(web): default provider selection for users without Codex#4117
mfazekas wants to merge 2 commits into
pingdotgg:mainfrom
mfazekas:fix/default-provider-instance

Conversation

@mfazekas

@mfazekas mfazekas commented Jul 18, 2026

Copy link
Copy Markdown

What Changed

  • Command palette project creation no longer hard-codes codex as the new project's defaultModelSelection. It resolves the first usable provider instance (ready → non-error → enabled, then the codex literal), stamps that instance's own default model, and adds the missing providers entry to the callback dependencies so the handler does not act on the at-mount provider snapshot.
  • The composer's instance resolution falls through to an enabled instance when the persisted instance id is known-but-disabled — but only when an enabled instance satisfies the thread's driver/continuation lock; otherwise the id is kept so the accurate "provider disabled" server error surfaces. Unknown ids (e.g. a custom instance not yet hydrated) are still returned as before. The composer's driver kind now follows the resolved instance, so options and send context stay consistent with the instance that actually runs.
  • resolveSelectableProviderInstance tiers its fallback by probe status and getDefaultProviderInstanceModel provides an instance-scoped default model. Unit tests cover the tiering, requested-instance retention, and the model helper.

Why

Fixes #4116. New users without Codex get their first palette-created project defaulted to codex, so the first thread fails (Failed to spawn Codex App Server process on fresh settings, or Provider instance 'codex' is disabled in T3 Code settings. when codex is disabled) and the thread stays permanently pinned to codex. The composer change also lets existing broken threads recover: on the next send they fall through to a working provider.

UI Changes

Before (thread pinned to codex, turn fails, composer shows the OpenAI icon with a claude model):

before

After (same flow defaults to the ready Claude instance and the send succeeds):

after

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Fix default provider selection in command palette and composer for users without Codex

  • Replaces the hardcoded codex/DEFAULT_MODEL fallback in CommandPalette.tsx with logic that picks the best available provider instance and its default model using resolveSelectableProviderInstance and getDefaultProviderInstanceModel.
  • Adds getDefaultProviderInstanceModel to providerInstances.ts, which prefers the first non-custom model for an instance, then the first listed model, then the driver-level default.
  • Improves resolveSelectableProviderInstance to rank instances by status: ready first, then non-error (e.g. warning), then any enabled instance — instead of picking arbitrarily.
  • In ChatComposer.tsx, retains an explicitly selected but disabled instance unless a compatible enabled replacement exists, so sends fail explicitly rather than silently switching drivers.
  • Behavioral Change: projects created from the command palette and composer turns now use the best available provider rather than always defaulting to codex.

Macroscope summarized caf8c05.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ee4fde05-67f2-4cd9-b525-fdd9d24d7e4b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 18, 2026
@mfazekas mfazekas changed the title Fix default provider selection for users without Codex fix(web): default provider selection for users without Codex Jul 18, 2026
New projects created via the command palette hard-coded codex as their
defaultModelSelection, and the composer dispatched a persisted instance id
even when that instance was known-disabled. Users without Codex got threads
permanently pinned to a provider that can never start (issue pingdotgg#4116).

- CommandPalette: resolve the project default to the first ready provider
  instance (falling back to enabled, then the codex literal) and stamp that
  instance's default model instead of the codex one; add missing providers
  dependency so the callback doesn't capture the at-mount provider list.
- ChatComposer: when the persisted instance is known-but-disabled, fall
  through to an enabled instance instead of returning the raw id.
- resolveSelectableProviderInstance: prefer ready instances so an enabled
  codex without the CLI installed no longer wins by list order.
@mfazekas
mfazekas force-pushed the fix/default-provider-instance branch from f720ae6 to d6da114 Compare July 18, 2026 09:41
@macroscopeapp

macroscopeapp Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Bug fix with limited scope to provider selection fallback logic. Changes ensure working providers are preferred over errored ones when user doesn't have Codex. Well-tested with clear intent and self-contained to provider selection utilities.

You can customize Macroscope's approvability policy. Learn more.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d6da114. Configure here.

Comment thread apps/web/src/components/CommandPalette.tsx Outdated
Comment thread apps/web/src/components/chat/ChatComposer.tsx
… recovery

Review follow-ups on the pingdotgg#4116 fix:

- resolveSelectableProviderInstance: fall back ready -> non-error -> enabled
  so unprobed (warning) instances beat errored ones; previously an enabled
  codex with a failed probe could still win by list order during startup.
- ChatComposer: abandon a known-disabled persisted instance only when an
  enabled instance satisfies the thread's driver/continuation lock, keeping
  the accurate server error otherwise; derive the composer's driver kind
  from the resolved instance so options and send context follow the
  instance that actually runs.
- CommandPalette: stamp the resolved instance's own default model via
  instance-scoped lookup instead of the driver default, which could pair a
  custom instance with another instance's model slug.
- Tests for the fallback tiering, requested-instance retention, and the
  instance-scoped model helper.
@mfazekas

Copy link
Copy Markdown
Author

Pushed a follow-up commit addressing the review findings:

  • Bugbot high (composer driver lags instance fallthrough): the composer now derives its driver kind from the resolved instance entry, so options and send context follow the instance that actually runs.
  • Bugbot medium (default model ignores resolved instance): project creation now uses an instance-scoped model lookup (getDefaultProviderInstanceModel) instead of the driver default.
  • Additionally, resolveSelectableProviderInstance falls back ready → non-error → enabled (an errored codex probe could previously still win by list order during the startup window), and the composer only abandons a known-disabled persisted instance when an enabled instance satisfies the thread's driver/continuation lock — otherwise it keeps the id so the accurate "provider disabled" error surfaces instead of a confusing driver-switch rejection.

Added unit tests for the fallback tiering, requested-instance retention, and the model helper.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). 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]: New user without Codex: first project defaults to codex and the first thread fails (and stays broken)

1 participant