Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Tests: control the Antigravity turn admission clock

RinKokawa702161edcfe4
diff --git a/server/drivers/antigravity.test.ts b/server/drivers/antigravity.test.ts
index 3f041e37af..b74dc6734a 100644
--- a/server/drivers/antigravity.test.ts
+++ b/server/drivers/antigravity.test.ts
@@ -1307,15 +1307,19 @@ describe("Antigravity driver over shared ACP", () => {
});
await instance.startupModelRefresh;
recorder = recordEvents(instance.adapter);
+ let now = Date.now();
+ vi.spyOn(Date, "now").mockImplementation(() => now);
+ const engineAdmission = vi.fn(async () => { now += 1; });
const run = async () => {
- const { turnId } = await instance!.adapter.sendTurn({ threadId: "thread-starts", text: "hello", approvalMode: "ask", model: "gemini-3.8-flash", cwd: fake.directory, resumeCursor: "fake-acp-session" });
+ const { turnId } = await instance!.adapter.sendTurn({ threadId: "thread-starts", text: "hello", approvalMode: "ask", model: "gemini-3.8-flash", cwd: fake.directory, resumeCursor: "fake-acp-session", engineAdmission });
await recorder!.until((event) => event.type === "turn.completed" && event.turnId === turnId);
return recentTurnStarts().at(-1)!;
};
- expect(await run()).toMatch(/^\[perf\] engine turn antigravityAgent: new process, models waited \d+ ms, spawn to initialize \d+ ms, authenticate \d+ ms, session (?:new|resume) \d+ ms, config 1 call \d+ ms, prompt to first update \d+ ms, total \d+ ms, ended end_turn$/u);
+ expect(await run()).toMatch(/^\[perf\] engine turn antigravityAgent: new process, models waited \d+ ms, room waited 1 ms, spawn to initialize \d+ ms, authenticate \d+ ms, session (?:new|resume) \d+ ms, config 1 call \d+ ms, prompt to first update \d+ ms, total \d+ ms, ended end_turn$/u);
expect(await run()).toMatch(/^\[perf\] engine turn antigravityAgent: kept process, models waited \d+ ms, session live, config 0 calls 0 ms, prompt to first update \d+ ms, total \d+ ms, ended end_turn$/u);
rmSync(join(tokenDirectory, "acp_token.json"));
expect(await run()).toMatch(/: no process, .*no prompt, total \d+ ms, ended auth_required$/u);
+ expect(engineAdmission).toHaveBeenCalledTimes(1);
});
it("ends a stale-model turn at once when the person stops it while the model list is read", async () => {