Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,13 @@
- **验证方式**:覆盖 running/submission-pending 允许、ready/awaiting-prompt not-running、busy/unknown/disconnected 零写入、预取消零入队、control 后 observer 仍由真实终态完成;验证 Agent prompt 区分 `terminal_exec`、`terminal_control` 与取消按钮。
- **适用范围**:`crates/terminal/src/exec_supervisor/*`、`crates/terminal/src/ssh_backend.rs`、`crates/terminal_view/src/public_mcp.rs`、Public MCP terminal control 工具与 Agent prompt。

- **标题**:嵌套 shell 卡死 terminal_busy 用 reintegrate 注入恢复,不要尝试 Ctrl+C
- **触发信号**:用户在可见 SSH 终端里进入 `sudo -i`、`su` 等嵌套 shell 后,`terminal.exec` 持续报 busy,且 `terminal.control action=interrupt` 发过 ETX 仍不恢复;滚屏看是空闲 root 提示符,session state 正常 connected。
- **根因 / 约束**:shell integration 是登录时一次 eval 注入,不写 rc 文件,嵌套 shell 不继承;root shell 的提示符不再发 OSC 133/OSC 7,supervisor readiness 卡死在 `SubmissionPending`/`CommandRunning` 瞬态(cwd 也停在上报值)。ETX 对无集成 shell 无意义——空提示符上只回显 `^C` 重画提示符,不产生 OSC 事件,readiness 不会翻转;`on_input` 只在 `Ready` 态处理用户回车,手动按回车也救不回来。
- **正确做法**:`terminal.control action=reintegrate`(High 风险显式动作):actor 校验无 exec 在途且未断连(`ExecSupervisor::reintegrate_shell`,卡在瞬态 readiness 时放行),向 PTY 写 `runtime_shell_integration_command()`(幂等守卫已剥,root login shell 重置了环境变量,eval 必然生效)。注入后新提示符的 OSC `InputStart` 无条件把 readiness 翻回 Ready,状态机零改动自愈;Agent 等 1-2 秒后重试 exec。Busy 错误必须带 `BusyContext{readiness}` 富化文案引导 Agent 走 read→reintegrate→retry 链路,不要裸字符串。本地终端 reintegrate 返回 `terminal_control_unsupported`(本地集成形态不同,POSIX eval 注入体不适用),未来支持时在 local actor 接对应注入体。
- **验证方式**:`cargo test -p terminal --lib reintegrate`(门控 fail-closed、瞬态放行、端到端自愈、SSH actor 注入 contract、local Unsupported contract)+ `cargo test -p public_mcp --test terminal_control`(schema enum、parse、reintegrate 结果 readiness_before=null、未知 action 拒绝)+ 三 crate 全量回归与 clippy。
- **适用范围**:`crates/terminal/src/exec_supervisor/*`、`crates/terminal/src/ssh_backend.rs`、`crates/terminal/src/pty_backend.rs`、`crates/public_mcp/src/tools/terminal_control.rs`、Agent terminal 工具 prompt 与错误文案。

- **标题**:Agent Auto 模式不进行工具审批,High/Critical 也直接执行
- **触发信号**:Auto 模式下出现 `NeedUserInput` 工具确认卡,或 Agent→tool_runtime 映射仍把 high-risk policy 设为 `Ask`。
- **根因 / 约束**:`ToolExecutionMode::Auto` 表达用户已授权 Agent 自主执行当前暴露工具;风险等级仍用于展示、审计和 Manual 模式审批,但不能在 Auto 模式再次暂停。`ReadOnly` 仍通过工具暴露过滤保证只读,不能用 Auto 的放行规则扩大其工具集合。
Expand Down
58 changes: 29 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ edition = "2024"
# (`gpui_component`, `gpui_base`, `gpui_shell`, ...).
# navop 强制 gpui-fast:所有 gpui-kit 系 crate 统一带 features = ["gpui-fast"],
# 经 feature 统一把整套 UI 栈切到 GPUI Fast 后端(外部 crate 名 gpui-fast-*)。
gpui-component = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8", features = ["gpui-fast"] }
gpui-component-assets = { package = "gpui-kit-assets", git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8", features = ["gpui-fast"] }
gpui-base = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8", features = ["gpui-fast"] }
gpui-shell = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8", features = ["gpui-fast"] }
gpui-component-shell = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8", features = ["gpui-fast"] }
gpui-component = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7", features = ["gpui-fast"] }
gpui-component-assets = { package = "gpui-kit-assets", git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7", features = ["gpui-fast"] }
gpui-base = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7", features = ["gpui-fast"] }
gpui-shell = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7", features = ["gpui-fast"] }
gpui-component-shell = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7", features = ["gpui-fast"] }
# gpui-webview(原 gpui-wry)强制 GPUI Fast;#3398 后它依赖
# gpui-pre-util =0.3.8 的版本要求与下面的 fork 快照天然一致(同一 snapshot 0.3.126)。
gpui-webview = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8" }
gpui-kit = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8", features = ["gpui-fast"] }
gpui-webview = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7" }
gpui-kit = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7", features = ["gpui-fast"] }

gpui = { package = "gpui-fast", version = "0.1" }
gpui_platform = { package = "gpui-fast-platform", version = "0.1", features = ["font-kit", "x11", "wayland", "runtime_shaders"] }
Expand Down Expand Up @@ -380,7 +380,7 @@ gpui-fast-windows = { git = "https://github.com/feigeCode/gpui-fast.git
# live in this root manifest: [patch] sections inside the gpui-component
# workspace are ignored by cargo. Mirrors the same entry in gpui-component's
# workspace root, pinned to the same revision as the gpui dependencies above.
rquickjs = { git = "https://github.com/feigeCode/gpui-kit", rev = "c7cb49390ca79dba018d7604f33fb87893c36ff8" }
rquickjs = { git = "https://github.com/feigeCode/gpui-kit", rev = "c43fe63395ce135cbc1a087e1d303318e0bcbfd7" }

# navop 全量 gpui-fast 后,整套 gpui-fast-* 都进编译图;同名源已在上面
# [patch.crates-io] 块内统一钉到 release/v0.1.5-navop.2,此处不再重复声明。
Expand Down
2 changes: 2 additions & 0 deletions crates/core/src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod repository;
pub mod row_mapping;
pub mod sftp_favorite_path;
pub mod sql_execution_history;
pub mod sql_library;
pub mod team_key_cache;
pub mod team_membership_cache;
pub mod terminal_command_history;
Expand Down Expand Up @@ -45,6 +46,7 @@ pub use rdp_settings::*;
pub use repository::*;
pub use sftp_favorite_path::*;
pub use sql_execution_history::*;
pub use sql_library::*;
pub use team_key_cache::*;
pub use team_membership_cache::*;
pub use terminal_command_history::*;
Expand Down
Loading
Loading