microsoft / microsoft/vscode

GitHub Copilot: camelCase subagentStart hook is silently ignored

Open
#335,244 2 comments 1 reaction 1 assignee Claimed by @lszomoru View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

## Description

In VS Code's native GitHub Copilot Chat extension, a GitHub Copilot hook using the documented camelCase event name `subagentStart` is silently ignored. The same hook works when its event name is changed to `SubagentStart`.

This is inconsistent with the GitHub Copilot hooks reference, which documents `subagentStart` as the event name. It is also inconsistent with other local Copilot surfaces: Copilot CLI and the VS Code Agents View accept both casings in my testing.

## Reproduction

1. In a workspace, configure a native GitHub Copilot hook in `.github/hooks/*.json` for `subagentStart`.
2. Enable `.github/hooks` as a hook location in VS Code's User settings.
3. Start a Copilot Chat session and delegate to a subagent.
4. Observe that the subagent runs but the hook command never executes; the Copilot Chat Hooks log contains no entry for it.
5. Change only the event key from `subagentStart` to `SubagentStart`.
6. Repeat step 3. The hook executes and its `additionalContext` reaches the subagent model.

## Expected behavior

The documented `subagentStart` event should be accepted, or VS Code should report an actionable validation error when it is not.

## Source-level cause

At commit `3e33b2105fb6e7feb2c2108c9074f66fac0b60f5`, the GitHub Copilot hook-name mapping omits `subagentStart` even though `vscode.ChatHookType.SubagentStart` exists:

- `HOOKS_BY_TARGET[Target.GitHubCopilot]` in `src/vs/workbench/contrib/chat/common/promptSyntax/hookTypes.ts`
- `HOOK_TYPE_MAP` in `src/vs/platform/agentPlugins/common/pluginParsers.ts`

`parseHooksJson` silently skips an unrecognized hook key. The second mapping has the same omission. Adding `subagentStart` → `SubagentStart` to both maps should restore the documented behavior.

The same source-level gap exists for `preCompact` / `PreCompact`; I have not separately executed a `preCompact` reproduction.

## Environment

- VS Code 1.136.1
- GitHub Copilot Chat 0.64.1
- Windows 11

References:
- https://docs.github.com/en/copilot/reference/hooks-reference
- https://github.com/microsoft/vscode/blob/3e33b2105fb6e7feb2c2108c9074f66fac0b60f5/src/vs/workbench/contrib/chat/common/promptSyntax/hookTypes.ts#L36-L45
- https://github.com/microsoft/vscode/blob/3e33b2105fb6e7feb2c2108c9074f66fac0b60f5/src/vs/platform/agentPlugins/common/pluginParsers.ts#L635-L654

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.