Repository navigation
fix(codex): resolve native pid behind npm launcher - #1772
Conversation
|
Thanks for the fix — the diagnosis checks out. I verified that the current npm package ( Reviewed on a tree rebased locally onto current P2 — direct-native installs now run ~31 needless process-tree scans per spawn. With P3
Context for maintainers: #1746 (opened a day earlier) targets the same launcher shape but only updates the attestation pid, so it does not clear the false unconfirmed-execution warning this PR addresses; the two are complementary. Both introduce a This is an automated preliminary review — the final call is the maintainers'. |
|
Follow-up review on the current head ( Independently re-verified the diagnosis and the change
Observations beyond the previous pass
No blocking issues; the change is correct and minimal. This is an automated preliminary review — final call is the maintainers'. |
跟进 deepcoldy#1772 双审意见(P2+P3),在原「所有托管 Codex spawn 都向后代解析 原生 pid」基础上: - P2:候选进程自身 comm 已是 codex 系原生叶时(standalone 直装),同步 解析立即返回、重试循环 tick 内先经 isDirectLeaf 判定后退出,不再对每个 tick 做全进程表 BFS(此前直装形态每次 spawn 空扫 31 次 ps -A,带 helper 子进程时最多 93 次)。 - P3:findLaunchedCliPid/resolveCodexOwnershipPid 透传 cliRuntime 配置的 自定义 Codex 兼容可执行名,官方名在自定义 runtime 下保持 fail-closed; 恢复被删的空白 wrapperCli 用例(钉 trim 早退只关通用 wrapper resolver、 不关 codex resolver);同步解析点的实参、retry 过滤参数与 native-leaf 零扫描行为改为对 worker 真实函数切片的行为级断言(原 harness 把 resolveCodexOwnershipPid 整个 stub,参数变异存活)。 Co-Authored-By: Claude Code <[email protected]>
|
Applied the P2/P3 follow-ups from the automated reviews as a second commit on this branch (your original commit is untouched):
Verified locally: tsc clean, build green, 186 related tests green (52 in the two wiring/discovery files), and the same tree rebased onto current master (47d4d38) is identical in behavior. Will merge once CI on the pushed head is green. |
7600 字符窗口余量不足:主干其他改动在 deliverRawInput 函数体内新增行后, sendToPty 锚点被推出窗口(合并态 CI test 2/3 + bun-test 双红),与被守护 的顺序契约无关。改为与同文件 writeAdoptMessage 用例一致的函数体边界 (到下一个顶层函数 markTurnRetired)。
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]>
|
🚀 Released in v3.41.0 |
Summary
Problem
The standard npm Codex entrypoint runs as a Node.js launcher and forks the packaged native
codexbinary. BotMux recorded the outer Node PID, while the native child held the rollout file descriptor. The positive ownership check therefore could not prove that a submitted Lark message entered Codex, so BotMux emitted the 90-second "Worker received but execution queue not confirmed" warning even though the turn was already executing.Verification
bunx vitest run test/find-launched-cli-pid.test.ts test/codex-terminal-session.test.ts test/codex-worker-bridge-wiring.test.ts(83 tests passed)bun run build