Repository navigation
fix(claude-code): 避免 PTY 慢提交提前释放回合权限 - #3928
Merged
deepcoldy merged 2 commits intoNov 27, 2026
Merged
Conversation
Han-wangyu
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
November 27, 2026 10:24
deepcoldy
reviewed
Nov 27, 2026
deepcoldy
left a comment
Owner
There was a problem hiding this comment.
审查结论(aea0f79cbc)
0 个新增阻断问题,代码层面可合;合并前仍需等待当前 CI 全部完成并通过。
重点核查
- 新 hold 的进入条件在
src/worker.ts:16486,仍限定于 Claude Code + PTY/tmux + 非 adopt + 无dispatchAttempt的普通真人 IM 写入;durable 重试、journal 恢复和跨代际 carry 都在入口处回退旧行为。 src/worker.ts:16525的到期复查先 drain transcript,再校验 backend、CLI 代际、restart、turn/attempt、authority 和 writeAt;busy 只把未证实开轮延到 60s 硬上限,不会无限续期。- 开轮后的队列恢复同时接到 transcript(
src/worker.ts:4233附近)与UserPromptSubmit;flushPending在入口和循环内(src/worker.ts:31389、src/worker.ts:31722)都防止未确认开轮时折入后继输入。 - raw passthrough、两类 interrupt、web terminal 及 local/scheduled turn 的撤销接线均已走查;替换 principal 不会被旧定时器误释。
- 另行检查了 30–60s busy extension 内再次出现 idle 的边界:真实 screen-idle 路径在 busy 未消失时仍先受既有 busy viewport veto;busy 消失后的释放与非 busy 到期复查一致,不列为缺陷。
实际验证
- 远端 head 确认为
aea0f79cbc6b871daef0daeddcabc481e624f9a3;本地 rebase 到含 #3900 的351c2e6229后,两笔提交与原 head 的range-diff完全一致,merge-tree无冲突。 bun run build通过(含 TypeScript 类型检查)。- 直接相关 3 个测试文件:Vitest 57/57、Bun 57/57。
- 补跑 authority/background/busy 相邻 4 个测试文件:Vitest 56/56、Bun 56/56。
git diff --check通过,worktree 无遗留改动。- 发布本结论时
bun-binary-darwin、network-boundary已通过,其余 PR checks 仍为 pending,未把本地结果当作全量 CI 通过。
非阻断测试建议
建议后续补真实 worker 的双消息进程级用例(hold 期间第二条不得写入,hook/transcript 开轮后应恢复),以及 raw/web/local 撤销接线的进程级回归。目前函数级 fake-timer 测试已覆盖主要判定,但挪动这些接线点不一定会让现有套件变红;这不阻断本次修复。
Owner
|
感谢贡献,已合并。 这个修复补上了长消息经 PTY 粘贴后、 一个非阻断的后续改进建议(不影响本次合入):当前测试主要覆盖了新增谓词与函数本身,建议后续补一组真实 worker 进程级用例,覆盖
这样后续重构若挪动接线点也能被测试拦住。最终以维护者审阅为准。 |
This was referenced Nov 27, 2026
|
🚀 Released in v3.59.36 |
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.
问题
关联 #3636。Claude Code 通过 PTY 接收普通 IM 长消息时,旧的输入提示符可能在本轮的
UserPromptSubmit和 JSONL 用户记录之前触发空闲。worker 把这个屏幕边沿当作回合结束,撤销本轮 managed origin。Claude 稍后开始执行,进程仍属于原回合,但需要发起人身份的工具调用会失败。#3810 已保护收到提交 hook 或转写开轮信号的回合。本 PR 补齐两个信号都还没到的窗口。后台 Bash 和任务通知续跑由 #3829 覆盖。
修复
验证
bun run build通过,包含 TypeScript 类型检查。