Skip to content

test(codex-app): 引擎身份用例等 attestation 到达再断言,修 gap-restart 偶发 - #2597

Merged
deepcoldy merged 1 commit into
masterfrom
test/codex-app-gap-restart-attestation-wait
Oct 30, 2026
Merged

deepcoldy merged 1 commit into
masterfrom
test/codex-app-gap-restart-attestation-wait

Conversation

@deepcoldy

Copy link
Copy Markdown
Owner

改了什么

修 test/worker-codex-app-turn-routing.integration.test.ts 里「Codex App worker engine identity」一组用例的偶发失败。#2548 的 CI 上,test (4/4) 红在 handles signed engine states on one connection: gap-restart:

AssertionError: expected { …(5) } to match object { enginePid: 4419, … }
+ (收到的是上一条 attestation,没有 enginePid)
❯ test/worker-codex-app-turn-routing.integration.test.ts:234

根因:测试把两条互不保序的通道当成了有序。

  • 测试用的 runner 收到 worker 的 ack 后写入 report 文件,ack 走 Codex App 控制 socket。
  • 新引擎的 local_process_attestation 走 worker → 测试进程的 IPC。
  • worker 在同一个处理函数里先发 attestation、再写 ack,但两条通道之间没有顺序保证。CI 负载高时 IPC 会晚到。测试看到 ack === 3 就立刻断言「最后一条 attestation 是新引擎」,于是读到的是上一条(gap 阶段那条没有 enginePid 的)。
  • restart 模式结构相同(等 ack 2),同样会受影响。
  • 三个异常退出的模式(changed / dropped)有同类隐患:进程退出和它最后发出的 IPC 消息也不保序。

修法(只改测试,不改产品代码):

  • restart / gap-restart:先 waitFor 最后一条 attestation 的 enginePid 变成新引擎,再做原来的断言。断言内容一条没改。
  • changed / dropped:等子进程退出后,用 vi.waitFor 等 error 消息到达,再断言。

产品侧不需要改:daemon 依赖的是 worker IPC 内部的顺序(同一通道有序),不依赖它和 runner socket 之间的先后。

测试

  • 复现:在测试进程收 IPC 处人为加 50ms 延迟(模拟 CI 负载)。修复前,changed / dropped / restart / gap-restart 4 例失败,失败位置和 CI 上的断言一致;修复后,同样加延迟 5/5 通过。探针代码已删,没有提交。
  • 不加延迟时,这 5 例在 isolate-run 里连跑 10 轮,10/10 全绿(Tests 5 passed)。
  • 整个文件在本机 isolate-run 里修复前后都有同样的 10 例失败(tmux 和空闲退出相关,本机环境起不来),与本 PR 改动的 5 例无关,以 CI 为准。

影响面

只改了一个测试文件,没有产品代码改动。

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

@deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。

这次运行覆盖 89a9cea…22d1c8d0b(20 个提交),同批合入的还有 #2546 #2556 #2589 #2591 #2545 #2538 #2595 #2596 #2581 #2539 #2598 #2515 #2536 #2575 #2366 #2606 #2544 #2593 #2603,失败不一定由本 PR 引起。

用例 跑道 状态 失败信息
Kimi basic bot flow feishu-core-clis failed waitFor timeout: Based on the screenshot, the middle column displays a welcome message "欢迎加入群组" (Welcome to the group) and system notifications about group creation and settings, rather than a list o…
Gemini basic bot flow feishu-core-clis failed waitFor timeout: Based on the screenshot, the main content area displays a topic conversation. I can see messages from "Gemini".
Codex DM chat mode replies inline and keeps one session feishu-core-dm-modes-codex failed Feishu Messenger chat list did not load after 4 attempts (URL: https://acn2e4mfbjx2.feishu.cn/next/messenger/, title: 消息 - 飞书). A login redirect means the saved storage state expired; a skeleton list…

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

🚀 Released in v3.56.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant