Background agents are cancelled when a new user turn emits user.abort
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
### 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](https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/steer-agents), 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
- macOS on Apple Silicon
- The cancellation was not caused by Computer Use interruption, model unavailability, agent duration limits, or session compaction.
- Runtime logs correlated both cancellation waves with explicit `user.abort` notifications.
- For comparison, equivalent workflows in the GitHub Copilot desktop app and OpenCode 1.17.15 preserve background tasks across ordinary new user messages. This is supporting behavioral context; the Copilot CLI steering documentation above remains the expected-contract basis.
- This is related to, but distinct from, https://github.com/github/copilot-cli/issues/3344: in this case the new turn proceeds, but prior background agents are cancelled.
- Partial filesystem work persisted, so relaunching agents was possible, but parent-side progress and agent conversation state were lost.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện workflow với hai hoặc nhiều background-agent và kiểm tra runtime logs để tìm các sự kiện notifications/copilot user.abort trong một lượt người dùng mới. Theo dõi việc xử lý thông báo đó và quá trình dọn dẹp lượt; hoàn tất khi các background-agent không liên quan vẫn tiếp tục chạy và có thể đọc được, hoặc nhận được cảnh báo cùng các checkpoint có thể tiếp tục trước khi bị hủy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- shell
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100