Files
rea/tests/boundary/filesystem/clientRegistrationRefresh.test.ts
morluto 089dfa3a8b fix(setup): derive client deadlines from one record per client (#15371)
* fix(setup): derive client deadlines from one record per client

Each supported client definition now declares the MCP deadlines it applies
to REA's server: key, unit, built-in default, maximum, coverage and whether
progress resets it. Setup raises a shorter or missing deadline to REA's
recommendation within the client's maximum and keeps a longer one; doctor
reports the same shortfall from the same record. Cline, Zed, Antigravity,
Hermes, Goose and Gemini CLI gain deadlines; the codex/kimi/grok/dsh name
branches, the Goose timeout literal and the per-client startup constants
are removed.

Refs #15337

* fix(setup): keep a raised Goose timeout over a short inherited one and expect Antigravity's deadline
2026-12-01 01:48:59 +00:00

48 lines
2.1 KiB
TypeScript

import { parse as parseToml } from "smol-toml";
import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { expect, it } from "vitest";
import { configureClientConfiguration } from "../../../src/application/SetupClientConfiguration.js";
import {
ownedPackageCommand,
ownedPackageRegistration,
} from "../../fixtures/ownedPackageRegistration.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { supportedClientRegistrationProfile } from "../../fixtures/clientRegistrationProfile.js";
it.each([90, 120])(
"preserves caller-selected Grok startup timeout %s when refreshing its launcher",
async (timeout) => {
const directory = await createTestTempDirectory("rea-grok-refresh-");
const configPath = join(directory, "config.toml");
const source = `[mcp_servers.rea]\ncommand = "npx"\nargs = ["-y", "rea-agents@6.1.0", "mcp"]\nstartup_timeout_sec = ${timeout}\ncustom_policy = "caller"\n\n[mcp_servers.rea.env]\nPATH = "/caller/bin:/usr/bin"\nCUSTOM = "preserved"\n`;
await writeFile(configPath, source);
const client = {
name: "grok_build",
registrationProfile: supportedClientRegistrationProfile("grok_build"),
configPath,
format: "grok",
} as const;
expect(
await configureClientConfiguration(client, {}, ownedPackageCommand),
).toMatchObject({ status: "configured" });
const refreshed = await readFile(configPath, "utf8");
expect(parseToml(refreshed, { integersAsBigInt: true })).toEqual({
mcp_servers: {
rea: {
...ownedPackageRegistration,
startup_timeout_sec: BigInt(timeout),
custom_policy: "caller",
env: { PATH: "/caller/bin:/usr/bin", CUSTOM: "preserved" },
},
},
});
expect(await readFile(`${configPath}.rea.backup`, "utf8")).toBe(source);
expect(
await configureClientConfiguration(client, {}, ownedPackageCommand),
).toEqual({ status: "unchanged" });
expect(await readFile(configPath, "utf8")).toBe(refreshed);
expect(await readFile(`${configPath}.rea.backup`, "utf8")).toBe(source);
},
);