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,289 @@
// Qa Lab plugin module implements codex plugin.fixture behavior.
import fs from "node:fs/promises";
import path from "node:path";
import { resolveCodexAuthProfile, type QaAuthProfileSnapshot } from "./auth-profile.fixture.js";
export const CODEX_PLUGIN_CURRENT_VERSION = "2026.5.21";
export const CODEX_PLUGIN_HEAD_VERSION = "head";
export const CODEX_PLUGIN_ID = "codex";
export const CODEX_PLUGIN_LIFECYCLE_MESSAGES = Object.freeze({
missingPlugin:
'Codex plugin is required for Codex runtime. Run "openclaw doctor --fix" to install @openclaw/codex, then retry.',
});
export type CodexPluginFixtureVersion = "missing" | "current" | "head" | (string & {});
export type CodexPluginState = {
installed: boolean;
version?: string;
};
export type CodexPluginLifecycleStatus = "ready" | "repair-required" | "blocked";
export type CodexPluginLifecycleResult = {
status: CodexPluginLifecycleStatus;
pluginState: CodexPluginState;
selectedAuthProfileId?: string;
tokenRoute?: "codex-oauth" | "unavailable";
remediation?: string;
removedRuntimePins: string[];
};
type CodexPluginPackageJson = {
name: "@openclaw/codex";
version: string;
openclaw: {
install: {
minHostVersion: string;
};
compat: {
pluginApi: string;
};
};
};
type ComparableVersion = {
major: number;
minor: number;
patch: number;
};
type CodexPluginInstallGateResult = {
text: string;
inputTokens: number;
responseCount: number;
};
function codexPluginDir(agentDir: string) {
return path.join(agentDir, "plugins", CODEX_PLUGIN_ID);
}
function resolveFixtureVersion(version: CodexPluginFixtureVersion): string {
if (version === "current") {
return CODEX_PLUGIN_CURRENT_VERSION;
}
return version;
}
function buildPackageJson(version: string): CodexPluginPackageJson {
return {
name: "@openclaw/codex",
version,
openclaw: {
install: {
minHostVersion: `>=${version === CODEX_PLUGIN_HEAD_VERSION ? CODEX_PLUGIN_CURRENT_VERSION : version}`,
},
compat: {
pluginApi: `>=${version === CODEX_PLUGIN_HEAD_VERSION ? CODEX_PLUGIN_CURRENT_VERSION : version}`,
},
},
};
}
function parseComparableVersion(value: string | undefined): ComparableVersion | null {
if (!value || value === CODEX_PLUGIN_HEAD_VERSION) {
return parseComparableVersion(CODEX_PLUGIN_CURRENT_VERSION);
}
const match = value.trim().match(/^(\d+)\.(\d+)\.(\d+)/);
if (!match) {
return null;
}
return {
major: Number.parseInt(match[1] ?? "0", 10),
minor: Number.parseInt(match[2] ?? "0", 10),
patch: Number.parseInt(match[3] ?? "0", 10),
};
}
function compareVersions(left: string | undefined, right: string): number {
const leftVersion = parseComparableVersion(left);
const rightVersion = parseComparableVersion(right);
if (!leftVersion || !rightVersion) {
return 0;
}
if (leftVersion.major !== rightVersion.major) {
return leftVersion.major - rightVersion.major;
}
if (leftVersion.minor !== rightVersion.minor) {
return leftVersion.minor - rightVersion.minor;
}
return leftVersion.patch - rightVersion.patch;
}
function formatPinnedOldRemediation(pluginVersion: string, hostVersion: string) {
return `Codex plugin version ${pluginVersion} is older than OpenClaw ${hostVersion}. Run "openclaw plugins update codex" or unpin codex, then rerun "openclaw doctor --fix".`;
}
function formatPinnedNewRemediation(pluginVersion: string, hostVersion: string) {
return `Codex plugin version ${pluginVersion} requires a newer OpenClaw host than ${hostVersion}. Upgrade OpenClaw or install a codex plugin version pinned to ${hostVersion}.`;
}
function collectStaleLegacyRuntimePins(config: unknown): string[] {
if (!config || typeof config !== "object") {
return [];
}
const root = config as {
agents?: {
defaults?: { agentRuntime?: { id?: unknown } };
list?: Record<string, { agentRuntime?: { id?: unknown } }>;
};
};
const markers = new Set<string>();
const collectRuntimePin = (value: unknown) => {
if (value === "openclaw") {
markers.add(`agentRuntime.id=${value}`);
}
};
collectRuntimePin(root.agents?.defaults?.agentRuntime?.id);
for (const entry of Object.values(root.agents?.list ?? {})) {
collectRuntimePin(entry.agentRuntime?.id);
}
return [...markers].toSorted();
}
export async function seedCodexPluginAt(
version: CodexPluginFixtureVersion,
agentDir: string,
): Promise<void> {
const targetDir = codexPluginDir(agentDir);
await fs.rm(targetDir, { recursive: true, force: true });
if (version === "missing") {
return;
}
const resolvedVersion = resolveFixtureVersion(version);
await fs.mkdir(targetDir, { recursive: true });
await fs.writeFile(
path.join(targetDir, "package.json"),
`${JSON.stringify(buildPackageJson(resolvedVersion), null, 2)}\n`,
"utf8",
);
await fs.writeFile(
path.join(targetDir, "openclaw.plugin.json"),
`${JSON.stringify({ id: CODEX_PLUGIN_ID, name: "Codex" }, null, 2)}\n`,
"utf8",
);
}
export async function snapshotCodexPluginState(agentDir: string): Promise<CodexPluginState> {
const packagePath = path.join(codexPluginDir(agentDir), "package.json");
const raw = await fs.readFile(packagePath, "utf8").catch((error: unknown) => {
if (error && typeof error === "object" && (error as { code?: unknown }).code === "ENOENT") {
return null;
}
throw error;
});
if (!raw) {
return { installed: false };
}
const parsed = JSON.parse(raw) as { version?: unknown };
return {
installed: true,
...(typeof parsed.version === "string" ? { version: parsed.version } : {}),
};
}
export function evaluateCodexPluginLifecycle(params: {
plugin: CodexPluginState;
auth: QaAuthProfileSnapshot;
hostVersion: string;
config?: unknown;
doctorFix?: boolean;
}): CodexPluginLifecycleResult {
const authSelection = resolveCodexAuthProfile(params.auth);
const selectedAuthProfileId =
authSelection.status === "ready" ? authSelection.profileId : undefined;
const tokenRoute = authSelection.status === "ready" ? "codex-oauth" : "unavailable";
const removedRuntimePins = params.doctorFix ? collectStaleLegacyRuntimePins(params.config) : [];
if (!params.plugin.installed) {
return {
status: "repair-required",
pluginState: params.plugin,
...(selectedAuthProfileId ? { selectedAuthProfileId } : {}),
tokenRoute,
remediation: CODEX_PLUGIN_LIFECYCLE_MESSAGES.missingPlugin,
removedRuntimePins,
};
}
if (authSelection.status === "blocked") {
return {
status: "blocked",
pluginState: params.plugin,
tokenRoute,
remediation: authSelection.remediation,
removedRuntimePins,
};
}
const versionDelta = compareVersions(params.plugin.version, params.hostVersion);
if (versionDelta < 0 && params.plugin.version) {
return {
status: "blocked",
pluginState: params.plugin,
selectedAuthProfileId,
tokenRoute,
remediation: formatPinnedOldRemediation(params.plugin.version, params.hostVersion),
removedRuntimePins,
};
}
if (versionDelta > 0 && params.plugin.version) {
return {
status: "blocked",
pluginState: params.plugin,
selectedAuthProfileId,
tokenRoute,
remediation: formatPinnedNewRemediation(params.plugin.version, params.hostVersion),
removedRuntimePins,
};
}
return {
status: "ready",
pluginState: params.plugin,
selectedAuthProfileId,
tokenRoute,
removedRuntimePins,
};
}
export function createCodexPluginInstallGate() {
const events: string[] = [];
let installed = false;
let resolveInstall: (() => void) | undefined;
const installedPromise = new Promise<void>((resolve) => {
resolveInstall = resolve;
});
return {
events,
markInstalled() {
if (installed) {
return;
}
installed = true;
events.push("codex-plugin:installed");
resolveInstall?.();
},
async runFirstTurnAfterInstall(params: {
inputTokens: number;
run: () => string | Promise<string>;
}): Promise<CodexPluginInstallGateResult> {
if (!installed) {
events.push("agent-turn:waiting-for-codex-plugin");
await installedPromise;
}
events.push("agent-turn:started");
const text = await params.run();
events.push("agent-turn:completed");
return {
text,
inputTokens: params.inputTokens,
responseCount: 1,
};
},
};
}