diff --git a/packages/coding-agent/test/history-storage-sqlite-compat.test.ts b/packages/coding-agent/test/history-storage-sqlite-compat.test.ts index 1c6bdd930..3e2f7555f 100644 --- a/packages/coding-agent/test/history-storage-sqlite-compat.test.ts +++ b/packages/coding-agent/test/history-storage-sqlite-compat.test.ts @@ -47,7 +47,8 @@ it("migrates legacy history schema away from unixepoch defaults", async () => { const storage = HistoryStorage.open(dbPath); storage.add("new prompt", "/tmp/new"); - await Bun.sleep(100); + // add() defers the INSERT via setImmediate; drain the macrotask queue + await new Promise(resolve => setImmediate(resolve)); const db = new Database(dbPath, { readonly: true }); try {