Repository navigation
test(codex-app): 空闲重连用例等本轮 final 之后的空闲状态再杀引擎,不再与 runner 空闲结算赛跑 - #2523
Merged
Merged
Conversation
第一轮后用例等「最后一条状态 busy=false」,这被启动时的初始状态提前满足, 杀引擎于是早于 runner 20ms 的空闲结算;runner 先察觉引擎退出时,空闲状态不带 引擎身份,worker 走 clearCodexAppEngineIdentity 分支,而抽出来的测试 scope 没 有这个函数,抛错后控制端断连、runner 重放同一状态无限循环(#2520)。改为等本 轮 final 之后的空闲状态被收下再杀;scope 补 failCodexAppControlGeneration 记入 rejected,等待超时的报错带上被拒原因、认证次数和最近的控制消息。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 29, 2026 14:26
This was referenced Oct 29, 2026
…-recovery-engines
Owner
Author
This was referenced Oct 29, 2026
deepcoldy
pushed a commit
to uestcwangci/botmux
that referenced
this pull request
Oct 29, 2026
…ity-recovery-2473-final 在作者最新 head 36930a4 上同步 master 至 0345cc5(其 merge base 651a7d3 之后的 4 个提交:deepcoldy#2526/deepcoldy#2513/deepcoldy#2523/deepcoldy#2525)。唯一冲突在 worker-argv-reaction-status 首轮 re-arm 用例的启动等待段:作者已在 deepcoldy#2513 合入前用信号驱动 fixture(paint-phase 文件按观测阶段推进,消除 固定 6s 墙钟,即复审建议的根治方向)重写了该用例,merge 已把 fake 定义取为信号驱动版,故等待段配套取作者版(等 projected-working 采样器 再写 startup 信号);deepcoldy#2513 配 setTimeout fake 的 fresh-empty 等待与 信号 fake 不兼容、不采用,其启动保证被作者版更强的等待覆盖。 codex-app-runner.integration 自动合并,PR 容量用例与 deepcoldy#2523/deepcoldy#2526 改动并存。Pi 用例双引擎 + 2 核 isolate 重载 3 次绿、全文件 16/16; codex 集成/容量/engine/deployment 共 210 项 vitest 绿。 Co-Authored-By: Claude Code <[email protected]>
|
🚀 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.
Closes #2520。
现象
PR #2513 head
93e4014f7首跑 run 40847512966 / bun-test:test/codex-app-runner.integration.test.ts「registers native engines across idle recovery on the authenticated worker path」61.7s 超时(runner timed out)。runner 在 SIGTERM 掉旧 app-server、空闲重连之后,已经答完第二轮(fake answer 1),随后打出几十个提示符›,用例始终等不到第二个 final。用例由 #2200 新增,与 #2513 的改动无关。根因(测试侧)
RUNNER_IDLE_SETTLE_MS)。如果 runner 先察觉了引擎退出、计时器才触发,这条空闲状态就不带引擎身份(引擎退出后executionIdentity为空)。handleTrustedCodexAppMarker。worker 收到不带引擎身份的状态时,走合法的生产分支调用clearCodexAppEngineIdentity();测试 scope 里没有这个函数,拿到undefined,一调用就抛 TypeError。控制端的.catch把它变成断开连接,runner 重连后重放同一条未确认的状态,于是无限循环:每轮空闲结算打一个›,后面那一轮的 final 排在这条状态后面,永远进不来。生产代码里这些函数都在,这条分支本身是正常的,不涉及生产改动。
证据
isolate-run,每次全新 HOME/TMPDIR、4 个并发跑整文件):12 次里这条红 1 次,形状与 CI 一致。rejected=[]、认证 79 次、published只有第一台引擎、控制端收到的最后一条消息停在第一轮的final-end,之后一条都没收进来。修法(纯测试,单文件)
idleAfterLastFinal),再杀引擎。这时 runner 已经带着还活着的旧引擎身份报完空闲,之后直到下一条输入都不会再有空闲结算,也就不会和引擎退出赛跑。failCodexAppControlGeneration,把它记进rejected;等待超时的报错带上被拒原因、认证次数和最近 8 条控制消息。以后再出问题能直接看出走了哪条路径。没有改
clearCodexAppEngineIdentity的缺口:改了等待条件后这条分支在本用例里已经走不到;就算补上真实实现,它会多发一次published,照样让toHaveLength(2)失败。验证
isolate-run,2 核 + 6 个空转进程,2 路并发,每次全新 HOME/TMPDIR):50/50 通过。改前同等负载下 10 次失败 1 次。test-hygiene)134 例全绿;bun test --timeout=180000(全新 HOME/TMPDIR)108 例全绿。另:同样的 4 并发跑整文件条件下,「polls locators, rejects repeated/wrong-epoch/slow-drip handshakes …」也会红,但那是同一个重文件 4 份并发的极端条件,CI 上没出现过,本 PR 不处理。
🤖 Generated with Claude Code