Repository navigation
test(worker): 场景 F 等 dialog_pending 更正通知后再让假人回答,消除与 hold 轮询的竞态 - #3026
Merged
Merged
Conversation
#2996 CI shard 3/4 上 worker-claude-startup-switch-confirm 场景 F 失败:假人在 hold 通知后固定 4s 回答,而确认框在忙 runner 上只存在约 0.4s,worker 的 1s hold 轮询没读到对话框,dialog_pending 更正通知不发。改为测试侧观测到更正 通知后才放行假人回答,确认框必然覆盖轮询;摘掉 worker 补发守卫时该用例确定性 超时变红。 Co-Authored-By: Claude Code <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 7, 2026 11:05
deepcoldy
pushed a commit
that referenced
this pull request
Nov 7, 2026
deepcoldy
pushed a commit
that referenced
this pull request
Nov 7, 2026
deepcoldy
pushed a commit
that referenced
this pull request
Nov 7, 2026
This was referenced Nov 7, 2026
deepcoldy
pushed a commit
that referenced
this pull request
Nov 7, 2026
…des #3026 switch-confirm race fix)
deepcoldy
pushed a commit
that referenced
this pull request
Nov 8, 2026
|
🚀 Released in v3.59.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.
背景
#2996 的 CI(run 42355456340,shard 3/4)上
test/worker-claude-startup-switch-confirm.integration.test.ts:349失败:场景 F(late hook dialog)只收到worker.startup_command_unconfirmed,缺worker.startup_command_dialog_pending。该测试由 #2981 引入。根因
纯测试夹具竞态,产品代码不需要改:
dialogDelayMs: 24_000,晚于 20s 的 hold);旧夹具在收到第一条 hold 通知 4s 后就让假人回答。STARTUP_CMD_HOLD_POLL_MS = 1s)里读屏。忙 runner 上这一拍轮询错过确认框,onScreen始终不是leave,更正通知不发;命令在 47.04s 被记录,hold 解除,最终断言缺第二条通知。日志中全程没有left for a person。改了什么(只改测试)
worker.startup_command_dialog_pending更正通知后才放行假人回答(假 CLI 的确认框本来就一直挂着,直到 personFile 出现)。确认框因此必然覆盖至少一次 hold 轮询,断言不再依赖调度时序;其余场景 A–E 行为不变。影响面
只改一个测试文件,生产代码不变。场景 F 时长约 25–30s,仍在 180s 用例超时内。
验证
npx vitest run --project unit test/worker-claude-startup-switch-confirm.integration.test.ts:1/1 通过(55 个断言),多次。bun test --timeout=180000 ./test/worker-claude-startup-switch-confirm.integration.test.ts:1/1 通过。src/worker.ts中hold.confirmation.onScreen === 'leave'的补发分支),新测试确定性失败(等待更正通知 60s 超时,275 行);还原后通过。not confirmed within 20000ms(42.487)→confirmed late(47.040),中间没有left for a person。