DeepSeek-Reasonix
DeepSeek-Reasonix copied to clipboard
Fix stale planner model startup / 修复陈旧规划模型导致启动失败
Problem
#4615 reports that after a forced shutdown, the desktop app can restart into a startup error like:
planner_model "OpenRouter/moonshotai/kimi-k2.6:free" is not a configured provider
That leaves the primary chat surface unusable even when the executor model is still configured.
Root Cause
Two startup paths were too strict for recovered desktop configuration state:
- Model references matched the provider segment with exact casing only, so a recovered
OpenRouter/...ref could miss a configuredopenrouterprovider even though the model id itself was valid. agent.planner_modelis optional, but boot treated a stale planner reference as fatal after the executor model had already resolved successfully.
Fix
- Resolve the provider segment of
provider/modelrefs with exact-match priority and a unique case-insensitive fallback, while keeping model ids case-sensitive. - Treat an unresolved optional
planner_modelas a warning and continue with the executor model instead of blocking startup. - Add regression coverage for mixed-case OpenRouter refs and stale optional planner refs during boot.
Verification
go test ./internal/config -run TestResolveModelAcceptsProviderNameCaseInsensitiveRef -count=1go test ./internal/boot -run TestBuildContinuesWhenOptionalPlannerModelIsStale -count=1go test ./internal/config ./internal/bootgo test ./...(cd desktop && go test ./...)go vet ./...(cd desktop && go vet ./...)git diff --checkgofmt -l .
Fixes #4615