mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 22:15:50 +00:00
fix(ci): verify packaged Agent Environment bridges (#12874)
* test(agentenv): observe timeout before polling a pending run * test(agentenv): verify bridge files at package boundary
This commit is contained in:
1 parent
b38438bab4
commit
41fc470072
14 files changed
+58
-94
No files matched your search
@@ -8,7 +8,6 @@ it("keeps complete note records and an unfinished trailing fragment", () => {
|
||||
expect(parseAgentEnvNotes(`${JSON.stringify(record)}\n{"id":`)).toEqual([
|
||||
record,
|
||||
]);
|
||||
expect(parseAgentEnvNotes(`${JSON.stringify(record)}\n`)).toEqual([record]);
|
||||
expect(parseAgentEnvNotes("")).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -16,5 +15,4 @@ it("rejects a newline-terminated note that is not a record", () => {
|
||||
expect(() =>
|
||||
parseAgentEnvNotes(`${JSON.stringify(record)}\n{bad}\n`),
|
||||
).toThrow(SyntaxError);
|
||||
expect(() => parseAgentEnvNotes("{bad}\n")).toThrow(SyntaxError);
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
const ROOT = new URL("../../", import.meta.url);
|
||||
|
||||
it("ships every agentenv helper the desktop code launches in the package", async () => {
|
||||
const files = (
|
||||
JSON.parse(await readFile(new URL("package.json", ROOT), "utf8")) as {
|
||||
files: string[];
|
||||
}
|
||||
).files;
|
||||
const sources = await readdir(new URL("src/desktop/", ROOT));
|
||||
const launched = new Set<string>();
|
||||
for (const source of sources.filter(
|
||||
(name) => name.endsWith(".ts") && !name.endsWith(".test.ts"),
|
||||
))
|
||||
for (const [, helper] of (
|
||||
await readFile(new URL(`src/desktop/${source}`, ROOT), "utf8")
|
||||
).matchAll(/"\.\.\/\.\.\/(bridge\/agentenv\/[\w.-]+\.py)"/gu))
|
||||
launched.add(helper as string);
|
||||
|
||||
expect([...launched].sort()).toEqual([
|
||||
"bridge/agentenv/capture.py",
|
||||
"bridge/agentenv/computer.py",
|
||||
"bridge/agentenv/solve.py",
|
||||
"bridge/agentenv/solve_cleanup.py",
|
||||
]);
|
||||
for (const helper of launched) expect(files).toContain(helper);
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
/** Bridge files shared by the runtime and the package verifier. */
|
||||
export const AGENTENV_BRIDGE_SOURCES = Object.freeze({
|
||||
capture: new URL("../../bridge/agentenv/capture.py", import.meta.url).href,
|
||||
computer: new URL("../../bridge/agentenv/computer.py", import.meta.url).href,
|
||||
solve: new URL("../../bridge/agentenv/solve.py", import.meta.url).href,
|
||||
solveCleanup: new URL(
|
||||
"../../bridge/agentenv/solve_cleanup.py",
|
||||
import.meta.url,
|
||||
).href,
|
||||
} as const);
|
||||
@@ -25,12 +25,11 @@ import {
|
||||
import { errorMessage } from "../kernel/errorMessage.js";
|
||||
import type { ComputerRelease } from "../domain/desktop/computerRelease.js";
|
||||
import { AGENTENV_PROVIDER } from "./AgentEnvProviderIdentity.js";
|
||||
import { AGENTENV_BRIDGE_SOURCES } from "./AgentEnvBridgeSources.js";
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
|
||||
const HELPER = fileURLToPath(
|
||||
new URL("../../bridge/agentenv/computer.py", import.meta.url),
|
||||
);
|
||||
const HELPER = fileURLToPath(AGENTENV_BRIDGE_SOURCES.computer);
|
||||
const HANDSHAKE_BYTES = 64 * 1024;
|
||||
const STDERR_BYTES = 16 * 1024;
|
||||
const TEARDOWN_MS = 120_000;
|
||||
|
||||
@@ -20,10 +20,9 @@ import {
|
||||
} from "./AgentEnvComputerHelper.js";
|
||||
import { AGENTENV_PROVIDER } from "./AgentEnvProviderIdentity.js";
|
||||
import { errorMessage } from "../kernel/errorMessage.js";
|
||||
import { AGENTENV_BRIDGE_SOURCES } from "./AgentEnvBridgeSources.js";
|
||||
|
||||
const HELPER = fileURLToPath(
|
||||
new URL("../../bridge/agentenv/solve.py", import.meta.url),
|
||||
);
|
||||
const HELPER = fileURLToPath(AGENTENV_BRIDGE_SOURCES.solve);
|
||||
const REPORT_BYTES = 256 * 1024;
|
||||
const STDERR_BYTES = 16 * 1024;
|
||||
/** The longest one solve may take, its deploy and teardown included, before REA stops it. */
|
||||
|
||||
@@ -17,10 +17,9 @@ import type {
|
||||
BuildControllerAnswer,
|
||||
ControlledComputer,
|
||||
} from "../ports/BuildComputerControl.js";
|
||||
import { AGENTENV_BRIDGE_SOURCES } from "./AgentEnvBridgeSources.js";
|
||||
|
||||
const CONTROLLER = fileURLToPath(
|
||||
new URL("../../bridge/agentenv/capture.py", import.meta.url),
|
||||
);
|
||||
const CONTROLLER = fileURLToPath(AGENTENV_BRIDGE_SOURCES.capture);
|
||||
/** The most file bytes one `data/get` brings back, so a large bundle arrives in several answers. */
|
||||
const FETCH_BATCH_BYTES = 8 * 1024 * 1024;
|
||||
/** Default time allowed for one REA command in the build computer. */
|
||||
|
||||
@@ -11,10 +11,9 @@ import {
|
||||
spawnOwnedProviderProcess,
|
||||
} from "../process/ProviderProcess.js";
|
||||
import { errorMessage } from "../kernel/errorMessage.js";
|
||||
import { AGENTENV_BRIDGE_SOURCES } from "./AgentEnvBridgeSources.js";
|
||||
|
||||
const CLEANUP = fileURLToPath(
|
||||
new URL("../../bridge/agentenv/solve_cleanup.py", import.meta.url),
|
||||
);
|
||||
const CLEANUP = fileURLToPath(AGENTENV_BRIDGE_SOURCES.solveCleanup);
|
||||
const resultSchema = z.discriminatedUnion("ok", [
|
||||
z.object({ ok: z.literal(true) }),
|
||||
z.object({ ok: z.literal(false), error: z.string() }),
|
||||
|
||||
Reference in new issue
Block a user