Skip to content

sessions: count remote plugin customizations#313558

Draft
joshspicer wants to merge 3 commits intomicrosoft:mainfrom
joshspicer:agents/fix-plugin-counter-increment
Draft

sessions: count remote plugin customizations#313558
joshspicer wants to merge 3 commits intomicrosoft:mainfrom
joshspicer:agents/fix-plugin-counter-increment

Conversation

@joshspicer
Copy link
Copy Markdown
Member

Summary

  • Preserve provider-declared plugin and built-in storage while normalizing customization items, even when AHP remote items do not have local plugin URIs.
  • Include active remote provider plugin rows in the Agents sidebar Plugins count while excluding locally synced remote-client rows.
  • Keep the Plugins list count aligned with displayed rows and avoid remote provider refetches when only local installed plugins change.
  • Preserve the newer origin/main customizations header collapse-toggle/touch handling.

Testing

  • npm run compile-check-ts-native
  • node --experimental-strip-types build/hygiene.ts $(git --no-pager diff --name-only -- 'src/**/*.ts' 'src/**/*.md')
  • npm run valid-layers-check
  • npm run transpile-client -- --quiet
  • env -u ELECTRON_RUN_AS_NODE ./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationItemsModel.test.ts --run src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationListWidget.test.ts --run src/vs/sessions/contrib/sessions/test/browser/aiCustomizationShortcutsWidget.test.ts

Copilot AI review requested due to automatic review settings April 30, 2026 18:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the AI Customizations surfaces (workbench + sessions window) so plugin-related customizations coming from remote harness providers are counted and grouped correctly, while keeping sidebar/plugin list counts aligned with what’s actually rendered.

Changes:

  • Add a dedicated IAICustomizationItemsModel.getPluginCount() observable that combines local installed plugins with provider-supplied remote plugin rows (excluding remote-client).
  • Preserve provider-declared storage/built-in origin during normalization even when inference inputs (like pluginUri / groupKey) are missing.
  • Align plugin list row counts with displayed rows and broaden “plugin item” detection via isPluginCustomizationItem.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationListWidget.test.ts Update stubs to include new getPluginCount() API.
src/vs/workbench/contrib/chat/test/browser/aiCustomization/aiCustomizationItemsModel.test.ts Add coverage for storage preservation and plugin-count behavior (including local plugin changes).
src/vs/workbench/contrib/chat/common/customizationHarnessService.ts Introduce isPluginCustomizationItem helper for consistent plugin-row detection.
src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.ts Use isPluginCustomizationItem and exclude remote-client from the rendered-count calculation.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.ts Implement getPluginCount() and remote plugin counting with stale-result protection.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.ts Treat provider-supplied storage (plugin/built-in) as authoritative during normalization.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.ts Extend storageToIcon to accept built-in storage and map it to the built-in icon.
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.ts Update debug panel state typing and include built-in storage counts.
src/vs/sessions/contrib/sessions/test/browser/aiCustomizationShortcutsWidget.test.ts Update mock model to implement getPluginCount().
src/vs/sessions/contrib/sessions/test/browser/aiCustomizationShortcutsWidget.fixture.ts Add plugin count support to fixtures.
src/vs/sessions/contrib/sessions/browser/customizationsToolbar.contribution.ts Drive Plugins badge count from itemsModel.getPluginCount() instead of plugin service directly.
src/vs/sessions/contrib/sessions/browser/aiCustomizationShortcutsWidget.ts Update header total to include plugin count via items model; add explicit collapse-toggle button with click/tap handling.
src/vs/sessions/AI_CUSTOMIZATIONS.md Document updated count consistency rules and provider-authoritative storage handling.

Copilot's findings

  • Files reviewed: 13/13 changed files
  • Comments generated: 1

joshspicer and others added 3 commits April 30, 2026 20:19
Remote agent-host customization providers can contribute plugin rows and plugin-sourced items without a local plugin URI. Preserve provider-declared storage while normalizing items and include remote provider plugin rows in sidebar plugin counts, excluding locally synced remote-client rows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When the AHP harness reports plugins that are already known to IAgentPluginService (e.g. the local Copilot CLI surfaces its installed plugins as remote-host customizations), do not double-count or double-display them. Match by display name and fold harness-provided rows into the locally installed plugin.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a new 'data sources' suite to AICustomizationItemsModel tests that:
- Validates getCount() for each prompts-based section (Agents, Skills, Instructions, Prompts, Hooks) reflects provider items filtered by the section's prompt type.
- Validates getCount() refetches and updates when the provider fires onDidChange.
- Validates getPluginCount() in three scenarios: only local plugins, only harness plugin rows (with type='plugin' / 'plugins' and remote-client filtered out), and a mix that exercises name-based dedup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joshspicer joshspicer force-pushed the agents/fix-plugin-counter-increment branch from fe8c1ad to 14e741f Compare May 1, 2026 00:20
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.

2 participants