File size: 1,062 Bytes
5c2a829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { describe, expect, it } from "vitest";
import { buildExecAutoReviewInputForShellCommand } from "./agent-harness-exec-review-runtime.js";

describe("agent harness exec auto-review input", () => {
  it.runIf(process.platform !== "win32").each(["bash", "sh", "/bin/sh"])(
    "does not bind %s login-shell startup as a reviewable command",
    async (shell) => {
      await expect(
        buildExecAutoReviewInputForShellCommand({
          command: `${shell} -lc "echo auto-review-startup-proof"`,
          cwd: process.cwd(),
          host: "codex-app-server",
        }),
      ).resolves.toBeUndefined();
    },
  );

  it("preserves ordinary single-command auto-review input", async () => {
    await expect(
      buildExecAutoReviewInputForShellCommand({
        command: "node --version",
        cwd: process.cwd(),
        host: "codex-app-server",
      }),
    ).resolves.toMatchObject({
      command: "node --version",
      argv: ["node", "--version"],
      host: "codex-app-server",
      reason: "approval-required",
    });
  });
});