Skip to content

fix(shell): 登录 shell 恢复沙箱转发入口并避免重复追加路径 - #3543

Merged
deepcoldy merged 1 commit into
deepcoldy:masterfrom
graysonlin5028:fix/login-shell-sandbox-relay-20261117
Nov 18, 2026
Merged

deepcoldy merged 1 commit into
deepcoldy:masterfrom
graysonlin5028:fix/login-shell-sandbox-relay-20261117

Conversation

@graysonlin5028

Copy link
Copy Markdown
Contributor

登录 shell 执行 profile 后可能重建 PATH。现有恢复脚本只恢复 BOTMUX_WRAPPER_BIN 和身份目录;Linux 文件沙箱中的宿主机入口可能不可见,或该变量没有传到工具进程,因此 botmux 仍可能找不到,或者选中宿主机入口而非沙箱转发入口。

本次将恢复顺序合并为一个前缀:会话身份目录 → Linux 沙箱 /run/sbxbin → 可见的 Botmux 安装目录。身份包装仍优先于普通工具入口;重复执行启动脚本时不再交替追加相同目录。只修改生成的 shell 启动脚本,不修改用户 dotfiles、会话权限或沙箱文件访问规则。

影响范围:Bash/Zsh 共用启动脚本;Linux 增加沙箱转发入口恢复,其他平台保留安装入口和身份目录的相对顺序。仍要求 Bash 的 BASH_ENV 指向生成的脚本;用户 profile 无条件覆盖它属于独立配置问题,本 PR 不改写用户配置。

验证:

  • Bun 1.4.4 执行 bun run build:通过,包含类型检查、Dashboard 构建及产物审计。
  • bun run test -- test/login-shell-tool-paths.test.ts test/cli-identity.test.ts test/trigger-user-shell-env.test.ts test/traex-shell-env.test.ts test/cli-identity-symlinked-home.test.ts test/botmux-wrapper.test.ts test/lark-tool-binding.test.ts:7 个文件、275 项测试通过。
  • 新增真实 Bash/Zsh 登录 shell 用例,以及 bubblewrap 下安装目录可见、被遮盖、变量缺失、宿主路径未挂载四种场景;验证转发入口恢复且身份包装保持优先。
  • 将生产实现还原到上游基线后,重复 source 和四个沙箱场景共 5 项回归用例失败;恢复修复后通过。

尚未部署到运行中的 daemon。

@deepcoldy

Copy link
Copy Markdown
Owner

你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改:
https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=d13jf65e-10a4-47dc-b8b7-2a88797bf14e

另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe

(本条为自动流程发出的提示消息)

@deepcoldy
deepcoldy merged commit f65c527 into deepcoldy:master Nov 18, 2026
15 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner

感谢贡献,这个修复已经合入 master(squash 提交 f65c527)。

评审中验证:typecheck、build(含 dist/资源审计)通过;登录 shell 路径相关 7 个测试文件全绿,包含真实 bash/zsh 登录 shell 与 bubblewrap 四场景(转发入口可见/被遮盖/变量缺失/宿主路径未挂载);把实现还原到旧版后,幂等用例与四个沙箱用例如期失败,恢复修复后转绿。非 Linux 平台生成的启动脚本逐字不变,普通非沙箱会话无行为回归。

两个不阻断合入的小项,留作后续可选改进:

  1. 既有问题(本 PR 之前就存在,非本次引入):生成脚本里 if [ -n "$BOTMUX_IDENTITY_BIN" ] 没有用 ${BOTMUX_IDENTITY_BIN:-} 守卫,外层 shell 若开启 set -u 且该变量未绑定会报 unbound variable。实际工具调用走 bash -lc,默认不启用 nounset,因此当前不受影响;可与 wrapper 目录那行统一加上 :- 守卫加固。
  2. 新测试的可移植性:bubblewrap「hidden」用例对 mkdtemp 生成的临时目录挂 --tmpfs,当 TMPDIR 本身是符号链接时 bwrap 会报 Can't mkdir parents。CI 的真实 /tmp 下全部通过;若要让测试在符号链接 TMPDIR 的环境也稳定,可在构造临时路径后做一次 realpath 归一化。

以上为自动评审的非阻断观察,最终以维护者审阅为准。欢迎继续贡献。

@github-actions

Copy link
Copy Markdown

@graysonlin5028 @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 f65c527…97637f5db(2 个提交),同批合入的还有 #3544,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
OpenCode basic bot flow feishu-core-clis failed Replanned 20 times, exceeding the limit. Please configure a larger value for replanningCycleLimit (or use MIDSCENE_REPLANNING_CYCLE_LIMIT) to handle more complex tasks.
Codex DM group mode moves the conversation into a new session group feishu-core-dm-modes-codex failed Node "feishu.runScenario" timed out after 1800000ms.
Claude group reply mode new-topic starts a session per topic feishu-core-group-modes failed Node "feishu.runScenario" timed out after 1800000ms.

@github-actions

Copy link
Copy Markdown

🚀 Released in v3.59.20

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants