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:
259
test/scripts/check-cli-startup-memory.test.ts
Normal file
259
test/scripts/check-cli-startup-memory.test.ts
Normal file
@@ -0,0 +1,259 @@
|
||||
// Check Cli Startup Memory tests cover check cli startup memory script behavior.
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { readdirSync, mkdtempSync, rmSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { testing } from "../../scripts/check-cli-startup-memory.mjs";
|
||||
|
||||
const tempRoots: string[] = [];
|
||||
|
||||
function makeTempRoot(): string {
|
||||
const root = mkdtempSync(path.join(tmpdir(), "openclaw-startup-memory-test-"));
|
||||
tempRoots.push(root);
|
||||
return root;
|
||||
}
|
||||
|
||||
function expectNoNodeStack(stderr: string): void {
|
||||
expect(stderr).not.toContain("Node.js");
|
||||
expect(stderr).not.toContain("\n at ");
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const root of tempRoots.splice(0)) {
|
||||
rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
describe("check-cli-startup-memory", () => {
|
||||
it("resolves the repository root from the script location", () => {
|
||||
const repoRoot = path.resolve(__dirname, "..", "..");
|
||||
const scriptUrl = pathToFileURL(path.join(repoRoot, "scripts/check-cli-startup-memory.mjs"));
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[
|
||||
"--input-type=module",
|
||||
"--eval",
|
||||
`const mod = await import(${JSON.stringify(scriptUrl.href)}); console.log(mod.testing.repoRoot);`,
|
||||
],
|
||||
{
|
||||
cwd: path.join(repoRoot, "test/scripts"),
|
||||
encoding: "utf8",
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stdout.trim()).toBe(repoRoot);
|
||||
});
|
||||
|
||||
it("keeps the Linux help startup budget tight while allowing macOS RSS overhead", () => {
|
||||
expect(testing.resolveDefaultLimitsMb("linux").help).toBe(100);
|
||||
expect(testing.resolveDefaultLimitsMb("darwin").help).toBeGreaterThan(100);
|
||||
});
|
||||
|
||||
it("keeps invalid startup memory env values from bypassing budgets", () => {
|
||||
expect(() =>
|
||||
testing.readPositiveNumberEnv("OPENCLAW_STARTUP_MEMORY_HELP_MB", 100, {
|
||||
OPENCLAW_STARTUP_MEMORY_HELP_MB: "abc",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_HELP_MB must be a positive number");
|
||||
expect(() =>
|
||||
testing.readPositiveNumberEnv("OPENCLAW_STARTUP_MEMORY_HELP_MB", 100, {
|
||||
OPENCLAW_STARTUP_MEMORY_HELP_MB: "1e3",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_HELP_MB must be a positive number");
|
||||
expect(() =>
|
||||
testing.readPositiveNumberEnv("OPENCLAW_STARTUP_MEMORY_HELP_MB", 100, {
|
||||
OPENCLAW_STARTUP_MEMORY_HELP_MB: "0x10",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_HELP_MB must be a positive number");
|
||||
expect(() =>
|
||||
testing.readPositiveNumberEnv("OPENCLAW_STARTUP_MEMORY_HELP_MB", 100, {
|
||||
OPENCLAW_STARTUP_MEMORY_HELP_MB: "0",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_HELP_MB must be a positive number");
|
||||
expect(
|
||||
testing.readPositiveNumberEnv("OPENCLAW_STARTUP_MEMORY_HELP_MB", 100, {
|
||||
OPENCLAW_STARTUP_MEMORY_HELP_MB: "125.5",
|
||||
}),
|
||||
).toBe(125.5);
|
||||
});
|
||||
|
||||
it("keeps invalid startup memory timeout env values from parsing loosely", () => {
|
||||
expect(() =>
|
||||
testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, {
|
||||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1e3",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive number");
|
||||
expect(() =>
|
||||
testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, {
|
||||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1000.5",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive integer");
|
||||
expect(() =>
|
||||
testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, {
|
||||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: String(Number.MAX_SAFE_INTEGER + 1),
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive integer");
|
||||
expect(
|
||||
testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, {
|
||||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1000",
|
||||
}),
|
||||
).toBe(1000);
|
||||
});
|
||||
|
||||
it("rejects missing startup memory artifact paths", () => {
|
||||
for (const args of [
|
||||
["--json"],
|
||||
["--json", "--summary"],
|
||||
["--json", "-h"],
|
||||
["--summary"],
|
||||
["--summary", "--json"],
|
||||
["--summary", "-h"],
|
||||
]) {
|
||||
expect(() => testing.parseArgs(args)).toThrow(/--(?:json|summary) requires a path/u);
|
||||
}
|
||||
});
|
||||
|
||||
it("does not create a temp home before argument validation succeeds", () => {
|
||||
if (process.platform !== "darwin" && process.platform !== "linux") {
|
||||
return;
|
||||
}
|
||||
|
||||
const tempRoot = makeTempRoot();
|
||||
const result = spawnSync(process.execPath, ["scripts/check-cli-startup-memory.mjs", "--json"], {
|
||||
cwd: path.resolve(__dirname, "..", ".."),
|
||||
encoding: "utf8",
|
||||
env: {
|
||||
...process.env,
|
||||
TMPDIR: tempRoot,
|
||||
TEMP: tempRoot,
|
||||
TMP: tempRoot,
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.status).not.toBe(0);
|
||||
expect(readdirSync(tempRoot)).toEqual([]);
|
||||
});
|
||||
|
||||
it("reports CLI argument errors without a Node stack trace", () => {
|
||||
const result = spawnSync(process.execPath, ["scripts/check-cli-startup-memory.mjs", "--wat"], {
|
||||
cwd: path.resolve(__dirname, "..", ".."),
|
||||
encoding: "utf8",
|
||||
});
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stdout).toBe("");
|
||||
expect(result.stderr.trim()).toBe("Unknown option: --wat");
|
||||
expectNoNodeStack(result.stderr);
|
||||
});
|
||||
|
||||
it("times out startup probes instead of hanging indefinitely", () => {
|
||||
if (process.platform !== "darwin" && process.platform !== "linux") {
|
||||
return;
|
||||
}
|
||||
|
||||
const tempRoot = makeTempRoot();
|
||||
const seenTimeouts: Array<number | undefined> = [];
|
||||
const seenKillSignals: Array<string | undefined> = [];
|
||||
const timeoutError = Object.assign(new Error("spawnSync timed out"), { code: "ETIMEDOUT" });
|
||||
|
||||
expect(() =>
|
||||
testing.runStartupMemoryCheck(
|
||||
[
|
||||
"--json",
|
||||
path.join(tempRoot, "startup-memory.json"),
|
||||
"--summary",
|
||||
path.join(tempRoot, "summary.md"),
|
||||
],
|
||||
{
|
||||
platform: "linux",
|
||||
timeoutMs: 1234,
|
||||
spawnSync: (
|
||||
_command: string,
|
||||
_args: string[],
|
||||
options: { killSignal?: string; timeout?: number },
|
||||
) => {
|
||||
seenTimeouts.push(options.timeout);
|
||||
seenKillSignals.push(options.killSignal);
|
||||
return {
|
||||
error: timeoutError,
|
||||
signal: "SIGKILL",
|
||||
status: null,
|
||||
stderr: "",
|
||||
stdout: "",
|
||||
};
|
||||
},
|
||||
},
|
||||
),
|
||||
).toThrow("--help timed out after 1234ms");
|
||||
expect(seenTimeouts).toEqual([1234, 1234, 1234]);
|
||||
expect(seenKillSignals).toEqual(["SIGKILL", "SIGKILL", "SIGKILL"]);
|
||||
});
|
||||
|
||||
it("rejects zero RSS markers instead of passing empty resource evidence", () => {
|
||||
if (process.platform !== "darwin" && process.platform !== "linux") {
|
||||
return;
|
||||
}
|
||||
|
||||
const tempRoot = makeTempRoot();
|
||||
expect(() =>
|
||||
testing.runStartupMemoryCheck(
|
||||
[
|
||||
"--json",
|
||||
path.join(tempRoot, "startup-memory.json"),
|
||||
"--summary",
|
||||
path.join(tempRoot, "summary.md"),
|
||||
],
|
||||
{
|
||||
platform: "darwin",
|
||||
spawnSync: () => ({
|
||||
signal: null,
|
||||
status: 0,
|
||||
stderr: "__OPENCLAW_MAX_RSS_KB__=0\n",
|
||||
stdout: "",
|
||||
}),
|
||||
},
|
||||
),
|
||||
).toThrow("--help did not report max RSS");
|
||||
});
|
||||
|
||||
it("passes the generated RSS hook as a Node import URL", () => {
|
||||
if (process.platform !== "darwin" && process.platform !== "linux") {
|
||||
return;
|
||||
}
|
||||
|
||||
const tempRoot = makeTempRoot();
|
||||
const seenArgs: string[][] = [];
|
||||
|
||||
const result = testing.runStartupMemoryCheck(
|
||||
[
|
||||
"--json",
|
||||
path.join(tempRoot, "startup-memory.json"),
|
||||
"--summary",
|
||||
path.join(tempRoot, "summary.md"),
|
||||
],
|
||||
{
|
||||
platform: "linux",
|
||||
spawnSync: (_command: string, args: string[]) => {
|
||||
seenArgs.push(args);
|
||||
return {
|
||||
error: null,
|
||||
signal: null,
|
||||
status: 0,
|
||||
stderr: "__OPENCLAW_MAX_RSS_KB__=1024\n",
|
||||
stdout: "",
|
||||
};
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(result.skipped).toBe(false);
|
||||
expect(seenArgs).toHaveLength(testing.cases.length);
|
||||
for (const args of seenArgs) {
|
||||
expect(args[0]).toBe("--import");
|
||||
expect(args[1]).toMatch(/^file:/u);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user