Repository navigation
refactor(worker): 抽出重启时交接 CLI PID marker 的判定并补齐不交接分支的测试 - #2337
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 25, 2026 11:05
Owner
Author
|
已合并 → 85fa304(squash)。#2320 复审提出的 3 条建议至此全部落地。
🤖 Generated with Claude Code |
|
🚀 Released in v3.52.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.
关联 #2320(#1963 的修复)。本 PR 落实 #2320 复审提出的 3 条不阻塞建议,不改变任何运行行为。
改了什么
handsCliPidMarkerToSuccessor()(src/core/cli-pid-marker-handoff.ts),shutdownWorkerForParentExit改为调用它。条件与 fix(worker): daemon 重启后接回进行中 turn 的执行身份,send 不再落到群顶层 #2320 合入时逐条相同:CLI 在会被重连的持久 pane 里、CLI 尚未退出、不是 adopt 的 pane、不是 Codex App、没有 Codex RPC 引擎。fix(worker): daemon 重启后接回进行中 turn 的执行身份,send 不再落到群顶层 #2320 里这些「不交接」分支只有正向路径的集成覆盖,现在每一条都有单测。cliSurvivesWorkerExit()从adapters/backend/sandbox.ts挪到同一个通用模块:它现在同时决定沙盒目录和 marker 两条生命周期规则,不再只是沙盒概念;sandboxTreeSurvivesWorkerExit()改为从新模块导入,语义不变。对应单测从test/sandbox.test.ts挪到test/cli-pid-marker-handoff.test.ts。detach_for_transfer)处补注释:说明这里不交接 turn,是因为 daemon 的transferSession在发起 detach 前已经以worker_busy拒绝忙碌会话,不会切断进行中的 turn;以后若放宽这道门禁,这里也要交接 marker。老用户影响
无。纯重构 + 注释 + 测试:判定条件、调用时机、marker 文件格式、配置都没有变化。
影响面
只涉及 worker 父进程退出路径的判定写法和一个函数的所在模块;跨 CLI / 后端 / 会话类型的行为与 #2320 合入时一致(#2320 的真实 worker 生命周期集成用例照常通过)。
测试
变异验证(每处改一行、跑相关测试、还原;均变红):
handsCliPidMarkerToSuccessor不保留用例cliSurvivesWorkerExit把 PTY 当持久后端cliSurvivesWorkerExit用例🤖 Generated with Claude Code