ChatModes: throttle update requests, only fire on change#320088
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves chat mode refresh behavior by throttling refresh requests and ensuring change events only fire when the computed/custom mode data actually changes. It also introduces structural equality helpers for several customization-related payload types and adjusts tests to await deterministic refresh completion.
Changes:
- Throttle custom-mode refreshes in
ChatModesand gateonDidChangefiring on detected structural changes. - Add
isEqualshelpers forIAgentSource,ChatRequestHooks, andIParsedHookCommand(with new unit tests). - Improve cancellation handling when collecting chat session customizations and make chat mode tests wait for pending updates instead of
timeout(0).
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts | Adds unit tests covering IAgentSource.isEquals. |
| src/vs/workbench/contrib/chat/test/common/promptSyntax/hookSchema.test.ts | Adds unit tests covering ChatRequestHooks.isEquals. |
| src/vs/workbench/contrib/chat/test/common/chatModeService.test.ts | Makes refresh waiting deterministic via waitForPendingUpdates() and adds a “no-change event” test. |
| src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts | Introduces IAgentSource.isEquals for source comparisons. |
| src/vs/workbench/contrib/chat/common/promptSyntax/hookSchema.ts | Introduces ChatRequestHooks.isEquals for hook payload comparisons. |
| src/vs/workbench/contrib/chat/common/customizationHarnessService.ts | Avoids returning results when cancellation is requested. |
| src/vs/workbench/contrib/chat/common/chatModes.ts | Implements throttled refresh, cancellation, and change-detection in CustomChatMode.updateData. |
| src/vs/platform/agentPlugins/test/common/pluginParsers.test.ts | Adds unit tests for IParsedHookCommand.isEquals. |
| src/vs/platform/agentPlugins/common/pluginParsers.ts | Introduces IParsedHookCommand.isEquals for structural comparisons (URIs/env). |
Copilot's findings
- Files reviewed: 9/9 changed files
- Comments generated: 2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
alexr00
approved these changes
Jun 5, 2026
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.
No description provided.