fix(bash): wake foreground task after auto-backgrounding
## Bug 详情 用户升级 4.0.16 后,使用过程中 CLI 会话可能一直处于 busy 状态,表现为无法继续输入且没有响应。 ## 根因 BashTool 的长命令在已经注册为 foreground task 后被自动后台化时,只设置了 backgroundShellId,但没有唤醒正在等待 progress/result 的 generator。若命令无输出或轮询没有再次触发,主 REPL 会继续等待,输入循环无法释放。 ## 修复方案 在 foreground task 自动后台化成功后,立即 resolve 当前 progress 等待器,让 runShellCommand 能观察到 backgroundShellId 并返回后台任务结果。 ## 变更要点 - 在 BashTool foreground auto-background 路径补齐 resolveProgress 唤醒逻辑 - 保持已有 spawnBackgroundTask 路径的唤醒行为一致 ## 自测 - bun test packages/builtin-tools/src/tools/BashTool/__tests__ 通过 - bun run typecheck 当前仍有仓库既有无关错误,未涉及本次变更
This commit is contained in:
parent
60856a29bc
commit
1a85db7ca8
|
|
@ -1094,6 +1094,11 @@ async function* runShellCommand({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
backgroundShellId = foregroundTaskId;
|
backgroundShellId = foregroundTaskId;
|
||||||
|
const resolve = resolveProgress;
|
||||||
|
if (resolve) {
|
||||||
|
resolveProgress = null;
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
logEvent(eventName, {
|
logEvent(eventName, {
|
||||||
command_type: getCommandTypeForLogging(command),
|
command_type: getCommandTypeForLogging(command),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user