Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(provider): add Antigravity (Google AGY) provider integration & ACP bridge #4995

Closedumarfaruq0z(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/4995/headopened View on GitHub

Summary

Adds full support for the Google Antigravity (agy) provider into T3 Code.

Antigravity has no native agent protocol, so this integration introduces an ACP compatibility bridge process (t3 agy-acp) that wraps agy --print mode while reconstructing live event streams from PreToolUse/PostToolUse/Stop hooks and trajectory transcripts (transcript.jsonl).

Note

Credit & Reference: This PR incorporates and builds upon the foundational ACP bridge architecture originally submitted by @agentool in #4497. It extends that work with dynamic UI model grouping, log-based account/subscription discovery, official vector SVG branding, non-interactive text-generation shortcuts, and full unit test coverage across all provider layers.


📸 Screenshots & UI Showcase

1. Model Discovery & Reasoning Effort Selector

Groups raw CLI slugs (gemini-3.6-flash-high, gemini-3.6-flash-medium, etc.) into clean base models with dynamic Reasoning Effort (Low / Medium / High) selectors.

image image

2. Provider Settings & Account Authentication

Automatically parses CLI logs to display the authenticated user's email address and subscription tier badge (Google AI Pro Subscription / Enterprise).

image

Renders structured response streaming, markdown formatting, and clean provider footer (with mode selector dropdown hidden via showInteractionModeToggle: false).

image ---

🛠️ What Changed & Why

1. UI Model Grouping (AntigravityProvider.ts)

  • Problem: agy models returns 11 raw, un-grouped slugs (e.g. gemini-3.6-flash-high, gemini-3.6-flash-medium, gemini-3.6-flash-low), cluttering the model picker dropdown.
  • Solution: Implemented groupAntigravityModels() to consolidate slugs under clean base models (Gemini 3.6 Flash) with a dynamic Reasoning Effort Selector (Low, Medium, High).

2. Account & Subscription Discovery (AntigravityProvider.ts)

  • Implemented checkAntigravityAccountAuth() to inspect .gemini/antigravity-cli/cli.log and onboarding.json, displaying the logged-in email and subscription badge (Google AI Pro Subscription, Enterprise, etc.).

3. Tool Execution & Live Event Stream (agyBridge.ts & AntigravityAdapter.ts)

  • Executes turns via agy --print mode using --dangerously-skip-permissions.
  • Reconstructs a real-time event stream by correlating PreToolUse/PostToolUse/Stop hooks with transcript JSONL records on stepIdx/step_index.
  • Sets showInteractionModeToggle: false so that unnecessary permission mode selectors (Full access / Supervised) are automatically hidden from the UI for Antigravity sessions.

4. Official Vector SVG Branding & Preview Badge (Icons.tsx & providerDriverMeta.ts)

  • Replaced fuzzy PNG icon with high-resolution vector SVG paths and gradient masks.
  • Updated provider badge label to "Preview".

5. File Attachments (attachmentStore.ts & AntigravityAdapter.ts)

  • Added attachmentFileUrl() using NodeURL.pathToFileURL() to safely URI-encode file paths across operating systems.
  • Attached files are converted to resource_link URIs, appended to the prompt, and granted directory access via agy --add-dir.

6. In-Session Model Switching (sessionModelSwitch: "in-session")

  • Because --model is a per-turn flag on agy --print --conversation <id>, model changes take effect on subsequent turns while preserving the conversation trajectory.

7. Process Concurrency & Error Resiliency

  • Uses isolated per-session state files (t3code-acp-sessions/<sessionId>.json) to avoid race conditions when running multiple subagents/threads concurrently.
  • Queue error catching returns explicit JSON-RPC error responses (-32603), preventing UI client hangups if an internal bridge error occurs.

✅ Checklist

  • Code follows repository standards and TypeScript Effect conventions.
  • Formatting ran cleanly via vp fmt.
  • All 61 unit tests pass locally.
  • Credited prior work in #4497 by @agentool.
  • Includes documentation in AGENTS.md.

Note

Add Antigravity (Google AGY) provider integration with ACP bridge

  • Introduces a new antigravity provider driver that launches the agy CLI as an ACP bridge subprocess, streams transcript records, and exposes a full provider adapter with approval gating, cancellation, and model discovery.
  • Adds AntigravityAdapter and AntigravityDriver wiring the provider into the built-in driver registry with periodic health checks reporting installation, version, auth state, and discovered models.
  • Implements incremental transcript parsing (AgyTranscriptCursor) that handles partial lines, overlong-line discard (4 MiB cap), and deferred tool-call correlation between hook events and transcript records.
  • Adds Antigravity-backed TextGeneration for commit messages, PR content, branch names, and thread titles, using a 180s streaming prompt with schema-validated JSON extraction.
  • Exposes two hidden CLI subcommands (agy-acp, agy-hook) used by the bridge for stdio communication and tool-lifecycle hook handling.
  • Adds the Antigravity provider to the settings UI (schema, icon, Experimental badge) and the model picker with a new badge.
  • Risk: the bridge runs as a child process over stdio; if the agy binary is missing or times out (4s for version, 15s for models), the provider degrades to an error/warning status rather than failing hard.
📊 Macroscope summarized 76f12ef. 20 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.


Note

High Risk Large new session/approval/teardown logic plus dependence on agy print mode, hooks, and transcript parsing; tools run with skip-permissions unless the hook gate is enabled, so CLI or filesystem behavior changes can break streaming or safety expectations.

Overview Adds a built-in Antigravity provider that drives the external agy CLI through a bundled stdio ACP bridge (t3 agy-acp / t3 agy-hook), since agy has no native agent protocol. Sessions are implemented as a large AntigravityAdapter on top of AcpSessionRuntime, with turn lifecycle, optional PreToolUse hook–based tool approval (print mode still auto-approves at the CLI), attachments as resource_link file: URIs via new attachmentFileUrl, and per-turn model/effort passed into the bridge through env vars.

Provider surface: AntigravityDriver wires adapter + text generation + managed snapshots; AntigravityProvider probes agy --version / agy models (with stdin: "ignore" to avoid hangs), groups tiered model slugs for the UI, and infers subscription/email from local CLI logs. Contracts/settings/UI registration are implied by the driver stack; AGENTS.md documents bridge constraints.

Shared ACP runtime: AcpSessionRuntime gains a dispatch gate and cancellation generation so session/cancel cannot race prompt send/register, and assistant segments close on failed prompts too—behavior Antigravity’s adapter relies on for stop/cancel fencing.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit bcbd5f64788c4464cf66c380a71a2a6ce2a242de. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 273d1970-649c-4e9e-afe9-14c08bfc64ae

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. @@ -0,0 +983,21 @@
      983+): Promise<TurnOutcome> {
      984+ // A cancel that raced the end of an earlier turn must not decide this one.
      985+ cancelledSessions.delete(sessionId);
      986+ // Claimed before any setup work: spawning `agy` takes long enough that a
      987+ // cancel can land first, and cancels are only honoured for the session
      988+ // holding this claim. Leaving it unset until after the spawn would silently
      989+ // drop those, letting an auto-approving child run on past a cancelled turn.
      990+ activeTurnSessionId = sessionId;
      991+ // Measured before `agy` starts: whatever the transcript already holds
      992+ // belongs to earlier turns of the conversation being resumed.
      993+ const baseline = transcriptBaseline(session.conversationId);
      994+ let hookDir: string | undefined;
      995+ let hookWorkspace: string | undefined;
      996+ let attachmentDir: string | undefined;
      997+ let child: NodeChildProcess.ChildProcess;
      998+ try {
      999+ hookDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-agy-hookout-"));
      1000+ hookWorkspace = createHookWorkspace();
      1001+ const attachments = stageAttachments(prompt.attachments);
      1002+ attachmentDir = attachments.dir;
      1003+ const command = process.env["T3_AGY_COMMAND"]?.trim() || "agy";
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High antigravity/agyBridge.ts:1003

      resolveAgyCommand computes shell: true for Windows .cmd/.bat launchers, but the turn-spawn path at line 1004 never calls it — it passes the raw T3_AGY_COMMAND/agy string directly to spawn with shell unset. On Windows, npm-installed CLIs are typically .cmd files, and Node's spawn cannot launch those without shell: true, so Antigravity turns fail to start. Call resolveAgyCommand and pass its shell value into the spawn options.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/acp/antigravity/agyBridge.ts around line 1003:
      
      `resolveAgyCommand` computes `shell: true` for Windows `.cmd`/`.bat` launchers, but the turn-spawn path at line 1004 never calls it — it passes the raw `T3_AGY_COMMAND`/`agy` string directly to `spawn` with `shell` unset. On Windows, npm-installed CLIs are typically `.cmd` files, and Node's `spawn` cannot launch those without `shell: true`, so Antigravity turns fail to start. Call `resolveAgyCommand` and pass its `shell` value into the `spawn` options.
      @@ -0,0 +432,21 @@
      432+ const version = parseGenericCliVersion(`${versionOutput.stdout}\n${versionOutput.stderr}`);
      433+ if (versionOutput.code !== 0) {
      434+ yield* Effect.logWarning("Antigravity CLI version probe exited with a non-zero status.", {
      435+ exitCode: versionOutput.code,
      436+ });
      437+ return buildServerProvider({
      438+ presentation: ANTIGRAVITY_PRESENTATION,
      439+ enabled: settings.enabled,
      440+ checkedAt,
      441+ models: fallbackModels,
      442+ probe: {
      443+ installed: true,
      444+ version,
      445+ status: "error",
      446+ auth: { status: "unknown" },
      447+ message: "Antigravity CLI is installed but failed to run.",
      448+ },
      449+ });
      450+ }
      451+
      452+ const discoveryResult = yield* discoverAntigravityModels(settings, environment).pipe(
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium Layers/AntigravityProvider.ts:452

      checkAntigravityProviderStatus reports auth.status as "unauthenticated" and tells the user to sign in whenever model discovery returns zero models, but a transient timeout, spawn failure, or non-zero agy models exit code also produces an empty model list. This causes a false authentication diagnosis for transient CLI/runtime errors instead of reporting the discovery failure, misleading the provider status and remediation shown to users. Consider distinguishing discovery failures (timeout, spawn error, non-zero exit) from the genuinely-empty-list case, so only the latter reports "unauthenticated".

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/Layers/AntigravityProvider.ts around line 452:
      
      `checkAntigravityProviderStatus` reports `auth.status` as `"unauthenticated"` and tells the user to sign in whenever model discovery returns zero models, but a transient timeout, spawn failure, or non-zero `agy models` exit code also produces an empty model list. This causes a false authentication diagnosis for transient CLI/runtime errors instead of reporting the discovery failure, misleading the provider status and remediation shown to users. Consider distinguishing discovery failures (timeout, spawn error, non-zero exit) from the genuinely-empty-list case, so only the latter reports `"unauthenticated"`.
      @@ -0,0 +1325,21 @@
      1325+ const target = (pending["params"] as Record<string, unknown> | undefined)?.["sessionId"];
      1326+ if (typeof target === "string" && pending["id"] !== undefined) {
      1327+ queuedPromptGenerations.set(pending["id"], cancelGeneration(target));
      1328+ }
      1329+ }
      1330+ queue = queue
      1331+ .then(() => handleRequest(pending))
      1332+ .catch((error: unknown) => {
      1333+ // Every request must be answered. Swallowing a handler failure would
      1334+ // leave the client blocked on a response that never arrives.
      1335+ if (pending["id"] !== undefined) {
      1336+ const detail = error instanceof Error ? error.message : String(error);
      1337+ sendError(pending["id"], -32603, `internal bridge error: ${detail}`);
      1338+ }
      1339+ });
      1340+ }
      1341+ }
      1342+
      1343+ // stdin closed: no approval can still be answered, so unblock the hooks
      1344+ // waiting on them (they fail closed) rather than letting them time out.
      1345+ failPendingOutbound("T3 Code disconnected before approving this tool call");
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High antigravity/agyBridge.ts:1345

      When the ACP client disconnects mid-turn, the bridge keeps running the Antigravity child for up to the two-hour print timeout instead of terminating. runAgyBridge does await queue before activeChild?.kill("SIGTERM"), and the queue is blocked on runTurn, which is itself awaiting the child process exit — so the kill is never reached until the child exits on its own. Kill activeChild before awaiting the queue so a client disconnect immediately stops the agent.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/acp/antigravity/agyBridge.ts around line 1345:
      
      When the ACP client disconnects mid-turn, the bridge keeps running the Antigravity child for up to the two-hour print timeout instead of terminating. `runAgyBridge` does `await queue` before `activeChild?.kill("SIGTERM")`, and the queue is blocked on `runTurn`, which is itself awaiting the child process exit — so the kill is never reached until the child exits on its own. Kill `activeChild` before awaiting the queue so a client disconnect immediately stops the agent.
      @@ -0,0 +241,21 @@
      241+ optionDescriptors: [
      242+ {
      243+ id: "reasoningEffort",
      244+ label: "Reasoning",
      245+ type: "select",
      246+ options,
      247+ ...(options.find((o) => o.isDefault)?.id
      248+ ? { currentValue: options.find((o) => o.isDefault)!.id }
      249+ : {}),
      250+ },
      251+ ],
      252+ });
      253+ }
      254+
      255+ result.push({
      256+ slug: data.defaultSlug,
      257+ name,
      258+ isCustom: false,
      259+ capabilities,
      260+ });
      261+ }
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High Layers/AntigravityProvider.ts:255

      groupAntigravityModels sets each grouped model's slug to data.defaultSlug, which includes the tier suffix (e.g. gemini-3.6-flash-high). When the user selects a different reasoning effort like Low, the adapter still launches the tier-qualified High slug (gemini-3.6-flash-high) alongside --effort low, instead of using the unqualified base model. The slug should be baseSlug so the selected effort option is the only thing controlling the tier.

      Suggested change
      255- result.push({
      256- slug: data.defaultSlug,
      257- name,
      258- isCustom: false,
      259- capabilities,
      260- });
      261- }
      255+ result.push({
      256+ slug: baseSlug,
      257+ name,
      258+ isCustom: false,
      259+ capabilities,
      260+ });
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/Layers/AntigravityProvider.ts around lines 255-261:
      
      `groupAntigravityModels` sets each grouped model's `slug` to `data.defaultSlug`, which includes the tier suffix (e.g. `gemini-3.6-flash-high`). When the user selects a different reasoning effort like Low, the adapter still launches the tier-qualified High slug (`gemini-3.6-flash-high`) alongside `--effort low`, instead of using the unqualified base model. The slug should be `baseSlug` so the selected effort option is the only thing controlling the tier.
      @@ -0,0 +860,21 @@
      860+ hook.event === "pre-tool-use" &&
      861+ hook.payload?.toolCall
      862+ ) {
      863+ requestToolApproval({
      864+ sessionId: input.sessionId,
      865+ hookDir: input.hookDir,
      866+ hookName: name,
      867+ payload: hook.payload,
      868+ });
      869+ }
      870+ }
      871+
      872+ const transcriptPath = resolveTranscriptPath(input.state);
      873+ if (transcriptPath) {
      874+ let chunk = "";
      875+ try {
      876+ const stats = NodeFS.statSync(transcriptPath);
      877+ if (stats.size > input.transcriptOffset.value) {
      878+ const fd = NodeFS.openSync(transcriptPath, "r");
      879+ try {
      880+ const length = stats.size - input.transcriptOffset.value;
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium antigravity/agyBridge.ts:880

      drain ignores the return value of NodeFS.readSync and treats the entire zero-filled buffer as transcript data, then advances transcriptOffset.value to stats.size. A short read (legal on network filesystems) injects NUL bytes into the JSON stream and permanently skips the unread suffix, corrupting or dropping transcript and tool output. Consider looping until length bytes are read, or advancing and decoding only by the returned bytesRead.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/acp/antigravity/agyBridge.ts around line 880:
      
      `drain` ignores the return value of `NodeFS.readSync` and treats the entire zero-filled buffer as transcript data, then advances `transcriptOffset.value` to `stats.size`. A short read (legal on network filesystems) injects NUL bytes into the JSON stream and permanently skips the unread suffix, corrupting or dropping transcript and tool output. Consider looping until `length` bytes are read, or advancing and decoding only by the returned `bytesRead`.
      @@ -0,0 +155,21 @@
      155+ _meta: { antigravity: { event: "transcript", recordType: type, stepIdx: stepIndex } },
      156+ },
      157+ ],
      158+ emittedAssistantText: false,
      159+ };
      160+}
      161+
      162+/**
      163+ * Drop transcript records belonging to earlier turns.
      164+ *
      165+ * One conversation keeps a single append-only transcript, and every turn opens
      166+ * with a `USER_INPUT` record, so the last one in the file marks where the
      167+ * current turn begins. Resuming a conversation starts reading at byte 0 — the
      168+ * turn's own records cannot be located any other way — which without this trim
      169+ * would replay every prior assistant message as new output.
      170+ *
      171+ * Applied only to the first batch of a turn. Returns the input unchanged when
      172+ * no `USER_INPUT` is present, which is the correct read for a transcript whose
      173+ * opening record has not been written yet.
      174+ */
      175+export function dropPriorTurnRecords(lines: ReadonlyArray<string>): ReadonlyArray<string> {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium antigravity/agyTranscript.ts:175

      dropPriorTurnRecords looks for the last USER_INPUT across all records, so when resuming a conversation and the first read lands before the current turn's USER_INPUT has been appended, it finds the last USER_INPUT from a prior turn, slices after it, and returns that prior turn's remaining records. The caller sees a trimmed array with a different length and marks the transcript primed, so those prior-turn assistant and tool records are streamed as new output. The intended retention branch — which holds the batch back when no current USER_INPUT is present — only triggers when there are zero USER_INPUT records in the batch. Consider distinguishing the current turn's opening USER_INPUT from historical ones, for example by carrying a turn-start marker into the trim so the retention path is taken until the new opening record actually appears.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/acp/antigravity/agyTranscript.ts around line 175:
      
      `dropPriorTurnRecords` looks for the last `USER_INPUT` across all records, so when resuming a conversation and the first read lands before the current turn's `USER_INPUT` has been appended, it finds the last `USER_INPUT` from a prior turn, slices after it, and returns that prior turn's remaining records. The caller sees a trimmed array with a different length and marks the transcript primed, so those prior-turn assistant and tool records are streamed as new output. The intended retention branch — which holds the batch back when no current `USER_INPUT` is present — only triggers when there are zero `USER_INPUT` records in the batch. Consider distinguishing the current turn's opening `USER_INPUT` from historical ones, for example by carrying a turn-start marker into the trim so the retention path is taken until the new opening record actually appears.
      @@ -0,0 +946,21 @@
      946+function flushTerminal(sessionId: string, state: AgyTurnState, stepIdx: number): void {
      947+ const terminal = state.pendingTerminal.get(stepIdx);
      948+ if (!terminal) {
      949+ return;
      950+ }
      951+ state.pendingTerminal.delete(stepIdx);
      952+ sendSessionUpdate(sessionId, terminal);
      953+}
      954+
      955+/**
      956+ * Hooks report `transcript_full.jsonl`; the sibling `transcript.jsonl` holds
      957+ * the same steps without internal model chatter and is the better stream to
      958+ * render.
      959+ *
      960+ * The choice is pinned for the rest of the turn. `transcriptOffset` and the
      961+ * line cursor are byte positions into whichever file was picked, so switching
      962+ * once the condensed file appears would resume reading at an offset that means
      963+ * nothing in the new file — skipping records, or re-emitting ones already
      964+ * streamed from the other one.
      965+ */
      966+function resolveTranscriptPath(state: AgyTurnState): string | undefined {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium antigravity/agyBridge.ts:966

      resolveTranscriptPath can select transcript.jsonl even when the turn's byte baseline was measured from transcript_full.jsonl. On a resumed conversation, transcriptBaseline measures whichever transcript file exists at spawn time. If only transcript_full.jsonl is present, the baseline is its size. But when the first hook reports the path, resolveTranscriptPath sees that transcript.jsonl now exists and pins the condensed file for the rest of the turn. The full-file byte offset is then applied to the condensed file, skipping all of the turn's output when the condensed file is shorter or starting mid-record when it is longer. The selected path and its baseline need to be determined as one pinned pair, so they cannot diverge between spawn and the first hook.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/acp/antigravity/agyBridge.ts around line 966:
      
      `resolveTranscriptPath` can select `transcript.jsonl` even when the turn's byte `baseline` was measured from `transcript_full.jsonl`. On a resumed conversation, `transcriptBaseline` measures whichever transcript file exists at spawn time. If only `transcript_full.jsonl` is present, the baseline is its size. But when the first hook reports the path, `resolveTranscriptPath` sees that `transcript.jsonl` now exists and pins the condensed file for the rest of the turn. The full-file byte offset is then applied to the condensed file, skipping all of the turn's output when the condensed file is shorter or starting mid-record when it is longer. The selected path and its baseline need to be determined as one pinned pair, so they cannot diverge between spawn and the first hook.
      @@ -0,0 +1163,21 @@
      1163+ // Images ride in as `resource_link` blocks (an ACP baseline type)
      1164+ // rather than inline base64, so the `image` capability stays off.
      1165+ promptCapabilities: { image: false, audio: false, embeddedContext: false },
      1166+ mcpCapabilities: { http: false, sse: false },
      1167+ },
      1168+ authMethods: [],
      1169+ // The bridge has no version of its own; it ships with the server, so
      1170+ // that is the version worth reporting. The Antigravity CLI version is
      1171+ // reported separately by the provider snapshot (`agy --version`).
      1172+ agentInfo: { name: "Antigravity", version: packageJson.version },
      1173+ });
      1174+ return;
      1175+ }
      1176+ // Antigravity manages its own Google sign-in; there is nothing for the
      1177+ // client to authenticate against, but the handshake still requires a
      1178+ // successful reply.
      1179+ case "authenticate": {
      1180+ sendResult(id, {});
      1181+ return;
      1182+ }
      1183+ case "session/new":
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High antigravity/agyBridge.ts:1183

      session/load with a sessionId whose persisted mapping is missing or unreadable silently starts a fresh Antigravity conversation instead of resuming the requested thread. lookupConversationId returns undefined in that case, so the installed BridgeSession has no conversationId, and the next session/prompt omits --conversation — the agent runs with none of the thread's prior context while the client receives a success reply as if the session were loaded. Consider returning an error from session/load when the requested mapping cannot be resolved.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/acp/antigravity/agyBridge.ts around line 1183:
      
      `session/load` with a `sessionId` whose persisted mapping is missing or unreadable silently starts a fresh Antigravity conversation instead of resuming the requested thread. `lookupConversationId` returns `undefined` in that case, so the installed `BridgeSession` has no `conversationId`, and the next `session/prompt` omits `--conversation` — the agent runs with none of the thread's prior context while the client receives a success reply as if the session were loaded. Consider returning an error from `session/load` when the requested mapping cannot be resolved.
      @@ -0,0 +735,21 @@
      735+
      736+ // `agy` binds the model with a `--model` flag on each spawn, and that
      737+ // flag composes with `--conversation` — verified against the CLI: a
      738+ // resumed conversation answers on the new model with its history
      739+ // intact. Applied before `turn.started` so the announced model is the
      740+ // one the turn actually runs on.
      741+ const turnModelSelection =
      742+ input.modelSelection?.instanceId === boundInstanceId ? input.modelSelection : undefined;
      743+ const requestedModelId = turnModelSelection?.model
      744+ ? resolveAntigravityBaseModelId(turnModelSelection.model)
      745+ : undefined;
      746+ if (requestedModelId !== undefined && requestedModelId !== ctx.currentModelId) {
      747+ yield* ctx.acp
      748+ .setSessionModel(requestedModelId)
      749+ .pipe(
      750+ Effect.mapError((cause) =>
      751+ mapAcpToAdapterError(PROVIDER, input.threadId, "session/set_model", cause),
      752+ ),
      753+ );
      754+ ctx.currentModelId = requestedModelId;
      755+ ctx.session = { ...ctx.session, model: turnModelSelection?.model ?? ctx.session.model };
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium Layers/AntigravityAdapter.ts:755

      When a turn switches models, ctx.session.model is set to the raw turnModelSelection.model (e.g. flash) while the ACP runtime and ctx.currentModelId use the normalized requestedModelId (e.g. gemini-3.6-flash-medium). As a result, listSessions and the turn.started event report an alias that does not match the model the turn actually runs on. Store requestedModelId in ctx.session.model so observable state stays consistent with the runtime.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/Layers/AntigravityAdapter.ts around line 755:
      
      When a turn switches models, `ctx.session.model` is set to the raw `turnModelSelection.model` (e.g. `flash`) while the ACP runtime and `ctx.currentModelId` use the normalized `requestedModelId` (e.g. `gemini-3.6-flash-medium`). As a result, `listSessions` and the `turn.started` event report an alias that does not match the model the turn actually runs on. Store `requestedModelId` in `ctx.session.model` so observable state stays consistent with the runtime.
      @@ -0,0 +223,21 @@
      223+
      224+ for (const [baseSlug, data] of groups.entries()) {
      225+ const name = formatAntigravityModelName(baseSlug);
      226+ const effortList = Array.from(data.efforts);
      227+
      228+ let capabilities: ModelCapabilities = EMPTY_CAPABILITIES;
      229+ if (effortList.length > 0) {
      230+ const options = effortList.map((eff) => ({
      231+ id: eff,
      232+ label: eff.charAt(0).toUpperCase() + eff.slice(1),
      233+ ...(eff === "high" || effortList.length === 1 ? { isDefault: true } : {}),
      234+ }));
      235+ const hasDefault = options.some((opt) => opt.isDefault);
      236+ if (!hasDefault && options.length > 0) {
      237+ (options[options.length - 1] as { isDefault?: boolean }).isDefault = true;
      238+ }
      239+
      240+ capabilities = createModelCapabilities({
      241+ optionDescriptors: [
      242+ {
      243+ id: "reasoningEffort",
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟠 High Layers/AntigravityProvider.ts:243

      groupAntigravityModels exposes the reasoning options under the descriptor id reasoningEffort, but the Antigravity adapter only reads an option whose id is effort. As a result, every Low/Medium/High selection made on discovered Antigravity models is silently ignored, and no --effort flag is bound when a session starts. Rename the descriptor id to effort so the adapter picks up the selection, or update the adapter to read reasoningEffort.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/server/src/provider/Layers/AntigravityProvider.ts around line 243:
      
      `groupAntigravityModels` exposes the reasoning options under the descriptor id `reasoningEffort`, but the Antigravity adapter only reads an option whose id is `effort`. As a result, every Low/Medium/High selection made on discovered Antigravity models is silently ignored, and no `--effort` flag is bound when a session starts. Rename the descriptor id to `effort` so the adapter picks up the selection, or update the adapter to read `reasoningEffort`.
    4. Reviewed the new Antigravity provider modules against the Effect service conventions. Most of the new code follows the established driver/adapter/provider shape (mirrors GrokDriver / GrokAcpSupport closely), but three items in the changed scope deviate:

      • apps/server/src/provider/Layers/AntigravityProvider.ts: blocking node:fs I/O in the snapshot path instead of the Effect FileSystem/Path services, and without the nodeBuiltinImport diagnostics header this tree requires.
      • apps/server/src/provider/Layers/AntigravityAdapter.ts: detail copied from cause.message, which is then used to build the error message (ProviderDriver.ts has the same shape in the snapshot mapError).
      • apps/server/src/provider/Layers/AntigravityProvider.test.ts: CommonJS require in an ESM test plus an unused effect/Path import.

      Not flagged: makeAntigravityAcpRuntime taking childProcessSpawner: ChildProcessSpawner["Service"] — it is the same seam GrokAcpSupport/CursorAcpSupport use for AcpSessionRuntime.layer, so changing it here would be a repo-wide redesign rather than a scoped fix.

      Posted via Macroscope — Effect Service Conventions
      @@ -0,0 +3,21 @@
      3+import * as Effect from "effect/Effect";
      4+import * as FileSystem from "effect/FileSystem";
      5+import * as Path from "effect/Path";
      6+import * as Schema from "effect/Schema";
      7+import { AntigravitySettings } from "@t3tools/contracts";
      8+
      9+import {
      10+ buildInitialAntigravityProviderSnapshot,
      11+ checkAntigravityProviderStatus,
      12+} from "./AntigravityProvider.ts";
      13+
      14+const decodeAntigravitySettings = Schema.decodeSync(AntigravitySettings);
      15+
      16+const isWindows = process.platform === "win32";
      17+
      18+/**
      19+ * Creates a Node.js-backed script stub that runs identically on Windows and Unix.
      20+ */
      21+function makeNodeStub(dir: string, fileName: string, jsCode: string): string {
      22+ const fs = require("node:fs");
      23+ const path = require("node:path");
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      require is not available in this ESM test module (sibling tests import node builtins at the top level behind // @effect-diagnostics nodeBuiltinImport:off), and Path imported from effect/Path on line 5 is unused. Suggest either top-level import * as NodeFS from "node:fs" / import * as NodePath from "node:path" with that header, or building the stub through the FileSystem/Path services already in scope, and dropping the unused import.

      Posted via Macroscope — Effect Service Conventions
      @@ -0,0 +22,21 @@
      22+import * as Result from "effect/Result";
      23+import { HttpClient } from "effect/unstable/http";
      24+import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
      25+import { createModelCapabilities } from "@t3tools/shared/model";
      26+import { resolveSpawnCommand } from "@t3tools/shared/shell";
      27+
      28+import {
      29+ buildServerProvider,
      30+ isCommandMissingCause,
      31+ parseGenericCliVersion,
      32+ providerModelsFromSettings,
      33+ spawnAndCollect,
      34+ type ServerProviderDraft,
      35+} from "../providerSnapshot.ts";
      36+import {
      37+ enrichProviderSnapshotWithVersionAdvisory,
      38+ type ProviderMaintenanceCapabilities,
      39+} from "../providerMaintenance.ts";
      40+import * as NodeFS from "node:fs";
      41+import * as NodeOS from "node:os";
      42+import * as NodePath from "node:path";
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      checkAntigravityAccountAuth performs blocking imperative I/O (existsSync, readdirSync, statSync, readFileSync) from these node builtins inside the provider snapshot path, so its filesystem dependency is hidden from the Effect environment. Sibling probes acquire it as a service instead — ClaudeProvider.ts yields FileSystem.FileSystem/Path.Path and declares them in its Effect.fn.Return requirements — and AntigravityDriverEnv already provides both, so no wiring change is needed.

      These imports also lack the // @effect-diagnostics nodeBuiltinImport:off header that every other node-builtin module in this tree carries (nodeBuiltinImport is set to error in tsconfig.base.json), so the file will not pass diagnostics as written.

      Consider turning checkAntigravityAccountAuth into an Effect that yields FileSystem.FileSystem and Path.Path and drops the node:fs/node:os/node:path imports (os.homedir() can come from the existing home-dir helpers).

      Posted via Macroscope — Effect Service Conventions
      @@ -0,0 +400,21 @@
      400+ ? {
      401+ mcpServers: [
      402+ {
      403+ type: "http" as const,
      404+ name: "t3-code",
      405+ url: mcpSession.endpoint,
      406+ headers: [{ name: "Authorization", value: mcpSession.authorizationHeader }],
      407+ },
      408+ ],
      409+ }
      410+ : {}),
      411+ ...acpNativeLoggers,
      412+ }).pipe(
      413+ Effect.provideService(Crypto.Crypto, crypto),
      414+ Effect.provideService(Scope.Scope, sessionScope),
      415+ Effect.mapError(
      416+ (cause) =>
      417+ new ProviderAdapterProcessError({
      418+ provider: PROVIDER,
      419+ threadId: input.threadId,
      420+ detail: cause.message,
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      ProviderAdapterProcessError.message is built from detail, so setting detail to cause.message makes the wrapper message a restatement of the underlying failure instead of stable structural context. The immediate error is already preserved as cause; a fixed detail describing the failing stage reads better in logs and keeps the chain intact. The same pattern appears in Drivers/AntigravityDriver.ts (Failed to build Antigravity snapshot: ${cause.message ...}) if you want to adjust both.

      Suggested change
      420- detail: cause.message,
      420+ detail: "Failed to start the Antigravity ACP bridge.",
      Posted via Macroscope — Effect Service Conventions
    5. Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 76f12ef7e0ea30fa127a8b306a9cca2c908a318d. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +149,21 @@
      149+ if (raw.schemaVersion !== ANTIGRAVITY_RESUME_VERSION) return undefined;
      150+ if (typeof raw.sessionId !== "string" || !raw.sessionId.trim()) return undefined;
      151+ return { sessionId: raw.sessionId.trim() };
      152+}
      153+
      154+/**
      155+ * Reasoning effort for `agy --effort`, read from the model option selections.
      156+ * Antigravity accepts only low/medium/high.
      157+ */
      158+function resolveEffortSelection(
      159+ options:
      160+ | ReadonlyArray<{ readonly id: string; readonly value: string | boolean }>
      161+ | null
      162+ | undefined,
      163+): string | undefined {
      164+ // Option values are a string/boolean union across providers; only a string
      165+ // effort is meaningful here.
      166+ const raw = options?.find((option) => option.id === "effort")?.value;
      167+ const effort = typeof raw === "string" ? raw.trim().toLowerCase() : undefined;
      168+ return effort === "low" || effort === "medium" || effort === "high" ? effort : undefined;
      169+}

      Effort option ID never matches

      High Severity

      The AntigravityAdapter isn't applying user-selected reasoning effort. resolveEffortSelection expects the option ID effort, but the UI provides reasoningEffort. This mismatch prevents the agy --effort flag from being set, so the CLI always uses its default reasoning tier, ignoring user preferences.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 76f12ef7e0ea30fa127a8b306a9cca2c908a318d. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +140,21 @@
      140+ discoveredPlanType = "enterprise";
      141+ } else if (
      142+ obj["consumerOnboardingComplete"] === true ||
      143+ obj["onboardingComplete"] === true
      144+ ) {
      145+ discoveredPlanType = "pro";
      146+ }
      147+ }
      148+ }
      149+ } catch {
      150+ // Fall through
      151+ }
      152+ }
      153+
      154+ const label = antigravityAccountAuthLabel(discoveredPlanType);
      155+
      156+ return {
      157+ status: "authenticated",
      158+ ...(label ? { label } : {}),
      159+ ...(discoveredEmail ? { email: discoveredEmail } : {}),
      160+ };

      Auth always marked authenticated

      Medium Severity

      The checkAntigravityAccountAuth function always returns status: "authenticated", even when no authentication details are found in logs or onboarding files. This causes the UI to display a generic "Google Subscription" label, misleadingly indicating an authenticated account when no evidence exists.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 76f12ef7e0ea30fa127a8b306a9cca2c908a318d. Configure [here](https://www.cursor.com/dashboard/bugbot).
      @@ -0,0 +996,21 @@
      996+ let attachmentDir: string | undefined;
      997+ let child: NodeChildProcess.ChildProcess;
      998+ try {
      999+ hookDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-agy-hookout-"));
      1000+ hookWorkspace = createHookWorkspace();
      1001+ const attachments = stageAttachments(prompt.attachments);
      1002+ attachmentDir = attachments.dir;
      1003+ const command = process.env["T3_AGY_COMMAND"]?.trim() || "agy";
      1004+ child = NodeChildProcess.spawn(
      1005+ command,
      1006+ buildAgyArgs({
      1007+ session,
      1008+ hookWorkspace,
      1009+ attachmentDir,
      1010+ promptText: composePromptText(prompt.baseText, attachments.staged, prompt.remoteUris),
      1011+ }),
      1012+ {
      1013+ cwd: session.cwd,
      1014+ env: { ...process.env, [HOOK_DIR_ENV]: hookDir },
      1015+ stdio: ["ignore", "pipe", "pipe"],
      1016+ },

      Windows spawn ignores shell helper

      Medium Severity

      The runTurn function directly spawns the Antigravity CLI command, bypassing resolveAgyCommand. This omission prevents shell: true from being set for .cmd or .bat files on Windows, causing Antigravity turns to fail for Windows users even when health probes succeed.

      Fix in Cursor Fix in Web
      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 76f12ef7e0ea30fa127a8b306a9cca2c908a318d. Configure [here](https://www.cursor.com/dashboard/bugbot).
    6. Closing in favor of #2829 (orchestration V2).

      Two things changed under this PR:

      1. It implements a provider against the V1 adapter contract (provider/Layers/*Adapter.ts, provider/Services/ProviderAdapter.ts, ProviderAdapterRegistry), all of which #2829 deletes. Providers are now orchestration-v2/Adapters/*AdapterV2.ts entries in ProviderAdapterRegistry.ts.
      2. #2829 adds a generic ACP Registry driver (provider/Drivers/AcpRegistryDriver.ts, Adapters/AcpRegistryAdapterV2.ts) that resolves and runs any agent published to the official ACP registry — so a bespoke adapter may no longer be needed at all for this agent.

      Once #2829 merges, please check whether the ACP Registry driver already covers this agent. If it does, great — no code needed. If it doesn't, rebase onto main and reopen against the V2 adapter shape and we'll take a look.

    7. juliusmarminge closed this

Sign in to join this conversation.