github / github/copilot-cli

ctrl+x → b  fails to background/interrupt a blocking  read_bash  call (no escape hatch when polling an async command)

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

描述

### Describe the bug

ctrl+x → b  ("move current task to background") does not work when the agent is blocked inside a  read_bash  call with a nonzero  delay , even though the underlying shell command was already started with  mode: "async" .

Repro: agent runs  bash { command, mode: "async" }  to start a long command, then calls  read_bash { shellId, delay: 150 }  to wait on it. Pressing  ctrl+x → b  during that 150s wait returns "No running sync task to move to background." There is no way to interrupt or background this — the session appears frozen with no escape hatch, which is worse than a plain  mode: "sync"  call (which presumably is backgroundable via the same keybind).

Expected:  ctrl+x → b  should also detect and background/interrupt a blocking  read_bash  (or any tool call) that's been running past some threshold, not just a live  bash mode=sync  invocation.

### Affected version

GitHub Copilot CLI 1.0.70.

### Steps to reproduce the behavior

1. Start a Copilot CLI session.
2. Have the agent run a shell command in background mode, e.g. equivalent of:
bash { command: "sleep 150", mode: "async" }
``` This returns a `shellId` immediately (command is now running detached in the background). ```
3. Immediately have the agent call:
read_bash { shellId: , delay: 150 }
``` This blocks the agent's tool call — and the interactive session — for the full 150 seconds while it waits to read output. ```
4. While that  read_bash  call is still pending/blocking (i.e., before the 150s elapses and before the agent's turn produces any further output), press  ctrl+x → b  to try to move the current task to background.

### Expected behavior

The current task (the agent's blocked turn) is moved to background, session control returns to the user, and the job can be checked later via  /tasks .

### Additional context

Actual result: The keybind reports "No running sync task to move to background" — even though the session is visibly blocked/unresponsive for the full 150-second duration. There is no live, backgroundable "task" for the CLI to detect, because the underlying shell command ( sleep 150 ) was already async — only the agent's read_bash  wait is blocking, and that isn't recognized as a task the keybind can act on.

Additional note: This was verified in contrast to a (not yet independently confirmed, but documented-as-working) genuine  bash mode="sync"  call — the bug is specific to the  read_bash -poll blocking pattern, which is the more dangerous case since it currently has no user-facing escape hatch at all.

贡献指南

打开贡献指南

调研方向

从 ctrl+x → b 键绑定处理开始,跟踪它如何识别正在运行的任务;然后跟进 read_bash 路径,检查 bash mode="async" 返回 shellId 后的非零 delay。使用 sleep 150 和 delay 150 重现。当被阻塞的 turn 可以移到后台、控制权返回,并且它出现在 /tasks 下且不再出现当前错误时,即完成。

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

评估

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

把新 issue 发到你的邮箱

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