From 0216c9f374945f16ff0b8365a305e51697179c0a Mon Sep 17 00:00:00 2001 From: Erik Marks <25517051+rekmarks@users.noreply.github.com> Date: Thu, 15 Jan 2026 14:07:27 -0800 Subject: [PATCH] fix: Add waitUntilQuiescent() to eliminate race condition in GC test The "should trigger GC syscalls through bringOutYourDead" test was flaking due to a race condition where reference count updates from resolvePromises syscalls were still pending in microtasks when the test checked them. Adding await waitUntilQuiescent() after queueMessage ensures all async operations complete before checking ref counts. This is consistent with other synchronization patterns in the test file (lines 91, 104, 129). Co-Authored-By: Claude Opus 4.5 --- packages/kernel-test/src/garbage-collection.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/kernel-test/src/garbage-collection.test.ts b/packages/kernel-test/src/garbage-collection.test.ts index c38f277e0..268ed7920 100644 --- a/packages/kernel-test/src/garbage-collection.test.ts +++ b/packages/kernel-test/src/garbage-collection.test.ts @@ -113,6 +113,7 @@ describe('Garbage Collection', () => { 'createObject', [objectId], ); + await waitUntilQuiescent(); const createObjectRef = createObjectData.slots[0] as KRef; // Store initial reference count information