Skip to content

Commit f35ede9

Browse files
committed
fix(release): support frozen target entrypoints
1 parent 672b2a1 commit f35ede9

21 files changed

Lines changed: 270 additions & 111 deletions

‎.github/workflows/install-smoke-reusable.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,12 @@ jobs:
706706
package_args=(
707707
--source-dir "$source_dir"
708708
--output-dir /output
709-
--pack-json /output/pack.json
709+
--output-name candidate.tgz
710710
)
711-
if [[ "$ALLOW_UNRELEASED_CHANGELOG" == "true" ]]; then
711+
# The TypeScript implementation is the capability boundary for this
712+
# newer option; frozen Node-native packers intentionally omit it.
713+
if [[ "$ALLOW_UNRELEASED_CHANGELOG" == "true" ]] && \
714+
[[ -f scripts/package-openclaw-for-docker.mts ]]; then
712715
package_args+=(--allow-unreleased-changelog)
713716
fi
714717
node scripts/package-openclaw-for-docker.mjs "${package_args[@]}"

‎.github/workflows/openclaw-live-and-e2e-checks-reusable.yml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ jobs:
10651065
command: pnpm test:ui:e2e --shard=4/4
10661066
- name: Agent plugin Gateway
10671067
command: pnpm test:e2e:agent-plugin-gateway
1068+
target_script: test:e2e:agent-plugin-gateway
10681069
env:
10691070
OPENCLAW_BUILD_PRIVATE_QA: "1"
10701071
OPENCLAW_ENABLE_PRIVATE_QA_CLI: "1"
@@ -1099,7 +1100,17 @@ jobs:
10991100
env:
11001101
OPENCLAW_E2E_WORKERS: "2"
11011102
OPENCLAW_E2E_USE_PREBUILT_DIST: "1"
1102-
run: ${{ matrix.command }}
1103+
TARGET_REQUIRED_SCRIPT: ${{ matrix.target_script || '' }}
1104+
run: |
1105+
set -euo pipefail
1106+
if [[ -n "$TARGET_REQUIRED_SCRIPT" ]] && ! node -e '
1107+
const packageJson = JSON.parse(require("node:fs").readFileSync("package.json", "utf8"));
1108+
if (typeof packageJson.scripts?.[process.argv[1]] !== "string") process.exit(1);
1109+
' "$TARGET_REQUIRED_SCRIPT"; then
1110+
echo "::notice::Skipping $TARGET_REQUIRED_SCRIPT: selected target does not provide this newer repo E2E capability."
1111+
exit 0
1112+
fi
1113+
${{ matrix.command }}
11031114
11041115
validate_special_e2e:
11051116
needs: validate_selected_ref

‎.github/workflows/openclaw-performance.yml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ jobs:
808808
fi
809809
810810
mkdir -p "$SOURCE_PERF_DIR/mock-hello"
811-
if ! node -e "const fs=require('node:fs'); const scripts=require('./package.json').scripts||{}; process.exit(scripts['test:gateway:cpu-scenarios'] && scripts['test:extensions:memory'] && scripts.openclaw && fs.existsSync('openclaw.mjs') && fs.existsSync('scripts/profile-extension-memory.mts') ? 0 : 1)"; then
811+
if ! node -e "const fs=require('node:fs'); const scripts=require('./package.json').scripts||{}; const extensionProbe=['scripts/profile-extension-memory.mts','scripts/profile-extension-memory.mjs'].some((entry)=>fs.existsSync(entry)); process.exit(scripts['test:gateway:cpu-scenarios'] && scripts['test:extensions:memory'] && scripts.openclaw && fs.existsSync('openclaw.mjs') && extensionProbe ? 0 : 1)"; then
812812
cat > "$SOURCE_PERF_DIR/index.md" <<EOF
813813
# OpenClaw Source Performance
814814
@@ -820,15 +820,19 @@ jobs:
820820
821821
- Tested ref: ${TESTED_REF}
822822
- Tested SHA: ${TESTED_SHA}
823-
- Required scripts: test:gateway:cpu-scenarios, test:extensions:memory, openclaw, openclaw.mjs, scripts/profile-extension-memory.mts
823+
- Required scripts: test:gateway:cpu-scenarios, test:extensions:memory, openclaw, openclaw.mjs, scripts/profile-extension-memory.{mts,mjs}
824824
EOF
825825
cat "$SOURCE_PERF_DIR/index.md" >> "$GITHUB_STEP_SUMMARY"
826826
exit 0
827827
fi
828828
829-
# target_ref may predate the dedicated profile; preserve the historical full build there.
830-
if node --import tsx -e "import('./scripts/build-all.mts').then((module) => process.exit(module.BUILD_ALL_PROFILES?.sourcePerformance ? 0 : 1)).catch(() => process.exit(1))"; then
829+
# Run the narrower build only when the candidate advertises the profile.
830+
if [[ -f scripts/build-all.mts ]] && \
831+
node --import tsx scripts/build-all.mts --help | grep -Fxq ' sourcePerformance'; then
831832
OPENCLAW_BUILD_PRIVATE_QA=1 node --import tsx scripts/build-all.mts sourcePerformance
833+
elif [[ -f scripts/build-all.mjs ]] && \
834+
node scripts/build-all.mjs --help | grep -Fxq ' sourcePerformance'; then
835+
OPENCLAW_BUILD_PRIVATE_QA=1 node scripts/build-all.mjs sourcePerformance
832836
else
833837
pnpm build
834838
fi

‎scripts/e2e/lib/fixtures/workspace.mjs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function writeAgentsDeleteConfig() {
3131
writeJson(path.join(stateDir, "openclaw.json"), {
3232
agents: {
3333
ownership: "explicit",
34-
defaults: { heartbeat: { agentId: "main" } },
3534
entries: {
3635
main: { workspace: sharedWorkspace },
3736
ops: { workspace: sharedWorkspace },

‎scripts/install-smoke-candidate-payload.mts‎

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ import tarfile
135135
mode, archive_path, member_name = sys.argv[1:]
136136
with tarfile.open(archive_path, "r:gz") as archive:
137137
members = archive.getmembers()
138+
if mode == "package-metadata":
139+
files = [member for member in members if member.isfile()]
140+
print(json.dumps({
141+
"entryCount": len(files),
142+
"unpackedSize": sum(member.size for member in files),
143+
}))
144+
sys.exit(0)
138145
if mode == "repo-file":
139146
requested_name = member_name
140147
roots = {
@@ -169,40 +176,6 @@ with tarfile.open(archive_path, "r:gz") as archive:
169176
return result.stdout;
170177
}
171178

172-
function readPackageVersionFromPackJson(value: unknown): {
173-
filename: string;
174-
normalized: unknown[];
175-
version: string;
176-
} {
177-
if (!Array.isArray(value) || value.length === 0) {
178-
throw new Error("candidate pack metadata must contain at least one package result");
179-
}
180-
const last = value.at(-1);
181-
if (!last || typeof last !== "object" || Array.isArray(last)) {
182-
throw new Error("candidate pack metadata must end with a package result");
183-
}
184-
const record = last as Record<string, unknown>;
185-
const filename = record.filename;
186-
if (
187-
typeof filename !== "string" ||
188-
filename !== path.basename(filename) ||
189-
filename !== path.win32.basename(filename) ||
190-
!/^openclaw-[A-Za-z0-9._-]+\.tgz$/u.test(filename)
191-
) {
192-
throw new Error("candidate pack metadata contains an unsafe tarball filename");
193-
}
194-
const version = assertVersion(record.version, "candidate pack version");
195-
return {
196-
filename,
197-
normalized: value.map((entry, index) =>
198-
index === value.length - 1 && entry && typeof entry === "object" && !Array.isArray(entry)
199-
? { ...entry, filename: "candidate.tgz" }
200-
: entry,
201-
),
202-
version,
203-
};
204-
}
205-
206179
function readPackageJsonFromTarball(tarballPath: string): Record<string, unknown> {
207180
const raw = runPythonTarReader(["member", tarballPath, "package/package.json"]);
208181
try {
@@ -216,6 +189,27 @@ function readPackageJsonFromTarball(tarballPath: string): Record<string, unknown
216189
}
217190
}
218191

192+
function readPackageTarballMetadata(tarballPath: string): {
193+
entryCount: number;
194+
unpackedSize: number;
195+
} {
196+
const raw = runPythonTarReader(["package-metadata", tarballPath, ""]);
197+
try {
198+
const value = JSON.parse(raw.toString("utf8")) as Record<string, unknown>;
199+
if (
200+
!Number.isSafeInteger(value.entryCount) ||
201+
value.entryCount < 1 ||
202+
!Number.isSafeInteger(value.unpackedSize) ||
203+
value.unpackedSize < 0
204+
) {
205+
throw new Error("package metadata has invalid archive sizes");
206+
}
207+
return { entryCount: value.entryCount, unpackedSize: value.unpackedSize };
208+
} catch (error) {
209+
throw new Error("candidate package tarball metadata is invalid", { cause: error });
210+
}
211+
}
212+
219213
async function writeExclusive(filePath: string, contents: string | Uint8Array): Promise<void> {
220214
await fs.writeFile(filePath, contents, { flag: "wx", mode: 0o644 });
221215
}
@@ -231,19 +225,15 @@ export async function sealInstallSmokeCandidatePayload(
231225
throw new Error("candidate payload output directory must be empty");
232226
}
233227

234-
const packJsonPath = path.join(options.packageDir, "pack.json");
235-
const pack = readPackageVersionFromPackJson(
236-
await readJson(packJsonPath, "candidate pack metadata"),
237-
);
238-
const sourceTarballPath = path.join(options.packageDir, pack.filename);
228+
const sourceTarballPath = path.join(options.packageDir, "candidate.tgz");
239229
await assertRegularFile(sourceTarballPath, "candidate package tarball");
240230
const packageJson = readPackageJsonFromTarball(sourceTarballPath);
241231
if (packageJson.name !== "openclaw") {
242232
throw new Error("candidate package tarball must contain the openclaw package");
243233
}
244-
if (packageJson.version !== pack.version) {
245-
throw new Error("candidate package tarball version does not match pack metadata");
246-
}
234+
const packageVersion = assertVersion(packageJson.version, "candidate package version");
235+
const packageMetadata = readPackageTarballMetadata(sourceTarballPath);
236+
const packageSize = (await fs.stat(sourceTarballPath)).size;
247237

248238
// Re-read installers from the immutable source archive after candidate execution. Candidate
249239
// build hooks never get a writable handle to the sealed scripts consumed by privileged jobs.
@@ -260,7 +250,20 @@ export async function sealInstallSmokeCandidatePayload(
260250
await fs.copyFile(sourceTarballPath, path.join(options.outputDir, "candidate.tgz"));
261251
await writeExclusive(
262252
path.join(options.outputDir, "candidate-pack.json"),
263-
`${JSON.stringify(pack.normalized, null, 2)}\n`,
253+
`${JSON.stringify(
254+
[
255+
{
256+
entryCount: packageMetadata.entryCount,
257+
filename: "candidate.tgz",
258+
name: "openclaw",
259+
size: packageSize,
260+
unpackedSize: packageMetadata.unpackedSize,
261+
version: packageVersion,
262+
},
263+
],
264+
null,
265+
2,
266+
)}\n`,
264267
);
265268
await writeExclusive(path.join(options.outputDir, "install.sh"), installScript);
266269
await writeExclusive(path.join(options.outputDir, "install-cli.sh"), cliInstallScript);
@@ -273,7 +276,7 @@ export async function sealInstallSmokeCandidatePayload(
273276
const manifest: InstallSmokeCandidatePayloadManifest = {
274277
...identity,
275278
files,
276-
packageVersion: pack.version,
279+
packageVersion,
277280
schema: SCHEMA,
278281
sourceArchiveSha256: await sha256File(options.archivePath),
279282
};

‎scripts/lib/live-docker-stage.sh‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,24 @@ openclaw_live_prepare_cli_backend() {
100100
fi
101101
}
102102

103+
openclaw_live_run_staged_script() {
104+
local stem="${1:?staged script stem required}"
105+
shift
106+
107+
# Frozen candidates may retain the Node-native .mjs runner while current
108+
# sources ship its .mts successor. Run the candidate's available entrypoint.
109+
if [ -f "${stem}.mts" ]; then
110+
node --import tsx "${stem}.mts" "$@"
111+
return
112+
fi
113+
if [ -f "${stem}.mjs" ]; then
114+
node "${stem}.mjs" "$@"
115+
return
116+
fi
117+
echo "staged OpenClaw script entrypoint not found: ${stem}.{mts,mjs}" >&2
118+
return 1
119+
}
120+
103121
openclaw_live_stage_source_tree() {
104122
local dest_dir="${1:?destination directory required}"
105123
local stage_mode="${OPENCLAW_LIVE_DOCKER_SOURCE_STAGE_MODE:-copy}"

‎scripts/test-live-acp-bind-docker.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state"
210210
openclaw_live_prepare_staged_config
211211
cd "$tmp_dir"
212212
export OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND="${OPENCLAW_LIVE_ACP_BIND_AGENT_COMMAND:-}"
213-
node --import tsx scripts/test-live.mts -- ${OPENCLAW_LIVE_ACP_BIND_TEST_FILES:-src/gateway/gateway-acp-bind.live.test.ts}
213+
openclaw_live_run_staged_script scripts/test-live -- ${OPENCLAW_LIVE_ACP_BIND_TEST_FILES:-src/gateway/gateway-acp-bind.live.test.ts}
214214
EOF
215215

216216
openclaw_live_acp_bind_append_build_extension acpx

‎scripts/test-live-cli-backend-docker.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ openclaw_live_link_runtime_tree "$tmp_dir"
294294
openclaw_live_stage_state_dir "$tmp_dir/.openclaw-state"
295295
openclaw_live_prepare_staged_config
296296
cd "$tmp_dir"
297-
node --import tsx scripts/test-live.mts -- src/gateway/gateway-cli-backend.live.test.ts
297+
openclaw_live_run_staged_script scripts/test-live -- src/gateway/gateway-cli-backend.live.test.ts
298298
EOF
299299

300300
OPENCLAW_LIVE_DOCKER_REPO_ROOT="$ROOT_DIR" "$TRUSTED_HARNESS_DIR/scripts/test-live-build-docker.sh"

‎scripts/test-live-codex-harness-docker.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ run_codex_harness_target() {
232232
export OPENCLAW_LIVE_CODEX_HARNESS_MODEL="$model"
233233
export OPENCLAW_LIVE_CODEX_HARNESS_THINKING="$thinking"
234234
echo "==> Codex harness target: model=$model thinking=$thinking"
235-
node --import tsx scripts/test-live.mts -- ${OPENCLAW_LIVE_CODEX_TEST_FILES:-src/gateway/gateway-codex-harness.live.test.ts}
235+
openclaw_live_run_staged_script scripts/test-live -- ${OPENCLAW_LIVE_CODEX_TEST_FILES:-src/gateway/gateway-codex-harness.live.test.ts}
236236
}
237237
if [ -n "${OPENCLAW_LIVE_CODEX_HARNESS_TARGETS:-}" ]; then
238238
IFS=',' read -r -a harness_targets <<<"$OPENCLAW_LIVE_CODEX_HARNESS_TARGETS"

‎scripts/test-live-gateway-models-docker.sh‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ while IFS= read -r docker_package; do
6161
openclaw_live_run_setup_command 180 "live CLI backend setup" npm install -g "$docker_package"
6262
done <<<"$docker_packages"
6363
openclaw_live_stage_gemini_auth
64-
if [[ -f scripts/test-live.mjs ]]; then
65-
node scripts/test-live.mjs -- src/gateway/gateway-models.profiles.live.test.ts
66-
else
67-
node --import tsx scripts/test-live.mts -- src/gateway/gateway-models.profiles.live.test.ts
68-
fi
64+
openclaw_live_run_staged_script scripts/test-live -- src/gateway/gateway-models.profiles.live.test.ts
6965
EOF
7066

7167
OPENCLAW_LIVE_DOCKER_REPO_ROOT="$ROOT_DIR" "$TRUSTED_HARNESS_DIR/scripts/test-live-build-docker.sh"

0 commit comments

Comments
 (0)