Skip to content

fix: exempt agent instructions from workspace subpath filter#307937

Merged
joshspicer merged 2 commits intomainfrom
josh/agent-instructions-subpath-fix
Apr 6, 2026
Merged

fix: exempt agent instructions from workspace subpath filter#307937
joshspicer merged 2 commits intomainfrom
josh/agent-instructions-subpath-fix

Conversation

@joshspicer
Copy link
Copy Markdown
Member

@joshspicer joshspicer commented Apr 6, 2026

Follow-up to #307745.

AGENTS.md, CLAUDE.md, and copilot-instructions.md live at the workspace root by design. The CLI harness restricts items to workspaceSubpaths (.github, .copilot, .agents, .claude), which filtered out these root-level agent instruction files in the core path (used by the Sessions window where providerApi.enabled is false).

Items with groupKey: 'agent-instructions' are now exempt from the workspace subpath filter, matching the existing exemption pattern for instructionFileFilter.

Sessions window → Customizations → Instructions → AGENTS.md should appear under "Agent Instructions" (it was filtered out by the workspace subpath check)
Sessions window → Sidebar tree → Instructions section should list AGENTS.md
Sessions window → Overview badge count for Instructions should include AGENTS.md (e.g. 13 not 10)

AGENTS.md, CLAUDE.md, and copilot-instructions.md live at the workspace
root by design. The CLI harness restricts items to workspaceSubpaths
(.github, .copilot, .agents, .claude) which filtered out these root-level
agent instruction files. Now items with groupKey 'agent-instructions' are
exempt from the subpath filter, matching the existing exemption for
instructionFileFilter patterns.
Copilot AI review requested due to automatic review settings April 6, 2026 02:03
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

This PR fixes discovery/filtering of workspace-root agent instruction files in the AI Customization list when using the core (non-provider) harness path. It exempts items categorized as groupKey: 'agent-instructions' from the active harness workspaceSubpaths restriction so files like AGENTS.md, CLAUDE.md, and copilot-instructions.md aren’t incorrectly hidden.

Changes:

  • Exempt agent-instructions items from the workspace subpath filter applied in the core item fetch pipeline.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts Keeps agent-instructions items visible even when workspaceSubpaths filtering would otherwise hide workspace-root instruction files.

Copilot's findings

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

The sessions AI customization tree view and overview were only calling
listPromptFiles(PromptsType.instructions) to discover instruction files.
However, AGENTS.md (along with CLAUDE.md and copilot-instructions.md)
is classified as an agent type by getPromptFileType(), so it was never
returned by that call.

Fix by also calling listAgentInstructions() and merging the results
(deduplicating by URI), matching the pattern already used by the
workbench customization editor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@joshspicer joshspicer marked this pull request as ready for review April 6, 2026 02:15
@joshspicer joshspicer enabled auto-merge (squash) April 6, 2026 02:16
@joshspicer joshspicer merged commit 6c8fcf1 into main Apr 6, 2026
29 of 30 checks passed
@joshspicer joshspicer deleted the josh/agent-instructions-subpath-fix branch April 6, 2026 02:44
@vs-code-engineering vs-code-engineering bot added this to the 1.115.0 milestone Apr 6, 2026
yogeshwaran-c pushed a commit to yogeshwaran-c/vscode that referenced this pull request Apr 6, 2026
…ft#307937)

* fix: exempt agent instructions from workspace subpath filter

AGENTS.md, CLAUDE.md, and copilot-instructions.md live at the workspace
root by design. The CLI harness restricts items to workspaceSubpaths
(.github, .copilot, .agents, .claude) which filtered out these root-level
agent instruction files. Now items with groupKey 'agent-instructions' are
exempt from the subpath filter, matching the existing exemption for
instructionFileFilter patterns.

* sessions: include AGENTS.md in instructions listing

The sessions AI customization tree view and overview were only calling
listPromptFiles(PromptsType.instructions) to discover instruction files.
However, AGENTS.md (along with CLAUDE.md and copilot-instructions.md)
is classified as an agent type by getPromptFileType(), so it was never
returned by that call.

Fix by also calling listAgentInstructions() and merging the results
(deduplicating by URI), matching the pattern already used by the
workbench customization editor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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