This repository was archived by the owner on May 20, 2026. It is now read-only.
fix: discover AGENTS.md and CLAUDE.md at workspace roots#4989
Merged
Conversation
The provider only found copilot-instructions.md (via customInstructionsService.getAgentInstructions()). AGENTS.md and CLAUDE.md live at the workspace root and are also agent instructions but weren't discovered. Now stats workspace roots for these files and includes them as agent-instructions items.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Copilot CLI customization provider to also surface workspace-root agent instruction files (AGENTS.md, CLAUDE.md) alongside existing copilot-instructions.md, aligning provider-driven item discovery with expected agent-instructions behavior (notably for the providerApi.enabled: true Copilot CLI harness path).
Changes:
- Extend
CopilotCLICustomizationProviderinstruction discovery to stat workspace roots forAGENTS.mdandCLAUDE.mdand emit them asagent-instructions. - Add/adjust unit tests to cover filesystem-based discovery of these workspace-root instruction files.
Show a summary per file
| File | Description |
|---|---|
| src/extension/chatSessions/vscode-node/copilotCLICustomizationProvider.ts | Adds workspace-root discovery for AGENTS.md/CLAUDE.md and emits them under agent-instructions. |
| src/extension/chatSessions/vscode-node/test/copilotCLICustomizationProvider.spec.ts | Updates provider construction for new deps and adds a test validating root-file discovery via mocked filesystem. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/extension/chatSessions/vscode-node/test/copilotCLICustomizationProvider.spec.ts:387
- This new test also relies on inline
as anymocks forIWorkspaceServiceandIFileSystemService. To keep tests maintainable and aligned with the codebase’s Vitest practices, prefer reusable mock classes (configurable for the “file exists” vs “not found” cases) rather than ad-hoc objects andanycasts.
const testProvider = disposables.add(new CopilotCLICustomizationProvider(
mockPromptFileService,
mockCopilotCLIAgents,
mockCustomInstructionsService,
mockPromptsService,
new TestLogService(),
{ getWorkspaceFolders: () => [workspaceRoot] } as any,
{
stat: (uri: URI) => existingUris.has(uri.toString())
? Promise.resolve({ type: 1, ctime: 0, mtime: 0, size: 0 })
: Promise.reject(new Error('not found')),
} as any,
));
- Files reviewed: 2/2 changed files
- Comments generated: 2
rebornix
approved these changes
Apr 6, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Companion to microsoft/vscode#307937.
The provider only discovered
copilot-instructions.mdviacustomInstructionsService.getAgentInstructions().AGENTS.mdandCLAUDE.mdlive at workspace roots and are also agent instructions but weren't found. Now stats workspace roots for these files and includes them asagent-instructionsitems.This fixes the
providerApi.enabled: truepath where the Copilot CLI harness uses the provider to supply items.