Skip to content

Fix async built-in chat mode loading#362

Open
jdneo wants to merge 2 commits into
mainfrom
fix/324-async-built-in-chat-modes
Open

Fix async built-in chat mode loading#362
jdneo wants to merge 2 commits into
mainfrom
fix/324-async-built-in-chat-modes

Conversation

@jdneo

@jdneo jdneo commented Jul 21, 2026

Copy link
Copy Markdown
Member

Load built-in chat modes after sign-in without blocking the SWT UI. Protect cached modes from stale reloads and refresh the preference observable asynchronously.

Add deterministic concurrency and authentication lifecycle coverage.

fix #324

Load built-in chat modes after sign-in without blocking the SWT UI. Protect cached modes from stale reloads and refresh the preference observable asynchronously.

Add deterministic concurrency and authentication lifecycle coverage.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 21, 2026 07:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses UI freezes caused by synchronous built-in chat mode loading by moving built-in mode refresh to an asynchronous flow tied to authentication changes, and adds deterministic concurrency coverage for the new behavior.

Changes:

  • Load/refresh built-in chat modes asynchronously after sign-in (and clear them on sign-out) to avoid blocking the SWT UI thread.
  • Add “generation” gating to prevent stale/in-flight built-in mode loads from overwriting newer cached results.
  • Add unit tests covering non-blocking loads and stale-result suppression in the manager, plus auth-lifecycle coverage in the UI service test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/UserPreferenceService.java Triggers async built-in mode reload on sign-in and updates the chat-mode observable via async realm execution.
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/services/UserPreferenceServiceTest.java Adds tests for auth sign-out clearing built-in modes and sign-in reload happening without blocking.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/BuiltInChatModeManager.java Refactors manager to async reload with stale-result protection and explicit cache clearing.
com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/chat/BuiltInChatModeManagerTests.java Adds deterministic tests for non-blocking reload and stale/in-flight result suppression.

Convert synchronous mode-loader exceptions into failed futures so callers retain consistent async error handling.

Inject the built-in mode manager from the chat service composition root and isolate preference-service tests from CopilotCore global state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

[Bug] UI freezes on startup from BuiltInChatModeManager.loadModesSync()

2 participants