test(server): keep provider fixture directories host-portable#9572

merged1
windows-tests/mode-bits
windows-tests/temp-cleanup
openedSep 4, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago
1 unresolved thread · Jump to file
Selected thread: apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts:74 — ### Fake probe never exits after abort **Medium Severity** <!-- DESCRIPTION START --> The fake CLI still keeps the event loop alive after the probe aborts, so it never releases `workspaceCwd`. On Windows the new retrying `rm` then fails every attempt, and Node's linear backoff on `maxRetries` can block teardown for tens of seconds before the leftover directory is ignored. <!-- DESCRIPTION END --> <!-- BUGBOT_BUG_ID: 531f9659-926b-42b7-840c-fac98f6be4e5 --> <!-- LOCATIONS START apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts#L64-L74 apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts#L124-L125 LOCATIONS END --> <details> <summary>Additional Locations (1)</summary> - [`apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts#L124-L125`](https://github.com/pingdotgg/t3code/blob/bc8fff55c03d5d73d561bbc412409cfe904b4aea/apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts#L124-L125) </details> <div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmY5NTY2YjgyLTFhMmEtNDg4YS1hYTQyLWZlNzI1NGJlMTdhYiIsImVuY3J5cHRpb25LZXkiOiJQSnNubVdBUkE4RFUyRWZ2UG15ZUZyUE1QRTlmWmpjQkxsWS1WWS1hSVkwIiwiYnJhbmNoIjoid2luZG93cy10ZXN0cy90ZW1wLWNsZWFudXAiLCJyZXBvT3duZXIiOiJwaW5nZG90Z2ciLCJyZXBvTmFtZSI6InQzY29kZSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmY5NTY2YjgyLTFhMmEtNDg4YS1hYTQyLWZlNzI1NGJlMTdhYiIsImVuY3J5cHRpb25LZXkiOiJQSnNubVdBUkE4RFUyRWZ2UG15ZUZyUE1QRTlmWmpjQkxsWS1WWS1hSVkwIiwiYnJhbmNoIjoid2luZG93cy10ZXN0cy90ZW1wLWNsZWFudXAiLCJyZXBvT3duZXIiOiJwaW5nZG90Z2ciLCJyZXBvTmFtZSI6InQzY29kZSIsInByTnVtYmVyIjo5NTcyLCJjb21taXRTaGEiOiJiYzhmZmY1NWMwM2Q1ZDczZDU2MWJiYzQxMjQwOWNmZTkwNGI0YWVhIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bc8fff55c03d5d73d561bbc412409cfe904b4aea. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
0 / 2 viewed2 files changedLine totals unavailable

apps/server/src/provider/Layers/ClaudeCapabilitiesProbe.test.ts · Earlier revision bc8fff55 · right 74

Original diff
@@ -51,8 +53,25 @@ it.layer(NodeServices.layer)("Claude capability probe SDK boundary", (it) => {
       const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-claude-probe-sdk-" });
       const executablePath = path.join(tempDir, "fake-claude.mjs");
       const invocationPath = path.join(tempDir, "invocation.json");
-      const workspaceCwd = path.join(tempDir, "workspace");
-      yield* fs.makeDirectory(workspaceCwd, { recursive: true });
+      // The probe aborts the SDK without awaiting the child's exit, and on
+      // Windows a directory that is still some process's cwd cannot be
+      // removed. Keep the workspace outside the scoped directory and let it
+      // go with a retrying removal once the child has gone.
+      const workspaceCwd = yield* fs.makeTempDirectory({ prefix: "t3-claude-probe-cwd-" });
+      // Node's own retry rather than an Effect schedule: it.effect runs on a
+      // TestClock, so a scheduled retry would wait for time nobody advances.
+      // If the child still holds the directory after that, an empty temp
+      // directory is left behind rather than failing the test for it.
+      yield* Effect.addFinalizer(() =>
+        Effect.promise(() =>
+          NodeFSP.rm(workspaceCwd, {
+            recursive: true,
+            force: true,
+            maxRetries: 20,
+            retryDelay: 250,
+          }).catch(() => undefined),
+        ),
+      );
C
cursorBotSep 4, 2026

Fake probe never exits after abort

Medium Severity

The fake CLI still keeps the event loop alive after the probe aborts, so it never releases workspaceCwd. On Windows the new retrying rm then fails every attempt, and Node's linear backoff on maxRetries can block teardown for tens of seconds before the leftover directory is ignored.

Additional Locations (1)

Reviewed by Cursor Bugbot for commit bc8fff55c03d5d73d561bbc412409cfe904b4aea. Configure here.