Skip to content

Commit 382e03e

Browse files
authored
Fix ui deadlock (#182)
* fix ui deadlock and infinite retry loop on 402 quota error * revert fix for 402 quota usage
1 parent cad24a6 commit 382e03e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services

com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.util.HashMap;
88
import java.util.List;
99
import java.util.Map;
10+
import java.util.concurrent.CompletableFuture;
1011
import java.util.concurrent.ExecutionException;
1112

1213
import org.apache.commons.lang3.StringUtils;
@@ -348,7 +349,11 @@ public void setActiveModel(String modelName) {
348349
// Persist using the composite key for proper identification
349350
UserPreference preference = getUserPreference();
350351
preference.setChatModel(compositeKey);
351-
persistUserPreference();
352+
// Persist asynchronously to avoid deadlock: persistUserPreference() calls
353+
// persistence().get() which blocks waiting for the LSP listener thread.
354+
// If called on the UI thread while the listener is in syncExec, both threads
355+
// deadlock.
356+
CompletableFuture.runAsync(this::persistUserPreference);
352357

353358
// Update observable
354359
ensureRealm(() -> activeModelObservable.setValue(model));

0 commit comments

Comments
 (0)