Repository navigation
fix(adopt): 补全中止时强制结束 herdr 子进程,补全测试接入 bun 测试腿 - #2633
Merged
deepcoldy merged 1 commit intoOct 31, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
VincentSayHi
marked this pull request as ready for review
October 31, 2026 10:47
VincentSayHi
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
October 31, 2026 10:47
Owner
|
你好,这个 PR 的自动评审群已建,麻烦点击链接加入群聊、查看评审意见并跟进后续修改: 另外你暂时不在自动拉群名单里,也可以把 GitHub 账号和飞书信息补进名单文档,补好后后续评审会自动拉你进群:https://bytedance.larkoffice.com/wiki/WJ1nwWbtxi89erkNGNbcgkt9nUe (本条为自动流程发出的提示消息) |
Owner
|
感谢跟进 #2090 的后续建议,已 squash 合入(9ef49822)。 复审中有一条不阻断的 follow-up,留在这里供后续处理:
再次感谢,欢迎继续贡献。 |
deepcoldy
pushed a commit
that referenced
this pull request
Oct 31, 2026
同步最新 master(#2624 sandboxPaths 只读层拒绝覆盖启动器挂载点根目录与 /run、#2633 herdr 中止强杀子进程、#2634 runtime-sweep ENOTDIR、 #2623 codex-app 软链 HOME 用例、#2627 Midscene 报告清理,共 5 提交)。 与本 PR 6 文件自动合并零冲突:#2624 在 bot-default-oncall 路由新增的 sandboxPathsReadOnlyRoot 字段与本 PR advice 字段并列;其 sandboxPaths 保存校验测试与本 PR advice 用例分区不重叠。本 PR 的 sharedSandbox* 建议 链与 sandboxCapable/localSandboxApplies 判定逐行确认未受影响。 Co-Authored-By: Claude Code <[email protected]>
|
@VincentSayHi @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 d6c1d90…0932a460d(4 个提交),同批合入的还有 #2605 #2623 #2624,失败不一定由本 PR 引起。
|
This was referenced Oct 31, 2026
|
🚀 Released in v3.56.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.
问题
#2090 合入时维护者列了 5 条不阻断的后续建议,本 PR 做第 1、3、4 条。第 2 条(非 Claude CLI 在自动命名标签页里的标题)涉及标题规则,不在本 PR。第 5 条(默认标签页名按
tab list返回顺序判位置)核实无需改:herdr 0.9.0 的handle_tab_list按0..tabs.len()遍历,返回顺序即位置顺序;本机 7 个空间实测,某空间首个标签页number为 17、默认名为「1」,多个空间同样成立。改了什么
改动集中在
src/services/adopt-live-enrich.ts和它的两个测试文件(其中test/adopt-live-enrich-confirm.test.ts新增)。1. 中止时强制结束 herdr 子进程(建议 1)
runHerdrCli把signal交给execFile,注释和HerdrRunner约定都说中止即结束子进程;但 Node 的execFile只对超时用killSignal: 'SIGKILL',中止时发 SIGTERM 并清掉超时计时器,忽略 SIGTERM 的子进程在 Node 下会一直活着(bun 下没问题)。botmux 有 Node 运行形态(npm 安装、开发时node dist/*.js),所以不只是注释问题。改法:不再把
signal交给execFile,自挂一次性 abort 监听,中止时child.kill('SIGKILL'),子进程close后移除监听;启动前已中止不启动、超时仍是 SIGKILL、从不 reject、返回值语义都不变,注释同步改正。不保留
execFile的signal再加自建监听,是因为 Node 内建的 abort 处理先执行并同步触发回调,在回调里移除自建监听会让 SIGKILL 发不出去。2. 补全测试接入 bun 测试腿(建议 3)
test/adopt-live-enrich.test.ts用了vi.importActual(顶部给确认路径用例包 spy)和vi.doMock/vi.resetModules(末尾确认路径块),被bun-leg-selectors整个排除在 bun 测试腿(CI 里用 bun 跑的那组测试)外,新模块在 bun 下零覆盖。改法:确认路径块连同顶部 spy 包装整块搬到新文件
test/adopt-live-enrich-confirm.test.ts(用例与断言逐字未改,仍由 vitest 跑),主文件进入 bun 测试腿。拆完后主文件在 bun 下有 2 条预算用例失败,都是两个 runner 的假时钟差异、不是代码行为差异,所以只改测试、不改 bun 测试垫片,断言不变:stops waiting on first-prompt reads at the budget:bun 垫片的advanceTimersByTimeAsync先同步推进时钟、不排空 microtask,读第一句还没开始就到点。改为推进前先await flush()(同文件已有用例这样写)。launches nothing new once start-up has used the budget:实测 Bun 1.4.3 的advanceTimersByTime(0)无论有没有待触发的计时器都推进 1 ms,900 变 901;补全在截止时已完成、不在等计时器。改为去掉那次advanceTimersByTimeAsync(0)、只await flush(),含义更严:截止已过,不推进假时间也必须返回。3. 长路径的对话记录查找先收窄(建议 4)
维护者建议复用
resolveClaudeJsonlPath的长路径前缀收窄。它是同步 fs、不接 signal、多命中返回 null,直接调用会破坏补全「每次 fs 调用前后查 signal、受预算约束」的约定并阻塞事件循环,所以只复用规则:slug(Claude 由 cwd 换算出的记录目录名)超过 200 字符时,先探测等于 slug 或以「slug 前 200 字符 +-」开头的目录,命中即返回,都没命中再全扫、已探测的不重复;slug ≤ 200 时代码路径与原来完全相同。没有新增对claude-code.ts的 import。测试与验证
都在最终提交上跑:
bun run buildbunx vitest run --project unit test/adopt-live-enrich.test.ts test/adopt-live-enrich-confirm.test.ts test/adopt-picker-cache.test.ts test/card-builder.test.ts test/command-handler.test.ts test/session-adopt.test.ts test/test-hygiene.test.tstest/adopt-live-enrich.test.ts(方式同scripts/run-bun-tests.mjs:独立进程、隔离 HOME / TMPDIR、--timeout=180000)vi.importActual is not a function)isDeferredFromBunLeg判定adopt-live-enrich-confirm.test.ts排除(留在 vitest)bunx tsc --noEmit -p tsconfig.json/adopt卡片,标题与位置行逐行相同新增 4 个用例:忽略 SIGTERM 的假 herdr 中止后确实结束(先忽略 TERM 再写 pid 作握手,afterEach 对记录的 pid 补发 SIGKILL,不留残余进程);长 slug 下记录在前缀目录里能找到、且不探测全部目录;长 slug 没有前缀目录时仍能找到;有前缀目录但其中没有目标记录时仍能找到、且不重复探测同一目录。只用关系断言,不读源码文本、不钉内部常量。
本机没跑全量
bun run test/bun run test:bun(改动只在一个模块和它的测试里),以本 PR 的 CI 为准。影响面
与其他 PR 的关系
#2090 的后续,对应维护者在 #2090 合入评论里列的建议 1、3、4。
已知遗留
test/的 tsconfig),与本 PR 无关,未改。🤖 Generated with Claude Code