-
Notifications
You must be signed in to change notification settings - Fork 1.3k
sessionStart and sessionEnd hooks fire per-prompt instead of per-session in interactive mode #991
Copy link
Copy link
Open
Labels
area:sessionsSession management, resume, history, session picker, and session stateSession management, resume, history, session picker, and session state
Description
Describe the bug
In interactive mode, sessionStart and sessionEnd hooks are triggered for each prompt/response cycle, not when the interactive session actually starts and ends. According to the documentation, these hooks should execute "when a new agent session begins" and "when the agent session completes or is terminated."
Affected version
0.0.383
Steps to reproduce the behavior
- Create hooks.json with sessionStart and sessionEnd hooks that log to a file
- Start Copilot CLI in interactive mode: copilot
- Submit a prompt (e.g., "Display the current time")
- Check the log file - observe sessionStart and sessionEnd entries
- Submit another prompt within the same interactive session
- Check the log file again - observe additional sessionStart and sessionEnd entries
Expected behavior
- sessionStart should fire once when the interactive session begins (copilot command executed)
- sessionEnd should fire once when the interactive session ends (user exits with /exit or Ctrl+D)
- For per-prompt logging, userPromptSubmitted hook should be used instead
Additional context
- Operating system: Linux
- CPU architecture: x86_64
- Shell: zsh
{
"version": 1,
"hooks": {
"sessionStart": [{"type": "command", "bash": ".github/hooks/scripts/session-start.sh"}],
"sessionEnd": [{"type": "command", "bash": ".github/hooks/scripts/session-end.sh"}]
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:sessionsSession management, resume, history, session picker, and session stateSession management, resume, history, session picker, and session state
Type
Fields
Give feedbackNo fields configured for Bug.