Skip to content

fix(model): persist /model selection to user config.toml#3671

Merged
esengine merged 2 commits into
esengine:main-v2from
CnsMaple:fix/model-persistence
Jun 9, 2026
Merged

fix(model): persist /model selection to user config.toml#3671
esengine merged 2 commits into
esengine:main-v2from
CnsMaple:fix/model-persistence

Conversation

@CnsMaple

@CnsMaple CnsMaple commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Generated by AI (CnsMaple + Reasonix)

Problem
/model picked a runtime model but the choice was lost on the next
reasonix chat — there was no plumbing from the slash command back to
~/.config/reasonix/config.toml, so users had to re-/model every
session.

Fix
The /model slash command now writes the chosen provider into the user
config via config.LoadForEdit(...).SaveTo(...) (the same edit primitive
used by the /theme PR, #3043). Persist failures stay on slog (operator
visibility) while user-visible status — including the "kept previous
model on save failure" path — goes through the TUI notice channel so the
chat line shows it, not the operator log.

Changes

  • internal/cli/model.go (+33/-2): /model subcommand persists to user
    config and routes feedback through the TUI notice.
  • internal/cli/model_test.go (+43): coverage for the persistence path.
  • internal/config/edit.go (+17/-5): edit helper now exposes the field
    needed by /model.
  • internal/config/edit_test.go (+15): edit-helper regression tests.

Tests

  • go test ./internal/cli/ -count=1 -run 'TestModel'
  • go test ./internal/config/ -count=1 -run 'TestPersistModel|TestLoadForEdit|TestEdit'
    → all pass.
  • Rebased onto esengine:main-v2 @ 90c24655.

Mirrors

@github-actions github-actions Bot added tui Terminal UI / CLI (internal/cli, internal/control) config Configuration & setup (internal/config) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 9, 2026
… paragraph in SetDefaultModel

gofmt on Linux/macOS CI legs reorders the doc comment when a list is
followed directly by another paragraph without a separating '//' line,
causing PR esengine#3671 to fail gofmt -l even though the original test suite
still passes. Add the canonical godoc separator so the file is
gofmt-clean on every runner.

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified end-to-end. On base the /model path writes nothing to config, so the choice was lost on the next launch. With the fix, persistModel writes default_model and a fresh config.Load() (next-launch simulation) resolves the default to the persisted provider/model ref. SetDefaultModel broadening to the provider/model form is covered by the config tests, including empty and unknown-model cases. Thanks.

@esengine esengine merged commit b7786ce into esengine:main-v2 Jun 9, 2026
9 checks passed
@CnsMaple CnsMaple deleted the fix/model-persistence branch June 10, 2026 02:10
SuMuxi66 pushed a commit to SuMuxi66/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
C:/Program Files/Git/model now writes the chosen provider/model to default_model in the user config so the next session starts on it instead of the global default. SetDefaultModel accepts the provider/model form (validated via ResolveModel).
dorokuma pushed a commit to dorokuma/DeepSeek-Reasonix that referenced this pull request Jun 10, 2026
C:/Program Files/Git/model now writes the chosen provider/model to default_model in the user config so the next session starts on it instead of the global default. SetDefaultModel accepts the provider/model form (validated via ResolveModel).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration & setup (internal/config) tui Terminal UI / CLI (internal/cli, internal/control) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants