Skip to content

Cancel active request when archiving a chat session#302162

Merged
bpasero merged 4 commits intomainfrom
copilot/stop-clear-session-when-archiving
Mar 16, 2026
Merged

Cancel active request when archiving a chat session#302162
bpasero merged 4 commits intomainfrom
copilot/stop-clear-session-when-archiving

Conversation

Copy link
Contributor

Copilot AI commented Mar 16, 2026

fix #280422

Archiving a running agent session left the request executing in the background. Now, archiving a session automatically cancels its active request.

  • Inject IChatService into AgentSessionsService and call cancelCurrentRequestForSession when onDidChangeSessionArchivedState fires with isArchived() === true
  • Centralized in the service layer so all archive paths (single archive, archive-all, archive-section, /clear slash command, delegation) get cancellation for free

Copilot AI and others added 2 commits March 16, 2026 14:42
Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com>
Copilot AI linked an issue Mar 16, 2026 that may be closed by this pull request
@bpasero bpasero added this to the 1.113.0 milestone Mar 16, 2026
@bpasero bpasero marked this pull request as ready for review March 16, 2026 18:49
Copilot AI review requested due to automatic review settings March 16, 2026 18:49
@bpasero bpasero enabled auto-merge (squash) March 16, 2026 18:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures that archiving an agent chat session also cancels any active in-flight chat request, preventing background execution after a session is archived.

Changes:

  • Inject IChatService into AgentSessionsService.
  • Hook onDidChangeSessionArchivedState to cancel the current request when a session becomes archived.

bpasero and others added 2 commits March 16, 2026 19:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@roblourens
Copy link
Member

Nice

@bpasero bpasero merged commit 7fb8d54 into main Mar 16, 2026
30 of 31 checks passed
@bpasero bpasero deleted the copilot/stop-clear-session-when-archiving branch March 16, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent sessions: stop and clear running session when archiving

4 participants