fix(cli): stop bare reasonix from re-running the setup wizard#2858
fix(cli): stop bare reasonix from re-running the setup wizard#2858esengine wants to merge 1 commit into
reasonix from re-running the setup wizard#2858Conversation
welcome() auto-launched interactiveSetup whenever config.SourcePath() returned "" — but that is also true for a user who configured a project reasonix.toml and then ran `reasonix` from another directory, so the wizard re-fired and could overwrite their config. Drop the auto-wizard: a bare `reasonix` now falls through to the status banner, which points the user at `reasonix setup`. Also guard the ErrUnknownModel recovery in chatREPL — only re-run setup on a true first run (no config anywhere). A model that no longer resolves against an existing config now surfaces the already-descriptive error instead of silently re-running the wizard over the user's config. Closes #2856
|
Closing in favour of the first-run rework that already landed on #2856's root cause was that This PR's The one piece still worth keeping — the Thanks for chasing this down. 🙏 |
Problem
Running a bare
reasonix(no subcommand) could re-trigger the full setup wizard even after the user had already configured — re-asking language / provider / API key, and potentially overwriting their config (#2856).Two paths caused it:
welcome()auto-launchedinteractiveSetupwheneverconfig.SourcePath() == "". ButSourcePath()only checks the cwdreasonix.tomland the global~/.config/reasonix/config.toml.reasonix setupwrites a project-localreasonix.toml, so runningreasonixfrom any other directory makesSourcePath()return""→ the wizard fires again.chatREPLErrUnknownModelrecovery re-ran the wizard whenever the configured default model failed to resolve — even when a config file clearly existed — silently overwriting it.Fix
welcome()no longer auto-launches the wizard. With no resolvable config it falls through to the existing status banner, which already lists the next step (reasonix setup). Explicitreasonix setupis unchanged.ErrUnknownModelrecovery now only re-runs setup on a true first run (config.SourcePath() == ""). When a config exists but its model can't resolve, it surfaces the existing descriptive error (which already says to runreasonix setup) instead of overwriting the config.No behaviour change to
reasonix setup,reasonix chat, or any non-interactive path.Verification
go build ./...,go vet ./internal/cli/...,go test ./internal/cli/...— pass.Closes #2856