When the user picks a provider+model in the inline prompt, remember
that choice across panel close/reopen AND across JupyterLab restarts,
keyed by notebookPath. If the stored provider (or the model under it)
is no longer present in the current providers payload, fall back to
the default (first provider / default[pid] model) - never silently
apply a stale value that would result in an empty or disabled select.
- New module src/components/model_selection.ts with
loadModelSelection / saveModelSelection / clearModelSelection.
Best-effort: localStorage may be disabled (private mode), quota
may be exhausted, value may be corrupt - all failure modes return
null / no-op rather than throw.
- IOpenCodeInlinePromptOptions gains notebookPath?: string.
- Constructor resolves the initial selection: prefer stored+valid,
else first provider / default[pid]. providerSelect.change and
modelSelect.change listeners call _persistSelection() to keep
storage in sync.
- _rebuildModelSelect now accepts a preferredModelId; if it exists
in the current provider's models it's used, else the default.
- OpenCodeCellActions._showPrompt passes notebookPath =
this._context?.notebookPath so the prompt can key the storage.
Tests
-----
- 10 unit tests in model_selection.spec.ts (load/save/clear +
malformed JSON + per-notebook independence).
- 4 prompt behavior tests in opencode_cell_actions.spec.ts
(valid stored applied, provider removed -> default, model removed
-> default, change -> saved).
- 72 frontend jest (was 58), 52 backend pytest (unchanged),
build green.
Co-Authored-By: Claude <noreply@anthropic.com>