From e19ab948b055ab3f5224d64406d122918ee65b7f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 13:13:46 +0000 Subject: [PATCH 1/2] test(antigravity): thread sessions get the ACP MCP terminal fallback env Fails on main: AntigravityDriver.makeRuntime builds the agent's env from the instance environment only, so the spawned agent never receives T3CODE_THREAD_ID or T3_ACP_MCP_NODE and the acp-mcp-call fallback for tools Antigravity does not register cannot run (#38123). Co-Authored-By: Claude Opus 5.5 --- .../Drivers/AntigravityDriver.test.ts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/apps/server/src/provider/Drivers/AntigravityDriver.test.ts b/apps/server/src/provider/Drivers/AntigravityDriver.test.ts index 447745fc673a..78daae63264d 100644 --- a/apps/server/src/provider/Drivers/AntigravityDriver.test.ts +++ b/apps/server/src/provider/Drivers/AntigravityDriver.test.ts @@ -3,6 +3,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices"; import { expect, it } from "@effect/vitest"; import { ANTIGRAVITY_DEFAULT_MODEL, + EnvironmentId, ProviderInstanceId, ProviderSessionId, ThreadId, @@ -142,6 +143,8 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* ( credentialKeys: ReadonlyArray; geminiApiKey: string | undefined; tempDirectory: string | undefined; + acpMcpNode: string | undefined; + threadId: string | undefined; handle: ChildProcessSpawner.ChildProcessHandle; }> = []; @@ -200,6 +203,8 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* ( geminiApiKey: env("GEMINI_API_KEY"), tempDirectory: environment.ANTIGRAVITY_HARNESS_PATH === undefined ? undefined : env("TMPDIR"), + acpMcpNode: env("T3_ACP_MCP_NODE"), + threadId: env("T3CODE_THREAD_ID"), handle, }); return handle; @@ -214,6 +219,7 @@ const makeHarness = Effect.fn("makeAntigravityDriverHarness")(function* ( { name: "PATH", value: instancePath }, { name: "T3_ACP_ANTIGRAVITY", value: "1" }, { name: "T3_ACP_REQUEST_LOG_PATH", value: requestLog }, + { name: "T3_ACP_MCP_HTTP", value: "1" }, { name: "GEMINI_API_KEY", value: "must-not-be-used" }, { name: "google_api_key", value: "must-not-be-used" }, { name: "GOOGLE_APPLICATION_CREDENTIALS", value: "/must-not-be-used.json" }, @@ -447,6 +453,44 @@ it.layer(layerTest)("AntigravityDriver", (it) => { }), ); + it.effect.skipIf(windowsHost)( + "gives the agent process the ACP MCP terminal fallback environment", + () => + Effect.gen(function* () { + const h = yield* makeHarness(); + yield* h.refresh(); + const workspace = yield* h.fs.makeTempDirectoryScoped({ prefix: "t3-ag-mcp-env-" }); + const threadId = ThreadId.make("thread-antigravity-mcp-env"); + yield* (yield* McpProviderSessions.McpProviderSessions).set({ + environmentId: EnvironmentId.make("environment-antigravity-mcp"), + threadId, + providerSessionId: "mcp-session-antigravity", + providerInstanceId: h.instance.instanceId, + endpoint: "http://127.0.0.1:43123/mcp", + authorizationHeader: "Bearer secret-antigravity-token", + browserToolsAvailable: false, + }); + const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({ + runtimeMode: "approval-required", + interactionMode: "default", + cwd: workspace, + }); + const modelSelection = { instanceId: h.instance.instanceId, model: "gemini-test-low" }; + const session = yield* h.instance.orchestrationAdapter.openSession({ + threadId, + providerSessionId: ProviderSessionId.make("provider-session-antigravity-mcp-env"), + modelSelection, + runtimePolicy, + }); + yield* session.ensureThread({ threadId, modelSelection, runtimePolicy }); + + // Antigravity runs shell commands itself (`terminal: false`), so they inherit this env. + const launch = h.launches.at(-1); + expect(launch?.threadId).toBe(threadId); + expect(launch?.acpMcpNode).toBeTruthy(); + }), + ); + it.effect.skipIf(windowsHost)( "closes refresh processes and clears account metadata when Google sign-in is required", () => From db716dcb44c6f6361663b1cf88feb722b601c163 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 13:18:20 +0000 Subject: [PATCH 2/2] fix(server): Antigravity agents get the ACP MCP terminal fallback environment AntigravityDriver.makeRuntime built the agent's environment from the instance environment only and dropped the session's processEnvironment, so the spawned agent never received T3CODE_THREAD_ID or the T3_ACP_MCP_* variables. Tools Antigravity does not register natively could then not be reached through acp-mcp-call from its shell. Merge the session environment over the instance environment for the agent spawn, as the Kiro, fx and ACP Registry adapters already do. Fixes pingdotgg/t3code#38123 Co-Authored-By: Claude Opus 5.5 --- .../orchestration-v2/Adapters/AntigravityAdapterV2.ts | 4 +++- apps/server/src/provider/Drivers/AntigravityDriver.ts | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts b/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts index b6f746269a6f..b6d02ffc01a8 100644 --- a/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts +++ b/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.ts @@ -74,7 +74,9 @@ export interface AntigravityAdapterV2Options { readonly instanceId: ProviderInstanceId; readonly selfInvocation: SelfInvocation; readonly makeRuntime: ( - input: Omit, + input: Omit & { + readonly processEnvironment?: NodeJS.ProcessEnv; + }, ) => Effect.Effect< AcpSessionRuntime.AcpSessionRuntime["Service"], EffectAcpErrors.AcpError | ProviderSetupError, diff --git a/apps/server/src/provider/Drivers/AntigravityDriver.ts b/apps/server/src/provider/Drivers/AntigravityDriver.ts index 75bca5acc87b..4b173c4dded6 100644 --- a/apps/server/src/provider/Drivers/AntigravityDriver.ts +++ b/apps/server/src/provider/Drivers/AntigravityDriver.ts @@ -197,9 +197,12 @@ export const AntigravityDriver: ProviderDriver< Effect.map((catalog) => stampIdentity(ModelCatalog.applyModelCatalog(draft, catalog))), ); - const makeRuntime = Effect.fn("AntigravityDriver.makeRuntime")(function* ( - input: Omit, - ): Effect.fn.Return< + const makeRuntime = Effect.fn("AntigravityDriver.makeRuntime")(function* ({ + processEnvironment: sessionEnvironment, + ...input + }: Omit & { + readonly processEnvironment?: NodeJS.ProcessEnv; + }): Effect.fn.Return< AcpSessionRuntime.AcpSessionRuntime["Service"], AcpErrors.AcpError | ProviderSetupError, Scope.Scope @@ -276,7 +279,7 @@ export const AntigravityDriver: ProviderDriver< installation: executable, profile, cwd: input.cwd, - baseEnv: processEnvironment, + baseEnv: { ...processEnvironment, ...sessionEnvironment }, auth, runtimeTempDirectory, }),