fix(antigravity): clean Windows runtime temp files #9626
Closedariszz(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/9626/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/provider/acp/AntigravityAcpSupport.ts line 98OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -51,0 +78,21 @@78+ directory: string,79+) {80+ yield* fileSystem.remove(directory, { recursive: true, force: true }).pipe(81+ Effect.retry({ times: 5, schedule: Schedule.exponential("100 millis") }),82+ Effect.catch((cause) =>83+ Effect.logWarning("antigravity runtime temp cleanup failed", { directory, cause }),84+ ),85+ );86+});87+88+/** Recovers hard-exit residue without touching directories owned by another live T3 server. */89+const reclaimOrphanedRuntimeTempDirectories = Effect.fn("reclaimOrphanedRuntimeTempDirectories")(90+ function* (fileSystem: FileSystem.FileSystem, path: Path.Path, directory: string) {91+ const parent = path.dirname(directory);92+ const entries = yield* fileSystem.readDirectory(parent).pipe(Effect.orElseSucceed(() => []));93+ for (const entry of entries) {94+ const owner = runtimeTempDirectoryOwner.exec(entry)?.[1];95+ if (!owner) continue;96+ const ownerProcessId = Number(owner);97+ if (!Number.isSafeInteger(ownerProcessId) || isProcessAlive(ownerProcessId)) continue;98+ yield* removeRuntimeTempDirectory(fileSystem, path.join(parent, entry));
- apps/server/src/provider/acp/AntigravityAcpSupport.ts line 142Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -51,0 +109,21 @@109+ const candidate = path.join(parent, entry);110+ const markerMatches = yield* fileSystem111+ .readFileString(path.join(candidate, runtimeTempDirectoryMarkerName))112+ .pipe(113+ Effect.map(114+ (contents) => contents === runtimeTempDirectoryMarkerContents(entry, ownerProcessId),115+ ),116+ Effect.orElseSucceed(() => false),117+ );118+ if (!markerMatches) continue;119+ yield* removeRuntimeTempDirectory(fileSystem, candidate);120+ }121+ },122+);123+124+/** Contains PyInstaller extraction residue inside a directory owned by this runtime scope. */125+const makeWindowsRuntimeTempDirectory = Effect.fn("makeWindowsRuntimeTempDirectory")(function* (126+ fileSystem: FileSystem.FileSystem,127+ path: Path.Path,128+) {129+ const directory = yield* fileSystem
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed