fix(admin-ui): model dropdown stays at 'Loading models...' on transient RPC failure #153
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_aibroker#153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When the admin UI's initial
loadChatModels()call fails (e.g. transient JSON-RPC blip while the admin process is starting up, or a brief disconnect from the server socket), the chat model autocomplete input stays pinned at the placeholderLoading models...forever. Thecatchblock only logs toconsole.error— it does not surface the failure to the user, does not retry, and does not update the placeholder.Other parts of the page that depend on
loadChatModelssucceeding (sidebarCATALOG > Modelscount, TTS/STT dropdowns, cost estimator) all silently stay at empty/0 in this state.Repro:
Modelinput stays at "Loading models...",CATALOG > Modelssays0, the audio dropdowns stay at "Disabled".Root cause
In
crates/hero_aibroker_admin/templates/fragments/chat_pane.htmltheloadChatModels()function ends with:No placeholder update, no retry, no user-visible signal. The browser console shows the error, but a normal operator looking at the UI sees a stuck spinner-like state with no indication that anything went wrong.
Proposal
Two-line change to the catch block:
Failed to load models — retrying…during the retry attempt, thenFailed to load models — refresh pageif the retry also fails.Code shape:
The connection-status badge in the header already polls every 30 s and self-heals, but the model dropdown only fetches once on page load — so it currently never recovers. This change brings the dropdown's resilience in line with the badge's.
Acceptance criteria
loadChatModels()'s first attempt throws, the placeholder updates toFailed to load models — retrying…and a second attempt fires after 2 s.Search model....Failed to load models — refresh pageand there are no further automatic retries.Test Results
Verified the fix in a headless browser against a live
hero_aibroker_adminprocess serving the patched template, on branchfix/admin-ui-model-load-retry.Build
cargo build -p hero_aibroker_admin— clean (Finished dev profile in 5.47s).http://127.0.0.1:8765/. HTTP 200.1. Happy path (regression check)
Loaded the page normally (RPC working). Inspected the chat model input:
chatModelInput.placeholderends atSearch model...exactly as before the fix.--fakeregistry capability filter).2. Forced both-fail recovery (the bug scenario)
Overrode
window.rpcto throw on every call. Re-firedloadChatModels()from a freshLoading models...state, then snapshotted the placeholder + cumulative rpc-call counter at fixed offsets:Failed to load models — retrying…Failed to load models — retrying…Failed to load models — retrying…Failed to load models — refresh pageFailed to load models — refresh pageInterpretation:
Failed to load models — retrying…immediately (acceptance criterion 1).Promise.all([rpc('models.config'), rpc('models.list')])accounts for 2 rpc calls per attempt; the counter going 2 → 4 between t=1000 ms and t=2200 ms confirms the scheduled retry fired at ~2 s.Failed to load models — refresh page(acceptance criterion 3).3. Restored-rpc check (retry path that succeeds)
After the both-fail test, restored
window.rpcto the working implementation and calledloadChatModels()again from aLoading models...state. The chat model input ended at:Confirms that when an attempt succeeds (either the first or the retry), the existing success path runs and the placeholder lands at
Search model...— acceptance criterion 2 holds.Acceptance-criteria status
Failed to load models — retrying…, retry scheduled at 2 s.Search model....Failed to load models — refresh page, no further retries.crates/hero_aibroker_admin/templates/fragments/chat_pane.html(+12 / -3).PR
#155 fix(admin-ui): retry model load once on transient RPC failure (#153) — targeting
main.