Repository navigation
fix(sandbox): BOTMUX_SANDBOX=0 不再关掉 bot 自己开的沙盒 - #2600
Merged
Merged
Conversation
env 只在取激活值(1/oncall/scratch)时强制所有 bot;未设、空、0、false 都按 bot 自己的 sandbox 配置走,非法值仍报错。文档写清优先级。 Fixes #2599 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 30, 2026 10:17
按复审意见: - identity-spawn-matrix 新增 cell 7:BOTMUX_SANDBOX=0 + sandbox:true + network:true → oncall 且 loopback 可达 → proven。旧实现在此格解析为 off、模型同为 proven,没有专属断言时回归不可见。 - identity-decision-report 文件头不再把 worker/frozen 分叉描述成 「BOTMUX_SANDBOX=0 forced the spawn off」(修复后该组合不可能 force off)。 - identity-decision-wiring 与 docs/execution-identity.md 的矩阵格数 同步为七格。 变异(解析器回退旧的非空短路):cell 6、cell 7 同时变红,其余 6 格绿。 Co-Authored-By: Claude Code <[email protected]>
This was referenced Oct 30, 2026
Owner
Author
|
合后核验(落地提交 42432fe):
未做:发版、部署。 补充:master 上包含本次改动的 0946357(#2615)CI run 41078884029 完整跑完,全部通过(build、test 1–4/4 与汇总 |
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 3400614…0946357b3(9 个提交),同批合入的还有 #2542 #2611 #2578 #2590 #2612 #2594 #2548 #2615,失败不一定由本 PR 引起。
|
This was referenced Oct 30, 2026
|
🚀 Released in v3.56.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
修 #2599:
BOTMUX_SANDBOX=0/false会把自己开了sandbox的 bot 的沙盒关掉,与resolveSandboxMode注释和docs/file-sandbox.md的描述相反。resolveSandboxMode(src/adapters/cli/sandbox-mode.ts)改成:BOTMUX_SANDBOX取激活值1/oncall/scratch→ 强制所有 bot 用该模式(不变);readIsolation: true→ oncall(不变);sandbox配置。未设、空、
0、false都是「不强制」,落到 2、3;其它取值仍报错拒绝启动(不变)。worker spawn、零注入/回复交付判定、默认 worktree 闸门、会话群标题等都走这一个解析器,一处修复全部生效。文档:
docs/file-sandbox.md、文档站sandbox.md(中英)写清优先级,说明这个环境变量只能全局强制开、不能全局关。对老用户的影响
BOTMUX_SANDBOX,或设成1/oncall/scratch的部署:行为不变。BOTMUX_SANDBOX=0/false的部署:自己开了sandbox(或旧readIsolation)的 bot,新会话会按配置进沙盒(以前被静默关掉)。没开沙盒的 bot 不受影响。这是修 bug,按文档本来就该如此;在不具备 bwrap 的机器上,这类 bot 新会话会像其它开了沙盒的 bot 一样报错拒绝启动,而不是无隔离运行。BOTMUX_SANDBOX,受益面和风险面都为零。测试
test/sandbox-mode.test.ts:0/false/ 空 / 未设 ×sandbox: true|oncall|scratch|false×readIsolation全组合;激活值仍强制;非法值仍抛错。修复前在 master 上复现失败(expected 'off' to be 'oncall'),修复后通过。test/reply-delivery.test.ts:原用例断言「BOTMUX_SANDBOX=0+ cfg scratch → 按 off 解析」,正是本 bug 的行为,改为按 scratch 解析(cursor 回落 send)。test/identity-spawn-matrix.test.ts:原 cell 1/5 靠BOTMUX_SANDBOX=0关掉sandbox:true,改为sandbox:off;新增 cell 6(BOTMUX_SANDBOX=0+sandbox:true→ oncall,真 bwrap argv 带--unshare-net,模型 single)与 cell 7(同前但保留网络 → oncall 且 loopback 可达,模型 proven;旧代码在这格解析成 off、模型同为 proven,没有专属格时回归不可见)。resolveSandboxMode改回「env 非空即短路」,sandbox-mode与reply-delivery的新断言变红,真 bwrap 矩阵 cell 6、cell 7 同时变红(其余 6 格绿)。既有问题(不在本 PR 范围)
daemon 侧若干历史守卫用
process.env.BOTMUX_SANDBOX === '1'(sandboxEnabled())判断「是否全局强制沙盒」,不认文档同样支持的oncall/scratch:worker 实际进了沙盒、这些闸门却按未开处理(/adopt不拒、回复卡仍建等)。master 上即存在,本 PR 未改这些判定点,另见 #2609。Fixes #2599
🤖 Generated with Claude Code