Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,23 @@ describe("AntigravityAdapterV2 harness recovery", () => {
});

describe("AntigravityAdapterV2 compaction", () => {
it.live.each([false, true])(
"negotiates native goals (%s) without enabling manual compaction",
(nativeGoals) =>
it.live.each([
{ nativeGoals: false, compact: false },
{ nativeGoals: true, compact: false },
{ nativeGoals: false, compact: true },
])(
"negotiates native goals ($nativeGoals) and advertised compaction ($compact)",
({ nativeGoals, compact }) =>
Effect.gen(function* () {
const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const crypto = yield* SecureRandom.SecureRandom;
const mockAgentPath = yield* path.fromFileUrl(
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
);
const logs = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-ag-compact-" });
const requestLog = path.join(logs, "requests.ndjson");
const instanceId = ProviderInstanceId.make("antigravity-compaction-test");
const goalSupport = yield* Ref.make(false);
const startupMilestone = yield* Deferred.make<void>();
Expand All @@ -346,7 +353,11 @@ describe("AntigravityAdapterV2 compaction", () => {
command: process.execPath,
args: [mockAgentPath],
cwd: input.cwd,
env: { T3_ACP_ANTIGRAVITY: "1" },
env: {
T3_ACP_ANTIGRAVITY: "1",
T3_ACP_AVAILABLE_COMMANDS: compact ? "compact" : "",
T3_ACP_REQUEST_LOG_PATH: requestLog,
},
},
}).pipe(
Effect.provideService(SecureRandom.SecureRandom, crypto),
Expand Down Expand Up @@ -375,28 +386,72 @@ describe("AntigravityAdapterV2 compaction", () => {
)
: Effect.void,
});
const threadId = ThreadId.make("thread-antigravity-compaction");
const modelSelection = { instanceId, model: "gemini-test-low" } as const;
const runtimePolicy = ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
runtimeMode: "full-access",
interactionMode: "default",
cwd: process.cwd(),
});
const opening = yield* adapter
.openSession({
threadId: ThreadId.make("thread-antigravity-compaction"),
threadId,
providerSessionId: ProviderSessionId.make("provider-session-antigravity-compaction"),
modelSelection: { instanceId, model: "gemini-test-low" },
runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy.make({
runtimeMode: "full-access",
interactionMode: "default",
cwd: process.cwd(),
}),
modelSelection,
runtimePolicy,
})
.pipe(Effect.forkScoped);
yield* Deferred.await(startupMilestone);
yield* Deferred.succeed(consumeStartupCommands, undefined);
const session = yield* Fiber.join(opening);
assert.deepEqual(yield* Ref.get(workspaceCommands), {
names: ["plan", "logout"],
names: compact ? ["compact"] : ["plan", "logout"],
cwd: process.cwd(),
});
assert.isUndefined(session.compactThread);
const compactThread = session.compactThread;
assert.isDefined(compactThread);
assert.equal(session.providerSession.capabilities.turns.supportsNativeGoals, nativeGoals);
assert.equal((yield* adapter.getCapabilities()).turns.supportsNativeGoals, nativeGoals);
const providerThread = yield* session.ensureThread({
threadId,
modelSelection,
runtimePolicy,
});
const turnInput = makeTurnInput({
threadId,
providerThread,
instanceId,
modelSelection,
runtimePolicy,
now: yield* DateTime.now,
messageText: "Compact the conversation.",
});
if (compact) {
yield* compactThread!(turnInput);
const events = yield* session.events.pipe(
Stream.takeUntil((event) => event.type === "turn.terminal"),
Stream.runCollect,
);
assert.isTrue(
events.some(
(event) =>
event.type === "turn_item.updated" &&
event.turnItem.type === "compaction" &&
event.turnItem.status === "completed",
),
);
} else {
const error = yield* compactThread!(turnInput).pipe(Effect.flip);
assert.instanceOf(error, ProviderAdapter.ProviderAdapterTurnStartError);
assert.instanceOf(error.cause, ProviderAdapter.ProviderCompactionUnsupportedError);
}
const prompts = (yield* fileSystem.readFileString(requestLog))
.trim()
.split("\n")
.map((line) => JSON.parse(line) as { method?: string; params?: { prompt?: unknown } })
.filter((request) => request.method === "session/prompt")
.map((request) => request.params?.prompt);
assert.deepEqual(prompts, compact ? [[{ type: "text", text: "/compact" }]] : []);
}).pipe(Effect.provide(layerSession)),
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@ export function makeAntigravityAcpAdapterFlavor(
normalizeToolCall: normalizeAntigravityToolCall,
extractSubagentUpdate: extractAntigravitySubagentUpdate,
supportsImagePrompts: true,
// ACP 1.3.0 treats /compact as ordinary model input.
supportsCompaction: false,
compactViaAdvertisedCommand: true,
requiresSignIn: isAntigravitySignInRequiredError,
// Antigravity can leave a prompt open without updates; long tools and approvals pause this.
promptInactivityTimeout: "15 minutes",
Expand Down
5 changes: 3 additions & 2 deletions docs/user/providers-antigravity.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ Antigravity. Antigravity cannot rewind its own conversation, so the next turn
starts a fresh Antigravity session and T3 Code sends it the kept conversation,
without the turns you removed.

Manual context compaction is unavailable through Antigravity's ACP runtime, even
though its CLI has `/compact`. Send `/clear` when you need a fresh context.
Use `/compact` to summarize a long conversation when your Antigravity runtime
offers that command. If it is unavailable, update Antigravity in provider settings
or send `/clear` when you need a fresh context.

### Skills and attachments

Expand Down
Loading