github / github/copilot-cli

list_agents returns empty while background agents are still visibly running in UI

未关闭
#3,514 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area:agents area:context-memory area:tools
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

## Bug: `list_agents` shows no agents while tasks are still active in UI

### Description
When multiple background agents are launched during a session, calling `list_agents` returns `` even though the user can see 7 active agents in the Copilot CLI tasks UI. The assistant incorrectly concludes "no agents running" and calls `task_complete`, while agents are still executing in the background.

### Steps to Reproduce
1. Start a Copilot CLI session
2. During a complex review task, background agents are launched (e.g., `explore` agents for parallel codebase investigation)
3. After the main analysis completes, call `list_agents`
4. `list_agents` returns ``
5. Meanwhile, the user sees 7 active tasks in the UI task list

### Expected Behavior
`list_agents` should return all currently running background agents, matching what the user sees in the UI.

### Actual Behavior
`list_agents` returns empty (``) while the UI shows 7 active agents still running. The assistant has no way to detect or stop these orphaned agents.

### Impact
- Assistant cannot detect running agents → cannot stop them
- Assistant incorrectly reports "no agents running" to the user
- Orphaned agents consume resources silently
- User has to manually identify and stop stale agents
- Breaks the HITL trust model — assistant says one thing, UI shows another

### Environment
- Copilot CLI version: 1.0.54
- Model: Claude Opus 4.6
- OS: macOS (Darwin)

### Additional Context
The agents were likely launched in a previous checkpoint/compaction cycle. After context compaction, the agent IDs may have been lost from the conversation context, making them invisible to `list_agents` but still running in the runtime.

贡献指南

打开贡献指南

调研方向

首先,在包含多个后台代理的 Copilot CLI 会话中重现该问题,然后在主分析完成后,将 list_agents 与 UI 中可见的任务列表进行比较。完成的标准是 list_agents 报告所有当前正在运行的代理,并提供足够的信息来停止它们,包括在上下文压缩之前启动的代理。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。