github / github/copilot-cli

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

未關閉
#4,127 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:agents area:sessions
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### 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.

貢獻指南

開啟貢獻指南

研究方向

首先重現兩個或更多背景代理的工作流程,並檢查執行階段日誌,以尋找新使用者回合期間的 notifications/copilot user.abort 事件。追蹤該通知的處理和回合清理;完成的標準是無關的背景代理仍在執行且可讀取,或者在取消前收到警告和可恢復的檢查點。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
shell
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。