Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/vscode-ui-plugin/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2574,6 +2574,8 @@ function setupLoginHandlers() {
});
} else if (config && config.setModel) {
config.setModel(payload.modelName);
// Fix: model_switch_complete is sent below after updateSessionModelConfig
// — no need to send it here (would cause double notification)
}
}

Expand All @@ -2599,6 +2601,18 @@ function setupLoginHandlers() {
success: false,
error: error instanceof Error ? error.message : 'Unknown error'
});
// Fix: notify frontend to clear isModelSwitching state on failure
// Use try-catch to avoid masking the original error if webview is disposed
if (payload.sessionId) {
try {
await communicationService.sendModelResponse(payload.requestId, {
success: false,
error: error instanceof Error ? error.message : 'Unknown error'
});
// Only clear isModelSwitching, don't update selectedModelId
await communicationService.sendModelSwitchComplete(payload.sessionId, '');
} catch {}
}
}
});

Expand Down