Repository navigation
fix(codex): 修复 scratch 沙盒下 tmux 参数超长与会话ID识别失败问题 - #1753
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 9, 2026 05:06
|
🚀 Released in v3.38.0 |
deepcoldy
pushed a commit
to 47seek/botmux
that referenced
this pull request
Oct 10, 2026
deepcoldy#1746 所修复的问题(npm 版 Codex 经 sh/node 启动器启动时, attestation 锚在启动器 pid,回合内工具进程的归属校验被回合前 进程快照拒绝 → current_actor_unverified)已由主干上的 deepcoldy#1753 与 deepcoldy#1772 修复并收口:复用 scheduleWrapperRealCliPid、全套重锚 backend.cliPid、configured executable 透传、切片级回归。 本提交补回该 PR 唯一未进入主干的增量——真实 worker 进程树 e2e: - 真 spawn worker → sh → node 启动器 → 原生 codex → 工具进程, 断言身份锚重锚到真实 codex 且 current-actor 校验通过,worker 代次/进程启动时钟失效均被拒绝(pty/tmux 各一例) - 新增 configured-runtime 重命名变体:自定义 leaf comm 只能经 executable 透传匹配,静态 codex 映射不得命中(pty/tmux 各一例) 变异验证:resolver gate 回退到 sandbox-only、applyRealPid 漏发 attestation 均使四例失败;retry 路径断掉 executable 透传仅使 configured 两例失败(official 两例保持绿)。Node 22 与 Bun 1.4 下四例均通过。 Co-Authored-By: Claude Code <[email protected]>
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.
背景与根因
在长机器人名称(如 24 字符以上)及深层工作区路径下,scratch 沙盒生成的 bwrap bind-mount 参数极长,超过了 tmux/system
ARG_MAX或内部参数长度限制,导致 tmux new-session 执行报错。在 scratch 沙盒或 launcher 启动模式下,worker 观察到的顶层进程为 bwrap/shim 等包装进程,而非真实的 Codex 叶子进程,无法从
/proc/<pid>/fd识别真实的 rollout 文件;并且在首轮会话(rollout 尚未落盘且状态栏未显示 thread id)时,误将内部自主会话(isAdopt === false)判定为未知状态抛错,阻断了正常交互。BOTMUX_COORDINATION_MODE=""时被误当成启用模式解析,导致进程报错。改动内容
src/adapters/backend/scratch-sandbox.ts,src/worker.ts):useBwrapArgsFile支持,在 tmux 后端下将长参数写入专用的临时 args 文件,通过文件描述符传递给 bwrap,避免命令行参数超长;!existing守卫避免误伤;src/services/codex-terminal-session.ts,src/worker.ts,src/adapters/cli/types.ts):resolveCodexOwnershipPid/startCodexLauncherPidResolve),确保在沙盒/launcher 模式下能追踪到底层的真实 Codex PID 并绑定 rollout,并规范独立文档注释;isAdopt === false),在状态栏尚未显示 ID 且 rollout 暂未就绪时平滑 fallback 到 legacy 写入模式,不中断首轮对话(生效前提为 rollout 已落盘或叶子 PID 已解析,异常下由 worker recheck 兜底)。src/services/durable-coordination-runtime.ts):BOTMUX_COORDINATION_MODE为空串的情况。影响范围与回归评估
测试验证