From d0c6409beb1d2eb9c7bf1bba248e58519afb5a1d Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 12 Nov 2026 22:03:02 +0000 Subject: [PATCH] test(acp-registry): subscribe to snapshot changes before triggering them The AcpRegistryDriver tests forked their snapshot-change waiters with a plain forkScoped, so the PubSub subscription only happened when the scheduler first ran that fiber. When the refresh or live-configuration publish landed first, the waiter missed the snapshot and hung until the 60s timeout. Fork with startImmediately so the subscription exists before the test triggers the change. AI-assisted; verified with the tests and tools listed above. --- .../src/server/driver.test.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/provider-acp-registry/src/server/driver.test.ts b/packages/provider-acp-registry/src/server/driver.test.ts index 05fc0a47d66bf..1495cb0bb64dd 100644 --- a/packages/provider-acp-registry/src/server/driver.test.ts +++ b/packages/provider-acp-registry/src/server/driver.test.ts @@ -587,7 +587,9 @@ it.layer(driverLayer, { excludeTestServices: true })("AcpRegistryDriver", (it) = Stream.runHead, ); - const probed = yield* waitForModels(["old-model"]).pipe(Effect.forkScoped); + const probed = yield* waitForModels(["old-model"]).pipe( + Effect.forkScoped({ startImmediately: true }), + ); yield* instance.snapshot.refresh; yield* Fiber.join(probed); yield* coordinator.publishLiveConfiguration( @@ -599,7 +601,9 @@ it.layer(driverLayer, { excludeTestServices: true })("AcpRegistryDriver", (it) = ); yield* fileSystem.writeFileString(modelsPath, JSON.stringify(["old-model", "new-model"])); - const refreshed = yield* waitForModels(["old-model", "new-model"]).pipe(Effect.forkScoped); + const refreshed = yield* waitForModels(["old-model", "new-model"]).pipe( + Effect.forkScoped({ startImmediately: true }), + ); yield* instance.invalidateCaches ?? Effect.void; yield* instance.snapshot.refresh; expect(Option.isSome(yield* Fiber.join(refreshed))).toBe(true); @@ -675,10 +679,14 @@ it.layer(driverLayer, { excludeTestServices: true })("AcpRegistryDriver", (it) = }, ); - const probed = yield* waitFor("model-a:,model-b:").pipe(Effect.forkScoped); + const probed = yield* waitFor("model-a:,model-b:").pipe( + Effect.forkScoped({ startImmediately: true }), + ); yield* instance.snapshot.refresh; yield* Fiber.join(probed); - const learned = yield* waitFor("model-a:effort,model-b:effort").pipe(Effect.forkScoped); + const learned = yield* waitFor("model-a:effort,model-b:effort").pipe( + Effect.forkScoped({ startImmediately: true }), + ); yield* coordinator.publishLiveConfiguration(identity.instanceId, session("model-b")); yield* coordinator.publishLiveConfiguration(identity.instanceId, session("model-a")); yield* Fiber.join(learned);