Repository navigation
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 27, 2026 07:52
Owner
Author
|
撤掉,与 #2426 撞同一问题且其修法更准。 #2426 的根因诊断成立:失败不是 tmux 发布慢,而是测试进程被调度饥饿挂起超过墙钟死线,恢复后第一次 display-message 读到的已是 tmux 服务端锁存的 本 PR 独有的一点建议并入 #2426:给该 describe 的 |
This was referenced Oct 27, 2026
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.
背景
#2421:
test/tmux-pipe-exit-code.test.ts的尸体夹具在beforeEach里用waitForDeadPane等待pane_dead_status发布。该 waiter 自带 10s 内部 deadline,而 unit 项目hookTimeout是 30s——饥饿 shard 上 tmux 发布 status 前,waiter 自己先到点,前置断言expect(deadStatus.status).toBe('77')收到空串而红(PR #2417 首跑实测:该文件 840s、shard 949s,本地对照 74s)。同文件同代码、同 runner 类别,负载不同结果不同,属环境饥饿而非代码缺陷。#2414 已在生产侧把
resolvePaneDeath改成alive / dead / unknown三态:一次读不到不等于死亡,按unknown重试。本 PR 是同一条不变量在测试夹具侧的对称收口——夹具自己的 tmux 读取也要有界且可重试。改了什么(仅测试文件,19 行)
describe('tmux liveness probes treat a kept corpse as missing')内:tmux()wrapper 从无超时的spawnSync改为timeout: 5_000。正常 tmux 客户端毫秒级返回;饥饿时一个可能无限挂起的等待变成有界失败,spawnSync超时返回status: null,waiter 按「读不到」处理继续轮询,而不是让单次读取吃掉整个 hook 预算。2 × 5s)+ waiter 18s = 28s,给 mkdtemp/writeFileSync 等同步夹具留 2s 余量。常量与预算算式写进注释,防止以后只调一边。expect(deadStatus.status).toBe('77')一字不松。骨架真没建起来仍须红;放大预算只是给「tmux 太饿还没发布」留出重试时间,不接受空值。为什么不是单纯把预算抬到 30s
那样两次无界的 new-session spawnSync 仍可能吃光预算,红法会从明确的断言失败变成「Hook timed out in 30000ms」,更难定位;而且第一次 display-message 自己挂起时 deadline 判断根本没机会执行。有界单调用 + 总预算留余量才能把「读不到」变成可重试的
unknown语义。验证
npx tsc --noEmit通过。test/tmux-pipe-exit-code.test.ts双引擎全绿:vitest 26/26(74.82s)、bun test --timeout=180000(CI runner 同款上限)26/26(73.92s、56 断言),与 CI/本地正常负载同量级。display-message恒返回{status:null, stdout:'1:'}(精确模拟「已死但 status 还读不到」)+ deadline 缩到 1s:失败落在expected '' to be '77'断言,8 条相关用例红,不是首次读空即红、也不是 30s hook 超时;git diff只剩正式的 19 行;测试均使用私有-S <tmpdir>/socket,不碰宿主 tmux。影响面
只改一个测试文件,不动生产代码、CI 配置和其他用例;不涉及 CLI/后端/会话类型。
🤖 Generated with Claude Code