fix(providers): don’t pick a provider just because its key is in the env - #3487
Open
meowgorithm wants to merge 3 commits into
Open
fix(providers): don’t pick a provider just because its key is in the env#3487meowgorithm wants to merge 3 commits into
meowgorithm wants to merge 3 commits into
Conversation
meowgorithm
force-pushed
the
undefault
branch
3 times, most recently
from
August 2, 2026 20:20
331bbad to
26f062e
Compare
Crush used to auto-select the first provider whose credentials happened to be present in the environment (alphabetical-ish order, so usually Anthropic) and persist that choice, making it look like the user had picked it. Now an unset or stale model selection is left empty and the model picker opens on the top of the list instead. Non-interactive runs, which cannot prompt, fall back to the first available model without saving it. 💘 Generated with Crush
With no model chosen yet, the model list opened with the highlight on a provider heading rather than on a model, so the first Enter did nothing. Now the first selectable model is highlighted. 💘 Generated with Crush
The model picker pruned the stored list of recently used models down to whatever providers were resolvable at that moment, and saved the result. Since a provider configured through an environment variable is only visible when Crush is launched from a shell that exported it, opening the picker could permanently drop history for providers that were merely temporarily absent. Unresolvable entries are now skipped when drawing the list and left in the config. 💘 Generated with Crush
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.
This fix keeps the model picker from defaulting to the first known provider it can find an find an env var for, which was usually Anthropic. This meant a couple things:
Generated notes below.
Crush would auto-select a provider based on whichever credentials happened to be sitting in your environment, walking the provider list in a fixed order — so in practice a lot of people silently ended up on Anthropic. Worse, that guess was written to your global config, so it looked like a choice you had made and it stuck.
The same code path also fired whenever a saved selection stopped resolving (provider temporarily missing an API key, a model retired from the catalog, an expired token, a bad network moment). A transient failure would therefore permanently rewrite your saved model.
What changed
crush runand other non-interactive entry points can't prompt, so they fall back to the first available model. That fallback lives in memory only and is never saved.Credential discovery from the environment is unchanged — that's still how providers become available. The only thing that goes away is treating "has credentials" as "user picked this".
Configs that name a model without naming a provider (
models.large.modelwith noprovider) still work: the model is matched against the providers that offer it, in a stable order.Note
A related bug is fixed separately in #3486: a failed provider-cache write could remove Hyper from the catalog, which is the most common way a saved selection became unresolvable in the first place. These two are independent and can land in either order, but this PR is the one that makes the damage non-permanent.
💘 Generated with Crush