Skip to content
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
joshspicer merged 1 commit into
mainfrom
josh/agent-instructions-subpath-fix
Apr 6, 2026
Merged

fix: discover AGENTS.md and CLAUDE.md at workspace roots#4989
joshspicer merged 1 commit into
mainfrom
josh/agent-instructions-subpath-fix

Conversation

@joshspicer
Copy link
Copy Markdown
Member

Companion to microsoft/vscode#307937.

The provider only discovered copilot-instructions.md via customInstructionsService.getAgentInstructions(). AGENTS.md and CLAUDE.md live at workspace roots and are also agent instructions but weren't found. Now stats workspace roots for these files and includes them as agent-instructions items.

This fixes the providerApi.enabled: true path where the Copilot CLI harness uses the provider to supply items.

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.
@joshspicer joshspicer marked this pull request as ready for review April 6, 2026 02:23
Copilot AI review requested due to automatic review settings April 6, 2026 02:23
@joshspicer joshspicer enabled auto-merge April 6, 2026 02:23
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 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 CopilotCLICustomizationProvider instruction discovery to stat workspace roots for AGENTS.md and CLAUDE.md and emit them as agent-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 any mocks for IWorkspaceService and IFileSystemService. 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 and any casts.
			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

@joshspicer joshspicer added this pull request to the merge queue Apr 6, 2026
Merged via the queue into main with commit 324d55e Apr 6, 2026
23 checks passed
@joshspicer joshspicer deleted the josh/agent-instructions-subpath-fix branch April 6, 2026 03:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants