From c8a4977378a01cefe0c98d84161f3caa49bdfa4c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 22 Feb 2026 12:29:53 +0000 Subject: [PATCH] test: replace mtime sleep with explicit utimes bump --- src/agents/workspace.bootstrap-cache.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/agents/workspace.bootstrap-cache.test.ts b/src/agents/workspace.bootstrap-cache.test.ts index c08f74fa3..a41bafe4a 100644 --- a/src/agents/workspace.bootstrap-cache.test.ts +++ b/src/agents/workspace.bootstrap-cache.test.ts @@ -47,6 +47,7 @@ describe("workspace bootstrap file caching", () => { it("invalidates cache when mtime changes", async () => { const content1 = "# Initial content"; const content2 = "# Updated content"; + const filePath = path.join(workspaceDir, DEFAULT_AGENTS_FILENAME); await writeWorkspaceFile({ dir: workspaceDir, @@ -58,15 +59,15 @@ describe("workspace bootstrap file caching", () => { const agentsFile1 = await loadAgentsFile(workspaceDir); expectAgentsContent(agentsFile1, content1); - // Wait a bit to ensure mtime will be different - await new Promise((resolve) => setTimeout(resolve, 10)); - // Modify the file await writeWorkspaceFile({ dir: workspaceDir, name: DEFAULT_AGENTS_FILENAME, content: content2, }); + // Some filesystems have coarse mtime precision; bump it explicitly. + const bumpedTime = new Date(Date.now() + 1_000); + await fs.utimes(filePath, bumpedTime, bumpedTime); // Second load should detect the change and return new content const agentsFile2 = await loadAgentsFile(workspaceDir);