mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 17:59:08 +00:00
* docs(desktop): clarify gzip scrub limits * fix(setup): own desktop build process cleanup * fix(doctor): compare desktop settings with resolved defaults * fix(desktop): refuse a build runtime whose export takes no task ends Several tasks pass --task-end to the build computer's export, so a runtime packed before it now fails at the start of the capture with the repack fix, as a runtime without synthetic seeds already did, rather than at export. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style(desktop): format the noisy-record draft files with the pinned oxfmt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): give the root-array draft test its own describe The records describe grew past the 150-line lint limit with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(doctor): inspect client-recorded desktop runners * fix(doctor): reuse matching runner probes * fix(setup): propagate cancellation to desktop actions * fix(desktop): rewrite a download's launch keys written with spaces around = The desktop entry parser accepts `Exec = notes %F` and an indented `TryExec =notes`, so the install script now matches those keys the same way instead of leaving the original program in place. Adds the feature's tasks.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): keep why a measured run failed in its solve record A solve that returned an outcome dropped the runner's error, so a run that failed to deploy, solve or verify was retried with no reason recorded. The record, the measure result and difficulty.json now carry it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(setup): stop Hopper on cancel, never report a cancelled setup ready, and keep a failed action's client setting - The Hopper install gets setup's signal: Linux already honoured it, and the macOS installer now stops its downloads and stops before mounting or copying. - runSetup checks the signal after the final doctor and close, so a cancellation there raises instead of returning ready. - A failed pack or agentenv install no longer writes its archive or runner to client configs, so the setting the client already had stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(setup): keep the completed setup result in a cancellation after cleanup A cancellation during the final doctor or host close carried only the applied actions, dropping each client's result and backup path and the doctor report. It now carries the whole result as setup_result, as doctor's cancellation carries its report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(desktop): move launch execution to boundary suite * fix(desktop): redact build schema failure output * refactor(desktop): normalize schema failure once * fix(desktop): omit unsafe schema parser snippets * fix(desktop): preserve draft change and selected path evidence * test(desktop): group retained dconf note regressions * fix(desktop): respect archive entry format in draft checks * test(desktop): separate unowned-file draft note cases * fix(desktop): preserve explicitly selected journal documents * fix(xml): avoid scanning selected ancestors per tag * fix(desktop): exclude covered text runs from draft counts * fix: preserve text when drafting desktop checks * fix: restore nested desktop state aliases * refactor: share UUID recognition across draft checks * fix: retain multiline XML attribute context * fix: retain relationship identifiers in task drafts * docs: clarify desktop draft identifier handling * test(desktop): type formatting run cases as pairs * fix(desktop): carry document format into selector evaluation * test(desktop): separate markup boundary regression group * fix(desktop): propagate formats through draft selectors * fix(desktop): switch selector format within archive entries * test(desktop): remove duplicate seed filename case * fix(setup): retain diagnostics when cancellation overlaps failure * refactor(setup): keep command cancellation at its owner * test(setup): verify cancellation at the application boundary * test(desktop): pass JSON format in exported index parity * docs(desktop): clarify task checks before scratch export * fix(desktop): respell selected paths in file URLs * test(desktop): group captured document spelling cases * test(desktop): run installer scripts at boundary * style(desktop): remove trailing blank line * fix(desktop): bound draft preview serialization * fix(desktop): restore selected state aliases * fix(desktop): respect entry format in draft noise * test(desktop): match exported alias evidence at its JSON boundary * fix(desktop): retain app state logs in exported seeds * fix: align desktop numeric seed comparisons * test(desktop): keep one draft exclusion fixture import * test(desktop): retain log eligibility across draft test groups * fix(doctor): resolve empty registered desktop runner * style: fix desktop launch test formatting * style: format native command path schema * fix(desktop): map selected external launch paths * style(desktop): format seed document regressions * test(desktop): group launch URL regressions * fix(desktop): omit redundant nested state aliases * fix(desktop): compare added free text as a whole * fix(desktop): check recompressed seeds as shipped * docs(desktop): clarify recovered seed format * test(desktop): group shipped gzip seed checks * fix: retain quoted identifier text in task drafts * fix: recognize Unicode XML in desktop state readers * fix(desktop): bound nested draft checks * fix(desktop): explain missing arrays in truncated views * fix(desktop): find XML type references in archives * test(desktop): remove duplicated capture assertions * fix(desktop): retain nested omitted text boundaries * style(desktop): format draft value imports * test(desktop): group model and draft value checks * fix(desktop): map captured launch paths once * refactor: remove unused whole-text guard state * refactor: stop passing unused text children * test: align free-text checks with whole-note policy * fix: validate recompressed desktop archive seeds * style(desktop): format archive seed regression * fix(desktop): retain placed-item sibling guards * fix(desktop): preserve archive paths and bound doctor reads * fix(doctor): refuse non-files before descriptor admission * fix(setup): track remaining cleanup resources across retries * test(desktop): specify XML format in heap pairing fixture * fix(setup): skip Hopper launch after cancelled copy * fix: preserve task measurement limits and cleanup * fix(desktop): retain reported solve sandbox cleanup * test(desktop): check retained log seed admission * fix(doctor): query agentenv for model endpoint * fix(doctor): preserve uncertainty for empty endpoint override * fix(desktop): redact runtime schema errors * fix(desktop): normalize captured file URLs * fix(desktop): report seeded files by capture path * fix(desktop): retain startup readiness failure stage * fix(desktop): retain JSON date checks * fix(desktop): preserve archive formatting checks * fix(desktop): preserve explicitly selected journal files * fix(desktop): report build command transport limits * docs(desktop): clarify unreadable dconf versions * test(desktop): remove duplicate history regression * fix(desktop): align XML names with exported reader * fix(desktop): create selected state alias targets * fix(desktop): inspect supported runtime archives * fix(desktop): keep ordinary text checks exact * fix(desktop): verify registered build host paths * fix(desktop): retain record identity in draft checks * test(desktop): preserve text reference numbers * fix(desktop): bound download install input reads * fix(desktop): match placed notes by whole text * test(desktop): match multiple task export results * fix(desktop): retain failed measurement file closes * fix(setup): retain completed actions on cancellation * test(setup): retain cancelled installer result * fix(desktop): scrub XML independently of reader compatibility * fix(desktop): preserve file aliases and reader diagnostics * style(desktop): format review fixes * fix(desktop): inspect archives with registered runner * test(desktop): verify registered archive interpreter * style(desktop): format capture review fixes * style(desktop): format review changes * feat(desktop): target agentenv-framework 0.9.1464 Desktop bundles, setup's --install-agentenv and the doctor's exact-version check now target 0.9.1464, which keeps an exported app's data/get call, holds the computer fixture above boot dialogs, leaves an unresolved setting's build unverified rather than failed, and mounts lock packages instead of copying them into the image. The web environment lane stays on 0.9.1431. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): retain per-solve sandbox cleanup roots * test(desktop): expect the solve cleanup helper among the shipped agentenv helpers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): clean up a stopped solve's sandboxes through agentenv 0.9.1482 agentenv-framework 0.9.1482 lists the local sandboxes under a root (local_sandbox_ids) and rebuilds one killed while it wrote its port map for teardown. The solve cleanup helper now terminates each sandbox agentenv lists, keeping its Docker and host-process checks, and reports anything else left under the root. Desktop bundles, setup's --install-agentenv and the doctor's version check target 0.9.1482. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): verify a killed solve's cleanup once its sandbox root is empty A solve's sandboxes are all local under its private root, and agentenv now keeps a sandbox's folder until its teardown is confirmed. So when the helper ends without a report and REA's cleanup empties that root, the cleanup is verified: a cancelled solve ends as a cancellation and a solve past its deadline as a failed run, rather than as cleanup the measure cannot vouch for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(desktop): target agentenv-framework 0.9.1485 0.9.1485 keeps a local sandbox's folder until its teardown is confirmed, which the solve cleanup's verified result relies on. (0.9.1484 failed to publish.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): record a solve stopped before it reports as failed, not as a refused request A helper killed from outside or stopped at its deadline left no report, so the measure refused with invalid input and told the caller to fix its model endpoint. A helper a signal ended now gives a failed solve of unknown cost, which the measure records and stops on; one that exits on its own without a report still ends the measure as a solve that could not run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(desktop): check verifier behavior after selector changes * test(windows): verify rejected writes during cleanup by effect * fix(desktop): preserve selected alias target kinds in exports * fix(cli): retain caller capture paths in environment builds * fix(ghidra): classify oversized endpoint records consistently * test: align model and Evidence expectations with current contracts * fix(desktop): reconcile upstream sandbox cleanup recovery * fix(docs): link cleanup qualification as repository evidence --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
358 lines
13 KiB
TypeScript
358 lines
13 KiB
TypeScript
import { execFile } from "node:child_process";
|
|
import { randomUUID } from "node:crypto";
|
|
import { constants } from "node:fs";
|
|
import { access, open, realpath } from "node:fs/promises";
|
|
import { basename, dirname, isAbsolute, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { promisify } from "node:util";
|
|
|
|
import { z } from "zod";
|
|
|
|
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
import type { AnalysisCapturedOutput } from "../domain/analysisErrorBase.js";
|
|
import { readBoundedControlLines } from "../process/BoundedControlLines.js";
|
|
import { cleanupOwnedProcessGroup } from "../process/ProcessOwnership.js";
|
|
import {
|
|
ProviderProcessSupervisor,
|
|
spawnOwnedProviderProcess,
|
|
type SpawnedOwnedProviderProcess,
|
|
} from "../process/ProviderProcess.js";
|
|
|
|
const execFileAsync = promisify(execFile);
|
|
|
|
export const AGENTENV_PROVIDER = "agentenv";
|
|
const HELPER = fileURLToPath(
|
|
new URL("../../bridge/agentenv/computer.py", import.meta.url),
|
|
);
|
|
const HANDSHAKE_BYTES = 64 * 1024;
|
|
const STDERR_BYTES = 16 * 1024;
|
|
const TEARDOWN_MS = 120_000;
|
|
const RUNNER_REMEDIATION =
|
|
"Put agent-env on PATH, or set REA_AGENT_ENV_COMMAND to the absolute path of the agent-env program of an agentenv-framework install (a venv, uv tool or pipx), then restart REA. rea doctor --provider desktop_build checks the build host.";
|
|
|
|
const handshakeSchema = z.union([
|
|
z.strictObject({
|
|
base_url: z.url({ protocol: /^https?$/u }),
|
|
mcp_url: z.url({ protocol: /^https?$/u }),
|
|
control_token: z.string().min(1).nullable(),
|
|
sandbox_id: z.string().min(1),
|
|
}),
|
|
z.strictObject({ error: z.string() }),
|
|
]);
|
|
/** The helper's one JSON line: where the kept computer is, or why there is none. */
|
|
export type Handshake = z.infer<typeof handshakeSchema>;
|
|
|
|
/** How a computer's teardown ended: confirmed by agentenv or by removing its containers, or not confirmed. */
|
|
export type ComputerRelease =
|
|
| {
|
|
readonly verified: true;
|
|
readonly teardown: "agentenv" | "container_label";
|
|
}
|
|
| {
|
|
readonly verified: false;
|
|
readonly reason: string;
|
|
readonly resources: readonly string[];
|
|
};
|
|
|
|
const unavailable = (operation: string, reason: string, cause?: unknown) =>
|
|
new AnalysisCapabilityUnavailableError(AGENTENV_PROVIDER, operation, reason, {
|
|
userMessage: reason,
|
|
remediationAction: RUNNER_REMEDIATION,
|
|
...(cause === undefined ? {} : { cause }),
|
|
});
|
|
|
|
const executable = async (path: string): Promise<boolean> =>
|
|
access(path, constants.X_OK).then(
|
|
() => true,
|
|
() => false,
|
|
);
|
|
|
|
const readHead = async (path: string): Promise<string> => {
|
|
const file = await open(path, "r");
|
|
try {
|
|
const { buffer, bytesRead } = await file.read(Buffer.alloc(512), 0, 512, 0);
|
|
return buffer.subarray(0, bytesRead).toString("utf8");
|
|
} finally {
|
|
await file.close();
|
|
}
|
|
};
|
|
|
|
/**
|
|
* The Python the agentenv runner runs with, so the helper can import
|
|
* `agent_env`: the interpreter its console script names on its `#!` line,
|
|
* or the `python3` beside the resolved script in its venv.
|
|
*/
|
|
export const agentEnvInterpreter = async (
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
operation: string,
|
|
): Promise<string> => {
|
|
const command = environment.REA_AGENT_ENV_COMMAND;
|
|
if (command === undefined || !isAbsolute(command))
|
|
throw unavailable(
|
|
operation,
|
|
"Build computers need REA_AGENT_ENV_COMMAND, the absolute path of agentenv's agent-env program, or agent-env on PATH; REA runs its helper with that runner's Python.",
|
|
);
|
|
let program: string;
|
|
let head: string;
|
|
try {
|
|
program = await realpath(command);
|
|
head = await readHead(program);
|
|
} catch (cause: unknown) {
|
|
throw unavailable(
|
|
operation,
|
|
`REA_AGENT_ENV_COMMAND ${command} cannot be read.`,
|
|
cause,
|
|
);
|
|
}
|
|
const named = /^#!(\/\S+)[ \t]*\r?\n/u.exec(head)?.[1];
|
|
for (const candidate of [
|
|
...(named !== undefined && basename(named).startsWith("python")
|
|
? [named]
|
|
: []),
|
|
join(dirname(program), "python3"),
|
|
])
|
|
if (await executable(candidate)) return candidate;
|
|
throw unavailable(
|
|
operation,
|
|
`REA_AGENT_ENV_COMMAND ${command} names no Python: its first line names no python interpreter and no python3 sits beside it.`,
|
|
);
|
|
};
|
|
|
|
/** What a Docker container name may hold, so a sandbox id outside it names no container. */
|
|
const CONTAINER_NAME = /^[A-Za-z0-9_.-]+$/u;
|
|
|
|
/**
|
|
* The `docker ps` filters that find one sandbox's containers: agentenv's
|
|
* local provider runs a computer as `agent-<sandbox id>` without a label, and
|
|
* labels only the containers and relays of its VM and closed-network modes.
|
|
*/
|
|
const sandboxFilters = (sandbox: string): readonly string[] => [
|
|
...(CONTAINER_NAME.test(sandbox)
|
|
? [`name=^agent-${sandbox.replaceAll(".", "\\.")}$`]
|
|
: []),
|
|
`label=agentenv.sandbox=${sandbox}`,
|
|
];
|
|
|
|
/** Remove the containers of one sandbox REA's helper named, by their exact name and label; undefined once removed. */
|
|
export const removeSandbox = async (
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
sandbox: string,
|
|
): Promise<string | undefined> => {
|
|
const filters = sandboxFilters(sandbox);
|
|
const manual = `Run docker rm -f ${filters.map((filter) => `$(docker ps -aq --filter '${filter}')`).join(" ")}.`;
|
|
const docker = environment.REA_DOCKER_COMMAND;
|
|
if (docker === undefined || !isAbsolute(docker))
|
|
return `agentenv's teardown did not confirm sandbox ${sandbox} is gone, and REA_DOCKER_COMMAND is not an absolute path to remove its containers. ${manual}`;
|
|
const options = { env: environment, timeout: TEARDOWN_MS };
|
|
try {
|
|
const containers = new Set<string>();
|
|
for (const filter of filters) {
|
|
const listed = await execFileAsync(
|
|
docker,
|
|
["ps", "-aq", "--filter", filter],
|
|
options,
|
|
);
|
|
for (const id of listed.stdout.split(/\s+/u).filter(Boolean))
|
|
containers.add(id);
|
|
}
|
|
if (containers.size > 0)
|
|
await execFileAsync(docker, ["rm", "-f", ...containers], options);
|
|
return undefined;
|
|
} catch (cause: unknown) {
|
|
return `Removing sandbox ${sandbox}'s containers failed: ${cause instanceof Error ? cause.message : String(cause)}. ${manual}`;
|
|
}
|
|
};
|
|
|
|
const parseHandshake = (line: string): Handshake => {
|
|
try {
|
|
const parsed = handshakeSchema.safeParse(JSON.parse(line));
|
|
if (parsed.success) return parsed.data;
|
|
} catch {
|
|
// Reported below as a line that is not a handshake.
|
|
}
|
|
return { error: "the helper wrote something other than its handshake" };
|
|
};
|
|
|
|
/**
|
|
* REA's helper process holding one computer up: an owned, supervised child
|
|
* run with the agentenv runner's Python. It reads the first JSON line and
|
|
* keeps draining stdout, so a handshake arriving after a cancelled wait still
|
|
* names the sandbox teardown must reach.
|
|
*/
|
|
export class ComputerHelper {
|
|
readonly #supervisor: ProviderProcessSupervisor;
|
|
readonly #handshake: Promise<Handshake | undefined>;
|
|
#sandboxId: string | undefined;
|
|
/** The helper said no computer came up, and exits on its own after its teardown. */
|
|
#failed = false;
|
|
#token: string | null = null;
|
|
#stopped:
|
|
| Promise<{
|
|
readonly exit: number | null | undefined;
|
|
readonly stopped?: string;
|
|
}>
|
|
| undefined;
|
|
|
|
private constructor(
|
|
private readonly spawned: SpawnedOwnedProviderProcess,
|
|
private readonly environment: Readonly<NodeJS.ProcessEnv>,
|
|
) {
|
|
this.#supervisor = new ProviderProcessSupervisor(
|
|
{
|
|
...spawned,
|
|
ownsProcessLifetime: true,
|
|
cleanup:
|
|
spawned.cleanup ??
|
|
(() => cleanupOwnedProcessGroup(spawned.ownership)),
|
|
},
|
|
{
|
|
captureStdout: false,
|
|
// A failed build's error comes last, after its package installs.
|
|
maxDiagnosticBytes: { stdout: 0, stderr: STDERR_BYTES },
|
|
diagnosticRetention: "tail",
|
|
},
|
|
);
|
|
// A helper that already exited must not crash REA when its stdin closes.
|
|
spawned.process.stdin?.on("error", () => undefined);
|
|
this.#handshake = new Promise((resolve) => {
|
|
const ended = () => resolve(undefined);
|
|
void this.#drain(resolve).then(ended, ended);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Spawn the helper for a bundle folder; it deploys the bundle's smoke task.
|
|
* Python writes no bytecode, in the helper or the children that inherit its
|
|
* environment, such as agentenv's own import of the bundle's app class, so
|
|
* the bundle's files stay as they were shared.
|
|
*/
|
|
static async spawn(options: {
|
|
readonly bundle: string;
|
|
readonly environment: Readonly<NodeJS.ProcessEnv>;
|
|
readonly signal: AbortSignal;
|
|
readonly operation: string;
|
|
}): Promise<ComputerHelper> {
|
|
const { environment, signal } = options;
|
|
const interpreter = await agentEnvInterpreter(
|
|
environment,
|
|
options.operation,
|
|
);
|
|
const spawned = await spawnOwnedProviderProcess({
|
|
command: interpreter,
|
|
arguments: [HELPER, options.bundle, "smoke"],
|
|
runId: randomUUID(),
|
|
expectedCommand: null,
|
|
hostEnvironment: environment,
|
|
env: { PYTHONDONTWRITEBYTECODE: "1" },
|
|
stdin: "pipe",
|
|
signal,
|
|
});
|
|
return new ComputerHelper(spawned, environment);
|
|
}
|
|
|
|
async #drain(resolve: (handshake: Handshake) => void): Promise<void> {
|
|
const stdout = this.spawned.process.stdout;
|
|
if (stdout === null) return;
|
|
let first: Handshake | undefined;
|
|
for await (const line of readBoundedControlLines(stdout, HANDSHAKE_BYTES)) {
|
|
if (first !== undefined) continue;
|
|
first = line.ok
|
|
? parseHandshake(line.value)
|
|
: { error: "the helper's handshake line is too long" };
|
|
if ("sandbox_id" in first) {
|
|
this.#sandboxId = first.sandbox_id;
|
|
this.#token = first.control_token;
|
|
} else this.#failed = true;
|
|
resolve(first);
|
|
}
|
|
}
|
|
|
|
/** The handshake, or undefined when the helper ended without one; cancellation rejects with its reason. */
|
|
handshake(signal: AbortSignal): Promise<Handshake | undefined> {
|
|
signal.throwIfAborted();
|
|
const aborted = new Promise<never>((_, reject) => {
|
|
signal.addEventListener("abort", () => reject(signal.reason), {
|
|
once: true,
|
|
});
|
|
});
|
|
return Promise.race([this.#handshake, aborted]);
|
|
}
|
|
|
|
/** The helper's stderr tail with the control token removed, and how it exited. */
|
|
output(): AnalysisCapturedOutput {
|
|
const snapshot = this.#supervisor.snapshot();
|
|
const token = this.#token;
|
|
return {
|
|
stdout: "",
|
|
stderr:
|
|
token === null
|
|
? snapshot.stderr.text
|
|
: snapshot.stderr.text.replaceAll(token, "[control token]"),
|
|
truncated:
|
|
snapshot.diagnosticTruncated === true ||
|
|
snapshot.stderr.observedBytes > snapshot.stderr.bytes,
|
|
exit_code: snapshot.exitCode ?? null,
|
|
signal: snapshot.signal ?? null,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Close stdin once the helper holds a computer; let one that reported its
|
|
* failure finish its own teardown; else SIGTERM. SIGTERM after a grace,
|
|
* then clear its process group.
|
|
*/
|
|
async #stop() {
|
|
const child = this.spawned.process;
|
|
const holding = this.#sandboxId !== undefined;
|
|
const waiting = holding || this.#failed;
|
|
if (holding) child.stdin?.end();
|
|
else if (!this.#failed) child.kill("SIGTERM");
|
|
if (!(await this.#supervisor.waitForExit(TEARDOWN_MS)) && waiting) {
|
|
child.kill("SIGTERM");
|
|
await this.#supervisor.waitForExit(TEARDOWN_MS);
|
|
}
|
|
const exit = this.#supervisor.observedExit()?.code;
|
|
const result = await this.#supervisor.stop();
|
|
return result.status === "incomplete"
|
|
? { exit, stopped: result.reason }
|
|
: { exit };
|
|
}
|
|
|
|
/**
|
|
* Bring the computer down. The helper's exit 0 or 2 means agentenv tore
|
|
* down everything it kept; otherwise the containers of the sandbox it
|
|
* named are removed by their `agentenv.sandbox` label. A failed release
|
|
* can be retried.
|
|
*/
|
|
async release(): Promise<ComputerRelease> {
|
|
const { exit, stopped } = await (this.#stopped ??= this.#stop());
|
|
if (stopped !== undefined) {
|
|
this.#stopped = undefined;
|
|
return {
|
|
verified: false,
|
|
reason: `REA's agentenv helper did not stop: ${stopped}`,
|
|
resources: [
|
|
`process group ${String(this.spawned.ownership.processGroupId)}`,
|
|
],
|
|
};
|
|
}
|
|
if (exit === 0 || exit === 2)
|
|
return { verified: true, teardown: "agentenv" };
|
|
const sandbox = this.#sandboxId;
|
|
if (sandbox === undefined)
|
|
return {
|
|
verified: false,
|
|
reason: `REA's agentenv helper ended (exit ${String(exit)}) before naming its sandbox; look for its container with docker ps -a --filter name=agent- and docker ps -a --filter label=agentenv.sandbox.`,
|
|
resources: ["an unnamed agentenv sandbox"],
|
|
};
|
|
const failure = await removeSandbox(this.environment, sandbox);
|
|
return failure === undefined
|
|
? { verified: true, teardown: "container_label" }
|
|
: {
|
|
verified: false,
|
|
reason: failure,
|
|
resources: [`containers labelled agentenv.sandbox=${sandbox}`],
|
|
};
|
|
}
|
|
}
|