Skip to content

feat(guard): add process guard facade and unified sandbox configuration draft - #334

Open
tardisblue9 wants to merge 4 commits into
openJiuwen-ai:mainfrom
tardisblue9:pr1-guard
Open

tardisblue9 wants to merge 4 commits into
openJiuwen-ai:mainfrom
tardisblue9:pr1-guard

Conversation

@tardisblue9

@tardisblue9 tardisblue9 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Paired: GitHub #334 ↔ GitCode !232

Summary

This PR adds the optional process-guard facade and its core call sites, preserving the eight review fixes below. It also proposes a common configuration layer for the process guard and the jiuwenbox work in #223 / #341, with an executable, independently tested initial configuration and capability contract.

The design proposal describes the intended integration. The initial implementation and adapter example distinguish implemented behavior from later work.

The new common layer is not wired into production startup, Shell, guard, TUI or ACP. Its schema and Python interfaces are review-stage contracts, not supported application settings. Existing runtime behavior and the eight fixes are retained. There are no real backend adapters, legacy migration, settings-loader registration, public CLI/environment names or kernel-enforcement acceptance in this draft. The process implementation remains in PR2, which waits for PR1 to merge; this PR does not modify #341's branch.

Initial common layer

  • Pure parsing of a versioned sandbox section with named profiles. Callers supply already-read inputs; only trusted user settings define profiles. Extracted user < environment < CLI selections preserve per-field provenance. Workdir input cannot alter the versioned policy.
  • Explicit schemas for process and jiuwenbox options, including safe diagnostics and mandatory network capabilities implied by guarded/offline selection. Unselected backend options remain opaque; configuration cannot load arbitrary Python modules.
  • Separate supported, available and enforced capability reports with scope-qualified requirements. A preflight probe cannot claim activation; mandatory requirements cannot be bypassed by warn, and no backend/host fallback is performed.
  • An injected preflight-only adapter seam and executable example. Fake probes in tests establish contract behavior, not actual confinement. Lifecycle and execution adapters remain a follow-up design decision.

Relative to the previous PR head combined with current main, this milestone adds nine files (843 lines) and modifies none of the existing runtime, test, dependency or workflow files. The original proposal document is retained unchanged. The current head incorporates main 350290f3 and the exact additions tested in the fork.

Existing implementation and review fixes

When no sandbox is requested, core guard hooks remain inert. The existing facade resolves startup policy, loads the expected distribution's entry point and supplies approval, workspace, subprocess, lifetime, rollback and TUI integration points. Named workspaces resolve before confinement; grants retain their directory scope.

The eight findings on c14056b9 remain addressed:

  1. Preserve an enabled user's request and failure policy when workdir also requests protection.
  2. Reuse the settings boolean coercer for accepted enablement values.
  3. Forward sandbox switches from either side of serve to browser-session children, leaving the HTTP server unconfined.
  4. Show a core-owned persistent TUI warning when the optional package cannot supply an indicator.
  5. Carry effective sandbox choice and failure policy to forked windows with --sandbox-on-unavailable=refuse|warn.
  6. Preserve sandbox denial provenance and sandbox_denied result metadata through main-agent/sub-agent result and hook paths.
  7. Use cancellation-safe approval cleanup, including a second cancel while the real TUI queue lock is held.
  8. Keep ACP state within active | degraded | inactive, with requested: true for an unavailable requested sandbox.

User documentation, protocol documentation and Chinese translations accompany the existing facade. A working directory may request stricter protection but cannot weaken an enabled user request. Workdir-only requests may warn; explicit user requests refuse by default. These existing runtime rules remain separate from the new, unwired versioned-schema draft.

Validation

  • Formal head: eba0192a8e43144f9ec2eea7b116a0b283f0556d. Main tested: 350290f36a66c47f33cffa2fc45eb0274953b708. Initial contract commit: d9abbb7dabd2b01c9fd44676a00a314a293b296e.
  • New contract coverage: 66 cases. Local Smart Test: 75 passed; selected architecture checks: 399 passed. Existing PR1 focused regression selection: 68 passed, covering configuration/startup, serve, fork, warnings, denial provenance, repeated cancellation and ACP.
  • Local Ruff, formatting, Linux/macOS/Windows typing, wheel build and isolated installed-wheel checks passed. The documented adapter example executed. Negative controls broke mandatory refusal and source authority and made the corresponding tests fail; the probes were removed before acceptance. No new skips, timeout relaxations or exemptions were introduced.
  • Complete original-baseline fork CI: 20/20 jobs passed on attempt 1, no rerun, trial f012910e59c9d5dd3e7d4b0d5df8acbd053b93be.
  • Complete current-main-combination fork CI: 20/20 jobs passed on attempt 1, no rerun, trial db18977179c6714813d5ad1a53ea40c7287321b2. This includes full Linux/macOS/Windows test shards, architecture, lint, build and installed-wheel gates. The trial differs from the formal head only by the fork-only workflow entry that calls the existing full CI; that entry is not included in this PR.
  • Earlier official run 45971014731, for old head bdc92fa1, hit a Windows TUI teardown PermissionError reading session.json in test_the_same_content_lets_a_running_side_question_check_finish. Its precise cause is not established and no root-cause fix is claimed. The new current-main combination passed that Windows shard on its first attempt (3,492 passed / 41 skipped) with the relevant runtime and test paths unchanged. Initial failure evidence is retained.
  • Official GitHub/CLA/GitCode checks for this new head must complete separately; previous-head results are not treated as current acceptance.

Design review requested

For discussion with @0x7c13, @MichaelLing83 and @alanhungyl:

  • Is the versioned profile schema and trust/source policy suitable for both implementations?
  • Do the scoped capabilities accurately distinguish process/file-tool protection from jiuwenbox's Shell protection?
  • Which lifecycle and execution contracts should connect the common layer to PR2 and feat(sandbox): run shell commands in the vendored jiuwenbox engine, continuation of PR#223 #341, and who should own each adapter?
  • How should legacy migration, restart-required backend switching and startup-only warning compatibility be settled before runtime wiring?

The initial module has no dependency on #341. PR2 and a jiuwenbox adapter would depend on an agreed common contract when runtime integration begins. The proposed division of work is a request for agreement, not an assignment or commitment by other contributors. Composition of both mechanisms remains outside the first milestone.

中文说明

本轮在既有 PR1 和八项修复之上,新增统一配置层的可执行初稿:版本化配置、来源权限、后端选项校验、分作用域能力和预检接口,并附测试与接入示例。相对原 PR 与当前 main 的组合仅新增 9 个文件;没有修改原有生产路径或测试。

初稿尚未接入应用运行时,示例不是当前可直接使用的用户配置。 真实后端适配、旧配置迁移、设置加载器及 CLI/env 公共名称仍待评审。不会因提交本初稿改变现有 guard 行为;PR2 继续等待 PR1 合入,不改动 #341 作者分支。

两轮完整 fork CI 均首轮 20/20 通过,其中一轮验证当前 main 的完整组合;本地契约、既有功能回归、架构、静态检查和安装包验收见上方。旧 SHA 的 Windows 关闭阶段失败已保留证据,不把一次通过称为根因修复;新 SHA 的官方检查另行跟进。

请优先反馈公共配置和能力边界,以及 PR2 / jiuwenbox 接入的接口、分工和依赖顺序。

@openjiuwen-collaboration-bot

openjiuwen-collaboration-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

head_sha: 27fe466850a6b9a9296489cd179eab82857f8ab5

变更摘要

本 PR 为 iCode 引入可选“文件访问沙箱”的接入层:新增门面模块 chrys.foundation.guard,通过 chrys.runtime_guards 入口点按需加载独立的 icode-sandbox 发行包,并在决策为关闭或未安装时让所有钩子退化为空操作。围绕该门面,PR 在 CLI 启动、审批中间件、TUI、ACP 服务、MCP/ACP/Workflow 子进程启动、回滚以及进程组管理等调用点接入了守卫信息,同时新增 sandbox.* 配置项、审批复用选项与本地化文案。守卫本身(内核隔离实现)不在本次变更内。

主要改动

  • 新增守卫门面 guard: src/chrys/foundation/guard.py 定义 Decision、GuardStatus、Guard / ToolCallHost / ToolCalls 协议和默认空实现 _NoGuard,提供 decide、install_at_startup、strip_flags、status_line、status_report、installed、confined 等函数;仅在要求启用时校验入口点归属并加载插件,不可用时按 sandbox.on_unavailable 选择退出码 78 或降级启动。
  • CLI 与 TUI 启动接入: src/chrys/app/cli/app.py 新增 _enable_sandbox,在命令分发最前对 run/acp/workflow 等命令安装守卫并剥离 --sandbox/--no-sandbox,新增 icode sandbox 子命令分发;run.py、workflow.py 输出沙箱状态行;TUI 新增 SandboxIndicator 底栏指示与 F7 面板,设置页通过 shown_rows 仅在包已安装时展示沙箱行。
  • 审批与授权流程扩展: 审批中间件 ApprovalMiddleware 实现 ToolCallHost,process 改为先经 _guard_calls.run 再执行原审批流程,并新增 ask、refuse、user_messages 等;新增 SandboxAccessDenied 事件与轨迹类型 SANDBOX_ACCESS_DENIED;ReuseChoice 与 ApprovalReuseOffer.kind 扩展 EXACT_TURN、read_folder、write_folder,审批对话框与 ACP _request_permission 相应增加“本轮/本文件夹”授权选项。
  • 新增沙箱配置项与路径声明: Settings 增加 sandbox.enabled、sandbox.on_unavailable、sandbox.main.allow_paths、sandbox.commands.allow_paths、sandbox.commands.write_paths、sandbox.floor.extra、sandbox.audit.redact_paths,均为 Apply.RESTART;sandbox.enabled 的工作目录合并策略为 ENABLE_ONLY,其余为 DENY,并补充中英文 i18n 文案。
  • 子进程与进程树接入: 新增 link_process_session / _linked_session 及 process_group_alive,使信号、存活检测与停止检测可穿透沙箱代理进程到达真实命令;MCP stdio、ACP agent、workflow worker 启动均通过 guard.current().launching_configured(...) 声明可读写路径,MCPServerConfig 新增 read_paths/write_paths 字段;文件回滚在 session_scope 内执行,_open_posix_parent 在受限进程下从可打开的最深目录重启遍历。

@openjiuwen-collaboration-bot

openjiuwen-collaboration-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

head_sha: 27fe466850a6b9a9296489cd179eab82857f8ab5

代码审查

审查结论

  • [建议] src/chrys/app/tui/terminal/_pty_backend.py:90 fix: kill_posix_process 提前 return 可能跳过进程组 killpg
  • [建议] src/chrys/foundation/guard.py:286 fix: settings_doc swallows every error, silently failing open on the sandbox decision
类型 数量
🔴 阻塞 0
🟡 建议 2

💬 仅评论

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 27fe466850a6b9a9296489cd179eab82857f8ab5

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A


# Also reaches the command behind a sandbox stub (a linked session).
if kill_process_group(pid):
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head_sha: 27fe466850a6b9a9296489cd179eab82857f8ab5

🟡 Medium Priority

建议:不要用 kill_process_group 的结果短路掉 killpg:二者覆盖的集合不同(进程树 vs 进程组)。改成树杀之后仍然补一次 killpg(用 suppress 包住 ProcessLookupError/PermissionError/OSError),或仅在进程组确实不存在时跳过,保持原「整组必杀」的语义。

Suggested change
return
kill_process_group(pid)
try:
posix_os.killpg(pid, posix_signal.SIGKILL)
except ProcessLookupError, PermissionError, OSError:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. No change here: kill_process_group(pid) already sends that same os.killpg(pid, SIGKILL) to the whole group (after also reaching the command behind a sandbox stub, when there is one), and returns True only when that killpg succeeded. When it returns False, the code continues with the original path unchanged: the same killpg, then the fallback to the leader. So the whole group is still always killed; nothing is skipped.

感谢。这里不改:kill_process_group(pid) 内部就会对整个进程组执行同一个 os.killpg(pid, SIGKILL)(有沙箱桩程序时还会先处理其背后的命令),只有这次 killpg 成功才返回 True。返回 False 时,代码照原来的路径继续:同样的 killpg,再回退到组长进程。所以整组仍然一定会被杀掉,没有跳过任何一步。

doc = read_yaml_doc_readonly(Path(os.path.realpath(path)) if owned else path) or {}
settings_edit(doc)
except Exception:
return {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head_sha: 27fe466850a6b9a9296489cd179eab82857f8ab5

🟡 Medium Priority

变更行:guard.py:286-293 的 settings_doc() 用 try: ... except Exception: return {} 包住了 import、read_yaml_doc_readonly、settings_edit 和整个 flatten 步骤,且不记录任何日志。

契约/影响:decide()(第 346-358 行)完全依赖这个 {} 来决定 sandbox.enabled、workdir.config_enabled 与 sandbox.on_unavailable;{} 意味着“用户没开沙箱、没设 on_unavailable”。

失效模式:用户在 settings.yaml 里写了 sandbox.enabled: true,但文件有一个 YAML 语法错误(或 settings_edit 在旧键名迁移上抛异常、或文档结构不是 dict 使 flatten 抛错),于是 doc == {},decision.enabled 保持默认 False、source == "default",install_at_startup 走 not decision.enabled 分支安装 _NoGuard()——iCode 在用户以为“沙箱已开”的情况下完全无沙箱启动,status_line() 也不打印任何东西(requested 为 False),既没有 WARNING 也没有退出。这正是本模块头部声称“It never runs a program outside a guard that is on”所禁止的 fail-open,且无日志无法事后发现。

建议:只吞掉“文件不存在/为空”的情况,对解析或旧键迁移失败向 stderr 输出一条明确警告(并把它计入 GuardStatus.reasons),避免坏掉的 settings.yaml 静默把沙箱关掉。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed. The user's own settings file is now read strictly: if it exists but can't be read or parsed, startup says which file and why (never its contents), and the reason is recorded in the sandbox status, instead of silently counting as "sandbox off". A missing or empty file is still no problem. A working directory's file is only ignored when broken: a repository must not be able to make iCode warn, just as it can't stop it from starting. Tests cover invalid YAML, a non-mapping document and non-UTF-8 bytes.

说得对,已修复。现在严格读取用户自己的设置文件:文件存在但读不出来或解析失败时,启动时会说明是哪个文件、为什么(不显示文件内容),并把原因记入沙箱状态,不再悄悄当作"沙箱关闭"。文件不存在或为空时照常处理。工作目录里的文件损坏时只忽略:仓库不能让 iCode 报警,就像它不能让 iCode 无法启动。测试覆盖了 YAML 语法错误、不是映射、不是 UTF-8 三种情况。

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

Warning

The PR label(s) can not be got!

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

Warning

The PR commit(s) can not be got!

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

Warning

The corresponding operation log is missing! please check it.

3 similar comments
@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

Warning

The corresponding operation log is missing! please check it.

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

Warning

The corresponding operation log is missing! please check it.

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 9d226fdb3a57d5126a9031f473ba929de02411f6

Warning

The corresponding operation log is missing! please check it.

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: c14056b973691453a3dfb0fc32c3db4f865937dc

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@0x7c13

0x7c13 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

在 PR #334 当前提交 c14056b 上确认了以下 8 个问题,建议合并前处理。

  1. 工作目录配置会把用户的「拒绝启动」降级成警告。 用户已在自己的设置里启用沙箱,并开启了工作目录配置。如果工作目录也启用沙箱,decide() 会把请求来源覆盖为 workdir。沙箱不可用时,本应以退出码 78 拒绝启动,实际却告警后继续运行。建议保留用户级请求及其失败策略,仅在工作目录是唯一请求来源时允许降级。guard.py:379
  2. 启动层会静默忽略设置加载器接受的启用值。 本地验证了 sandbox.files.enabled: 1 和带首尾空格的 " true "。正常设置加载器将两者都读为启用,启动层却跳过沙箱初始化,也没有告警。建议复用现有的 bool_coercer()。guard.py:274
  3. icode serve --sandbox 会静默丢弃显式沙箱参数。 该选项被 CLI 接受后剥离,浏览器会话子进程没有收到它。把选项放在 serve 前面则会触发父进程初始化沙箱,缺包时退出 78。建议统一两种顺序,明确把选项传给会话子进程,或返回参数错误。app.py:244
  4. 沙箱不可用时,进入 TUI 后看不到持续警告。 降级启动会向 stderr 打印警告,但实际渲染的底栏没有 PR 承诺的 Sandbox NOT active。建议由核心 TUI 根据 guard 状态显示警告,使沙箱包缺失时也能提示用户。screen.py:1330
  5. 告警后能打开父窗口,却无法打开分叉窗口。 仅由工作目录请求沙箱且沙箱不可用时,父窗口会按设计告警后启动。分叉窗口的启动器却追加了显式 --sandbox,实测子进程退出 78。建议传递请求来源和失败策略,保留工作目录请求的降级行为。launcher.py:113
  6. 沙箱拒绝会被记录成用户拒绝。 refuse() 写入了 sandbox 来源,但结果转换时会丢弃该值,最终记录为 user_rejected 和 approval_rejected,after_tool_call hook 也收不到拒绝来源。建议保留独立的沙箱拒绝来源和错误类型。approval.py:374
  7. 连续取消会留下已经失效的沙箱审批弹窗。 用真实的 TUI 审批队列控制器复现了这个时序。第一次取消开始撤回审批,第二次取消在撤回等待队列锁时将其打断,后台请求已结束,弹窗仍留在队列中。建议复用普通审批已有的 _publish_abandoned() 清理路径。approval.py:409
  8. ACP 降级状态超出了协议文档定义的枚举。 实际 initialize 响应在请求了沙箱但降级启动时返回 requested-not-active,文档只列出 active、degraded 和 inactive。按文档枚举解析的客户端会收到未知值。建议返回 state: inactive 和 requested: true,或将实际状态补进协议文档并加测试。guard.py:259

Preserve user startup policy across workdir settings, browser sessions and
forked windows. Show unavailable status without the optional package, retain
sandbox denial metadata, and retract abandoned approvals safely.
@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: f32008e8ae8a7ae48157db82cada7c1b9cc827e3

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@tardisblue9

Copy link
Copy Markdown
Contributor Author

@0x7c13 感谢详细审查。这 8 项问题已在新提交 f32008e8ae8a7ae48157db82cada7c1b9cc827e3 中处理,并已合入最新 main(3930a4f8):

  1. 启动策略优先级:工作目录请求不再覆盖已启用的用户级请求及失败策略;只有工作目录是唯一请求来源时,才采用默认告警降级行为。
  2. 布尔值解析:启动配置复用 bool_coercer(),与设置加载器一致处理 1、带空格的 true 等值。
  3. serve 参数传递:统一 serve 前后的沙箱参数,传递给浏览器会话子进程,由会话进程初始化沙箱。
  4. 持续告警:包缺失时由核心 TUI 显示持续的沙箱未激活警告,并提供原因提示与中英文文案。
  5. 分叉窗口:通过 --sandbox-on-unavailable=refuse|warn 传递父窗口的有效失败策略,保留工作目录单独请求时的降级行为,也防止子环境弱化拒绝策略。
  6. 拒绝来源:工具结果与主/子代理 after_tool_call hook 保留 sandbox 来源,错误类型为 sandbox_denied,不再记为 user_rejected。原有 approval_rejected 标志保留为执行前拦截的兼容标志。
  7. 连续取消:复用 _publish_abandoned() 清理路径,回归测试覆盖真实审批队列持锁时连续取消,确认已失效弹窗被撤回。
  8. ACP 状态:降级时返回 state: inactive、requested: true,保持协议约定的枚举。

验证情况:

  • 修复前复现了 16 个失败用例及 6 个通过的对照,修复后定向回归 33 项通过。
  • 最新 main 组合的完整非集成测试:41,545 passed、136 skipped、3 warnings;架构检查:1,348 passed、1 deselected,完整测试运行器退出码为 0。
  • Ruff、格式、三平台类型检查、国际化、锁文件、wheel 构建与隔离安装验证均通过;没有新增测试跳过或放宽超时、架构限制。
  • fork 跨平台 CI 20/20 项通过;试跑提交仅比正式候选多一个 fork 专用 CI 入口文件。
  • 针对本次 f32008e8 的 GitCode 回报 六项检查均 SUCCESS。发此回复时,官方 GitHub CI 的 Lint 与 CLA 已通过,架构及其他任务仍在运行或排队,尚未全部完成。

PR 说明、相关用户文档和协议文档也已同步更新。请帮忙复核,感谢!

@tardisblue9 tardisblue9 changed the title feat(guard): a facade for an optional process guard, and the call sites that consult it feat(guard): add process guard facade with unified sandbox design proposal Nov 27, 2026
@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: bdc92fa1832f3a16fff6b8d6fda7e26c2225e289

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@tardisblue9 tardisblue9 changed the title feat(guard): add process guard facade with unified sandbox design proposal feat(guard): add process guard facade and unified sandbox configuration draft Nov 27, 2026
@0x7c13

0x7c13 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator
  • [P2] 从其他目录恢复会话时,沙箱启动会漏读会话工作目录的设置。 用本地 mock 模型跑了真实的 icode run -s。恢复后的会话确实使用保存的工作目录,但 guard 在恢复前只检查了终端当前目录,漏掉了会话目录的启用设置,继续运行时也没有警告。应在启动 guard 前按会话恢复规则确定实际工作目录。app.py:206
  • [P2] CLI 测试泄漏全局启动决策,导致分叉测试随执行顺序失败。 工作区策略测试只恢复 _current,留下新加的 _launch_decision。分叉测试单跑通过,紧接该测试运行就会多出 --sandbox --sandbox-on-unavailable=warn 并失败。582 项组合测试中有 5 项因此失败。应在测试夹具中同时隔离这两项状态。test_app.py:661
    另外有四处已确认的行为问题。
  • CLI 帮助和列表命令会被沙箱启动拦住。 模拟沙箱包不可用时,icode run --help、icode --sandbox --version 和 icode workflow list 都退出 78。应在启动 guard 前识别帮助、版本和只读列表。workflow validate 会执行工作流顶层代码,应保留现有保护。app.py:257
  • 启动配置和设置界面的解析仍不一致。 设置加载器把带空格的 " warn " 读为 warn,启动层却按 refuse 处理。CHRYS_FILE_SANDBOX 填入非法值时,启动层也会静默忽略。建议共用解析逻辑并报告非法环境变量值。guard.py:417
  • 沙箱拒绝在 TUI 仍显示为普通工具错误。 结果和 hook 已保留正确的 sandbox_denied,但 TUI 的拒绝类型集合缺了这个值,实测显示状态为 error。rejection_metadata.py:31
  • ACP 能力发现文档仍和实际响应有出入。 上轮的状态枚举已修复。实测沙箱关闭时,initialize 仍会发布 sandbox 和 chrys/sandbox_denied。文档应明确客户端通过 requested 和 state 判断实际状态。frontend-api.md:66
    设计提案里最需要维护者拍板的是合入顺序。应明确 PR1 是否先发布 sandbox.files.* 并承诺后续兼容,还是等统一配置契约达成共识后再合入运行时代码。统一沙箱提案 §8

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: eba0192a8e43144f9ec2eea7b116a0b283f0556d

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants