Fix async built-in chat mode loading#362
Open
jdneo wants to merge 2 commits into
Open
Conversation
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>
Contributor
There was a problem hiding this comment.
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>
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.
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