Skip to content

fix(migrate): import legacy default model and run migration before desktop config load#4224

Merged
esengine merged 3 commits into
esengine:main-v2from
heshuimu:fix/import-legacy-default-model
Jun 13, 2026
Merged

fix(migrate): import legacy default model and run migration before desktop config load#4224
esengine merged 3 commits into
esengine:main-v2from
heshuimu:fix/import-legacy-default-model

Conversation

@heshuimu

@heshuimu heshuimu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

The v0.x ~/.reasonix/config.json stored the user's model in a "model" key (e.g. "deepseek-v4-pro"), but legacyConfig had no field for it — every v0.x migration silently wrote "deepseek-flash" from Default().

Two fixes:

  • Missing field: Add Model to legacyConfig. Resolve the bare model name to a "provider/model" ref (e.g. "deepseek-pro/deepseek-v4-pro") so the frontend doesn't scan providers and land on the wrong one.

  • Desktop startup race: Move MigrateLegacyIfNeeded() before config.Load in restoreOrBuildTabs. It was running after tabs had already resolved their model against the missing-config defaults, so the corrected default_model never reached the chat window.

The v0.x config.json stored the user's model preference in a "model"
key, but the migration struct had no field for it — so every v0.x
migration silently reset the default to "deepseek-flash" regardless
of what the user had configured.
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development config Configuration & setup (internal/config) labels Jun 12, 2026
On first launch the desktop's restoreOrBuildTabs called config.Load
before MigrateLegacyIfNeeded had run — so when the config file didn't
exist yet, Load fell back to Default() (deepseek-flash). The tab's
model was resolved to Flash and saved to the tabs file before boot.Build
ran the migration and wrote the correct default_model.

Move MigrateLegacyIfNeeded to the top of restoreOrBuildTabs so it runs
once at startup, before any config loading. boot.Build's own migration
call becomes a harmless no-op (destination already exists).
@github-actions github-actions Bot added the desktop Wails desktop app (desktop/**) label Jun 12, 2026
…tion

Instead of writing the bare model name (e.g. "deepseek-v4-pro") to
default_model, resolve it through cfg.ResolveModel to produce a proper
"provider/model" ref (e.g. "deepseek-pro/deepseek-v4-pro"). This
makes the stored ref explicit and avoids the frontend's toRef having
to scan providers — which could pick the wrong provider if names
overlap.
@heshuimu heshuimu changed the title fix(migrate): import legacy default model from v0.x config.json fix: import legacy default model and run migration before desktop config load Jun 12, 2026
@heshuimu heshuimu changed the title fix: import legacy default model and run migration before desktop config load fix(migrate): import legacy default model and run migration before desktop config load Jun 12, 2026
@esengine esengine merged commit eb624ee into esengine:main-v2 Jun 13, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration & setup (internal/config) desktop Wails desktop app (desktop/**) 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