github / github/copilot-cli

Autopilot background-task timeout exits active parent after subagent completes

未关闭
#4,628 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:agents area:non-interactive
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the bug

In autopilot mode, the 600-second background-task wait timeout terminates the
entire Copilot CLI process even after the background subagent has completed and
the parent agent has resumed work.

The timeout appears to start from when the parent first becomes idle.
It is not cancelled or reset when the background task completes.

The process exits with code 0, causing automation to treat the interrupted run
as successful.

Affected version

1.0.80

Steps to reproduce the behavior
  1. Start Copilot CLI in autopilot mode.
  2. Launch a background subagent that remains active for several minutes.
  3. Allow the parent agent to become idle while awaiting that subagent.
  4. Let the subagent complete before the configured COPILOT_TASK_WAIT_TIMEOUT_SECONDS deadline.
  5. Allow the parent to resume work.
  6. Original timer still fires and exits the entire process, even though the parent is active and the subagent has finished.

Observed timeline from one run:

06:07:40 - background subagent started
06:10:52 - parent became idle while waiting
06:19:12 - subagent completed; parent resumed
06:20:48 - parent was actively streaming an edit tool call
06:20:52 - exactly 600 seconds after the parent became idle, Copilot emitted:
"Timed out after 600s waiting for background tasks to finish; exiting.
Set COPILOT_TASK_WAIT_TIMEOUT_SECONDS to change the limit."

The process then returned exitCode: 0.
The in-progress edit was never executed.

Expected behavior

When a background-task timeout is reached, Copilot CLI should:

  1. Cancel only background tasks that are still running.
  2. Return control to the parent with a timeout notification.
  3. Cancel the wait timer when all background tasks complete.
  4. Not terminate an active parent because of a stale background-task timer.

If a session-level deadline intentionally terminates the process, it should be reported as a timeout with a nonzero exit status rather than successful completion.

Additional context

copilot-cli-timeout-redacted-logs.zip

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪 autopilot mode 中对 COPILOT_TASK_WAIT_TIMEOUT_SECONDS 的处理以及后台任务完成的生命周期。重现六步场景,验证 subagent 完成且父任务恢复后等待计时器是否会被取消,并检查任何有意触发的 session timeout 是否报告非零退出状态。

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

评估

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

把新 issue 发到你的邮箱

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