Skip to content

refactor and add tests for agentCustomizationContentExpander#317773

Merged
aeschli merged 2 commits into
mainfrom
aeschli/outer-panther-978
May 21, 2026
Merged

refactor and add tests for agentCustomizationContentExpander#317773
aeschli merged 2 commits into
mainfrom
aeschli/outer-panther-978

Conversation

@aeschli
Copy link
Copy Markdown
Contributor

@aeschli aeschli commented May 21, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 21, 2026 13:40
@aeschli aeschli enabled auto-merge (squash) May 21, 2026 13:40
@aeschli aeschli self-assigned this May 21, 2026
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

Note

Copilot was unable to run its full agentic suite in this review.

This PR refactors plugin-content expansion logic into a dedicated AgentCustomizationContentExpander and adds a comprehensive test suite covering skills/agents/rules/commands discovery and metadata handling.

Changes:

  • Introduced AgentCustomizationContentExpander to encapsulate scanning plugin subfolders and parsing frontmatter metadata.
  • Refactored AgentCustomizationItemProvider to delegate expansion and simplify its internal logic.
  • Added extensive browser tests validating discovery rules, metadata extraction, and propagation of groupKey/pluginUri.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/test/browser/agentHost/agentCustomizationContentExpander.test.ts Adds coverage for expansion behavior across all supported folder types and key propagation.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.ts Delegates plugin expansion to the new expander and restructures parallel expansion flow.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.ts New implementation of plugin-content expansion and frontmatter parsing.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment on lines +222 to +228
private async _expandPluginContents(plugin: PluginMeta, token: CancellationToken): Promise<readonly ICustomizationItem[]> {
const cached = this._expansionCache.get(plugin.item.uri);
if (cached && cached.nonce === plugin.nonce) {
return cached.children;
}

// pluginUri is already an agent-host:// URI (from toRemoteUri),
// so use it directly as the filesystem root.
const fsRoot = pluginUri;
const children: ICustomizationItem[] = [];
try {
if (!await this._fileService.canHandleResource(fsRoot)) {
return [];
}
if (token.isCancellationRequested) {
return [];
}

const dirNames = ['agents', 'skills', 'commands', 'rules'] as const;
const subdirs = dirNames.map(name => ({ name, resource: URI.joinPath(fsRoot, name) }));
const stats = await this._fileService.resolveAll(subdirs.map(s => ({ resource: s.resource })));

if (token.isCancellationRequested) {
return [];
}

for (let i = 0; i < subdirs.length; i++) {
const stat = stats[i];
if (!stat.success || !stat.stat?.isDirectory || !stat.stat.children) {
continue;
}
const promptType = promptsTypeForPluginDir(subdirs[i].name);
if (!promptType) {
continue;
}
children.push(...await this._collectFromTypeDir(stat.stat.children, pluginUri, promptType, groupKey, isBundleItem, token));
}
children.sort((a, b) => `${a.type}:${a.name}`.localeCompare(`${b.type}:${b.name}`));
} catch (err) {
this._logService.trace(`[AgentCustomizationItemProvider] Failed to expand plugin ${pluginUri.toString()}: ${err}`);
return [];
}

this._expansionCache.set(pluginUri, { nonce, children });
const children = await this._contentExpander.expandPluginContents(plugin.item.uri, plugin.childGroupKey, plugin.isBundleItem, plugin.item.source, token);
this._expansionCache.set(plugin.item.uri, { nonce: plugin.nonce, children });
Comment on lines +77 to +89
const eligible: Entry[] = [];
const readMetaDataPromises = [];
for (const child of entries) {
// Skip dotfiles (e.g. .DS_Store)
if (child.name.startsWith('.')) {
continue;
}
if (!child.isDirectory) {
continue;
}
eligible.push(child);
readMetaDataPromises.push(this.readPromptMetadata(joinPath(child.resource, SKILL_FILENAME), token));
}
roblourens
roblourens previously approved these changes May 21, 2026
@aeschli aeschli merged commit c883dd5 into main May 21, 2026
25 checks passed
@aeschli aeschli deleted the aeschli/outer-panther-978 branch May 21, 2026 22:09
@vs-code-engineering vs-code-engineering Bot added this to the 1.122.0 milestone May 21, 2026
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.

3 participants