Skip to content

fix(cli): stop bare reasonix from re-running the setup wizard#2858

Closed
esengine wants to merge 1 commit into
main-v2from
fix/2856-no-rewizard
Closed

fix(cli): stop bare reasonix from re-running the setup wizard#2858
esengine wants to merge 1 commit into
main-v2from
fix/2856-no-rewizard

Conversation

@esengine
Copy link
Copy Markdown
Owner

@esengine esengine commented Jun 3, 2026

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:

  1. welcome() auto-launched interactiveSetup whenever config.SourcePath() == "". But SourcePath() only checks the cwd reasonix.toml and the global ~/.config/reasonix/config.toml. reasonix setup writes a project-local reasonix.toml, so running reasonix from any other directory makes SourcePath() return "" → the wizard fires again.
  2. chatREPL ErrUnknownModel recovery 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). Explicit reasonix setup is unchanged.
  • The ErrUnknownModel recovery 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 run reasonix 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

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
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 3, 2026
@esengine
Copy link
Copy Markdown
Owner Author

esengine commented Jun 3, 2026

Closing in favour of the first-run rework that already landed on main-v2.

#2856's root cause was that reasonix setup wrote a project-local reasonix.toml, so running reasonix from another directory couldn't see it and re-triggered the wizard. main-v2 now fixes that at the source: setup writes to the user-global config by default, and welcome() only auto-launches the wizard when no config resolves from any source (src == "" && cfgErr != nil). A configured user always loads config and drops straight into chat — no more surprise wizard, no overwrite.

This PR's welcome() change instead removes the first-run auto-guide entirely, which conflicts with (and would regress) that onboarding flow.

The one piece still worth keeping — the config.SourcePath() == "" guard on the ErrUnknownModel recovery in chatREPL — is carried forward in #2908.

Thanks for chasing this down. 🙏

@esengine esengine closed this Jun 3, 2026
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.

[Bug]:reasonix 无参数运行会在某些情况下重新触发设置向导

1 participant