-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Describe the bug
When a session is resumed using --resume, hooks configured in .github/hooks/*.json are never loaded.
In the source code (index.js v0.0.411-1), createSession() calls loadHooks() to discover and register hook files from .github/hooks/. However, getSession() — which handles the --resume code path — does not call loadHooks(). This means any tool or wrapper that uses --resume will never trigger any configured hooks (sessionEnd, agentStop, etc.).
Affected version
GitHub Copilot CLI 0.0.411-1 (Windows_NT)
Steps to reproduce the behavior
- Install a hook via a
.github/hooks/*.jsonfile (e.g.toasty --install copilotcreates~/.github/hooks/toasty.jsonwith asessionEndhook). - Start Copilot CLI with
--resume <sessionId>. - Complete a session or trigger the hook event.
- Observe that the hook command is never executed.
Without --resume (fresh createSession path), the same hook file works correctly.
Expected behavior
getSession() should call loadHooks() (or equivalent) so that hooks from .github/hooks/*.json are loaded for resumed sessions, just as they are for new sessions.
Additional context
- Impact: Any wrapper that always passes
--resume(e.g. Agency / Microsoft Agent Platform) will never fire hooks. This completely breaks the hooks feature for those users. - Root cause location: In the minified
index.js,createSessioncontains a call tothis.loadHooks(e)whilegetSessionhas zero references toloadHooks,hooks, or the hook-loading helpers (B3t,Tee). - Hook file format is correct: The
.github/hooks/toasty.jsonfile validates against the zod schema (version: 1,hooks.sessionEndarray withtype: "command",powershell/bashfields,timeoutSec). - Hook file location is correct: Copilot CLI globs
<gitRoot>/.github/hooks/**/*.json(or<cwd>/.github/hooks/if not in a git repo). The file is at~/.github/hooks/toasty.json. - Verified across 5 Agency sessions that
--resumeis always passed, confirming hooks never load.
Reactions are currently unavailable