Fix ui deadlock#182
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the chat UI deadlock that could permanently freeze Eclipse when a 402 quota error triggers model fallback handling, and adds guards to prevent an infinite 402 retry loop. It also improves turn rendering so model info isn’t duplicated and stays positioned correctly when warnings are added.
Changes:
- Make model preference persistence asynchronous to avoid blocking the UI thread during fallback switching.
- Prevent infinite 402 fallback retry loops by detecting when the fallback model is already active and adjusting messaging accordingly.
- Ensure the model info footer in a Copilot turn is replaced (not duplicated) and remains below warning widgets.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelService.java | Persists model preference asynchronously to break the UI-thread ↔ LSP-listener deadlock chain. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/ChatContentViewer.java | Adds “already on fallback” guard to avoid infinite 402 retry/switch loops and conditionally replaces the 402 message. |
| com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/CopilotTurnWidget.java | Prevents duplicate model info labels and forces footer ordering below warning widgets. |
ethanyhou
approved these changes
May 13, 2026
Contributor
ethanyhou
left a comment
There was a problem hiding this comment.
Verified and LGTM, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #179
Problem
When a 402 quota error occurs during chat, the UI freezes permanently due to a deadlock between the main thread and the LSP listener thread.
Deadlock chain:
processTurnEvent()→ blocks inDisplay.syncExec()waiting for UI threadsetFallBackModelAsActiveModel()→persistUserPreference()→persistence().get()blocks waiting for LSP responsesyncExec→ the persistence response can never arriveChanges
ModelService.javapersistUserPreference()is now called asynchronously viaCompletableFuture.runAsync()insetActiveModel(), breaking the deadlock chain by keeping the UI thread unblocked.