mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
fix(qa): use dist-backed Gateway child launcher (#118401)
This commit is contained in:
committed by
GitHub
parent
27ec985fe2
commit
d74e351c00
@@ -369,19 +369,22 @@ describe("Gateway child fixture helpers", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("resolves source and built Gateway CLI commands", async () => {
|
||||
it("resolves the repo runner before a built Gateway CLI fallback", async () => {
|
||||
const repoRoot = await tempDirs.makeTempDir("qa-gateway-command-");
|
||||
await mkdir(path.join(repoRoot, "src"), { recursive: true });
|
||||
await writeFile(path.join(repoRoot, "src", "entry.ts"), "export {};\n", "utf8");
|
||||
await mkdir(path.join(repoRoot, "scripts"), { recursive: true });
|
||||
const runnerPath = path.join(repoRoot, "scripts", "run-node.mjs");
|
||||
await writeFile(runnerPath, "export {};\n", "utf8");
|
||||
|
||||
expect(testing.resolveQaGatewayChildCommand(repoRoot)).toEqual({
|
||||
executablePath: process.execPath,
|
||||
argsPrefix: ["--import", "tsx", path.join(repoRoot, "src", "entry.ts")],
|
||||
argsPrefix: [runnerPath],
|
||||
cwd: repoRoot,
|
||||
usePackagedPlugins: true,
|
||||
});
|
||||
|
||||
await mkdir(path.join(repoRoot, "dist"), { recursive: true });
|
||||
await writeFile(path.join(repoRoot, "dist", "index.js"), "export {};\n", "utf8");
|
||||
await rm(path.join(repoRoot, "scripts"), { recursive: true });
|
||||
expect(testing.resolveQaGatewayChildCommand(repoRoot)).toEqual({
|
||||
executablePath: process.execPath,
|
||||
argsPrefix: [path.join(repoRoot, "dist", "index.js")],
|
||||
@@ -463,6 +466,7 @@ describe("buildQaRuntimeEnv", () => {
|
||||
"/repo/.artifacts/qa-runtime/openclaw-qa-suite-test",
|
||||
);
|
||||
expect(env.OPENCLAW_QA_ALLOW_LOCAL_IMAGE_PROVIDER).toBe("1");
|
||||
expect(env.OPENCLAW_BUILD_PRIVATE_QA).toBe("1");
|
||||
expect(env.OPENCLAW_ALLOW_SLOW_REPLY_TESTS).toBe("1");
|
||||
expect(env.OPENCLAW_BUNDLED_PLUGINS_DIR).toBe("/tmp/openclaw-qa/bundled-plugins");
|
||||
expect(env.OPENCLAW_COMPATIBILITY_HOST_VERSION).toBe("2026.4.8");
|
||||
|
||||
@@ -144,7 +144,7 @@ function createQaGatewayEmptyTransport() {
|
||||
}
|
||||
|
||||
function resolveQaGatewayChildCommand(repoRoot: string): QaGatewayChildCommand {
|
||||
for (const relativePath of ["dist/index.mjs", "dist/index.js"]) {
|
||||
for (const relativePath of ["scripts/run-node.mjs", "dist/index.mjs", "dist/index.js"]) {
|
||||
const entryPath = path.join(repoRoot, relativePath);
|
||||
if (existsSync(entryPath)) {
|
||||
return {
|
||||
@@ -156,16 +156,9 @@ function resolveQaGatewayChildCommand(repoRoot: string): QaGatewayChildCommand {
|
||||
}
|
||||
}
|
||||
|
||||
const sourceEntryPath = path.join(repoRoot, "src/entry.ts");
|
||||
if (existsSync(sourceEntryPath)) {
|
||||
return {
|
||||
executablePath: process.execPath,
|
||||
argsPrefix: ["--import", "tsx", sourceEntryPath],
|
||||
cwd: repoRoot,
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error("OpenClaw CLI entry not found: expected dist/index.(m)js or src/entry.ts");
|
||||
throw new Error(
|
||||
"OpenClaw CLI entry not found: expected scripts/run-node.mjs or dist/index.(m)js",
|
||||
);
|
||||
}
|
||||
|
||||
async function runQaGatewayCliCommand(params: {
|
||||
@@ -450,6 +443,7 @@ export function buildQaRuntimeEnv(params: {
|
||||
};
|
||||
const normalizedEnv = normalizeQaProviderModeEnv(env, params.providerMode);
|
||||
Object.assign(normalizedEnv, params.runtimeEnvPatch);
|
||||
normalizedEnv.OPENCLAW_BUILD_PRIVATE_QA = "1";
|
||||
delete normalizedEnv[QA_LIVE_ANTHROPIC_SETUP_TOKEN_ENV];
|
||||
delete normalizedEnv[QA_LIVE_SETUP_TOKEN_VALUE_ENV];
|
||||
return scrubQaGatewayChildSecretEnv(normalizedEnv);
|
||||
|
||||
Reference in New Issue
Block a user