Repository navigation
test(sandbox): 软链 HOME 下 codex-app 走仅凭证隔离的端到端回归用例(pty/tmux) - #2623
Merged
Merged
Conversation
看板 #86 第 5 点:bootstrap 路径以词法形式交给 runner,在仅凭证隔离 (--bind / /)下能解析;文件沙盒在 Linux 早已拒绝 codex-app。不改生产代码, 用真实 worker + 真 bwrap 锁住这一行为。 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 16:30
复审 P3 跟进(不改 src/ 行为): - dist/codex-app-runner.js 缺失时 beforeAll 直接报错(同 workflow-c0/ whiteboard-cli/preset-export-cli 用例),不再随宿主探测静默 skip; skipIf 只保留「宿主建不了 bwrap namespace」一个条件。 - 文件头注释更正:CI 放开 userns 限制后两条用例真实执行;嵌套 isolate-run 需先挂 spare procfs,建不了 PID namespace 才 skip。 - attestation 只取最后一条带 enginePid 的消息,免疫 final_output 后 插入 engineless 重发的理论抖动窗口。 - 空 enrollment marker 加注释:worker 只 lstat 判存在,空/损坏按 fail-closed 视为已注册,故意不用合法 pending 内容。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
pushed a commit
that referenced
this pull request
Oct 31, 2026
同步最新 master(#2624 sandboxPaths 只读层拒绝覆盖启动器挂载点根目录与 /run、#2633 herdr 中止强杀子进程、#2634 runtime-sweep ENOTDIR、 #2623 codex-app 软链 HOME 用例、#2627 Midscene 报告清理,共 5 提交)。 与本 PR 6 文件自动合并零冲突:#2624 在 bot-default-oncall 路由新增的 sandboxPathsReadOnlyRoot 字段与本 PR advice 字段并列;其 sandboxPaths 保存校验测试与本 PR advice 用例分区不重叠。本 PR 的 sharedSandbox* 建议 链与 sandboxCapable/localSandboxApplies 判定逐行确认未受影响。 Co-Authored-By: Claude Code <[email protected]>
|
@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 d6c1d90…0932a460d(4 个提交),同批合入的还有 #2605 #2633 #2624,失败不一定由本 PR 引起。
|
This was referenced Oct 31, 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.
改了什么
看板 #86(沙盒任务③ Linux bwrap 稳健性)第 5 点:软链 HOME 下 Codex App 的 bootstrap 路径。维护者定 A:不改生产代码,只补回归用例,并写清为什么不复现。第 1–4 点已由 #2543 合入(54b28dfd8),本 PR 基于它。
新增
test/worker-codex-app-symlinked-home-credential-only.integration.test.ts。用例起一个真实 worker 和一个真实的仅凭证隔离 bwrap,codex-app runner 用真实的dist/codex-app-runner.js,对接 fake app-server。pty、tmux 各一条:home-link -> real-home),SESSION_DATA_DIR 用软链形式;final_output),没有任何error;NSpid有两级,内层 pid 与 fake 自己写下的 pid 一致;日志里也有 credential-only bwrap 的包装记录。BOTMUX_TMUX_SOCKET=botmux-p5-<pid>),清理时只kill-server这个私有 server。第 5 点为什么不复现
任务里的担心:worker 用
process.env.SESSION_DATA_DIR的词法形式拼 bootstrap 路径,写进子进程环境,runner 原样读取;软链 HOME 下这个路径在沙盒里可能不存在。实测和读代码都说明,这条路径在 Linux 上能走到的配置里都能解析:backendSandboxCompatibilityError在启动前就拒绝了 codex-app(codex_app_file_sandbox_unsupported),走不到写 bootstrap 那一步。--bind / /,宿主上的软链在沙盒里原样存在,所以<home-link>/.botmux/...在沙盒里照样能解析到真实目录。sessionVisiblePath(path, canonicalPaths)只在canonicalPaths = sandboxRequested(文件沙盒)时取 realpath。换上它,在上面所有能走到的配置下都是原样返回,不改变行为,变异测试也咬不红。所以按维护者的决定不改。这个用例锁住的是第 2 点:将来如果仅凭证隔离改成不再保留宿主软链、或者遮罩把 bootstrap 目录盖住,runner 就读不到 bootstrap,用例会变红(见下面的变异)。
用户反馈的「codex-app 绑定平台后起不来」,对应的是 #2543 已修的第 1 点:仅凭证隔离没有 /dev,
/dev/null都打不开。影响面
纯测试,
src/零改动。验证
用例要起真沙盒,只在 isolate-run 里跑。isolate-run 自己是嵌套的 PID namespace,要先在里面额外挂一个完整 procfs,内层 bwrap 才能
--unshare-pid --proc;宿主建不了 user/PID namespace 时整组 skip。CI 会先关掉 AppArmor 对非特权 user namespace 的限制(ci.yml打印「bwrap userns OK」),所以 CI 上这两条是真跑的:本 PR 首跑 test (1/4) 日志里本文件2 tests用时 8231ms。变异证据(每次只改一处,在 isolate-run 里跑本文件):
~/.botmux/bots(bootstrap 所在目录)一起遮罩--unshare-pidNSpid断言)🤖 Generated with Claude Code