Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
265
test/scripts/e2e-mock-config-limits.test.ts
Normal file
265
test/scripts/e2e-mock-config-limits.test.ts
Normal file
@@ -0,0 +1,265 @@
|
||||
// E2E Mock Config Limits tests cover e2e mock config limits script behavior.
|
||||
import { type ChildProcess, spawn, spawnSync } from "node:child_process";
|
||||
import { once } from "node:events";
|
||||
import { mkdtemp, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getFreePort } from "../../src/test-utils/ports.js";
|
||||
|
||||
const mockOpenAiPath = "scripts/e2e/mock-openai-server.mjs";
|
||||
const webSearchMockPath = "scripts/e2e/lib/openai-web-search-minimal/mock-server.mjs";
|
||||
const browserCdpFixturePath = "scripts/e2e/lib/browser-cdp-snapshot/fixture-server.mjs";
|
||||
const configReloadAssertPath = "scripts/e2e/lib/config-reload/assert-log.mjs";
|
||||
const clickClackFixturePath = "scripts/e2e/lib/release-user-journey/clickclack-fixture.mjs";
|
||||
const scrubbedEnvKeys = [
|
||||
"CLICKCLACK_FIXTURE_PORT",
|
||||
"CLICKCLACK_FIXTURE_REQUEST_MAX_BYTES",
|
||||
"FIXTURE_PORT",
|
||||
"MOCK_PORT",
|
||||
"MOCK_REQUEST_LOG",
|
||||
"OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES",
|
||||
"OPENCLAW_CONFIG_RELOAD_LOG_PATH",
|
||||
"OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS",
|
||||
"OPENCLAW_MOCK_OPENAI_PORT",
|
||||
"RAW_SCHEMA_ERROR",
|
||||
"SUCCESS_MARKER",
|
||||
];
|
||||
|
||||
function cleanEnv(env: Record<string, string>) {
|
||||
const childEnv = { ...process.env };
|
||||
for (const key of scrubbedEnvKeys) {
|
||||
delete childEnv[key];
|
||||
}
|
||||
return { ...childEnv, ...env };
|
||||
}
|
||||
|
||||
function runScript(scriptPath: string, env: Record<string, string>) {
|
||||
return spawnSync(process.execPath, [scriptPath], {
|
||||
encoding: "utf8",
|
||||
env: cleanEnv(env),
|
||||
killSignal: "SIGKILL",
|
||||
timeout: 3_000,
|
||||
});
|
||||
}
|
||||
|
||||
async function waitForListening(child: ChildProcess, port: number, output: () => string) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
let settled = false;
|
||||
const timeout = setTimeout(() => {
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
reject(new Error(`mock server did not listen on ${port}: ${output()}`));
|
||||
}, 3_000);
|
||||
const finish = (error?: Error) => {
|
||||
if (settled) {
|
||||
return;
|
||||
}
|
||||
settled = true;
|
||||
clearTimeout(timeout);
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
};
|
||||
if (output().includes(`mock-openai listening on ${port}`)) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
child.stdout?.on("data", () => {
|
||||
if (output().includes(`mock-openai listening on ${port}`)) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
child.once("exit", (code, signal) => {
|
||||
finish(new Error(`mock server exited before listening: code=${code} signal=${signal}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function stopServer(child: ChildProcess) {
|
||||
if (child.exitCode !== null || child.signalCode !== null) {
|
||||
return;
|
||||
}
|
||||
const exited = once(child, "exit").then(() => undefined);
|
||||
child.kill("SIGTERM");
|
||||
await Promise.race([
|
||||
exited,
|
||||
delay(1_000).then(() => {
|
||||
if (child.exitCode === null && child.signalCode === null) {
|
||||
child.kill("SIGKILL");
|
||||
}
|
||||
}),
|
||||
]);
|
||||
if (child.exitCode === null && child.signalCode === null) {
|
||||
await exited;
|
||||
}
|
||||
}
|
||||
|
||||
async function withMockServer(
|
||||
scriptPath: string,
|
||||
env: Record<string, string>,
|
||||
run: (
|
||||
baseUrl: string,
|
||||
output: {
|
||||
stderr: () => string;
|
||||
stdout: () => string;
|
||||
},
|
||||
) => Promise<void>,
|
||||
) {
|
||||
const port = await getFreePort();
|
||||
let stderr = "";
|
||||
let stdout = "";
|
||||
const child = spawn(process.execPath, [scriptPath], {
|
||||
env: cleanEnv({ ...env, MOCK_PORT: String(port) }),
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
});
|
||||
child.stdout?.setEncoding("utf8");
|
||||
child.stderr?.setEncoding("utf8");
|
||||
child.stdout?.on("data", (chunk: string) => {
|
||||
stdout += chunk;
|
||||
});
|
||||
child.stderr?.on("data", (chunk: string) => {
|
||||
stderr += chunk;
|
||||
});
|
||||
try {
|
||||
await waitForListening(child, port, () => `${stdout}\n${stderr}`);
|
||||
await run(`http://127.0.0.1:${port}`, {
|
||||
stderr: () => stderr,
|
||||
stdout: () => stdout,
|
||||
});
|
||||
} finally {
|
||||
await stopServer(child);
|
||||
}
|
||||
}
|
||||
|
||||
describe("e2e mock and config helper numeric limits", () => {
|
||||
it("rejects loose mock OpenAI port env values", () => {
|
||||
const mockPort = runScript(mockOpenAiPath, { MOCK_PORT: "44080tcp" });
|
||||
expect(mockPort.status).not.toBe(0);
|
||||
expect(mockPort.stderr).toContain("invalid MOCK_PORT: 44080tcp");
|
||||
|
||||
const fallbackPort = runScript(mockOpenAiPath, {
|
||||
OPENCLAW_MOCK_OPENAI_PORT: "44080http",
|
||||
});
|
||||
expect(fallbackPort.status).not.toBe(0);
|
||||
expect(fallbackPort.stderr).toContain("invalid OPENCLAW_MOCK_OPENAI_PORT: 44080http");
|
||||
});
|
||||
|
||||
it("rejects out-of-range mock OpenAI port env values", () => {
|
||||
const mockPort = runScript(mockOpenAiPath, { MOCK_PORT: "65536" });
|
||||
expect(mockPort.status).not.toBe(0);
|
||||
expect(mockPort.stderr).toContain("invalid MOCK_PORT: 65536");
|
||||
|
||||
const fallbackPort = runScript(mockOpenAiPath, {
|
||||
OPENCLAW_MOCK_OPENAI_PORT: "65536",
|
||||
});
|
||||
expect(fallbackPort.status).not.toBe(0);
|
||||
expect(fallbackPort.stderr).toContain("invalid OPENCLAW_MOCK_OPENAI_PORT: 65536");
|
||||
});
|
||||
|
||||
it("rejects loose OpenAI web-search mock port env values", () => {
|
||||
const result = runScript(webSearchMockPath, { MOCK_PORT: "80http" });
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(result.stderr).toContain("invalid MOCK_PORT: 80http");
|
||||
});
|
||||
|
||||
it("rejects out-of-range fixture listener ports", () => {
|
||||
const webSearch = runScript(webSearchMockPath, { MOCK_PORT: "65536" });
|
||||
expect(webSearch.status).not.toBe(0);
|
||||
expect(webSearch.stderr).toContain("invalid MOCK_PORT: 65536");
|
||||
|
||||
const browserFixture = runScript(browserCdpFixturePath, { FIXTURE_PORT: "65536" });
|
||||
expect(browserFixture.status).not.toBe(0);
|
||||
expect(browserFixture.stderr).toContain("invalid FIXTURE_PORT: 65536");
|
||||
|
||||
const clickClack = runScript(clickClackFixturePath, {
|
||||
CLICKCLACK_FIXTURE_PORT: "65536",
|
||||
});
|
||||
expect(clickClack.status).not.toBe(0);
|
||||
expect(clickClack.stderr).toContain("invalid CLICKCLACK_FIXTURE_PORT: 65536");
|
||||
});
|
||||
|
||||
it("rejects loose config-reload log timeout env values", () => {
|
||||
const result = runScript(configReloadAssertPath, {
|
||||
OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS: "30000ms",
|
||||
});
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(result.stderr).toContain("invalid OPENCLAW_CONFIG_RELOAD_LOG_TIMEOUT_MS: 30000ms");
|
||||
});
|
||||
|
||||
it("rejects loose config-reload log read caps", () => {
|
||||
const result = runScript(configReloadAssertPath, {
|
||||
OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES: "256kb",
|
||||
});
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(result.stderr).toContain("invalid OPENCLAW_CONFIG_RELOAD_LOG_MAX_READ_BYTES: 256kb");
|
||||
});
|
||||
|
||||
it("returns a clear error when mock OpenAI cannot append request logs", async () => {
|
||||
const requestLogDirectory = await mkdtemp(join(tmpdir(), "openclaw-mock-request-log-"));
|
||||
try {
|
||||
await withMockServer(
|
||||
mockOpenAiPath,
|
||||
{ MOCK_REQUEST_LOG: requestLogDirectory },
|
||||
async (baseUrl, output) => {
|
||||
const response = await fetch(`${baseUrl}/v1/responses`, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ input: "OPENCLAW_E2E_OK" }),
|
||||
});
|
||||
const body = await response.json();
|
||||
|
||||
expect(response.status).toBe(500);
|
||||
expect(body.error.message).toContain("mock OpenAI request log write failed");
|
||||
await expect
|
||||
.poll(() => output.stderr(), { timeout: 1_000 })
|
||||
.toContain("mock-openai request log write failed");
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
await rm(requestLogDirectory, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("returns a clear error when web-search mock cannot append request logs", async () => {
|
||||
const requestLogDirectory = await mkdtemp(join(tmpdir(), "openclaw-web-search-log-"));
|
||||
try {
|
||||
await withMockServer(
|
||||
webSearchMockPath,
|
||||
{
|
||||
MOCK_REQUEST_LOG: requestLogDirectory,
|
||||
RAW_SCHEMA_ERROR: "400 schema rejected",
|
||||
SUCCESS_MARKER: "OPENCLAW_SCHEMA_E2E_OK",
|
||||
},
|
||||
async (baseUrl, output) => {
|
||||
const response = await fetch(`${baseUrl}/v1/responses`, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
input: "OPENCLAW_SCHEMA_E2E_OK",
|
||||
reasoning: { effort: "low" },
|
||||
tools: [{ type: "web_search" }],
|
||||
}),
|
||||
});
|
||||
const body = await response.json();
|
||||
|
||||
expect(response.status).toBe(500);
|
||||
expect(body.error.message).toContain("mock OpenAI request log write failed");
|
||||
await expect
|
||||
.poll(() => output.stderr(), { timeout: 1_000 })
|
||||
.toContain("mock-openai-web-search request log write failed");
|
||||
},
|
||||
);
|
||||
} finally {
|
||||
await rm(requestLogDirectory, { force: true, recursive: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user