
















@@ -826,7 +826,7 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
826826expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_macos_js");
827827expect(remoteCommand).toContain('corepack enable --install-directory "$PNPM_HOME"');
828828expect(remoteCommand).toContain("pnpm --version >&2");
829-expectGroupedShellCommand(remoteCommand, "/usr/bin/env pnpm --version");
829+expectGroupedShellCommand(remoteCommand, "openclaw_crabbox_env pnpm --version");
830830});
831831832832it("bootstraps Corepack for raw AWS macOS env option pnpm commands", () => {
@@ -895,7 +895,7 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
895895);
896896});
897897898-it("does not bootstrap absolute env ignore-environment commands it cannot preserve", () => {
898+it("bootstraps Corepack for raw AWS macOS absolute env ignore-environment commands", () => {
899899const result = runWrapper(
900900"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
901901[
@@ -913,6 +913,62 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
913913],
914914);
915915916+const output = parseFakeCrabboxOutput(result);
917+const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
918+expect(result.status).toBe(0);
919+expect(output.args).toContain("--shell");
920+expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_macos_js");
921+expect(remoteCommand).toContain("pnpm --version >&2");
922+expectGroupedShellCommand(
923+remoteCommand,
924+"openclaw_crabbox_env -i PATH=/usr/bin:/bin pnpm --version",
925+);
926+});
927+928+it("injects the bootstrapped PATH for raw AWS macOS absolute env -i commands", () => {
929+const result = runWrapper(
930+"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
931+[
932+"run",
933+"--provider",
934+"aws",
935+"--target",
936+"macos",
937+"--",
938+"/usr/bin/env",
939+"-i",
940+"pnpm",
941+"--version",
942+],
943+);
944+945+const output = parseFakeCrabboxOutput(result);
946+const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
947+expect(result.status).toBe(0);
948+expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_macos_js");
949+expect(remoteCommand).toContain(
950+'if [ "$openclaw_env_ignore" = "1" ] && [ "$openclaw_env_path_seen" = "0" ]; then openclaw_env_args+=("PATH=$PATH"); fi;',
951+);
952+expectGroupedShellCommand(remoteCommand, "openclaw_crabbox_env -i pnpm --version");
953+});
954+955+it("does not rewrite custom env executables for raw AWS macOS ignore-environment commands", () => {
956+const result = runWrapper(
957+"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
958+[
959+"run",
960+"--provider",
961+"aws",
962+"--target",
963+"macos",
964+"--",
965+"./tools/env",
966+"-i",
967+"pnpm",
968+"--version",
969+],
970+);
971+916972const output = parseFakeCrabboxOutput(result);
917973const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
918974expect(result.status).toBe(0);
@@ -1027,7 +1083,7 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
10271083expect(remoteCommand.indexOf("-S|--split-string|-S*|--split-string=*)")).toBeLessThan(
10281084remoteCommand.indexOf("-[!-]*i*)"),
10291085);
1030-expectGroupedShellCommand(remoteCommand, "/usr/bin/env -S 'pnpm --version'");
1086+expectGroupedShellCommand(remoteCommand, "openclaw_crabbox_env -S 'pnpm --version'");
10311087});
1032108810331089it("bootstraps Corepack for AWS macOS node changed-gate commands", () => {
@@ -2324,6 +2380,48 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
23242380);
23252381});
232623822383+it("preserves sparse changed-gate Git bootstrap for direct absolute env -i commands", () => {
2384+const result = runWrapper(
2385+"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
2386+["run", "--provider", "aws", "--", "/usr/bin/env", "-i", "pnpm", "check:changed"],
2387+{
2388+gitResponses: {
2389+[GIT_CONFIG_SPARSE_KEY]: { stdout: "true\n" },
2390+[GIT_STATUS_PORCELAIN_KEY]: { stdout: "" },
2391+[GIT_MERGE_BASE_MAIN_HEAD_KEY]: { stdout: "abc123\n" },
2392+},
2393+},
2394+);
2395+2396+const output = parseFakeCrabboxOutput(result);
2397+const remoteCommand = normalizeShellLineEndings(output.args.at(-1) ?? "");
2398+expect(result.status).toBe(0);
2399+expect(output.args).toContain("--shell");
2400+expect(remoteCommand).toContain("git init -q");
2401+expect(remoteCommand).toMatch(
2402+/&& \/usr\/bin\/env -i OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 CI=1 pnpm check:changed$/u,
2403+);
2404+});
2405+2406+it("does not mark custom env executables outside the sanitized env", () => {
2407+const result = runWrapper(
2408+"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
2409+["run", "--provider", "aws", "--", "./tools/env", "-i", "pnpm", "check:changed"],
2410+{
2411+gitResponses: {
2412+[GIT_CONFIG_SPARSE_KEY]: { stdout: "true\n" },
2413+[GIT_STATUS_PORCELAIN_KEY]: { stdout: "" },
2414+[GIT_MERGE_BASE_MAIN_HEAD_KEY]: { stdout: "abc123\n" },
2415+},
2416+},
2417+);
2418+2419+const output = parseFakeCrabboxOutput(result);
2420+expect(result.status).toBe(0);
2421+expect(output.args.join("\0")).not.toContain("OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1");
2422+expect(output.args.join("\0")).not.toContain("git init -q");
2423+});
2424+23272425it("does not mark assignment-prefixed env -i changed gates outside the sanitized env", () => {
23282426const result = runWrapper(
23292427"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。