Skip to content

Fix custom models not showing in dropdown without force reload#1342

Merged
sfierro merged 1 commit intomainfrom
KIL-611/custom-model-reload
Apr 27, 2026
Merged

Fix custom models not showing in dropdown without force reload#1342
sfierro merged 1 commit intomainfrom
KIL-611/custom-model-reload

Conversation

@sfierro
Copy link
Copy Markdown
Contributor

@sfierro sfierro commented Apr 24, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where dropdown options weren't refreshing after model management operations, ensuring you always see the current list of available options.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

The page imports clear_available_models_cache from the stores module and explicitly calls it after successful add_model and remove_model operations, ensuring the cached available_models is invalidated to prevent stale dropdown data.

Changes

Cohort / File(s) Summary
Cache Invalidation
app/web_ui/src/routes/(app)/settings/providers/add_models/+page.svelte
Added import of clear_available_models_cache from stores and calls to clear the cached available models after add and remove operations to prevent stale cache values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • scosman

Poem

🐰 Cache be gone, no more delays!
Whiskers twitch in clearing ways,
Fresh models hop into our view,
No stale data for this crew! 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is completely empty, missing all required template sections including the problem description, related issues, CLA confirmation, and checklists. Add a complete PR description following the template, including what the PR does, related issue links, CLA confirmation, and verification of the required checklists.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: enabling custom models to appear in the dropdown without requiring a force reload.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch KIL-611/custom-model-reload

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds cache invalidation logic to the model settings page. By calling clear_available_models_cache after loading data, it ensures that model dropdowns are updated correctly when models are added or modified. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/web_ui/src/routes/(app)/settings/providers/add_models/+page.svelte (1)

298-308: ⚠️ Potential issue | 🟡 Minor

Consider clearing the cache even when the DELETE fails, and consider early-return semantics.

On delete_error the code alerts but still falls through to load_data() and clear_available_models_cache(). That's probably fine (and arguably desirable, since the server state is unknown after an error), but it's worth being deliberate:

  • If you intend to treat the failure as "no-op", early-return after the alert so the list/cache aren't needlessly refreshed.
  • If you intend to stay resilient (refresh in case partial state changed), keep as-is — the current change is correct for that interpretation.

No behavior change required for this PR; just flagging for intent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/web_ui/src/routes/`(app)/settings/providers/add_models/+page.svelte
around lines 298 - 308, The delete handler currently alerts on delete_error but
then continues to call load_data() and clear_available_models_cache(); decide
which semantics you want and make it explicit: if failure should be treated as a
no-op, add an early return immediately after the alert (so don't call
load_data() or clear_available_models_cache()); if you want resilient behavior
(refresh despite the error), leave the calls to load_data() and
clear_available_models_cache() as-is but add a comment near delete_error,
load_data(), and clear_available_models_cache() to document that refresh/cache
invalidation is intentional on failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@app/web_ui/src/routes/`(app)/settings/providers/add_models/+page.svelte:
- Around line 298-308: The delete handler currently alerts on delete_error but
then continues to call load_data() and clear_available_models_cache(); decide
which semantics you want and make it explicit: if failure should be treated as a
no-op, add an early return immediately after the alert (so don't call
load_data() or clear_available_models_cache()); if you want resilient behavior
(refresh despite the error), leave the calls to load_data() and
clear_available_models_cache() as-is but add a comment near delete_error,
load_data(), and clear_available_models_cache() to document that refresh/cache
invalidation is intentional on failure.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e35eb8c-9974-4ea9-b2ce-cbddb3a70b47

📥 Commits

Reviewing files that changed from the base of the PR and between 7f69c4c and f0c9586.

📒 Files selected for processing (1)
  • app/web_ui/src/routes/(app)/settings/providers/add_models/+page.svelte

@github-actions
Copy link
Copy Markdown

📊 Coverage Report

Overall Coverage: 92%

Diff: origin/main...HEAD

No lines with coverage information in this diff.


@sfierro sfierro merged commit 2e1018b into main Apr 27, 2026
14 checks passed
@sfierro sfierro deleted the KIL-611/custom-model-reload branch April 27, 2026 17:17
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