Skip to content

Use 'sessionTypes' to filter chat customizations in UI, 'when' only in promptsService#310999

Merged
aeschli merged 4 commits intomainfrom
aeschli/different-loon-316
Apr 17, 2026
Merged

Use 'sessionTypes' to filter chat customizations in UI, 'when' only in promptsService#310999
aeschli merged 4 commits intomainfrom
aeschli/different-loon-316

Conversation

@aeschli
Copy link
Copy Markdown
Contributor

@aeschli aeschli commented Apr 17, 2026

Fixes #311016

…n promptsService

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 17, 2026 13:23
@aeschli aeschli enabled auto-merge (squash) April 17, 2026 13:23
@aeschli aeschli self-assigned this Apr 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 17, 2026

Screenshot Changes

Base: 57d9b714 Current: e9e0e814

Changed (1)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after

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 reworks how chat prompt customizations are filtered by moving session-based filtering to sessionTypes (evaluated in UI/consumers) while moving when clause evaluation into PromptsService (evaluated during prompt file listing).

Changes:

  • Add optional when?: string to prompt file resource/proposed API types and propagate it through prompt file provider results.
  • Pass the current chat session type into ComputeAutomaticInstructions and switch instruction/skill/agent filtering from when expressions to sessionTypes.
  • Update UI filtering (mode picker, slash command completions), tests, and Copilot’s contributed prompt metadata to align with the new semantics.
Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts Adds when?: string to proposed ChatResource API shape.
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts Adds when?: string to provider resource type and introduces matchesSessionType helper.
src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.ts Propagates when from providers and filters extension prompt files by when inside PromptsService.
src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.ts Accepts current session type and filters instructions/skills/agents via sessionTypes.
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts Passes session type into ComputeAutomaticInstructions.
src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.ts Passes session type into ComputeAutomaticInstructions for subagent runs.
src/vs/workbench/contrib/chat/browser/widget/input/modePickerActionItem.ts Filters chat modes by sessionTypes using the current session’s type.
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts Filters prompt slash commands by sessionTypes instead of when.
src/vs/workbench/contrib/chat/common/chatModes.ts Persists/rehydrates sessionTypes in cached custom chat mode data.
src/vs/workbench/contrib/chat/test/common/promptSyntax/service/promptsService.test.ts Updates tests to assert when filtering now happens inside PromptsService.
src/vs/workbench/contrib/chat/test/common/promptSyntax/computeAutomaticInstructions.test.ts Updates tests to pass session type and validates session-type filtering behavior.
extensions/copilot/package.json Removes chatSessionType checks from when and uses sessionTypes for session scoping.

Copilot's findings

  • Files reviewed: 11/12 changed files
  • Comments generated: 2

aeschli and others added 2 commits April 17, 2026 15:45
Co-authored-by: Copilot <copilot@github.com>
roblourens
roblourens previously approved these changes Apr 17, 2026
Co-authored-by: Copilot <copilot@github.com>
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.

Copilot's findings

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

Comment on lines +551 to +554
const when = ContextKeyExpr.deserialize(file.when);
if (!when) {
this.logger.warn(`[getExtensionPromptFiles] Ignoring contributed prompt file with invalid when clause: ${file.when}`);
return false;
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

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

The warning for invalid when clauses doesn’t include any identifying info about the offending resource (e.g. URI / extension), and the message says “contributed” even though provider-supplied files are also filtered here. Including file.uri (and extension/provider id when available) would make this actionable when debugging invalid clauses from multiple sources.

Copilot uses AI. Check for mistakes.
@aeschli aeschli merged commit 9677ab2 into main Apr 17, 2026
31 checks passed
@aeschli aeschli deleted the aeschli/different-loon-316 branch April 17, 2026 16:25
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 17, 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.

Built in skills are not available

3 participants