Skip to content

feat(tui): agent Bash 超时自动后台化 + Windows 命令引号修复 + Ctrl+B 交互优化#114

Merged
cc-claws merged 3 commits into
mainfrom
fix/tui-bash-render-ghost
Jul 3, 2026
Merged

feat(tui): agent Bash 超时自动后台化 + Windows 命令引号修复 + Ctrl+B 交互优化#114
cc-claws merged 3 commits into
mainfrom
fix/tui-bash-render-ghost

Conversation

@cc-claws

@cc-claws cc-claws commented Jul 3, 2026

Copy link
Copy Markdown
Owner

$(cat <<'EOF'

cc-claws and others added 2 commits July 3, 2026 10:38
agent Bash 注册、后台化和退出会改变底部状态栏与工具块可见状态,Windows 终端偶发物理屏幕和 ratatui diff buffer 不同步,导致页面残影。新增一次性终端清屏重绘标记,只在 agent Bash 生命周期切换后触发。

修改内容:
- UiState 新增一次性终端清屏重绘标记
- shell_command.rs 在 agent Bash 注册、后台化和退出后请求清屏重绘
- main.rs 在 draw_app 渲染前消费标记并调用 Terminal::clear()
- shell_command_test.rs 覆盖 agent Bash 注册、后台化、退出三类状态切换

特性/影响:
- 只影响 agent Bash 工具路径,不改变 Read/Grep 等普通工具渲染
- 清屏只在状态切换后的下一帧触发,避免每帧全量重绘

Co-Authored-By: Codex gpt-5 <noreply@openai.com>
BashTool 超时时不再无条件杀进程,支持通过 auto_background_tx 通知 TUI
将仍在运行的前台任务自动转后台继续运行;同步修复 Windows cmd /C 使用
raw_arg 保留命令内层引号,解决带引号绝对路径命令失败的问题;Ctrl+B 后台化
后先聚焦底部 shell 入口而非直接打开面板,改善交互层级。

修改内容:
- AgentShellHandle 新增 background_rx / auto_background_tx 字段,BashTool
  通过 wait_for_shell_result 同时监听进程结果、手动后台化和超时三个信号
- terminal.rs 实现 ShellWaitResult 三路 select 等待,超时且宿主支持时发送
  auto_background_tx 并返回后台任务占位串而非 kill
- terminal_inline_executor.rs 不再 drop background_rx,留给 BashTool select
- process/mod.rs 移除 has_cmd_special_chars,改用 raw_arg 传递 cmd /C 命令
- agent_shell_executor.rs / shell_command.rs 新增 auto_background_rx 处理逻辑
- shortcuts.rs Ctrl+B 统一聚焦 background_tasks_bar_focused,Enter 才打开面板

特性/影响:
- TUI 场景下 BashTool 超时不再杀进程,进程转后台继续运行
- Windows 上带引号绝对路径的命令(如 python "D:/x.py")不再引号泄漏
- Ctrl+B 后台化流程从"直接打开面板"改为"先聚焦底部入口"

Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@cc-code>
@cc-claws cc-claws force-pushed the fix/tui-bash-render-ghost branch 2 times, most recently from 66d88b4 to 4ca5910 Compare July 3, 2026 04:06
移除 terminal.rs 中不再使用的 timeout 导入(已被 wait_for_shell_result
中的 tokio::time::sleep 替代),去掉三处 format_background_task_started
调用中 command 参数的多余 & 引用(command 本身已是 &str,&&str 触发
clippy::needless_borrow)。

修改内容:
- terminal.rs:13 移除 unused import timeout
- terminal.rs:450/466/474 去掉 &command 多余引用

Co-Authored-By: mimo-v2.5-pro <XiaomiMiMo@cc-code>
@cc-claws cc-claws force-pushed the fix/tui-bash-render-ghost branch from 4ca5910 to 7695bbc Compare July 3, 2026 04:10
@cc-claws cc-claws merged commit 25f17b5 into main Jul 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant