Skip to content

fix(vscode): keep custom provider picker open after partial add - #10195

Merged
chrarnoldus merged 2 commits into
Kilo-Org:mainfrom
truffle-dev:fix/custom-provider-picker-persists-after-add-10139
Jun 17, 2026
Merged

fix(vscode): keep custom provider picker open after partial add#10195
chrarnoldus merged 2 commits into
Kilo-Org:mainfrom
truffle-dev:fix/custom-provider-picker-persists-after-add-10139

Conversation

@truffle-dev

Copy link
Copy Markdown
Contributor

Context

Refs #10139 (first of two reports in that issue).

The "Fetched models" picker in the Custom Provider dialog wipes itself after the user clicks Add Selected, even when only a subset of the fetched models was added. The user has to re-enter the base URL/key to trigger another fetch in order to add the rest. The expected behavior is for the un-picked models to stay visible.

Implementation

addSelected() in CustomProviderDialog.tsx unconditionally called setFetchedModels(undefined) after merging the picked rows into form.models. That cleared the picker entirely.

The fix filters the picked IDs out of fetchedModels and clears the selection. Only when every fetched model has been added do we close the picker (the previous behavior). Search input is preserved across partial adds so the user can keep narrowing.

The auto-fetch effect at line 167 is unaffected: it watches fetchURL/fetchKey signals, not the picker state, so partial-add no longer races against a refetch.

The second report in #10139 (API key not persisting after Submit) is intentionally out of scope here; I left a comment on the issue with what I traced and what reproduction info would help nail it down.

Screenshots

N/A — picker visibility change; no visual layout shift.

How to Test

  1. Open the Custom Provider dialog and enter a base URL with several fetchable models (e.g. an OpenRouter-compatible endpoint).
  2. Wait for the picker to populate; deselect a couple of models.
  3. Click Add Selected.
  4. Before this fix: the picker disappears and you have to clear/re-enter the URL or key to fetch again.
  5. After this fix: the un-picked models stay visible, the selection clears, and you can pick more without re-fetching. Adding the last remaining model still closes the picker.

The picker called setFetchedModels(undefined) unconditionally after
"Add Selected", wiping the remaining un-picked models. Users had to
re-fetch to add a subset twice in a row.

Filter the picked IDs out of fetchedModels and clear the selection.
Only close the picker when every fetched model has been added.

Refs: Kilo-Org#10139
truffle-dev added a commit to truffle-dev/story that referenced this pull request May 13, 2026
Opened Kilo-Org/kilocode#10195 fixing the picker-disappears
half of #10139. Triage comment on #10139 with four narrowing
questions for the API-key persistence half.
@kilo-code-bot

kilo-code-bot Bot commented May 13, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

The change in addSelected() is correct and well-scoped. After a partial add:

  • pickedIds is built from picked (already filtered to selected IDs present in fetchedModels)
  • remaining correctly spans the full models snapshot, not just visible/filtered rows
  • When remaining models exist: picker updates to show only the un-added models, selection is cleared
  • When all models are added: original close behavior (clear picker + search) is preserved
  • Search is intentionally preserved across partial adds, matching the PR description
  • No memory leaks introduced — the intermediate Sets are short-lived locals
  • The auto-fetch createEffect at line 167 watches fetchURL/fetchKey signals only, so it is unaffected by the setFetchedModels call in this path

One minor observation (not worth blocking): pickedIds could be replaced by sel directly (const remaining = models.filter((m) => !sel.has(m.id))), since picked is already models.filter((m) => sel.has(m.id)). Using pickedIds adds a redundant Set construction but improves local readability — a style preference, not a bug.

Files Reviewed (1 file)
  • packages/kilo-vscode/webview-ui/src/components/settings/CustomProviderDialog.tsx

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-4.6 · 261,472 tokens

@truffle-dev

Copy link
Copy Markdown
Contributor Author

Polite nudge in case this slipped past triage, @marius-kilocode. The fix is one line in CustomProviderDialog.tsx (don't clear the picker after a partial add), and the kilo-code-bot review on day-of-open recommended merge with no issues found. Happy to rebase if main has drifted.

@truffle-dev

Copy link
Copy Markdown
Contributor Author

@chrarnoldus since you just merged #11121 (the fetch-auth half of #10139), flagging that this is its one-line companion from the same issue: the picker-disappearing half. addSelected() clears the picker after a partial add; the fix is to keep the un-added models visible. Diff is +12/-2, all checks green, and the kilo-code-bot review recommended merge with no issues on day-of-open. Happy to rebase if main has drifted — and equally happy to close it if the picker behavior is already being handled elsewhere.

@chrarnoldus chrarnoldus self-assigned this Jun 16, 2026
@chrarnoldus
chrarnoldus merged commit 474171a into Kilo-Org:main Jun 17, 2026
18 checks passed
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…r-picker-persists-after-add-10139

fix(vscode): keep custom provider picker open after partial add
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants