fix(migrate): import legacy default model and run migration before desktop config load#4224
Merged
esengine merged 3 commits intoJun 13, 2026
Merged
Conversation
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.
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).
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The v0.x
~/.reasonix/config.jsonstored the user's model in a"model"key (e.g."deepseek-v4-pro"), butlegacyConfighad no field for it — every v0.x migration silently wrote"deepseek-flash"fromDefault().Two fixes:
Missing field: Add
ModeltolegacyConfig. 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()beforeconfig.LoadinrestoreOrBuildTabs. It was running after tabs had already resolved their model against the missing-config defaults, so the correcteddefault_modelnever reached the chat window.