fix: avoid nesting dedicated Linux workers (#124636)

* fix: avoid nesting dedicated Linux workers

* fix: preserve worker routing prerequisites

---------

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Peter Steinberger
2026-08-16 08:25:04 -07:00
committed by GitHub
parent eeffa53b20
commit 55240929f5
14 changed files with 216 additions and 75 deletions
+60 -6
View File
@@ -326,6 +326,7 @@ describe("scripts/changed-lanes", () => {
...createNestedGitEnv(),
CI: "",
GITHUB_ACTIONS: "",
AGENT_HOST_ROLE: "workstation",
OPENCLAW_CHECK_CHANGED_REMOTE_CHILD: "",
OPENCLAW_TESTBOX: "",
PATH: `${binDir}:${process.env.PATH ?? ""}`,
@@ -1134,7 +1135,7 @@ describe("scripts/changed-lanes", () => {
shouldDelegateChangedCheckToCrabbox(
["--base", "origin/main"],
{ PATH: "/usr/bin" },
{ result },
{ platform: "darwin", result },
),
).toBe(true);
expect(changedCheckRequiresRemote(result)).toBe(true);
@@ -1171,7 +1172,7 @@ describe("scripts/changed-lanes", () => {
const result = detectChangedLanes(["src/config/config.ts"]);
expect(changedCheckRequiresRemote(result)).toBe(true);
expect(shouldDelegateChangedCheckToCrabbox([], {}, { result })).toBe(true);
expect(shouldDelegateChangedCheckToCrabbox([], {}, { platform: "darwin", result })).toBe(true);
});
it("adds the dead export scan only for production source changes", () => {
@@ -1204,9 +1205,13 @@ describe("scripts/changed-lanes", () => {
expect(shouldDelegateChangedCheckToCrabbox([], {}, { cwd: dir, result: noChangesResult })).toBe(
false,
);
expect(shouldDelegateChangedCheckToCrabbox([], {}, { cwd: dir, result: docsResult })).toBe(
true,
);
expect(
shouldDelegateChangedCheckToCrabbox(
[],
{},
{ cwd: dir, platform: "darwin", result: docsResult },
),
).toBe(true);
writeRepoFile(dir, "node_modules/.modules.yaml", "layoutVersion: 5\n");
writeRepoFile(dir, "node_modules/.bin/oxfmt", "#!/bin/sh\n");
@@ -1231,7 +1236,56 @@ describe("scripts/changed-lanes", () => {
]);
expect(result.docsOnly).toBe(true);
expect(changedCheckRequiresRemote(result)).toBe(true);
expect(shouldDelegateChangedCheckToCrabbox([], {}, { cwd: repoRoot, result })).toBe(true);
expect(
shouldDelegateChangedCheckToCrabbox([], {}, { cwd: repoRoot, platform: "darwin", result }),
).toBe(true);
});
it("runs trusted changed gates on a dedicated Linux worker", () => {
const dir = makeTempRepoRoot(tempDirs, "openclaw-check-changed-worker-route-");
const result = detectChangedLanes(["src/config/config.ts"]);
const detectedWorker = {
cwd: dir,
interactive: false,
platform: "linux" as const,
result,
virtualized: true,
};
expect(
shouldDelegateChangedCheckToCrabbox(
[],
{},
{
interactive: false,
platform: "linux",
virtualized: true,
},
),
).toBe(true);
expect(shouldDelegateChangedCheckToCrabbox([], {}, detectedWorker)).toBe(true);
writeRepoFile(dir, "node_modules/.modules.yaml", "layoutVersion: 5\n");
writeRepoFile(dir, "node_modules/.bin/oxfmt", "#!/bin/sh\n");
writeRepoFile(dir, "node_modules/typescript/package.json", '{"name":"typescript"}\n');
expect(shouldDelegateChangedCheckToCrabbox([], {}, detectedWorker)).toBe(false);
expect(
shouldDelegateChangedCheckToCrabbox([], {}, { ...detectedWorker, interactive: true }),
).toBe(true);
expect(
shouldDelegateChangedCheckToCrabbox(
[],
{ AGENT_HOST_ROLE: "worker" },
{ platform: "linux", result, virtualized: false },
),
).toBe(false);
expect(
shouldDelegateChangedCheckToCrabbox([], { AGENT_HOST_ROLE: "workstation" }, detectedWorker),
).toBe(true);
expect(shouldDelegateChangedCheckToCrabbox([], { OPENCLAW_TESTBOX: "1" }, detectedWorker)).toBe(
true,
);
});
it("delegates staged changed gates as explicit remote paths", () => {