Repository navigation
test(tmux): 私有 tmux 测试剥离继承的 TMUX,杜绝 kill-server 打到宿主默认 server - #2043
Merged
Merged
Conversation
4 个 worker 集成测试只靠 TMUX_TMPDIR 隔离 tmux,却把 process.env 里的 TMUX / TMUX_PANE 原样传给 tmux 客户端和 worker。套件在 tmux pane 里启动时,tmux 客户端 会忽略 TMUX_TMPDIR、连到调用者自己的 server,清理用的 `tmux kill-server` 于是杀掉 宿主上的 server 及其全部会话(2026-10-20 实际发生:在默认 server 的 pane 里跑全量 测试,默认 server 上所有 bot 会话的 pane 丢失,daemon 自动重启后恢复)。 - 新增 test/helpers/private-tmux-env.ts 的 privateTmuxEnv(root, extra):固定 TMUX_TMPDIR 并删除 TMUX / TMUX_PANE;4 个测试的 worker 环境与 kill-server / 探测命令都改走它。 - 新增 tmux-test-isolation-guard:扫描 test/,凡同时出现 TMUX_TMPDIR 与 kill-server 的文件必须剥离 TMUX 或使用显式 -L / -S socket;并单测 privateTmuxEnv 的剥离。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 19, 2026 18:39
deepcoldy
added a commit
to baicaicc/botmux
that referenced
this pull request
Oct 20, 2026
新测试此前直接展开 process.env,套件若在 tmux pane 中启动会继承 TMUX, tmux 客户端因而忽略 TMUX_TMPDIR 直连调用者 server,清理的 kill-server 会杀掉宿主全部线上会话(deepcoldy#2043 同类事故)。改用 privateTmuxEnv 剥除 TMUX/TMUX_PANE,清理走显式 -S 私有 socket;过 tmux 测试隔离守卫, 并在继承 TMUX 指向替身 server 时实证替身存活。 Co-Authored-By: Claude Code <[email protected]>
|
🚀 Released in v3.48.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.
问题
4 个 worker 集成测试只靠
TMUX_TMPDIR隔离 tmux,却把process.env里的TMUX/TMUX_PANE原样传给 tmux 客户端和 worker:worker-codex-actor-launcher.integrationworker-codex-model-migration-picker.integrationworker-codex-startup-readiness.integrationworker-collaborative-oncall.integration套件在 tmux pane 里启动时(
TMUX已设置),tmux 客户端会忽略TMUX_TMPDIR、连到调用者自己的 server,清理用的tmux kill-server于是杀掉宿主上的 server 及其全部会话。2026-10-20 实际发生过一次:在默认 tmux server 的 pane 里跑了全量测试,默认 server 被杀,上面所有 bot 会话的 pane 丢失(daemon 在十几秒内全部自动重启恢复,但进行中的轮次被打断)。
改动(仅测试)
test/helpers/private-tmux-env.ts:privateTmuxEnv(root, extra)固定TMUX_TMPDIR并删除TMUX/TMUX_PANE;4 个测试的 worker 环境、kill-server与探测命令都改走它。test/tmux-test-isolation-guard.test.ts:test/,凡同时出现TMUX_TMPDIR与kill-server的文件,必须剥离TMUX或使用显式-L/-Ssocket,防止以后再加出同样的测试;privateTmuxEnv确实剥离继承的TMUX/TMUX_PANE。影响面
仅测试代码,不涉及
src/。其它 tmux 测试已各自用-L/-S或剥离TMUX,guard 全部通过。测试
TMUX指向它后跑worker-codex-startup-readiness.integration:tmux-test-isolation-guard:vitest 2/2、bun test 2/2 通过。TMUX无关),以 CI 结果为准。🤖 Generated with Claude Code