From 5327bdde846647cb29591c10fc3cac0f22a0554a Mon Sep 17 00:00:00 2001 From: Alex Cheema <41707476+AlexCheema@users.noreply.github.com> Date: Thu, 26 Mar 2026 17:57:00 -0700 Subject: [PATCH] Fix custom model add requiring two attempts + enlarge sidebar buttons (#1805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation Adding a custom model from the Hub tab shows "Added" toast but the model doesn't appear in the All tab. You have to add it a second time for it to work. Also, the "All" button in the model picker sidebar is too small to read comfortably. ## Changes **Race condition fix (`src/exo/api/main.py`):** - Call `add_to_card_cache(card)` directly in `add_custom_model()` after sending the `ForwarderCommand`, before the API response returns **Sidebar sizing (`dashboard/src/lib/components/FamilySidebar.svelte`):** - Increased sidebar min-width from 72/64px to 80/72px - Increased "All" icon from `w-5 h-5` to `w-6 h-6` - Increased all sidebar labels from 9px to 11px ## Why It Works `POST /models/add` sends a `ForwarderCommand(AddCustomModelCard)` and returns immediately. The frontend then calls `GET /models` which reads from `_card_cache`. But the cache was only updated by the worker event handler after the event round-trips through the master — a race the frontend almost always loses. By updating the cache directly in the API handler, `GET /models` immediately reflects the new model. The worker's later `add_to_card_cache` call is idempotent (dict key assignment). ## Test Plan ### Manual Testing - Open model picker → Hub tab → add a custom model → verify it appears in All tab on the first attempt - Verify sidebar "All" button and other labels are visually larger and readable ### Automated Testing - `uv run basedpyright` passes with 0 errors - `uv run ruff check` passes --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .../src/lib/components/FamilySidebar.svelte | 25 ++++++------------- .../lib/components/ModelFilterPopover.svelte | 2 +- src/exo/api/main.py | 5 ++++ 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/dashboard/src/lib/components/FamilySidebar.svelte b/dashboard/src/lib/components/FamilySidebar.svelte index 4a7307a0..62633a5e 100644 --- a/dashboard/src/lib/components/FamilySidebar.svelte +++ b/dashboard/src/lib/components/FamilySidebar.svelte @@ -42,31 +42,20 @@