From 18c6c32628e5a8c50240bd73e0b5b5339579e99f Mon Sep 17 00:00:00 2001 From: "swe-agent[bot]" <0+swe-agent[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 00:34:38 +0800 Subject: [PATCH] fix(test): resolve CI timing race in TestFakeCmdInfra MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 问题:TestFakeCmdInfra/integration_with_runCodexTask 在 CI 环境中间歇性失败 原因:WaitDelay(1ms) 与 stdout 事件延迟(1ms) 过于接近,在 CI 负载下 Wait() 可能在第二个 JSON 事件写入前返回,导致过早关闭 stdout 修复:将 WaitDelay 从 1ms 增加到 5ms,确保 Wait() 在所有 stdout 数据写入后才返回,消除竞态条件 测试:本地和 -race 模式均通过 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- codex-wrapper/main_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codex-wrapper/main_test.go b/codex-wrapper/main_test.go index c6dc7ab..53f819c 100644 --- a/codex-wrapper/main_test.go +++ b/codex-wrapper/main_test.go @@ -618,7 +618,7 @@ func TestFakeCmdInfra(t *testing.T) { Data: `{"type":"item.completed","item":{"type":"agent_message","text":"fake-msg"}}` + "\n", }, }, - WaitDelay: time.Millisecond, + WaitDelay: 5 * time.Millisecond, }) newCommandRunner = func(ctx context.Context, name string, args ...string) commandRunner {