From 7da2d12898871dad4982bded245a3a012a672001 Mon Sep 17 00:00:00 2001 From: Dimitri Kennedy Date: Fri, 23 Oct 2026 21:25:23 -0400 Subject: [PATCH] test: accept tree-hash fail-closed in growing-file race (HACK-1404) --- src/manage.test.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/manage.test.ts b/src/manage.test.ts index 6f6115f..e789ed5 100644 --- a/src/manage.test.ts +++ b/src/manage.test.ts @@ -3400,8 +3400,18 @@ describe("syncManagedTools", () => { await Bun.write(join(home, "growth-stop"), "stop\n"); expect(result.codexInstall.status).toBe("failed"); - expect(result.codexInstall.stderr).toContain("unexpected-growing"); - expect(result.codexInstall.stderr).toContain("file changed"); + // The mutator races the bounded reader. On a busy or single-core runner + // (seen on CI with Bun 1.4.4) the reader can finish between appends and + // then fails closed on the tree hash instead of the per-file change + // check. Both outcomes reject the payload; require one of them. + const stderr = result.codexInstall.stderr ?? ""; + const caughtDuringRead = + stderr.includes("unexpected-growing") && + (stderr.includes("file changed") || stderr.includes("file grew")); + const caughtByTreeHash = stderr.includes( + "installed tree hash differs from bundled payload" + ); + expect(caughtDuringRead || caughtByTreeHash).toBe(true); }); it("dry-runs bundled codex plugin setup without writing files", async () => {