Skip to content

CM-64462: add GitHub Copilot (VS Code) support to AI guardrails#498

Merged
Ilanlido merged 5 commits into
mainfrom
CM-64462-copilot-hooks
Jul 20, 2026
Merged

CM-64462: add GitHub Copilot (VS Code) support to AI guardrails#498
Ilanlido merged 5 commits into
mainfrom
CM-64462-copilot-hooks

Conversation

@Ilanlido

Copy link
Copy Markdown
Collaborator

New copilot IDE integration: hooks install to ~/.copilot/hooks/cycode.json (Copilot-native format, also read by Copilot CLI and the cloud coding agent), scan parsing for the VS Code payload dialect (prompt / read_file / MCP tools), session context with MCP config and plugin inventory from all three plugin sources (CLI registry, VS Code registry, chat.pluginLocations).

Copilot hooks have no matchers, so the no-handler fast path in scan_command now resolves before any policy/client work, and unmatched tools return a neutral {} that leaves VS Code's own permission flow intact.

MCP tool names arrive as mcp__ where the prefix derives from the server's self-reported handshake name; known config names (incl. plugin servers) match via normalized variants, anything else reports the unsplit remainder rather than a guessed split.

Also: claude-code payload matching now requires transcript_path (VS Code Copilot sends near-identical payloads without it), and cursor/codex report mode no longer appends the shell '&' on Windows where nothing detaches safely (cmd no-op, PowerShell parse error).

New copilot IDE integration: hooks install to ~/.copilot/hooks/cycode.json
(Copilot-native format, also read by Copilot CLI and the cloud coding agent),
scan parsing for the VS Code payload dialect (prompt / read_file / MCP tools),
session context with MCP config and plugin inventory from all three plugin
sources (CLI registry, VS Code registry, chat.pluginLocations).

Copilot hooks have no matchers, so the no-handler fast path in scan_command
now resolves before any policy/client work, and unmatched tools return a
neutral {} that leaves VS Code's own permission flow intact.

MCP tool names arrive as mcp_<prefix>_<tool> where the prefix derives from
the server's self-reported handshake name; known config names (incl. plugin
servers) match via normalized variants, anything else reports the unsplit
remainder rather than a guessed split.

Also: claude-code payload matching now requires transcript_path (VS Code
Copilot sends near-identical payloads without it), and cursor/codex report
mode no longer appends the shell '&' on Windows where nothing detaches
safely (cmd no-op, PowerShell parse error).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

Ilanlido and others added 4 commits July 19, 2026 14:17
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A module-level Path.home() constant binds its filesystem accessor at import
on py<=3.10, bypassing fake filesystems in tests and ignoring home changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
url2pathname handles drive-letter file URIs (file:///C:/...) that a bare
urlparse().path mangles with a leading slash; also build the pluginLocations
test fixture with json.dumps so Windows path separators are escaped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot's bash hook field runs under bash, which reattaches a backgrounded
command's stdin to /dev/null (POSIX behavior with job control off) - the scan
read an empty payload and silently no-oped without reaching the backend.
An explicit <&0 disables that default and keeps the payload flowing.

Cursor/Codex keep the bare '&' - their runners were verified to deliver
stdin to backgrounded scans (zsh keeps it; bash/sh do not).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Ilanlido
Ilanlido merged commit 2d82352 into main Jul 20, 2026
28 checks passed
@Ilanlido
Ilanlido deleted the CM-64462-copilot-hooks branch July 20, 2026 07:42
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.

2 participants