Test bounded Computer execution

360c93673ffb · Devin AI · · parent 77043c01bf59

Test bounded Computer execution

Co-Authored-By: Christopher David <chris@openagents.com>
Co-Authored-By
Christopher David <chris@openagents.com>

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified packages/openagents-cli/test/computer.test.ts

Diff

1 file changed, +36 -0

packages/openagents-cli/test/computer.test.ts modified +36

@@ -33,6 +33,7 @@ import {

33 33
  ComputerProbe,
34 34
  toolchainCatalog,
35 35
} from "../src/computer-probe.js";
36
import { executeComputerCommand } from "../src/computer-executor.js";
36 37
import { environmentLayerFromValues } from "../src/environment.js";
37 38
import { credentialStoreTestFileLayer } from "../src/credential-store.js";
38 39
import { pendingDeviceAuthorizationStoreTestLayer } from "../src/device-authorization-store.js";

@@ -288,6 +289,41 @@ describe("local Computer journal", () => {

288 289
  });
289 290
});
290 291
292
describe("local Computer execution", () => {
293
  it("executes argv directly with scrubbed environment and bounded output", async () => {
294
    const chunks: string[] = [];
295
    const execution = executeComputerCommand(
296
      [
297
        process.execPath,
298
        "-e",
299
        "process.stdout.write((process.env.OPENAGENTS_COMPUTER_SECRET ?? 'missing') + 'x'.repeat(32))",
300
      ],
301
      process.cwd(),
302
      { timeoutMillis: 5_000, maximumOutputBytes: 8 },
303
      (chunk) => chunks.push(chunk),
304
    );
305
    const outcome = await execution.done;
306
    expect(outcome.exitCode).toBe(0);
307
    expect(outcome.truncated).toBe(true);
308
    expect(chunks.join("")).toBe("missingx");
309
    expect(chunks.join("")).not.toContain("oa_");
310
  });
311
312
  it("reports cancellation without fabricating an exit code", async () => {
313
    const execution = executeComputerCommand(
314
      [process.execPath, "-e", "setInterval(() => undefined, 10_000)"],
315
      process.cwd(),
316
      { timeoutMillis: 5_000, maximumOutputBytes: 64 },
317
      () => undefined,
318
    );
319
    execution.cancel();
320
    const outcome = await execution.done;
321
    expect(outcome.cancelled).toBe(true);
322
    expect(outcome.timedOut).toBe(false);
323
    expect(outcome.exitCode).toBe(null);
324
  });
325
});
326
291 327
describe("Computer CLI output", () => {
292 328
  const output = (
293 329
    documents: Array<{ readonly document: OutputDocument; readonly mode: OutputMode }>,

This page updates live while a promote is in flight · changelog