feat: 盒内工具可用性(挂 /.grok、/root/.bun + 修 PATH) - #2
Draft
doge-liang wants to merge 1 commit into
Draft
Conversation
盒内 grok/agent/bun 断链(装在顶层 /.grok、/root/.bun,未绑),codex 等 /root/.local 工具因交互登录 shell PATH 缺 /root/.local/bin 而找不到—— 后者根因:宿主侧 attach 客户端(面板 spawnTmux / ag-box attach)跑 tmux new-session 时把宿主 PATH 带进首个会话 pane,而非盒 tmux 全局 env。 修:① mounts ro-bind /.grok、/root/.bun(补断链);② startSandbox 写 boxHome/.bash_profile 强制正确 PATH(登录 shell 必源,与进盒方式无关)。 boxPath/bashProfileContent 抽为纯函数单测;真机一次性盒验 grok/agent/ codex/bun/claude 全部解析。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
盒内工具可用性:挂 /.grok、/root/.bun + 修交互 shell PATH
系统调试定位到两个独立根因导致宿主 CLI 工具在沙盒内
command not found:grok/agent真身在顶层/.grok、bun在/root/.bun,/usr/local/bin里的符号链接指向这些路径,但 mounts 没绑 → 盒内断链。ag-box attach)跑tmux new-session时,首个会话 pane 继承宿主客户端 PATH(缺/root/.local/bin),而非盒 tmux 全局 env(update-environment默认不含 PATH)。故连挂载好的 codex 也找不到。改动
lib/mounts.js:roHome 加/.grok、/root/.bun(ro-bind);抽boxPath(nix)、bashProfileContent(nix)纯函数。lib/runtime.js:startSandbox建 boxHome 时写boxHome/.bash_profile强制正确 PATH(登录 shell 必源,与进盒方式无关)。test/box-mounts.test.js:+5 用例(工具根 bind 有/无、boxPath、profile 内容)。41/41 通过。验证
真机一次性盒:登录 shell PATH 恢复含
/root/.local/bin,grok/agent/codex/bun/claude全部解析。已install.sh部署两节点。安全权衡
ro-bind 只读绑二进制目录,扩大挂载面但风险低;范围经确认只加这两个根。
🤖 Generated with Claude Code