fix: customization provider API rendering bugs and sessions window isolation#307745
Merged
joshspicer merged 5 commits intomainfrom Apr 6, 2026
Merged
fix: customization provider API rendering bugs and sessions window isolation#307745joshspicer merged 5 commits intomainfrom
joshspicer merged 5 commits intomainfrom
Conversation
Multiple concurrent loadItems() calls can overlap when autoruns fire simultaneously. Without serialization, a slow earlier call can resolve after the correct one and overwrite allItems with stale/empty results. The sequence counter ensures only the latest call's result is applied.
The list widget subscribed to onDidChangeCustomAgents, onDidChangeSlashCommands, and onDidChangeSkills but not onDidChangeInstructions. This meant instruction file discovery completing after the initial load never triggered a widget refresh.
The autorun that subscribes to itemProvider.onDidChange only read activeHarness. If the harness ID was persisted from a previous session, activeHarness never changed when the CLI harness registered, so the subscription was never set up. Now also reads availableHarnesses to re-fire when harnesses are added/removed.
filterItemsForProvider only had storage-based groups (local, user, extension, builtin). Provider-supplied instruction items have semantic groupKey values like 'context-instructions' and 'on-demand-instructions' which didn't match any group, causing all instruction items to be silently dropped (allItems: 0). Add instruction-semantic groups when the current section is Instructions, matching filterItemsForCore.
The sessions window manages its own harnesses via SessionsCustomizationHarnessService and the remoteAgentHost contribution. Extension-contributed harnesses via the provider API should not be registered in the sessions window.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes multiple rendering/refresh issues in the AI Customizations UI when using the ChatSessionCustomizationProvider API, and prevents provider API registrations from impacting the Sessions window.
Changes:
- Prevent stale concurrent
loadItems()results from overwriting newer results via a sequence counter. - Ensure the customization list refreshes when instruction discovery completes (
onDidChangeInstructions) and when new provider harnesses register (re-establishonDidChangesubscription). - Fix instruction provider grouping so semantic instruction
groupKeys are routed into the correct collapsible headers; ignore provider registrations in the Sessions window.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts | Fixes list refresh races, adds missing instruction change subscription, re-establishes provider onDidChange subscription, and updates provider grouping for instruction items. |
| src/vs/workbench/api/browser/mainThreadChatAgents2.ts | Prevents customization provider API registration from being applied in Sessions windows by early-returning when isSessionsWindow is true. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts
Show resolved
Hide resolved
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts
Show resolved
Hide resolved
roblourens
approved these changes
Apr 4, 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.
Fixes several bugs in the Chat Customizations UI when using the
ChatSessionCustomizationProviderAPI (chat.customizations.providerApi.enabled: true).Fixes
1. Race condition in
loadItems()— sequence counterMultiple concurrent
loadItems()calls overlap when autoruns fire simultaneously (harness registers →availableHarnessesfires, thenactiveHarnessfires, thensetSectionfires). Without serialization, a slow earlier call (core path) can resolve after the correct provider-path call and overwriteallItemswith empty results. A sequence counter ensures only the latest call's result is applied.2. Missing
onDidChangeInstructionssubscriptionThe widget subscribed to
onDidChangeCustomAgents,onDidChangeSlashCommands, andonDidChangeSkillsbut notonDidChangeInstructions. Instruction file discovery completing after the initial load never triggered a widget refresh.3. Provider
onDidChangeautorun not re-establishedThe autorun that subscribes to
itemProvider.onDidChangeonly readactiveHarness. If the harness ID was persisted from a previous session,activeHarnessnever changed when the CLI harness registered, so the subscription was never set up. Now also readsavailableHarnesses.4. Instruction items dropped in
filterItemsForProviderfilterItemsForProvideronly had storage-based groups (local,user,extension,builtin). Provider-supplied instruction items have semanticgroupKeyvalues (context-instructions,on-demand-instructions,agent-instructions) which didn't match any group — causing all instruction items to be silently dropped (allItems: 0). This was a regression from #307226.5. Sessions window ignores provider API
The sessions window manages its own harnesses via
SessionsCustomizationHarnessServiceand theremoteAgentHostcontribution. Extension-contributed harnesses via the provider API should not be registered in the sessions window.