fix(cli): stop config overwrite when the default model can't resolve#2908
Merged
Conversation
…l can't resolve chatREPL's ErrUnknownModel recovery re-ran the wizard whenever the configured default model failed to resolve, even with a config already present — silently overwriting it. Gate the recovery on config.SourcePath() == "" so an existing config falls through to the descriptive error (which already points at `reasonix setup`) instead. Refs #2856
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.
Problem
chatREPL'sErrUnknownModelrecovery re-ran the setup wizard whenever the configured default model failed to resolve (e.g. a renamed/removed provider) — even when a config file already existed.interactiveSetupthen wrote over the user's config, one of the overwrite paths flagged in #2856.The first-run onboarding rework already landed on
main-v2(setup writes to the user-global config, andwelcome()only auto-launches the wizard when no config resolves from any source), so #2856's main cause is fixed. This closes the one remaining overwrite path.Fix
Gate the recovery on
config.SourcePath() == ""(a true first run with no config anywhere). When a config exists but its model can't resolve, fall through to the existing descriptive error, which already tells the user to runreasonix setup.Verification
go build ./...,go vet ./internal/cli/...,go test ./internal/cli/...— pass.Refs #2856. Supersedes #2858 (whose
welcome()change conflicts with the first-run rework already onmain-v2).