Skip to content

Background agents are cancelled when a new user turn emits user.abort #4127

Description

@scotttesler

Describe the bug

Submitting a new user turn can send notifications/copilot -> user.abort to the active turn and cancel background subagents launched by that turn. The agents then appear as cancelled in the background-agent list, and their IDs later become unreadable after the aborted turn is garbage-collected.

This prevents the intended orchestration workflow where long-running background agents continue working while the user asks unrelated questions in the main session.

Affected version

GitHub Copilot CLI 1.0.71-1

Steps to reproduce the behavior

  1. Start two or more native task agents in background mode for long-running work.
  2. Confirm that the agents are running.
  3. Submit another user message to the main session while the agents are still running.
  4. Inspect the background-agent list.
  5. Observe that agents associated with the previous turn are marked cancelled; after turn cleanup, reading their IDs can return Agent not found.

The behavior reproduced in two separate waves in one session. Repository worktrees and partial edits survived, but the agents had to be relaunched manually with reconstructed context.

Expected behavior

Per Steering agents in GitHub Copilot CLI, a new user message should steer the active task rather than implicitly trigger a full abort.

Background agents should continue running unless the new instruction explicitly cancels them or makes their assigned work obsolete. Unrelated background work should survive the new parent turn and remain readable.

If the CLI cannot preserve background agents across a new user turn, it should warn before submission that the message will cancel them and retain a resumable checkpoint for each cancelled agent.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agentsarea:sessionsSession management, resume, history, session picker, and session state

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions