fix(server): sweep stale Antigravity _MEI orphans on Windows #12717
Closedmacodev00(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/12717/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:M
- apps/server/src/provider/acp/AntigravitySessionFiles.ts line 124OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -61,0 +104,21 @@104+ }) {105+ const fs = yield* FileSystem.FileSystem;106+ const path = yield* Path.Path;107+ if (input.systemTempDirectory === "" || !(yield* fs.exists(input.systemTempDirectory))) {108+ return;109+ }110+ const nowMs = input.nowMs ?? (yield* Clock.currentTimeMillis);111+ const minAgeMs = input.minAgeMs ?? ANTIGRAVITY_LEGACY_SYSTEM_TEMP_MIN_AGE_MS;112+ const entries = yield* fs113+ .readDirectory(input.systemTempDirectory)114+ .pipe(Effect.orElseSucceed(() => []));115+ for (const entry of entries) {116+ if (!entry.startsWith("_MEI")) continue;117+ const directory = path.join(input.systemTempDirectory, entry);118+ const stats = yield* fs.stat(directory).pipe(Effect.option);119+ if (Option.isNone(stats) || stats.value.type !== "Directory") continue;120+ const modifiedAt = Option.match(stats.value.mtime, {121+ onNone: () => Option.getOrUndefined(stats.value.birthtime),122+ onSome: (mtime) => mtime,123+ });124+ if (modifiedAt === undefined || nowMs - modifiedAt.getTime() < minAgeMs) continue;
- @@ -130,3 +133,10 @@130133 Effect.provideService(FileSystem.FileSystem, fileSystem),131134 );132135 }136+ // Pre-#12008 probes unpacked into the host TEMP. Profile isolation does137+ // not reclaim those. Windows-only: Unix can delete a live unpack.138+ if (platform === "win32") {139+ for (const systemTempDirectory of resolveAntigravityLegacySystemTempDirectories(140+ yield* HostProcessEnvironment,141+ )) {142+ yield* cleanOrphanedAntigravitySystemTempDirs({ systemTempDirectory }).pipe(
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge closed this
Sign in to join this conversation.
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
d8949ce7-d87b-4139-80e8-eb99c30b61c1📥 Commits
Reviewing files that changed from the base of the PR and between 52b89d3b8355e602d06c2c8afdd884dcb52fe23a and 027e7b2879aca3c01efb2dd844007f1d2529f2af.
📒 Files selected for processing (1)
apps/server/src/provider/acp/AntigravitySessionFiles.test.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough#
The change adds cleanup for stale, Antigravity-marked
_MEIdirectories in legacy system temp paths. On Windows,AntigravityDriver.createresolvesTEMPandTMPpaths and sweeps them. Cleanup preserves unmarked directories, directories at or under the age cutoff, and directories it cannot remove.Changes#
Antigravity cleanup
apps/server/src/provider/acp/AntigravitySessionFiles.ts,apps/server/src/provider/acp/AntigravitySessionFiles.test.tsTEMP/TMPresolution and cleanup for stale, marked_MEIdirectories. Tests cover marker and age filtering, the cutoff boundary, removal failures, and missing temp roots.apps/server/src/provider/Drivers/AntigravityDriver.ts,apps/server/src/provider/Drivers/AntigravityDriver.test.tsPriority: ➖ Normal
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)#
Merge Risk: 🟡 Moderate · up to
027e7A later server startup may remove files from an aged
_MEIdirectory still used by an Antigravity process, potentially disrupting that session. Protect live directories or explicitly accept this risk before merging.Security Architecture Review#
Security architecture risk: 🔵 Low · up to
027e7The cleanup is limited to Windows and old, marked directories. However, those checks do not establish that a directory is unused or owned by this server. An older live Antigravity extraction could be targeted; actual disruption and Windows filesystem behavior remain unverified.
Retained concerns
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
#12239, and the implementation directly addresses the reported Antigravity _MEI leftovers.✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.