You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sessionStart and sessionEnd hooks fire per-prompt instead of per-session in interactive mode #991
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
Activity
ssfdre38 commentedon Jan 17, 2026
Solution Available: Session Lifecycle Plugin
I've built a plugin that provides proper session start/end tracking!
Plugin: session-lifecycle
Live now: https://github.com/barrersoftware/copilot-plugins-registry/tree/master/plugins/session-lifecycle
What it does:
onActualSessionStartfires once when session truly startsonActualSessionEndfires once when session truly endsHow to use
Example Output
For Developers
You can extend the plugin for custom session logic:
Why a plugin?
This is a workaround while the GitHub team works on fixing the hook behavior in the CLI. The plugin:
Testing
Would love feedback! Perfect for anyone building session analytics or needing proper lifecycle tracking.
Package: @barrersoftware/copilot-plugins
Registry: https://github.com/barrersoftware/copilot-plugins-registry
VildMedPap commentedon Mar 31, 2026
How on earth is this still not resolved?
demorgi commentedon Apr 7, 2026
Hey @stephentoub @andyfeller any timeline on this getting resolved?
stephentoub commentedon Apr 8, 2026
This should be fixed in the next copilot CLI build.
fix(desktop): solve #3330 — copilot CLI v1.0.22+ notifications broken
lar:///operator-surface.names.invariants