Skip to content

Recognize userPromptTransformed plugin hooks in Copilot sessions - #345068

Merged
Connor Peet (connor4312) merged 1 commit into
microsoft:mainfrom
wycats:wycats/user-prompt-transformed
Oct 30, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
microsoft:mainfrom
wycats:wycats/user-prompt-transformed

Conversation

@wycats

Copy link
Copy Markdown
Contributor

Why

An Agent Plugin whose only contribution is a userPromptTransformed hook appears enabled in VS Code, but never reaches Copilot. Adding an unrelated sessionStart hook makes the same prompt-transform hook run.

The platform parser drops the event, and the workbench also filters it out of the recognized hook types. With no recognized contributions left, VS Code skips forwarding the plugin to the agent host.

This recognizes userPromptTransformed through both layers and adds its SDK adapter. Successive commands receive the previous command's transformed prompt and return modifiedTransformedPrompt to Copilot. The original submitted prompt stays unchanged. Hook availability remains specific to Copilot.

Testing

Regression tests cover discovery and forwarding of a plugin containing only this hook, prompt replacement, sequential transformations, empty replacements, failed commands, and isolation between messages. The affected Node and workbench suites pass (491 tests), along with client typechecking and targeted lint.

The original failure and the sessionStart workaround were reproduced in installed VS Code 1.144.0. The patched source has been validated through the build and tests above; it has not yet been exercised in an interactive Copilot session.

To check in Copilot, install an Agent Plugin with only com.github.copilot/hooks/hooks.json contributing userPromptTransformed. Have its command append a recognizable marker to transformedPrompt and return it as modifiedTransformedPrompt. Start a fresh Copilot session and verify the command runs and the model receives the marker without adding a sessionStart hook or a skill.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the hook-discovery and prompt-transformation changes, though interactive Copilot validation remains outstanding.

No open issues 🎉

What changed in this PR

Fixes discovery and forwarding of Agent Plugins that contribute only userPromptTransformed, connecting platform parsing, workbench recognition, and Copilot SDK execution.

Changes:

  • Recognizes the hook across shared types and parsers while keeping availability Copilot-specific.
  • Adds sequential prompt transformations that preserve the original submitted prompt.
  • Adds regression coverage for discovery, forwarding, replacement handling, failed commands, and isolation between messages.

Interactive Copilot validation remains outstanding, as noted in the PR description.

File Description
src/​vscode-dts/​vscode.proposed.chatHooks.d.ts Adds the hook to the proposed API type.
src/​vs/​workbench/​contrib/​chat/​test/​common/​promptSyntax/​hookCompatibility.test.ts Tests Copilot-specific recognition and aliases.
src/​vs/​workbench/​contrib/​chat/​test/​common/​plugins/​agentPluginFormatDetection.test.ts Tests discovery of a transform-only plugin.
src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​resolveCustomizationRefs.test.ts Tests forwarding without prompt-file contributions.
src/​vs/​workbench/​contrib/​chat/​common/​promptSyntax/​hookTypes.ts Registers the hook, metadata, and Copilot alias.
src/​vs/​platform/​agentPlugins/​test/​common/​pluginParsers.test.ts Tests parsing a transform-only hook file.
src/​vs/​platform/​agentPlugins/​common/​pluginParsers.ts Recognizes canonical and Copilot hook names.
src/​vs/​platform/​agentHost/​test/​node/​copilotPluginConverters.test.ts Tests transformation sequencing and output handling.
src/​vs/​platform/​agentHost/​node/​copilot/​copilotPluginConverters.ts Adds the SDK adapter and chains transformed prompts.

Review effort: Balanced

@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) October 30, 2026 15:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain for the changes enabling Copilot to discover and forward prompt-transform-only Agent Plugins.

No open issues 🎉

Review effort: Balanced

@connor4312
Connor Peet (connor4312) merged commit 22bc1ae into microsoft:main Oct 30, 2026
55 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants