-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Describe the bug
When a CLI extension registers hooks via joinSession (e.g., onPreToolUse, onPostToolUse), the hooks previously defined in hooks.json stop firing. The extension hooks appear to replace/override the hooks.json pipeline rather than composing with it.
Expected: Extension hooks and hooks.json hooks should both run — extensions should layer on top of existing hooks, not replace them.
Actual: Once an extension with joinSession hooks is loaded, the hooks defined in hooks.json are no longer honored.
Affected version
GitHub Copilot CLI 1.0.5
Steps to reproduce the behavior
- Create a
hooks.json(or.github/hooks/hooks.json) with a hook — e.g., anonPreToolUsehook that logs or blocks a specific command. - Verify the hook fires as expected (it should).
- Create a CLI extension in
.github/extensions/that callsjoinSessionwith its own hooks (e.g.,onPreToolUseoronPostToolUse). - Start a new Copilot CLI session so the extension loads.
- Trigger the same action that would fire the hooks.json hook.
- Observe: The hooks.json hook no longer fires. Only the extension's hooks run.
Expected behavior
Both the hooks.json hooks and the extension hooks should fire. Extensions should compose with existing hooks rather than replacing them. The hook pipeline should be additive — an extension registering onPreToolUse should not prevent a hooks.json onPreToolUse from also executing.
Additional context
- This is consistently reproducible.
- Reported via the GitHub Copilot at Microsoft Teams channel.
- Related (but different): Custom agents with builtin agent names are silently ignored #1528 covers custom agents with builtin names being silently ignored — this issue is specifically about extension hooks overriding hooks.json hooks.