Skip to content

fix(dash): live slot+model counts in sidebars#306

Merged
thinmintdev merged 1 commit into
mainfrom
fix/sidebar-live-counts
May 25, 2026
Merged

fix(dash): live slot+model counts in sidebars#306
thinmintdev merged 1 commit into
mainfrom
fix/sidebar-live-counts

Conversation

@thinmintdev
Copy link
Copy Markdown
Contributor

Bug

Left-sidebar slot + model counts (Sidebar in chrome.jsx and McpSidebar in mcp-main.jsx) read HAL0_DATA.slots.length / HAL0_DATA.models.length — a module-level static seed in ui/src/dash/data.jsx. The counts therefore never update when /api/slots or /api/models changes; they're frozen at app boot.

McpSidebar additionally read HAL0_DATA.lemond.status / .version for its status block. The chrome.jsx Sidebar already migrated lemond to useLemondRollup via SidebarStatusBlock — McpSidebar didn't.

Fix

Surgical migration to the existing live React Query hooks (already used in dash/slots.jsx and dash/models.jsx):

  • chrome.jsx::SidebaruseSlots() + useModels(), default to 0 when data is undefined.
  • mcp-main.jsx::McpSidebar — same useSlots / useModels migration, plus migrate the lemond status block to useLemondRollup() mirroring the SidebarStatusBlock pattern in chrome.jsx.

HAL0_DATA and other consumers are untouched (intentional fallback for the rest of the prototype).

Files

  • ui/src/dash/chrome.jsx (+6 / -2)
  • ui/src/dash/mcp-main.jsx (+14 / -4)

Verification ran

On hal0-dev (/tmp/hal0-sidebar-live/ui):

  • npm run typecheck — clean.
  • npm install + rm -rf node_modules/.vite dist && npm run build — clean.

On hal0 LXC (/opt/hal0/ui, branch checked out + force-reset to remote tip after rebase onto current main):

  • rm -rf node_modules/.vite dist && npm run build — clean (115 modules, dist/assets/index-CY9F9Fds.js, 508 kB).
  • npm run typecheck — clean.
  • grep 'queryKey:\["slots"\]\|queryKey:\["models"\]' dist/assets/index-*.js → 2 matches (hooks compiled into the bundle).
  • systemctl restart hal0-api → active.
  • curl http://127.0.0.1:8080/ → 200; served <script src=".../index-CY9F9Fds.js"> matches freshly-built bundle.
  • /api/slots reports 5 slots (embed/primary/rerank/stt/tts), /api/models reports 0 — both will render live in the sidebar instead of the static seed (which had different counts).
  • POST /api/slots/primary/restart → 200; count stable at 5, primary state cycled to ready — useSlots' 5s polling carries the change.

Out of scope

Other HAL0_DATA consumers (data.jsx is a shared fallback for many components — intentional), eviction bug, tweaks panel, firstrun, other sidebars.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Sidebar (chrome.jsx) and McpSidebar (mcp-main.jsx) read static
HAL0_DATA.slots/models seed at module load, so counts never updated.
Migrate both to useSlots/useModels React Query hooks (already used
elsewhere in the dash) and migrate McpSidebar's lemond status block
to useLemondRollup, mirroring SidebarStatusBlock in chrome.jsx.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thinmintdev thinmintdev force-pushed the fix/sidebar-live-counts branch from 2d38c02 to 2144663 Compare May 25, 2026 18:08
@thinmintdev thinmintdev merged commit 7777f51 into main May 25, 2026
4 checks passed
@thinmintdev thinmintdev deleted the fix/sidebar-live-counts branch May 25, 2026 18:14
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.

1 participant