Repository navigation
test(codex-app-runner): native user input 失败分支等 stdout 送达再断言,不再跨通道抢先读 - #2233
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 23, 2026 15:09
refused / timedOut / interrupt-error 分支在请求日志里看到 turn/interrupt 后立即断言 stdout 已含 "Codex user input failed"。runner 确实先写这行再发 interrupt,但请求日志 是假 codex 直接写盘、测试同步读到,stdout 要经管道由事件循环送进 harness.stdout, 两者在测试进程里没有先后保证(bun 下 runner 的 stdout 还可能先缓冲),bun-test 间歇失败(#2232)。改为 waitFor 等这行到达。 同文件同类:async-question overlap 分支等到 control socket 的 final 后立即读 stdout,同样改为先等再断言;async-question 夹具的 HTTP server 遇到宿主机端口 扫描器的空 body 探针会 JSON.parse 抛错(#1965 漏掉的一处),空 body 直接回 400。 Fixes #2232 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
force-pushed
the
test/codex-runner-user-input-stdout-wait
branch
from
October 23, 2026 15:31
077aca5 to
365ef20
Compare
Owner
Author
|
已合并 PR #2233 → a9e529c(squash,作者 deepcoldy),关闭 #2232。
|
|
🚀 Released in v3.51.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.
Fixes #2232
改了什么(纯测试改动)
只改
test/codex-app-runner.integration.test.ts,共三处:bridges native user input through the real runner/IPC exchange的失败分支(refused / timedOut / interrupt-error)。原来是在请求日志里看到turn/interrupt后,立即断言 stdout 已含Codex user input failed;现在改成waitFor等这一行出现在 stdout 里。bridges async questions … overlap分支等到 control socket 送来 final 后,立即读 stdout 里的END EXAMPLE;现在改为先等它到达,再断言恰好出现一次。GET /时,JSON.parse('')会抛错,用例因routeError失败。test: 容忍回环端口扫描探针,消除 mock server 空 body JSON.parse 导致的随机失败 #1965 给 12 个夹具加了这层防护,这里是漏掉的一处。现在空 body 直接回 400;非空但格式错误的请求体照旧报错。为什么
这条偶发挡住了 #2231 的 bun-test 首跑(run 39971519080 · job 120475149791;#2231 本身只改测试收尾,与这个文件无关)。
runner 端的顺序是对的:先
writeLine("Codex user input failed: …"),再发turn/interrupt。但测试是在两个没有先后保证的通道上做比较:harness.stdout。bun 下 runner 写 stdout 还可能先缓冲。所以看到 interrupt 时,那一行 stdout 可能还在路上。vitest 腿对这组用例有自动重试,问题被掩盖了;bun 腿不重试,于是露了出来。
影响面
只改这一个测试文件,生产代码零改动。
验证
bun run build✅;tsc --noEmit✅;test-hygiene26/26 ✅data推迟 300ms 再追加,模拟 stdout 晚到):GET /:去掉防护时,两个运行时下bridges async questions的 15 个用例全部失败;加上防护后全部通过。JSON Parse error: Unexpected EOF),这才发现了它。另外,bun 并发跑同一个文件时会争用写死的/tmp/botmux-codex-app-<uid>locator(locator verification failed after rename),这是并发跑同一文件造成的,CI 不会这样跑,不算偶发。🤖 Generated with Claude Code