fix(desktop): recover composer model pill after rapid profile switches - #47537
fix(desktop): recover composer model pill after rapid profile switches#47537LeonSGP43 wants to merge 1 commit into
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused retry and request-ordering coverage. The current-main premise is still valid: the profile-switch effect calls refreshCurrentModel(true) in apps/desktop/src/app/desktop-controller.tsx:661-670, while the current hook silently drops a failed model-info request at apps/desktop/src/app/session/hooks/use-model-controls.ts:53-68.
Problems
- The new bounded loop still returns after its final failed request at
apps/desktop/src/app/session/hooks/use-model-controls.ts:96-100without changing state or exposing recovery. SinceModelPillrenders an empty$currentModelasGlyphSpinner(apps/desktop/src/app/chat/composer/model-pill.tsx:56-60), this can still leave the user with an indefinite spinner. The new test atuse-model-controls.test.tsx:212-235covers recovery before exhaustion, but not this terminal path.
Suggested changes
- Add a retryable exhausted-refresh state and a visible action that re-runs the refresh, then cover the all-attempts-fail path. Keep the request-id ordering guard, which correctly addresses the overlapping-refresh case.
Automated hermes-sweeper review.
| } | ||
| const retryDelay = retryDelays[attempt] | ||
|
|
||
| if (typeof retryDelay !== 'number') { |
There was a problem hiding this comment.
On the fourth failed request retryDelays[attempt] is undefined, so this returns with $currentModel still empty; ModelPill then keeps rendering its spinner. Please surface a retryable failure/recovery action here and add an exhaustion-path test rather than leaving the terminal state indistinguishable from loading.
Summary
Verification
npm --workspace apps/desktop exec -- vitest run --environment jsdom src/app/session/hooks/use-model-controls.test.tsxnpm --workspace apps/desktop exec -- eslint src/app/session/hooks/use-model-controls.ts src/app/session/hooks/use-model-controls.test.tsxgit diff --checkCloses #47524.