fix(admin-ui): retry model load once on transient RPC failure (#153) #155

Merged
rawdaGastan merged 1 commit from fix/admin-ui-model-load-retry into main 2026-06-16 10:00:42 +00:00
Member

Closes #153.

What

When the admin UI's initial loadChatModels() call fails (e.g. transient JSON-RPC blip while the admin process is starting up), the chat model input was pinned at Loading models... forever — the catch block only logged to console.error with no placeholder update, no retry, and no recovery.

This change makes the catch block:

  1. Update the placeholder to Failed to load models — retrying… immediately on first failure.
  2. Schedule a single retry 2 s later.
  3. If the retry also fails, update the placeholder to Failed to load models — refresh page (terminal).
  4. If either attempt succeeds, the existing success path runs and the placeholder turns into Search model... as before — no behavioural change on the happy path.

Diff

+12 / -3 in crates/hero_aibroker_admin/templates/fragments/chat_pane.html. Only the catch block + function signature change; success path untouched.

Verification (headless browser)

Forced window.rpc to throw for both attempts and snapshotted the input placeholder + rpc-call counter at fixed offsets:

t (ms) placeholder rpc calls
0 Failed to load models — retrying… 2
100 Failed to load models — retrying… 2
1000 Failed to load models — retrying… 2
2200 Failed to load models — refresh page 4
3000 Failed to load models — refresh page 4
  • First attempt failed → placeholder transitioned correctly, retry scheduled.
  • Retry fired at ~2 s (rpc calls 2 → 4 for the two parallel calls), failed → terminal placeholder.
  • No third attempt.

Restored window.rpc and called loadChatModels() again; happy path produced value=claude-haiku, placeholder=Search model..., 34 models loaded. No regression.

Acceptance criteria

  • First attempt failure updates placeholder to Failed to load models — retrying… and schedules a retry after 2 s.
  • Retry-succeeds case populates the dropdown and sets the placeholder to Search model... via the existing success path.
  • Both-fail case sets the placeholder to Failed to load models — refresh page and stops retrying.
  • No behavioural change on the success path.
  • No other files modified.
Closes #153. ## What When the admin UI's initial `loadChatModels()` call fails (e.g. transient JSON-RPC blip while the admin process is starting up), the chat model input was pinned at `Loading models...` forever — the `catch` block only logged to `console.error` with no placeholder update, no retry, and no recovery. This change makes the catch block: 1. Update the placeholder to `Failed to load models — retrying…` immediately on first failure. 2. Schedule a single retry 2 s later. 3. If the retry also fails, update the placeholder to `Failed to load models — refresh page` (terminal). 4. If either attempt succeeds, the existing success path runs and the placeholder turns into `Search model...` as before — no behavioural change on the happy path. ## Diff `+12 / -3` in [`crates/hero_aibroker_admin/templates/fragments/chat_pane.html`](crates/hero_aibroker_admin/templates/fragments/chat_pane.html). Only the `catch` block + function signature change; success path untouched. ## Verification (headless browser) Forced `window.rpc` to throw for both attempts and snapshotted the input placeholder + rpc-call counter at fixed offsets: | t (ms) | placeholder | rpc calls | |---|---|---| | 0 | `Failed to load models — retrying…` | 2 | | 100 | `Failed to load models — retrying…` | 2 | | 1000 | `Failed to load models — retrying…` | 2 | | 2200 | `Failed to load models — refresh page` | 4 | | 3000 | `Failed to load models — refresh page` | 4 | - First attempt failed → placeholder transitioned correctly, retry scheduled. - Retry fired at ~2 s (rpc calls 2 → 4 for the two parallel calls), failed → terminal placeholder. - No third attempt. Restored `window.rpc` and called `loadChatModels()` again; happy path produced `value=claude-haiku`, `placeholder=Search model...`, 34 models loaded. No regression. ## Acceptance criteria - [x] First attempt failure updates placeholder to `Failed to load models — retrying…` and schedules a retry after 2 s. - [x] Retry-succeeds case populates the dropdown and sets the placeholder to `Search model...` via the existing success path. - [x] Both-fail case sets the placeholder to `Failed to load models — refresh page` and stops retrying. - [x] No behavioural change on the success path. - [x] No other files modified.
rawdaGastan deleted branch fix/admin-ui-model-load-retry 2026-06-16 10:00:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_aibroker!155
No description provided.