fix: resolve workspace teardown race with persistence fence

This commit is contained in:
Hibryda 2026-03-08 20:54:43 +01:00
parent a69022756a
commit dba6a88a28
5 changed files with 39 additions and 10 deletions

View file

@ -191,6 +191,7 @@ import {
stopAgentDispatcher,
isSidecarAlive,
setSidecarAlive,
waitForPendingPersistence,
} from './agent-dispatcher';
// Stop any previous dispatcher between tests so `unlistenMsg` is null and start works
@ -601,4 +602,11 @@ describe('agent-dispatcher', () => {
}));
});
});
describe('waitForPendingPersistence', () => {
it('resolves immediately when no persistence is in-flight', async () => {
vi.useRealTimers();
await expect(waitForPendingPersistence()).resolves.toBeUndefined();
});
});
});