← Back to Pull requests

fix(desktop): save model selection as a local draft #6162

Closed
unknown closed this pull request without merging on Oct 19, 2026 08:43 UTC
View on GitHub
unknown unknown commented on Oct 19, 2026 06:30 UTC
Author

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

  • Desktop typecheck, Biome lint and git diff --check pass. Desktop files are excluded from the repository formatter.

  • 37 connection-settings tests cover rapid edits, delayed save/refresh, failed writes, external-refresh baseline changes, connection testing, custom models and leave protection. The two external-refresh regressions fail before their fix.

  • 16 overlay tests and the renderer architecture check pass. The architecture policy suite also passes (168 tests).

  • Desktop Storybook builds successfully. All 30 Providers stories plus the parameter-save flow in Traditional Chinese and English pass (32 browser runs). Save/Cancel queries target the parameter dialog separately from the new save bar.

  • Browser checks cover the 444-model catalog in Chinese at 1280 × 900 and English at 480 × 800, save-bar visibility across scroll positions, ordinary provider detail, and Escape during suspended settings loading.
  • 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

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • 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

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • Diff: 443 lines (+332 / -111) across 5 files Reviewer: liugddx Review duration: 133m
    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
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.3% (MEDIUM) · Higher = larger blast radius
    45.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.9% · Safe to merge
    17.9%
    Repository