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

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:
2026-07-05 09:36:54 +00:00
parent 3216769225
commit bedb527145
21108 changed files with 6010766 additions and 0 deletions

View File

@@ -0,0 +1,318 @@
// E2E Agent Turn Output tests cover e2e agent turn output script behavior.
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import {
assertAgentReplyContainsMarker,
assertOpenAiRequestLogUsed,
extractAgentReplyTexts,
} from "../../scripts/e2e/lib/agent-turn-output.mjs";
describe("scripts/e2e/lib/agent-turn-output", () => {
it("extracts local and gateway agent reply payload text", () => {
expect(
extractAgentReplyTexts(
JSON.stringify({
payloads: [{ text: "OPENCLAW_E2E_OK_LOCAL" }],
meta: { finalAssistantVisibleText: "visible" },
}),
),
).toEqual(["visible", "OPENCLAW_E2E_OK_LOCAL"]);
expect(
extractAgentReplyTexts(
JSON.stringify({
result: {
payloads: [{ text: "OPENCLAW_E2E_OK_GATEWAY" }],
meta: { finalAssistantRawText: "raw" },
},
}),
),
).toEqual(["raw", "OPENCLAW_E2E_OK_GATEWAY"]);
});
it("reads compact JSON replies from combined stdout and stderr logs", () => {
expect(
extractAgentReplyTexts(
[
"warning: diagnostic on stderr",
JSON.stringify({ payloads: [{ text: "OPENCLAW_E2E_OK_COMBINED" }] }),
].join("\n"),
),
).toEqual(["OPENCLAW_E2E_OK_COMBINED"]);
});
it("reads pretty JSON replies from combined stdout and stderr logs", () => {
expect(
extractAgentReplyTexts(
[
"warning: diagnostic on stderr",
JSON.stringify(
{
payloads: [{ text: "OPENCLAW_E2E_OK_PRETTY" }],
},
null,
2,
),
].join("\n"),
),
).toEqual(["OPENCLAW_E2E_OK_PRETTY"]);
});
it("does not accept markers that only appear outside reply payloads", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
[
"Return marker OPENCLAW_E2E_OK_PROMPT_ECHO",
JSON.stringify({ payloads: [{ text: "wrong reply" }] }),
].join("\n"),
);
expect(() =>
assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_PROMPT_ECHO", outputPath),
).toThrow(/agent reply payload did not contain marker/u);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("does not accept reply-shaped JSON embedded in diagnostic lines", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
[
`echo ${JSON.stringify({ payloads: [{ text: "OPENCLAW_E2E_OK_DIAGNOSTIC" }] })}`,
JSON.stringify({ payloads: [{ text: "real reply without marker" }] }),
].join("\n"),
);
expect(() =>
assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_DIAGNOSTIC", outputPath),
).toThrow(/agent reply payload did not contain marker/u);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("does not accept markers that only appear in error payload text", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
JSON.stringify({
payloads: [
{ isError: true, text: "OPENCLAW_E2E_OK_ERROR_PAYLOAD" },
{ text: "regular reply without marker" },
],
}),
);
expect(() =>
assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_ERROR_PAYLOAD", outputPath),
).toThrow(/agent reply payload did not contain marker/u);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("does not accept markers that only appear in failed result meta text", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
JSON.stringify({
result: {
status: "error",
meta: { finalAssistantVisibleText: "OPENCLAW_E2E_OK_ERROR_META" },
payloads: [{ isError: true, text: "OPENCLAW_E2E_OK_ERROR_META" }],
},
}),
);
expect(() =>
assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_ERROR_META", outputPath),
).toThrow(/agent reply payload did not contain marker/u);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("does not accept markers that only appear in blocked root final text", () => {
expect(
extractAgentReplyTexts(
JSON.stringify({
status: "blocked",
finalAssistantVisibleText: "OPENCLAW_E2E_OK_BLOCKED_META",
}),
),
).toEqual([]);
});
it("does not accept markers mirrored into blocked run metadata", () => {
const marker = "OPENCLAW_E2E_OK_BLOCKED_META";
expect(
extractAgentReplyTexts(
JSON.stringify({
payloads: [{ isError: true, text: marker }],
meta: {
error: { message: marker },
finalAssistantVisibleText: marker,
livenessState: "blocked",
},
}),
),
).toEqual([]);
});
it("does not accept payload markers from failed result envelopes", () => {
expect(
extractAgentReplyTexts(
JSON.stringify({
payloads: [{ text: "OPENCLAW_E2E_OK_FAILED_PAYLOAD" }],
status: "error",
}),
),
).toEqual([]);
});
it("ignores stale reply markers outside the recent output tail", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
[
JSON.stringify({ payloads: [{ text: "OPENCLAW_E2E_OK_STALE" }] }),
"x".repeat(2_200_000),
JSON.stringify({ payloads: [{ text: "current reply without marker" }] }),
].join("\n"),
);
expect(() => assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_STALE", outputPath)).toThrow(
/agent reply payload did not contain marker/u,
);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("bounds missing marker diagnostics to the recent output tail", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
[
"DO_NOT_DUMP_OLD_OUTPUT",
"x".repeat(70 * 1024),
JSON.stringify({ payloads: [{ text: "wrong reply" }] }),
].join("\n"),
);
expect(() => assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_MISSING", outputPath)).toThrow(
/agent reply payload did not contain marker/u,
);
try {
assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_MISSING", outputPath);
} catch (error) {
expect(error).toBeInstanceOf(Error);
expect((error as Error).message).toContain("Output tail:");
expect((error as Error).message).toContain("wrong reply");
expect((error as Error).message).not.toContain("DO_NOT_DUMP_OLD_OUTPUT");
}
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("bounds large reply payload diagnostics", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-agent-output-"));
try {
const outputPath = join(dir, "agent.log");
writeFileSync(
outputPath,
JSON.stringify({
payloads: [
{
text: `DO_NOT_DUMP_OLD_REPLY${"x".repeat(70 * 1024)}recent reply tail`,
},
],
}),
);
try {
assertAgentReplyContainsMarker("OPENCLAW_E2E_OK_MISSING", outputPath);
} catch (error) {
expect(error).toBeInstanceOf(Error);
expect((error as Error).message).toContain("Reply payload summary:");
expect((error as Error).message).toContain("recent reply tail");
expect((error as Error).message).not.toContain("DO_NOT_DUMP_OLD_REPLY");
return;
}
throw new Error("expected missing marker assertion to fail");
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("checks that the mock OpenAI endpoint was actually hit", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-request-log-"));
try {
mkdirSync(dir, { recursive: true });
const logPath = join(dir, "requests.jsonl");
writeFileSync(logPath, `${JSON.stringify({ path: "/v1/responses" })}\n`);
expect(() => assertOpenAiRequestLogUsed(logPath)).not.toThrow();
writeFileSync(logPath, `${JSON.stringify({ path: "/health" })}\n`);
expect(() => assertOpenAiRequestLogUsed(logPath)).toThrow(/was not used/u);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("finds OpenAI request paths split across large log scan chunks", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-request-log-"));
try {
const logPath = join(dir, "requests.jsonl");
const pathPrefix = "/v1/res";
writeFileSync(logPath, `${"x".repeat(64 * 1024 - pathPrefix.length)}${pathPrefix}ponses\n`);
expect(() => assertOpenAiRequestLogUsed(logPath)).not.toThrow();
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
it("bounds missing OpenAI request diagnostics to the recent log tail", () => {
const dir = mkdtempSync(join(tmpdir(), "openclaw-e2e-request-log-"));
try {
const logPath = join(dir, "requests.jsonl");
writeFileSync(
logPath,
["DO_NOT_DUMP_OLD_REQUESTS", "x".repeat(70 * 1024), '{"path":"/health"}'].join("\n"),
);
try {
assertOpenAiRequestLogUsed(logPath, "mock server");
} catch (error) {
expect(error).toBeInstanceOf(Error);
expect((error as Error).message).toContain("mock server was not used");
expect((error as Error).message).toContain("Request log tail:");
expect((error as Error).message).not.toContain("DO_NOT_DUMP_OLD_REQUESTS");
return;
}
throw new Error("expected missing request log assertion to fail");
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
});