Repository navigation
fix(antigravity): avoid spawning process on probe and isolate temp di… #11657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a24b5a9
eb3f1c2
4e3d82b
a16f8fc
02f7c42
bd23bdb
15f98db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,68 @@ export const removeAntigravitySessionFiles = Effect.fn("removeAntigravitySession | |
| recursive: true, | ||
| force: true, | ||
| }); | ||
|
|
||
| // Best-effort cleanup of any unlocked temporary unpack directories left by PyInstaller | ||
| const tmpDirectory = path.join(acpDirectory, "tmp"); | ||
| if (yield* fs.exists(tmpDirectory)) { | ||
| const entries = yield* fs.readDirectory(tmpDirectory).pipe(Effect.orElseSucceed(() => [])); | ||
| for (const entry of entries) { | ||
| if (entry.startsWith("_MEI")) { | ||
| yield* fs | ||
| .remove(path.join(tmpDirectory, entry), { recursive: true, force: true }) | ||
| .pipe(Effect.ignore); | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| Effect.catch(() => Effect.logWarning("Could not remove temporary Antigravity session files.")), | ||
| ); | ||
|
|
||
| /** Sweeps orphaned PyInstaller unpack directories from prior runs. */ | ||
| export const cleanOrphanedAntigravityTempDirs = Effect.fn("cleanOrphanedAntigravityTempDirs")( | ||
| function* (profileDirectory?: string) { | ||
| const fs = yield* FileSystem.FileSystem; | ||
| const path = yield* Path.Path; | ||
|
|
||
| // 1. Clean profile-isolated tmp directory if provided | ||
| if (profileDirectory) { | ||
| const acpTmp = path.join(profileDirectory, "antigravity-acp", "tmp"); | ||
| if (yield* fs.exists(acpTmp)) { | ||
| const entries = yield* fs.readDirectory(acpTmp).pipe(Effect.orElseSucceed(() => [])); | ||
| for (const entry of entries) { | ||
| if (entry.startsWith("_MEI")) { | ||
| yield* fs | ||
| .remove(path.join(acpTmp, entry), { recursive: true, force: true }) | ||
| .pipe(Effect.ignore); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // 2. Clean orphaned _MEI folders in system temp directory left by previous Antigravity probes on Windows | ||
| // On Unix, concurrent processes can have their files deleted without file locking protection, | ||
| // so system temp sweeping is restricted to Windows where active files are lock-protected. | ||
| if (process.platform === "win32") { | ||
| const systemTemp = process.env.TEMP || process.env.TMP; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Sweep both configured system temporary directories.
🤖 Prompt for AI Agents |
||
| if (systemTemp && (yield* fs.exists(systemTemp))) { | ||
| const entries = yield* fs.readDirectory(systemTemp).pipe(Effect.orElseSucceed(() => [])); | ||
| for (const entry of entries) { | ||
| if (entry.startsWith("_MEI")) { | ||
| const fullPath = path.join(systemTemp, entry); | ||
| const hasGoogle3 = yield* fs | ||
| .exists(path.join(fullPath, "google3")) | ||
| .pipe(Effect.orElseSucceed(() => false)); | ||
| const hasGoogle = | ||
| hasGoogle3 || | ||
| (yield* fs | ||
| .exists(path.join(fullPath, "google")) | ||
| .pipe(Effect.orElseSucceed(() => false))); | ||
| if (hasGoogle) { | ||
| yield* fs.remove(fullPath, { recursive: true, force: true }).pipe(Effect.ignore); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| ); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High
Drivers/AntigravityDriver.ts:104Starting T3 deletes unpacked runtimes belonging to concurrently running Antigravity or other Google PyInstaller processes on Unix, because
cleanOrphanedAntigravityTempDirs(profileDirectory)scans shared TEMP without proving instance ownership or process liveness; any cleanup errors are also ignored. Limit the sweep to an instance-owned temp root, or verify ownership and liveness before removing a directory.🤖 Copy this AI Prompt to have your agent fix this: