Skip to content

Commit 8b8058a

Browse files
authored
fix(release): supply exact Codex companions to cross-OS checks and repair legacy node-host metadata (#120442)
* fix(release): supply exact Codex companions to cross-OS checks and repair legacy node-host metadata * test(release): align async run title rejection
1 parent df038b9 commit 8b8058a

8 files changed

Lines changed: 383 additions & 18 deletions

‎.github/workflows/openclaw-cross-os-release-checks-reusable.yml‎

Lines changed: 209 additions & 2 deletions
Large diffs are not rendered by default.

‎.github/workflows/openclaw-release-checks.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,7 @@ jobs:
814814
candidate_sha256: ${{ needs.prepare_release_package.outputs.package_sha256 }}
815815
candidate_version: ${{ needs.prepare_release_package.outputs.package_version }}
816816
candidate_source_sha: ${{ needs.prepare_release_package.outputs.source_sha }}
817+
candidate_artifact_json: ${{ inputs.candidate_artifact_json }}
817818
openai_model: openai/gpt-5.6-luna
818819
ubuntu_runner: ubuntu-24.04
819820
windows_runner: windows-2025

‎src/gateway/node-command-policy.test.ts‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import {
1616
resolveNodeCommandAllowlist,
1717
resolveNodePairingCommandAllowlist,
1818
} from "./node-command-policy.js";
19-
import { filterLegacyNodeProtocolFeatures } from "./node-legacy-protocol-filter.js";
19+
import {
20+
filterLegacyNodeProtocolFeatures,
21+
normalizeLegacyNodeHostClientMetadata,
22+
} from "./node-legacy-protocol-filter.js";
2023

2124
describe("gateway/node-command-policy", () => {
2225
afterEach(() => {
@@ -173,6 +176,39 @@ describe("gateway/node-command-policy", () => {
173176
});
174177
});
175178

179+
it.each([
180+
["darwin", "macos", "Mac"],
181+
["linux", "linux", "Linux"],
182+
["win32", "windows", "Windows"],
183+
])("normalizes shipped protocol-v3 node-host metadata for %s", (platform, expected, family) => {
184+
expect(
185+
normalizeLegacyNodeHostClientMetadata({
186+
id: GATEWAY_CLIENT_IDS.NODE_HOST,
187+
version: "2026.5.7",
188+
platform,
189+
mode: GATEWAY_CLIENT_MODES.NODE,
190+
}),
191+
).toMatchObject({ platform: expected, deviceFamily: family });
192+
});
193+
194+
it("does not normalize non-node-host or conflicting legacy metadata", () => {
195+
const conflicting = {
196+
id: GATEWAY_CLIENT_IDS.NODE_HOST,
197+
version: "2026.5.7",
198+
platform: "linux",
199+
deviceFamily: "iPhone",
200+
mode: GATEWAY_CLIENT_MODES.NODE,
201+
} as const;
202+
expect(normalizeLegacyNodeHostClientMetadata(conflicting)).toBe(conflicting);
203+
204+
const otherClient = {
205+
...conflicting,
206+
id: GATEWAY_CLIENT_IDS.LINUX_APP,
207+
deviceFamily: undefined,
208+
};
209+
expect(normalizeLegacyNodeHostClientMetadata(otherClient)).toBe(otherClient);
210+
});
211+
176212
it("adds explicitly defaulted plugin node-host agent tools from the active registry", () => {
177213
const registry = createEmptyPluginRegistry();
178214
registry.nodeHostCommands.push(

‎src/gateway/node-legacy-protocol-filter.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// N-1 (legacy protocol) node feature filtering, kept out of the oversized
22
// node-command-policy.ts file.
3+
import {
4+
GATEWAY_CLIENT_IDS,
5+
GATEWAY_CLIENT_MODES,
6+
} from "../../packages/gateway-protocol/src/client-info.js";
7+
import type { ConnectParams } from "../../packages/gateway-protocol/src/index.js";
38
import { getActivePluginGatewayNodePolicyRegistry } from "../plugins/runtime.js";
49
import {
510
DEFAULT_DANGEROUS_NODE_COMMANDS,
@@ -18,6 +23,29 @@ const BUILT_IN_NODE_COMMANDS = new Set<string>([
1823
...IOS_WATCH_RELAY_COMMANDS,
1924
]);
2025

26+
const LEGACY_NODE_HOST_DESKTOP_METADATA: Readonly<
27+
Record<string, { platform: string; deviceFamily: string }>
28+
> = {
29+
darwin: { platform: "macos", deviceFamily: "Mac" },
30+
linux: { platform: "linux", deviceFamily: "Linux" },
31+
win32: { platform: "windows", deviceFamily: "Windows" },
32+
};
33+
34+
/** Normalizes the desktop metadata emitted by the shipped protocol-v3 node host. */
35+
export function normalizeLegacyNodeHostClientMetadata(
36+
client: ConnectParams["client"],
37+
): ConnectParams["client"] {
38+
if (
39+
client.id !== GATEWAY_CLIENT_IDS.NODE_HOST ||
40+
client.mode !== GATEWAY_CLIENT_MODES.NODE ||
41+
client.deviceFamily?.trim()
42+
) {
43+
return client;
44+
}
45+
const metadata = LEGACY_NODE_HOST_DESKTOP_METADATA[client.platform];
46+
return metadata ? { ...client, ...metadata } : client;
47+
}
48+
2149
export function filterLegacyNodeProtocolFeatures(params: {
2250
caps: readonly string[];
2351
commands: readonly string[];

‎src/gateway/server.auth.default-token.suite.ts‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ export function registerDefaultAuthTokenSuite(): void {
502502
ws.close();
503503
});
504504

505-
test("allows authenticated previous-protocol nodes to register for maintenance", async () => {
505+
test("retains authenticated previous-protocol node-host maintenance commands", async () => {
506506
const nodeWs = await openWs(port);
507507
const operatorWs = await openWs(port);
508508
try {
@@ -511,23 +511,35 @@ export function registerDefaultAuthTokenSuite(): void {
511511
minProtocol: MIN_NODE_PROTOCOL_VERSION,
512512
maxProtocol: MIN_NODE_PROTOCOL_VERSION,
513513
role: "node",
514-
client: { ...NODE_CLIENT, version: legacyVersion },
514+
client: { ...NODE_CLIENT, version: legacyVersion, platform: "linux" },
515+
caps: ["system"],
516+
commands: ["system.which"],
515517
});
516518
expect(nodeRes.ok).toBe(true);
517519

518520
const operatorRes = await connectReq(operatorWs);
519521
expect(operatorRes.ok).toBe(true);
520-
const listRes = await rpcReq<{ nodes?: Array<{ connected?: boolean; version?: string }> }>(
521-
operatorWs,
522-
"node.list",
523-
{},
522+
type LegacyNodeStatus = {
523+
commands?: string[];
524+
connected?: boolean;
525+
deviceFamily?: string;
526+
pendingDeclaredCommands?: string[];
527+
pendingRequestId?: string;
528+
platform?: string;
529+
version?: string;
530+
};
531+
const pendingList = await rpcReq<{
532+
nodes?: LegacyNodeStatus[];
533+
}>(operatorWs, "node.list", {});
534+
const pendingNode = pendingList.payload?.nodes?.find(
535+
(node) => node.connected === true && node.version === legacyVersion,
524536
);
525-
expect(listRes.ok).toBe(true);
526-
expect(
527-
listRes.payload?.nodes?.some(
528-
(node) => node.connected === true && node.version === legacyVersion,
529-
),
530-
).toBe(true);
537+
expect(pendingNode).toMatchObject({
538+
deviceFamily: "Linux",
539+
pendingDeclaredCommands: ["system.which"],
540+
platform: "linux",
541+
});
542+
expect(pendingNode?.pendingRequestId).toBeTypeOf("string");
531543
} finally {
532544
nodeWs.close();
533545
operatorWs.close();

‎src/gateway/server/ws-connection/connect-node-session.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import {
1010
import { AUTH_RATE_LIMIT_SCOPE_NODE_PAIRING } from "../../auth-rate-limit.js";
1111
import { ADMIN_SCOPE, PAIRING_SCOPE, WRITE_SCOPE } from "../../method-scopes.js";
1212
import { reconcileNodePairingOnConnect } from "../../node-connect-reconcile.js";
13-
import { filterLegacyNodeProtocolFeatures } from "../../node-legacy-protocol-filter.js";
13+
import {
14+
filterLegacyNodeProtocolFeatures,
15+
normalizeLegacyNodeHostClientMetadata,
16+
} from "../../node-legacy-protocol-filter.js";
1417
import { withSerializedRateLimitAttempt } from "../../rate-limit-attempt-serialization.js";
1518
import type {
1619
DeviceAuthorizedGatewayConnect,
@@ -83,6 +86,11 @@ export async function prepareGatewayNodeConnect(
8386
broadcastNodePairingResult,
8487
} = context;
8588
const { device, devicePublicKey, usesLegacyNodeProtocol, rejectUnauthorized } = state;
89+
if (usesLegacyNodeProtocol) {
90+
// Protocol-v3 node hosts predate canonical desktop family metadata. Repair
91+
// that exact shipped envelope before policy reconciliation or exec vanishes.
92+
connectParams.client = normalizeLegacyNodeHostClientMetadata(connectParams.client);
93+
}
8694
const nodeId = connectParams.device?.id ?? connectParams.client.id;
8795
const nodePairingSnapshot = await beginNodePairingConnect(nodeId);
8896
const pairedNode = nodePairingSnapshot.pairedNode;

‎test/scripts/openclaw-cross-os-release-workflow.test.ts‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ describe("cross-OS release checks workflow", () => {
175175
candidate_sha256: "${{ needs.prepare_release_package.outputs.package_sha256 }}",
176176
candidate_source_sha: "${{ needs.prepare_release_package.outputs.source_sha }}",
177177
candidate_version: "${{ needs.prepare_release_package.outputs.package_version }}",
178+
candidate_artifact_json: "${{ inputs.candidate_artifact_json }}",
178179
});
179180

180181
expect(job(release, "docker_e2e_release_checks").with).toMatchObject({
@@ -214,6 +215,7 @@ describe("cross-OS release checks workflow", () => {
214215
"candidate_sha256",
215216
"candidate_source_sha",
216217
"candidate_version",
218+
"candidate_artifact_json",
217219
]) {
218220
expect(workflow.on?.workflow_dispatch?.inputs?.[inputName], inputName).toMatchObject({
219221
default: "",
@@ -238,6 +240,14 @@ describe("cross-OS release checks workflow", () => {
238240
candidate_artifact_run_id: "${{ github.run_id }}",
239241
candidate_sha256: "${{ steps.candidate_metadata.outputs.sha256 }}",
240242
candidate_version: "${{ steps.candidate_metadata.outputs.version }}",
243+
codex_plugin_file_name: "${{ steps.codex_plugin_metadata.outputs.file_name }}",
244+
codex_plugin_sha256: "${{ steps.codex_plugin_metadata.outputs.sha256 }}",
245+
prepublish_plugin_registry_artifact_id:
246+
"${{ steps.upload_generated_plugin_registry.outputs.artifact-id || fromJSON(inputs.candidate_artifact_json || '{}').prepublishPluginRegistryArtifactId || '' }}",
247+
prepublish_plugin_registry_artifact_run_attempt:
248+
"${{ steps.upload_generated_plugin_registry.outputs.artifact-id && github.run_attempt || fromJSON(inputs.candidate_artifact_json || '{}').prepublishPluginRegistryArtifactRunAttempt || '' }}",
249+
prepublish_plugin_registry_artifact_run_id:
250+
"${{ steps.upload_generated_plugin_registry.outputs.artifact-id && github.run_id || fromJSON(inputs.candidate_artifact_json || '{}').prepublishPluginRegistryArtifactRunId || '' }}",
241251
source_sha: "${{ steps.candidate_metadata.outputs.source_sha }}",
242252
});
243253
for (const [jobName, workflowJob] of Object.entries(workflow.jobs)) {
@@ -371,6 +381,65 @@ describe("cross-OS release checks workflow", () => {
371381
expect(verify.run).toContain('"$actual_baseline_sha256" != "$EXPECTED_BASELINE_SHA256"');
372382
});
373383

384+
it("binds OpenAI onboarding to the exact prerelease Codex companion", () => {
385+
const workflow = readWorkflow(WORKFLOW_PATH);
386+
const prepare = job(workflow, "prepare");
387+
const binding = step(prepare, "Validate prerelease plugin registry artifact binding");
388+
expect(binding.run).toContain('verify-upload "Prerelease plugin registry"');
389+
expect(binding.env).toMatchObject({
390+
ARTIFACT_ID:
391+
"${{ fromJSON(inputs.candidate_artifact_json || '{}').prepublishPluginRegistryArtifactId || '' }}",
392+
ARTIFACT_RUN_ID:
393+
"${{ fromJSON(inputs.candidate_artifact_json || '{}').prepublishPluginRegistryArtifactRunId || '' }}",
394+
MANIFEST_SHA256:
395+
"${{ fromJSON(inputs.candidate_artifact_json || '{}').prepublishPluginRegistryManifestSha256 || '' }}",
396+
});
397+
398+
const sourceCheckout = step(prepare, "Checkout public source ref");
399+
expect(sourceCheckout.if).toContain("inputs.provider == 'openai'");
400+
expect(sourceCheckout.with?.ref).toBe(
401+
"${{ inputs.candidate_artifact_name != '' && inputs.candidate_source_sha || inputs.ref }}",
402+
);
403+
expect(step(prepare, "Install companion plugin build dependencies").run).toBe(
404+
"pnpm install --frozen-lockfile --prefer-offline --ignore-scripts",
405+
);
406+
const pack = step(prepare, "Pack exact Codex companion plugin");
407+
expect(pack.run).toContain("prepublish-plugin-registry-artifact.mjs create");
408+
expect(pack.run).toContain("--repo-root source");
409+
expect(pack.run).toContain(`--required-packages-json '["@openclaw/codex"]'`);
410+
411+
const metadata = step(prepare, "Resolve exact Codex companion plugin");
412+
expect(metadata.run).toContain('any(.name == "@openclaw/codex")');
413+
expect(metadata.run).toContain("prepublish-plugin-registry-artifact.mjs verify");
414+
expect(metadata.run).toContain('--source-sha "$SOURCE_SHA"');
415+
expect(metadata.run).toContain('--candidate-version "$CANDIDATE_VERSION"');
416+
expect(metadata.run).toContain("entry.tarball !== path.win32.basename(entry.tarball)");
417+
expect(
418+
step(prepare, "Upload generated prerelease plugin registry artifact").with,
419+
).toMatchObject({
420+
name: "openclaw-cross-os-release-checks-plugins-${{ github.run_id }}-${{ github.run_attempt }}",
421+
"if-no-files-found": "error",
422+
});
423+
424+
const consumer = job(workflow, "cross_os_release_checks");
425+
const download = step(consumer, "Download prerelease plugin registry artifact");
426+
expect(download.with).toMatchObject({
427+
"artifact-ids": "${{ needs.prepare.outputs.prepublish_plugin_registry_artifact_id }}",
428+
"run-id": "${{ needs.prepare.outputs.prepublish_plugin_registry_artifact_run_id }}",
429+
});
430+
const verify = step(consumer, "Verify release-check inputs");
431+
expect(verify.run).toContain('"$actual_codex_sha256" != "$EXPECTED_CODEX_PLUGIN_SHA256"');
432+
433+
const run = step(consumer, "Run cross-OS release checks");
434+
expect(run.env?.CODEX_PLUGIN_FILE_NAME).toBe(
435+
"${{ needs.prepare.outputs.codex_plugin_file_name }}",
436+
);
437+
expect(run.run).toContain("OPENCLAW_ALLOW_PLUGIN_INSTALL_OVERRIDES=1");
438+
expect(run.run).toContain(
439+
"JSON.stringify({ codex: `npm-pack:${process.env.CODEX_PLUGIN_TGZ}` })",
440+
);
441+
});
442+
374443
it("executes the release harness directly with Node", () => {
375444
const wrapper = readFileSync(WRAPPER_PATH, "utf8");
376445
const script = readFileSync(SCRIPT_PATH, "utf8");

‎test/scripts/package-acceptance-workflow.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,14 +1969,18 @@ describe("package acceptance workflow", () => {
19691969
["title", { MOCK_GH_RUN_TITLE: "Unrelated workflow run" }],
19701970
["head branch", { MOCK_GH_RUN_HEAD_BRANCH: "other" }],
19711971
["event", { MOCK_GH_RUN_EVENT: "push" }],
1972-
] as const)("refuses a returned run URL with the wrong %s", (_label, overrides) => {
1972+
] as const)("refuses a returned run URL with the wrong %s", (label, overrides) => {
19731973
const { calls, result } = runFullReleaseChildDispatch(FULL_RELEASE_CHILD_DISPATCHES[0], {
19741974
MOCK_GH_DISPATCH_OUTPUT: "https://github.com/openclaw/openclaw/actions/runs/101",
19751975
...overrides,
19761976
});
19771977

19781978
expect(result.status).toBe(1);
1979-
expect(result.stderr).toContain("Refusing to adopt unvalidated ci.yml run 101");
1979+
expect(result.stderr).toContain(
1980+
label === "title"
1981+
? "Refusing to adopt ci.yml run 101: display title never matched"
1982+
: "Refusing to adopt unvalidated ci.yml run 101",
1983+
);
19801984
expect(
19811985
calls.some(({ args }) =>
19821986
args.some((value) => value.includes("/actions/workflows/") && value.endsWith("/runs")),

0 commit comments

Comments
 (0)