From b03eb7eda8edd1752704e477835582244b84d161 Mon Sep 17 00:00:00 2001 From: Badcuban <108198679+badcuban@users.noreply.github.com> Date: Mon, 16 Nov 2026 05:40:04 -0500 Subject: [PATCH] test(server): the webhook issue-thread test waits for the event to name its thread An event reads "joined" once its run is claimed, and names its thread (the run's thread_id) once the run reaches the thread, a step later. The test waited for "joined" and then read the thread at once, so on a busy runner it read null. It now waits for both. Under load the old test failed 2 of 12 runs with CI's error; the new one passed 18 of 18. --- apps/server/src/scheduled/WebhookEvents.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/server/src/scheduled/WebhookEvents.test.ts b/apps/server/src/scheduled/WebhookEvents.test.ts index 8b0a8bb9c..c5330a6ad 100644 --- a/apps/server/src/scheduled/WebhookEvents.test.ts +++ b/apps/server/src/scheduled/WebhookEvents.test.ts @@ -782,10 +782,14 @@ it.layer(NodeServices.layer)("event tasks", (it) => { assert.equal(waiting[1]?.status, "waiting"); assert.equal(waiting[1]?.reason, "Waiting for this issue's first run to start its thread."); - // The first run's thread exists: the second event continues it. + // The first run's thread exists: the second event continues it. An + // event reads "joined" once its run is claimed, and names the thread + // once the run has reached it, a step later: wait for both. yield* Deferred.succeed(gate, undefined); yield* eventually( - eventsOf(computer, task.id).pipe(Effect.map((events) => events[1]?.status === "joined")), + eventsOf(computer, task.id).pipe( + Effect.map((events) => events[1]?.status === "joined" && events[1]?.threadId != null), + ), "the second event joined the issue's thread", ); const runs = yield* computer.runs(task.id);