Skip to content

fix: resolve model switch UI freeze on edge cases#47

Open
NSIETeam wants to merge 2 commits into
OrionStarAI:opensourcefrom
NSIETeam:fix/model-switch-bugs
Open

fix: resolve model switch UI freeze on edge cases#47
NSIETeam wants to merge 2 commits into
OrionStarAI:opensourcefrom
NSIETeam:fix/model-switch-bugs

Conversation

@NSIETeam

Copy link
Copy Markdown

Bug Fix: Model switch UI freeze on edge cases

Problem

Users experience the model selector UI permanently showing "Switching..." in two scenarios:

  1. switchModel() throws an exception: The catch block sends sendModelResponse({success:false}) but does NOT send model_switch_complete. The frontend's isModelSwitching flag is only cleared when model_switch_complete is received, so the UI gets stuck.

  2. geminiClient is null: When geminiClient is unavailable but config.setModel exists, the model is switched successfully but no model_switch_complete event is emitted, leaving the frontend out of sync.

Fix

Fix 1 (extension.ts catch block): Added sendModelSwitchComplete() call in the catch block of onSetCurrentModel handler, so the frontend clears isModelSwitching even on failure.

Fix 2 (extension.ts config.setModel path): Added sendModelSwitchComplete() call after config.setModel(), ensuring the frontend is notified when the model is switched via the config fallback path.

Files Changed

  • packages/vscode-ui-plugin/src/extension.ts (+6 lines)

Testing

  • Code review confirms both code paths now emit model_switch_complete
  • Manual test: trigger switchModel failure, verify UI recovers
  • Manual test: model switch with null geminiClient, verify UI updates

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