fix(antigravity): isolate per-session app-data directories so concurrent threads stop resuming each other #43675
Openliuzhao1225(GitHub profile, opens in a new tab)wants to merge 7 commits into
main fromrefs/pull/43675/headopened View on GitHubliuzhao1225(GitHub profile, opens in a new tab) linked this to fix #43012
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
juliusmarminge added labelstakeover:in-progress
- @@ -230 +236,21 @@230236237+/** Lists child conversation IDs referenced by DB-backed `invoke_subagent` steps. */238+export function readAntigravityInvokeChildIds(dbPath: string): ReadonlyArray<string> {239+ let database: NodeSqlite.DatabaseSync;240+ try {241+ database = new NodeSqlite.DatabaseSync(dbPath, { readOnly: true });242+ } catch {243+ return [];244+ }245+ try {246+ database.exec("PRAGMA busy_timeout = 100");247+ const hasSteps =248+ database249+ .prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'steps'")250+ .get() !== undefined;251+ if (!hasSteps) return [];252+ const rows = database253+ .prepare(254+ "SELECT step_payload FROM steps WHERE step_type = ? AND step_format = 0 AND length(step_payload) <= ?",255+ )256+ .all(INVOKE_SUBAGENT_STEP_TYPE, MAX_STEP_BYTES);@@ -230,0 +247,21 @@247+ const hasSteps =248+ database249+ .prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'steps'")250+ .get() !== undefined;251+ if (!hasSteps) return [];252+ const rows = database253+ .prepare(254+ "SELECT step_payload FROM steps WHERE step_type = ? AND step_format = 0 AND length(step_payload) <= ?",255+ )256+ .all(INVOKE_SUBAGENT_STEP_TYPE, MAX_STEP_BYTES);257+ const ids = new Set<string>();258+ for (const row of rows) {259+ const payload = payloadOf(row);260+ if (payload === undefined) continue;261+ const record = decodeInvokeRecord(payload);262+ if (record === undefined) continue;263+ for (const child of record.children) ids.add(child.conversationId);264+ }265+ return [...ids];266+ } catch {267+ return [];@@ -0,0 +299,21 @@299+ // 1. Pure DB-backed legacy session (step_type = 127 only, no subagents/*.json).300+ const seeded = yield* makeProfile({ profile, steps: autoApproved });301+ const acp = path.join(profile, "antigravity-acp");302+ const legacyDbPath = path.join(acp, "conversations", `${ROOT}.db`);303+ const historicalSec = 1_700_000_000;304+ const badGatewayError = Buffer.concat([305+ Buffer.from([0x0a, 0x24]),306+ Buffer.from(307+ "Agent execution terminated due to error.\u0012agent executor error: Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []: Error 502, Message: Bad Gateway: Failed to connect to backend API, Status: 502 Bad Gateway, Details: []\n(1) attached stack trace\n -- stack trace:\nThe model is currently unreachable.",308+ ),309+ ]);310+ // Hold a read-only handle across writer close so `-wal` stays uncheckpointed on disk.311+ let legacyReader: NodeSqlite.DatabaseSync | undefined;312+ const migrated = yield* Effect.ensuring(313+ Effect.gen(function* () {314+ yield* Effect.promise(async () => {315+ const db = new NodeSqlite.DatabaseSync(legacyDbPath);316+ try {317+ db.exec("PRAGMA journal_mode = WAL");318+ db.exec("PRAGMA wal_autocheckpoint = 0");319+ legacyReader = new NodeSqlite.DatabaseSync(legacyDbPath, { readOnly: true });@@ -0,0 +158,21 @@158+ if (platform === "win32") {159+ const canonicalSource = await NodeFSP.realpath(source);160+ const canonicalInfo = await NodeFSP.lstat(canonicalSource, { bigint: true });161+ if (!canonicalInfo.isFile()) throw new Error("Expected a regular Antigravity profile file.");162+ const existingBigInt = await NodeFSP.lstat(target, { bigint: true }).catch((error: unknown) => {163+ if (hasCode(error, "ENOENT")) return undefined;164+ throw error;165+ });166+ if (167+ existingBigInt !== undefined &&168+ existingBigInt.isFile() &&169+ canonicalInfo.ino !== 0n &&170+ existingBigInt.dev === canonicalInfo.dev &&171+ existingBigInt.ino === canonicalInfo.ino172+ ) {173+ return;174+ }175+ if (existingBigInt !== undefined) await NodeFSP.rm(target, { force: true });176+ await NodeFSP.link(canonicalSource, target).catch(async (error: unknown) => {177+ if (!linkFallbackReason(error)) throw error;178+ await NodeFSP.copyFile(canonicalSource, target);@@ -0,0 +451,21 @@451+ if (childBrain !== undefined) {452+ const segments = ["brain", childId];453+ await copyManagedTree(childBrain.path, path.join(directory, ...segments), platform);454+ legacyArtifacts.push(segments);455+ }456+ }457+ });458+ yield* writeAntigravitySessionSlot(root, sessionId, slotId);459+ }).pipe(460+ Effect.onError(() =>461+ profileIO("Could not remove incomplete Antigravity migration directory.", () =>462+ NodeFSP.rm(directory, { recursive: true, force: true }),463+ ).pipe(Effect.ignore),464+ ),465+ );466+467+ for (const segments of legacyArtifacts) {468+ yield* profileIO("Could not remove migrated Antigravity artifact.", async () => {469+ const entry = await source(segments, segments[0] === "brain" ? "directory" : "file");470+ if (entry !== undefined) await NodeFSP.rm(entry.path, { recursive: true, force: true });471+ }).pipe(Effect.catch((error) => Effect.logWarning(error.detail, { segments })));@@ -0,0 +465,21 @@465+ );466+467+ for (const segments of legacyArtifacts) {468+ yield* profileIO("Could not remove migrated Antigravity artifact.", async () => {469+ const entry = await source(segments, segments[0] === "brain" ? "directory" : "file");470+ if (entry !== undefined) await NodeFSP.rm(entry.path, { recursive: true, force: true });471+ }).pipe(Effect.catch((error) => Effect.logWarning(error.detail, { segments })));472+ }473+ return true;474+ },475+ Effect.uninterruptible,476+);477+478+export const clearAntigravitySessionAuthFiles = Effect.fn("clearAntigravitySessionAuthFiles")(479+ function* (profileDirectory: string) {480+ const path = yield* Path.Path;481+ yield* profileIO("Could not clear Antigravity session sign-in files.", async () => {482+ if ((await lstatOrUndefined(profileDirectory)) === undefined) return;483+ const root = await NodeFSP.realpath(profileDirectory);484+ let firstError: unknown;485+ for (const folder of [ANTIGRAVITY_SESSIONS_DIR, ANTIGRAVITY_DISPOSABLE_DIR]) {@@ -294,3 +317,21 @@294317 ),295318 ),296319 );320+321+ let appDataDir: string;322+ let bindSessionId: (sessionId: string) => Effect.Effect<void, AcpErrors.AcpError> = () =>323+ Effect.void;324+ if (appDataMode === "shared") {325+ appDataDir = ANTIGRAVITY_SHARED_APP_DATA_DIR;326+ } else if (appDataMode === "disposable") {327+ const slotId = yield* random.uuidV4();328+ const prepared = yield* prepareAntigravitySessionAppDataDir({329+ profile,330+ auth,331+ kind: "disposable",332+ slotId,333+ }).pipe(334+ Effect.provideService(FileSystem.FileSystem, fileSystem),335+ Effect.provideService(HostProcess.Platform, platform),336+ Effect.provideService(Path.Path, path),337+ );@@ -87,0 +104,21 @@104+ );105+ if (sessionsDir === undefined || sessionRoots.has(sessionsDir.path)) continue;106+ let failed = false;107+ const slots = yield* fileSystem.readDirectory(sessionsDir.path).pipe(108+ Effect.catchTags({109+ PlatformError: (error) => {110+ if (error.reason._tag !== "NotFound") failed = true;111+ return Effect.succeed([]);112+ },113+ }),114+ );115+ const slotDirs: Array<string> = [];116+ for (const slotId of slots.filter(isValidAntigravitySlotId).sort()) {117+ const conversations = yield* Effect.promise(() =>118+ antigravityManagedPath(119+ profileRoot,120+ [ANTIGRAVITY_SESSIONS_DIR, slotId, "conversations"],121+ "directory",122+ ),123+ );124+ if (conversations !== undefined) slotDirs.push(conversations.path);
Pushedc810e3a
- @@ -0,0 +245,21 @@245+ yield* fs.writeFileString(canonicalToken, "win-token-v1");246+ const profile: AntigravityProfile = {247+ platform: "win32",248+ geminiHome,249+ acpDirectory,250+ tokenPath: path.join(acpDirectory, "acp_token.json"),251+ tempDirectory: path.join(acpDirectory, "tmp"),252+ browserCommand: "noop",253+ };254+ const slotId = "44444444-4444-4444-8444-444444444444";255+ const slot = yield* prepareAntigravitySessionAppDataDir({256+ profile,257+ auth: personalAuth,258+ kind: "session",259+ slotId,260+ });261+262+ const slotToken = path.join(slot.directory, "antigravity-oauth-token");263+ const slotMcp = path.join(slot.directory, "mcp_oauth_tokens.json");264+ expect(yield* fs.readFileString(slotToken)).toBe("win-token-v1");265+ expect(yield* fs.readFileString(slotMcp)).toBe("{}\n");@@ -8687,3 +8707,5 @@86878707 );86888708 });868987098710+ const discardFailedRuntime = Effect.gen(function* () {8711+ yield* Ref.set(loadingSessionId, null);@@ -10095,0 +10155,21 @@10155+ }) {10156+ const { threadId, sessionId } = input;10157+ if (flavor.restartRuntimeOnSessionSwitch) {10158+ const initialFailure = yield* Ref.modify(initialSessionActivationFailure, (failure) =>10159+ failure?.sessionId === sessionId ? [failure.error, null] : [undefined, failure],10160+ );10161+ if (initialFailure !== undefined) return yield* initialFailure;10162+ const needsRestart = yield* Ref.get(runtimeRestartRequired);10163+ const currentSession = yield* Ref.get(activeSessionId);10164+ if (!needsRestart && currentSession === sessionId) return undefined;10165+ if (currentSession !== sessionId) {10166+ const currentTurn = yield* Ref.get(activeTurn);10167+ const pendingWork = yield* (10168+ sessionRuntime.hasPendingBackgroundWork ?? Effect.succeed(false)10169+ );10170+ if (currentTurn !== null || pendingWork) {10171+ return yield* new ProviderAdapter.ProviderAdapterProtocolError({10172+ driver,10173+ detail: "Cannot replace ACP session while a turn or background work is active",10174+ });10175+ }@@ -11799,4 +11949,5 @@1179911949 yield* Ref.set(loadingSessionId, sessionId);1180011950 const activated = yield* runtime1180111951 .loadSession(sessionId, acpMcpActivation(mcpContext))11802- .pipe(Effect.onError(() => Ref.set(loadingSessionId, null)));11952+ .pipe(11953+ Effect.onError(() => Ref.set(loadingSessionId, null)),
Pushed3dc670b
Pushed103ae78
Pushed15f0579
- @@ -237,0 +245,21 @@245+export function readAntigravityInvokeChildIds(dbPath: string): ReadonlyArray<string> {246+ const database = new NodeSqlite.DatabaseSync(dbPath, { readOnly: true });247+ try {248+ database.exec("PRAGMA busy_timeout = 100");249+ const hasSteps =250+ database251+ .prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'steps'")252+ .get() !== undefined;253+ if (!hasSteps) return [];254+ const rows = database255+ .prepare(256+ "SELECT step_payload FROM steps WHERE step_type = ? AND step_format = 0 AND length(step_payload) <= ?",257+ )258+ .iterate(INVOKE_SUBAGENT_STEP_TYPE, MAX_STEP_BYTES);259+ const ids = new Set<string>();260+ for (const row of rows) {261+ const payload = payloadOf(row);262+ if (payload === undefined) continue;263+ const record = decodeInvokeRecord(payload);264+ if (record === undefined) continue;265+ for (const child of record.children) ids.add(child.conversationId);@@ -0,0 +265,21 @@265+ const slotMcp = path.join(slot.directory, "mcp_oauth_tokens.json");266+ expect(yield* fs.readFileString(slotToken)).toBe("win-token-v1");267+ expect(yield* fs.readFileString(slotMcp)).toBe("{}\n");268+ yield* fs.writeFileString(slotToken, "win-token-v2");269+ expect(yield* fs.readFileString(canonicalToken)).toBe("win-token-v2");270+271+ // Re-preparing an already linked slot preserves the link and refreshed contents.272+ yield* prepareAntigravitySessionAppDataDir({273+ profile,274+ auth: personalAuth,275+ kind: "session",276+ slotId,277+ });278+ expect(yield* fs.readFileString(slotToken)).toBe("win-token-v2");279+280+ // A cross-volume canonical token cannot be hard-linked; the slot must still share it.281+ const crossSlotId = "55555555-5555-4555-8555-555555555555";282+ const fsPromises = NodeFS.promises;283+ const realLink = fsPromises.link;284+ fsPromises.link = () =>285+ Promise.reject(Object.assign(new Error("cross-device link"), { code: "EXDEV" }));@@ -0,0 +690,21 @@690+ return [t1, t2] as const;691+ }),692+ );693+ const sessionA = threadA.nativeThreadRef?.nativeId ?? null;694+ const sessionB = threadB.nativeThreadRef?.nativeId ?? null;695+ if (sessionA === null || sessionB === null) {696+ throw new Error("Expected native thread IDs.");697+ }698+ expect(sessionA).not.toBe(sessionB);699+ const profileRoot = (yield* Effect.promise(() =>700+ antigravityProfileRoot(directories.profile),701+ ))!;702+ const slotA = yield* Effect.promise(() =>703+ readAntigravitySessionSlotId(profileRoot, sessionA),704+ );705+ const slotB = yield* Effect.promise(() =>706+ readAntigravitySessionSlotId(profileRoot, sessionB),707+ );708+ expect(slotA).toBeDefined();709+ expect(slotB).toBeDefined();710+ expect(slotA).not.toBe(slotB);@@ -0,0 +450,21 @@450+ isValidAntigravityNativeId(childId)451+ ) {452+ childIds.add(childId);453+ }454+ }455+ }456+ for (const childId of childIds) {457+ const childBrain = await source(["brain", childId], "directory");458+ if (childBrain !== undefined) {459+ const segments = ["brain", childId];460+ await copyManagedTree(childBrain.path, path.join(directory, ...segments), platform);461+ legacyArtifacts.push(segments);462+ }463+ }464+ });465+ yield* writeAntigravitySessionSlot(root, sessionId, slotId);466+ }).pipe(467+ Effect.onError(() =>468+ profileIO("Could not remove incomplete Antigravity migration directory.", () =>469+ NodeFSP.rm(directory, { recursive: true, force: true }),470+ ).pipe(Effect.ignore),@@ -105,4 +171,12 @@105171 : resolvedRoot;106172 conversationDirs.add(yield* fileSystem.realPath(dir).pipe(Effect.orElseSucceed(() => dir)));107173 }108- const result = yield* readAntigravityUsage([...conversationDirs], windowStartMs, cache).pipe(174+ const sources: Array<175+ string | { readonly root: string; readonly directories: ReadonlyArray<string> }176+ > = [177+ ...conversationDirs,178+ ...[...sessionRoots.entries()]179+ .filter(([, entry]) => entry.directories.length > 0)180+ .map(([root, entry]) => ({ root, directories: entry.directories })),181+ ];182+ const result = yield* readAntigravityUsage(sources, windowStartMs, cache).pipe(@@ -11201,5 +11328,8 @@1120111328 yield* awaitRuntimeTeardown();1120211329 const sessionId = yield* nativeThreadId(driver, threadInput.providerThread);1120311330 const previousItemIdentityVersion = itemIdentityVersion;11331+ const previousPolicy = latestRuntimePolicy;1120411332 useProviderThreadIdentity(threadInput.providerThread);11205- const restorePreviousItemIdentity = Effect.sync(() => {11333+ if (threadInput.runtimePolicy !== undefined) {11334+ latestRuntimePolicy = threadInput.runtimePolicy;11335+ }@@ -11788,6 +11916,21 @@11916+ driver,11917+ detail: "Cannot read ACP thread snapshot while a turn is active",11918+ });11919+ }1178811920 if (!capabilities.threads.canReadThreadSnapshot) {1178911921 return yield* new ProviderAdapter.ProviderAdapterProtocolError({1179011922 driver,1179111923 detail: "ACP driver does not support session/load snapshots",1179211924 });1179311925 }11926+ }11927+ const previousItemIdentityVersion = itemIdentityVersion;11928+ useProviderThreadIdentity(snapshotInput.providerThread);11929+ const restoreIdentity = Effect.sync(() => {11930+ itemIdentityVersion = previousItemIdentityVersion;11931+ });11932+ if (flavor.restartRuntimeOnSessionSwitch) {11933+ yield* ensureSessionActive({11934+ threadId: snapshotInput.providerThread.appThreadId,11935+ sessionId,11936+ }).pipe(Effect.tapError(() => restoreIdentity));
juliusmarminge added labelstakeover:blocked
juliusmarminge removed labelstakeover:in-progress
Pushed89ddd3a
- @@ -10094,2 +10185,21 @@1009410185 });100951018610187+ const ensureSessionActive = Effect.fnUntraced(function* (input: {10188+ readonly threadId: ThreadId | null;10189+ readonly sessionId: string;10190+ readonly resetSnapshot?: boolean;10191+ readonly runtimePolicy?: ProviderAdapter.ProviderAdapterV2RuntimePolicy;10192+ }) {10193+ const { threadId, sessionId } = input;10194+ if (flavor.restartRuntimeOnSessionSwitch) {10195+ const initialFailure = yield* Ref.modify(initialSessionActivationFailure, (failure) =>10196+ failure?.sessionId === sessionId ? [failure.error, null] : [undefined, failure],10197+ );10198+ if (initialFailure !== undefined) return yield* initialFailure;10199+ const needsRestart = yield* Ref.get(runtimeRestartRequired);10200+ const currentSession = yield* Ref.get(activeSessionId);10201+ const candidatePolicy = input.runtimePolicy ?? latestRuntimePolicy;10202+ const workspaceChanged =10203+ input.runtimePolicy !== undefined && input.runtimePolicy.cwd !== runtimeSpawnedCwd;10204+ if (!needsRestart && !workspaceChanged && currentSession === sessionId) {10205+ return undefined;@@ -10095,0 +10228,21 @@10228+ yield* quarantineNativeTransportAtGeneration(10229+ yield* Ref.get(runtimeCallbackGeneration),10230+ );10231+ yield* advanceRuntimeCallbackGeneration;10232+ yield* Ref.set(snapshot, emptySnapshotState());10233+ prepareTerminalEnvironment(yield* readMcpContext(threadId), sessionId);10234+ const candidate = yield* startAcpRuntime(threadId, sessionId, candidatePolicy);10235+ latestRuntimePolicy = candidatePolicy;10236+ yield* commitReplacementSession(threadId, candidate, { clearSnapshot: false });10237+ yield* Ref.set(loadingSessionId, null);10238+ return candidate;10239+ }10240+ const guardActiveWork =10241+ currentSession === sessionId && !workspaceChanged10242+ ? undefined10243+ : continuationPermit.withPermit(10244+ Effect.gen(function* () {10245+ const activeNow = yield* Ref.get(activeTurn);10246+ const bufferedNow = yield* Ref.get(wakeBuffer);10247+ const continuationNow = yield* Ref.get(continuationRequested);10248+ if (activeNow !== null || bufferedNow.length > 0 || continuationNow) {
Pushedbf22c6f
- @@ -11794,9 +12022,20 @@12022+ }).pipe(Effect.tapError(() => restoreIdentity));12023+ } else {12024+ yield* restartRuntimeAfterTeardownIfRequired(12025+ snapshotInput.providerThread.appThreadId,12026+ ).pipe(Effect.tapError(() => restoreIdentity));12027+ }12028+ if (12029+ (yield* Ref.get(activeSessionId)) !== sessionId ||12030+ snapshotLoadedForSessionId !== sessionId12031+ ) {1179412032 yield* Ref.set(snapshot, emptySnapshotState());12033+ snapshotLoadedForSessionId = null;1179512034 const mcpContext = yield* readMcpContext(1179612035 snapshotInput.providerThread.appThreadId,1179712036 );1179812037 prepareTerminalEnvironment(mcpContext, sessionId);1179912038 yield* Ref.set(loadingSessionId, sessionId);1180012039 const activated = yield* runtime1180112040 .loadSession(sessionId, acpMcpActivation(mcpContext))11802- .pipe(Effect.onError(() => Ref.set(loadingSessionId, null)));12041+ .pipe(
Pushed94d0d94
juliusmarminge added labelstakeover:blocked
juliusmarminge removed labelstakeover:in-progress
Sign in to join this conversation.
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:
Walkthrough
Antigravity now assigns managed app-data directories to sessions and disposable runtimes. Session-data readers and usage scans resolve these directories. The ACP adapter supports runtime replacement during session switches, including session loading, resumption, and snapshot tracking.
Changes: Antigravity session isolation
apps/server/src/provider/acp/AntigravityProfilePaths.ts,apps/server/src/provider/acp/AntigravitySessionSlots.ts,apps/server/src/provider/antigravityAuthSupport.ts,apps/server/src/provider/acp/AntigravitySessionIsolation.test.tsapps/server/src/provider/Drivers/AntigravityDriver.ts,apps/server/src/provider/Drivers/AntigravityDriver.test.ts,apps/server/src/provider/AntigravityAuth.ts,apps/server/src/provider/acp/AntigravitySessionIsolation.test.tsapps/server/src/provider/Drivers/AntigravityUsage.ts,apps/server/src/provider/Drivers/antigravityUsageReader.ts,apps/server/src/provider/acp/AntigravityChildWork.ts,apps/server/src/provider/acp/AntigravityTurnOutcome.ts,apps/server/src/provider/acp/AntigravitySessionIsolation.test.ts,apps/server/src/usage/UsageService.test.tspackages/provider-acp/src/server/AcpSessionRuntime.ts,packages/provider-acp/src/server/adapter.ts,apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts,apps/server/src/provider/acp/AntigravitySessionIsolation.test.tsEstimated code review effort: 4 (Complex) | ~60 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)#
Possibly related issues
Suggested reviewers:
juliusmarmingeMerge Risk:
Moderate · previous review
bf22cConcurrent Antigravity threads now get isolated app-data slots, and earlier session-switching races are fixed. A few edge cases remain. A snapshot read during background work can leave a task marked as running, which blocks later session switches. A failed runtime start can leave a stale or empty history snapshot. Some narrow slot-migration and cleanup issues also remain. Resolve or explicitly accept these before merging.
Pre-merge checks:
4
#43012] requires that a second Antigravity thread does not resume or cancel another thread's in-flight turn on the same provider instance. Root cause: allagy acpprocesses sh…#43012]. Slot creation, shared-auth and MCP links, and logout sweep are needed because auth files now exist in each slot. Legacy migration keeps existing conv…Full details: Title check
Explanation
The title names the main change: per-session app-data directories for Antigravity, which stops concurrent threads from resuming each other's turns. The title is specific, follows conventional commit format, and matches the changeset and linked issue objectives.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section has substantive content. The Problem section gives the root cause and the error text. The Change section lists the affected files and explains the design. The Scope section links issue
#43012. The Verification section gives concrete commands, results, and states what was not run (native Windows E2E). The description does not state whether an agent was used, which the template requests, and it does not follow the title-length guidance (105 characters). The Scope section does not explain why the change spans several components. Those gaps are minor.Full details: Linked Issues check
Explanation
Directly linked issue [
#43012] requires that a second Antigravity thread does not resume or cancel another thread's in-flight turn on the same provider instance. Root cause: allagy acpprocesses share--app-data-dir antigravity-acp, so startup resumes conversations owned by live processes. Change: each session gets its own slot undersessions/<slotId>, indexed bysession-slots/<sessionId>(AntigravityDriver.ts, AntigravitySessionSlots.ts, AntigravityProfilePaths.ts).buildAntigravityAcpSpawnInputin antigravityAuthSupport.ts acceptsappDataDirand passes it to the CLI. Refresh and text generation use ephemeraldisposable/<slotId>slots. AntigravityDriver.test.ts asserts distinct directories for two thread sessions. AntigravitySessionIsolation.test.ts covers concurrent driver isolation. The author reports real-binary probes (agy 1.5.14 and 1.5.18, macOS arm64) with two concurrent processes andcrossRestart=false. This assessment did not re-run those probes. The reported reproduction ran on Linux with CLI 1.5.17. No code path in the diff is OS-specific for the slot selection. The workaround and separate-instance idea are not acceptance criteria. [#42581] is background only. No unmet coding requirement is found.Full details: Out of Scope Changes check
Explanation
Changes map to per-session isolation for [
#43012]. Slot creation, shared-auth and MCP links, and logout sweep are needed because auth files now exist in each slot. Legacy migration keeps existing conversations reachable after files move into slots. The child-work, turn-outcome, and usage readers (AntigravityChildWork.ts, AntigravityTurnOutcome.ts, AntigravityUsage.ts, antigravityUsageReader.ts) resolve slot paths so they keep reading data. The ACP changes in packages/provider-acp (restartRuntimeOnSessionSwitch, disabled nativesession/forkon AntigravityAdapterV2,sessionStartMethod,ensureSessionActive) support the rule that each session runs with its matching slot.restartRuntimeOnSessionSwitchis an opt-in flavor flag, so the Antigravity-specific behavior is gated. Remaining uncertainty: the shared adapter.ts changes (ACP v1 load-replay recording, runtime policy and filesystem handler application, resumeThread behavior) apply to all ACP flavors by default. Their effect on other flavors was not verified in this pass. No unrelated change was demonstrated.Finishing Touches
Generate unit tests (beta)