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
Hook event for turns that end by user abort (agentStop is skipped on Ctrl+C / Esc) #5075
Describe the feature or problem you'd like to solve
No hook fires when a turn ends because the user aborted it (Ctrl+C / Esc), so hook consumers cannot tell that the agent is idle again.
Proposed solution
agentStop is documented to fire only when the agent goes idle and "was not aborted or blocked by a rejected tool" (AgentStopHookInput in the SDK types). A turn that is aborted therefore produces userPromptSubmitted and then nothing. Anything that tracks the agent's state from hooks (status lines, notifications, dashboards, a "your agent finished" sound) keeps showing "working" forever after an abort.
Any of these would solve it:
fire agentStop for aborted turns too, with stopReason: "aborted" (and e.g. "tool_rejected" for the rejected-tool case), so existing handlers can filter on it; or
a separate event (e.g. agentAbort / turnEnd) that fires for every way a turn can end.
Today the only workaround we found is to watch the session's events.jsonl for an abort entry after the prompt reappears, which depends on an internal file format.
Example prompts or workflows
A user runs several Copilot sessions and gets a desktop notification when each one finishes or needs approval. They press Ctrl+C on one: it should show "idle", not "working".
A status-line script colours the prompt by agent state from hooks; after an abort it stays "busy".
A host that queues follow-up prompts sends the next one when the agent stops; after an abort the queue never drains.
Additional context
Copilot CLI 1.0.93 (measured first on 1.0.88), Windows 10 x64.
We hit this while integrating Copilot CLI into a desktop app that shows many agent sessions side by side (NeuroSquad); the rest of the lifecycle (userPromptSubmitted, agentStop, notification) maps cleanly.
Activity