fix(desktop): save model selection as a local draft #6162
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 443 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.365
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6162"
general
weight: 0.35
liugddx
Summary
This PR makes two connected changes to provider model selection:
1. Edit a local draft and save the final selection explicitly. Rapid model toggles currently save immediately and hold the editor lock through a catalog refresh, so later inputs are ignored. Switches now update a local draft; Save submits the final selection once. A bottom save bar remains visible while scrolling large catalogs, using the existing settings-pane scroll area. Failed writes retain edits. Background refreshes update the persisted baseline while preserving the draft, and a successful write remains acknowledged if its subsequent refresh fails. Connection tests use the saved selection.
2. Protect unsaved model selections when leaving the editor. Explicit saving introduces a period with unsaved changes. The provider editor registers its leave check with shared settings navigation, so Back, settings-page changes, Host selection and Escape ask before discarding those edits. Escape dismissal stays available while the settings chunk is loading.
These changes belong together: users can make several edits without Host round trips, then save them or explicitly discard them when leaving. Adding a custom model still saves that model immediately without persisting an unrelated selection draft.
Refs #5549
Verification
git diff --checkpass. Desktop files are excluded from the repository formatter.Screenshots show the production ProvidersPanel and settings frame in Desktop Storybook with a 444-model OpenRouter fixture and sample data.
Chinese, 1280 × 900:
!Unsaved selection with a visible save bar in a 444-model catalog
English, 480 × 800:
!Narrow provider editor keeps Save visible without horizontal overflow
Windows 11 native validation has not been run. This PR removes per-toggle writes; catalog-revision deduplication and the cause of the reported Windows process crash remain outside this change. Keep #5549 open for its remaining native validation and profiling criteria.
AI use
Tool(s) and scope: Codex implemented the draft/save interaction, navigation protection and regression tests, performed local review and validation, and prepared this description.
Checklist
Does this PR entail a change in behavior?