Skip to content

fix(cli): stop config overwrite when the default model can't resolve#2908

Merged
esengine merged 1 commit into
main-v2from
fix/2856-chatrepl-guard
Jun 3, 2026
Merged

fix(cli): stop config overwrite when the default model can't resolve#2908
esengine merged 1 commit into
main-v2from
fix/2856-chatrepl-guard

Conversation

@esengine
Copy link
Copy Markdown
Owner

@esengine esengine commented Jun 3, 2026

Problem

chatREPL's ErrUnknownModel recovery 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. interactiveSetup then 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, and welcome() 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 run reasonix 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 on main-v2).

…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
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 3, 2026
@esengine esengine merged commit d78c412 into main-v2 Jun 3, 2026
6 checks passed
@esengine esengine deleted the fix/2856-chatrepl-guard branch June 3, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant