Repository navigation
test(codex): attestation 文件改为写临时文件再改名,避免假 Codex 读到空文件 - #3155
Merged
Merged
Conversation
启动探测用例里,worker 会为同一轮多次重发 managed_turn_origin(进程号从探测进程
换到真实 CLI 时都会重发),测试每收到一次就原地重写 attestation 文件。本地打点:
最后一次重写离假 Codex 首次提交时读这个文件只有 2–14ms。writeFileSync 先截断再写,
读恰好落在两步之间就读到空串,夹具里 JSON.parse('') 报
"Unexpected end of JSON input",用例在 CI 上偶发红。
改为写临时文件再 rename,读到的只会是旧内容或新内容。同样的并发读写对照:
原地重写 75 万次读里 70 万次读到空,改名写入 52 万次读 0 次读到空。
Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 8, 2026 03:51
deepcoldy
pushed a commit
that referenced
this pull request
Nov 8, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🚀 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.
Fixes #3154
改了什么
test/worker-codex-lazy-rollout-ownership.integration.test.ts的夹具收到managed_turn_origin时,原来用writeFileSync原地重写 attestation 文件,现在改为先写临时文件再renameSync。只改测试,不碰产品代码。为什么
启动探测用例里 worker 会为同一轮反复重发
managed_turn_origin(进程号从探测进程换到真实 CLI 时都会重发),夹具每次都原地重写这个文件;假 Codex 在首次提交时读它。本地打点 3 次,每次这一轮都重写 6 次,最后一次重写离假 Codex 读取只有 2–14ms。writeFileSync先截断再写,读恰好落在两步之间就读到空串,夹具最后JSON.parse('')报Unexpected end of JSON input,CI 上偶发红(run 42436901239 / job 128597566113,同 run 其余 622 个文件全绿)。改名写入后,读到的只会是旧内容或新内容。
验证
npx vitest run --project unit test/worker-codex-lazy-rollout-ownership.integration.test.ts:两次各 8/8 通过。bun test ./test/worker-codex-lazy-rollout-ownership.integration.test.ts:8 pass / 0 fail。npx tsc --noEmit:通过。影响面
只改这一个测试文件的夹具;和 #2892 修的 slow-launcher 超时不是同一个问题。
🤖 Generated with Claude Code