Skip to content

Commit c47ceb0

Browse files
authored
improve(release): reuse exact-SHA validation evidence (#104162)
* perf(release): share changelog verification snapshots * perf(release): reuse exact-SHA validation evidence * feat(release): checkpoint candidate workflow state * feat(release): watch CI transitions compactly * fix(testbox): rotate stale reusable leases * refactor(release): move CI verifier into scripts * fix(release): preserve verifier executable mode * fix(testbox): force noninteractive remote hydration * perf(testbox): skip sync for proven clean heads * fix(testbox): keep changed gates synchronized * fix(testbox): isolate git state probes * fix(testbox): isolate wrapper git commands * fix(testbox): preserve git command contracts * fix(release): validate reused SHA evidence * fix(release): resume serialized plugin selections * fix(testbox): sync source on every lease reuse * fix(release): verify from trusted workflow checkout * fix(release): gate evidence reuse on trusted lineage * fix(release): support legacy verifier checkouts * fix(testbox): export CI across shell snippets * fix(release): revalidate reused evidence before publish * fix(release): reject untrusted reuse before lookup * fix(release): reuse SHA-pinned root evidence * fix(ci): allow unreleased notes in QA packages * fix(release): satisfy script lint contracts * fix(release): handle Unicode workflow refs safely
1 parent 6595d17 commit c47ceb0

31 files changed

Lines changed: 1305 additions & 162 deletions

‎.agents/skills/openclaw-changelog-update/scripts/verify-release-notes.mjs‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414

1515
const repo = "openclaw/openclaw";
1616
const githubSnapshotSchemaVersion = 1;
17+
const githubSnapshotCheckpointInterval = 25;
1718
const commitAssociationQueryBatchSize = 20;
1819
const excludedHandles = new Set(["openclaw", "clawsweeper", "claude", "codex", "steipete"]);
1920
const nonEditorialTypes = new Set([
@@ -182,10 +183,10 @@ function parseArgs(argv) {
182183
return options;
183184
}
184185

185-
function run(command, args) {
186+
function run(command, args, options = {}) {
186187
return execFileSync(command, args, {
187188
encoding: "utf8",
188-
env: { ...process.env, NO_COLOR: "1" },
189+
env: { ...process.env, NO_COLOR: "1", ...options.env },
189190
maxBuffer: 16 * 1024 * 1024,
190191
stdio: ["ignore", "pipe", "pipe"],
191192
});
@@ -220,7 +221,12 @@ function gitIsAncestor(base, target) {
220221

221222
function fetchGithubApi(args) {
222223
try {
223-
return JSON.parse(run("ghx", ["api", ...args]).replace(/\u001B\[[0-?]*[ -/]*[@-~]/g, ""));
224+
return JSON.parse(
225+
run("ghx", ["api", ...args], { env: { GHX_NO_CACHE: "1" } }).replace(
226+
/\u001B\[[0-?]*[ -/]*[@-~]/g,
227+
"",
228+
),
229+
);
224230
} catch (error) {
225231
if (typeof error.stdout === "string" && error.stdout.trim() !== "") {
226232
return JSON.parse(error.stdout.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g, ""));
@@ -231,11 +237,15 @@ function fetchGithubApi(args) {
231237

232238
export function createGithubSnapshotState({
233239
base,
240+
checkpointEvery = githubSnapshotCheckpointInterval,
234241
filePath,
235242
refresh = false,
236243
repository = repo,
237244
target,
238245
}) {
246+
if (!Number.isSafeInteger(checkpointEvery) || checkpointEvery < 1) {
247+
fail("GitHub snapshot checkpoint interval must be a positive integer");
248+
}
239249
let responses = {};
240250
if (!refresh && existsSync(filePath)) {
241251
let parsed;
@@ -265,13 +275,15 @@ export function createGithubSnapshotState({
265275
}
266276
return {
267277
base,
278+
checkpointEvery,
268279
dirty: refresh && existsSync(filePath),
269280
filePath,
270281
hits: 0,
271282
misses: 0,
272283
repository,
273284
responses,
274285
target,
286+
writesSincePersist: 0,
275287
};
276288
}
277289

@@ -298,6 +310,10 @@ export function githubApiWithSnapshot(args, fetchApi, snapshotState) {
298310
}
299311
snapshotState.responses[key] = structuredClone(response);
300312
snapshotState.dirty = true;
313+
snapshotState.writesSincePersist += 1;
314+
if (snapshotState.writesSincePersist >= snapshotState.checkpointEvery) {
315+
persistGithubSnapshot(snapshotState);
316+
}
301317
return response;
302318
}
303319

@@ -322,6 +338,7 @@ export function persistGithubSnapshot(snapshotState) {
322338
writeFileSync(tempPath, output);
323339
renameSync(tempPath, snapshotState.filePath);
324340
snapshotState.dirty = false;
341+
snapshotState.writesSincePersist = 0;
325342
} finally {
326343
rmSync(tempPath, { force: true });
327344
}
@@ -331,16 +348,20 @@ function githubApi(args) {
331348
return githubApiWithSnapshot(args, fetchGithubApi, githubSnapshotState);
332349
}
333350

351+
export function defaultGithubSnapshotPath(base, target, gitCommonDir) {
352+
const defaultName = `verify-release-notes-${base}-${target}.json`;
353+
return path.resolve(gitCommonDir, "openclaw-release-cache", defaultName);
354+
}
355+
334356
function initializeGithubSnapshot(options) {
335357
if (options.noGithubSnapshot) {
336358
return undefined;
337359
}
338360
const base = git(["rev-parse", `${options.base}^{commit}`]);
339361
const target = git(["rev-parse", `${options.target}^{commit}`]);
340-
const defaultName = `verify-release-notes-${base}-${target}.json`;
341362
const filePath = path.resolve(
342363
options.githubSnapshotPath ??
343-
git(["rev-parse", "--git-path", `openclaw-release-cache/${defaultName}`]),
364+
defaultGithubSnapshotPath(base, target, git(["rev-parse", "--git-common-dir"])),
344365
);
345366
const state = createGithubSnapshotState({
346367
base,

‎.agents/skills/release-openclaw-ci/SKILL.md‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Use this with `$release-openclaw-maintainer` and `$openclaw-testing` when a rele
3939
task-owned box and warm a fresh one before testing. Testbox source sync is
4040
relative to the warmed source tree; continuing can mix an old base file with
4141
a new candidate diff and produce false lockfile or Docker failures.
42+
- Reused Testboxes are provenance-gated after their first successful run.
43+
Source-only edits may reuse the lease; base, dependency, wrapper, or Testbox
44+
workflow drift requires a fresh lease. Do not set
45+
`OPENCLAW_TESTBOX_ALLOW_STALE=1` for release evidence.
4246
- For a committed release candidate, warm the box with
4347
`blacksmith testbox warmup ... --ref <candidate-branch-or-sha>`. Do not rely
4448
on source sync to overlay committed branch changes onto the workflow's
@@ -109,23 +113,29 @@ gh workflow run full-release-validation.yml \
109113
-f rerun_group=all
110114
```
111115

116+
For immutable workflow proof on a moving `main`, use
117+
`pnpm ci:full-release --sha <release-sha>`. Its canonical `release-ci/*` ref
118+
keeps exact-target evidence reuse enabled after proving the workflow commit is
119+
still on trusted `main` lineage. Pass `-f reuse_evidence=false` only when the
120+
operator intentionally needs a fresh full run.
121+
112122
Use `release_profile=stable` unless the operator explicitly asks for the broad advisory provider/media matrix. Stable and full profiles force the release soak; the beta profile may opt in with `run_release_soak=true`. Use narrow `rerun_group` after focused fixes.
113123
Publish with `openclaw-release-publish.yml` using `release_profile=from-validation`
114124
unless a maintainer intentionally wants to cross-check a specific profile; the
115125
publish workflow reads the effective profile from the full-validation manifest.
116126

117127
## Watch
118128

119-
Use the summary helper instead of repeated raw polling:
129+
Use the transition-only summary watcher instead of repeated raw polling:
120130

121131
```bash
122-
node .agents/skills/release-openclaw-ci/scripts/release-ci-summary.mjs <full-release-run-id>
132+
node scripts/release-ci-summary.mjs <full-release-run-id> --watch
123133
```
124134

125-
Then watch only when useful:
135+
For a one-shot snapshot:
126136

127137
```bash
128-
gh run watch <full-release-run-id> --repo openclaw/openclaw --exit-status
138+
node scripts/release-ci-summary.mjs <full-release-run-id>
129139
```
130140

131141
Stop watchers before ending the turn or switching strategy.

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@ jobs:
965965
node scripts/build-all.mjs qaRuntime
966966
pnpm ui:build
967967
node scripts/package-openclaw-for-docker.mjs \
968+
--allow-unreleased-changelog \
968969
--skip-build \
969970
--output-dir .artifacts/qa-e2e/smoke-ci-package \
970971
--output-name openclaw-current.tgz

‎.github/workflows/full-release-validation.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ jobs:
241241
evidence_reuse:
242242
name: Check for reusable validation evidence
243243
needs: [resolve_target]
244-
if: inputs.rerun_group == 'all' && inputs.reuse_evidence && github.ref == 'refs/heads/main'
244+
if: inputs.rerun_group == 'all' && inputs.reuse_evidence && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-ci/'))
245245
runs-on: ubuntu-24.04
246246
timeout-minutes: 10
247247
outputs:
@@ -276,6 +276,7 @@ jobs:
276276
env:
277277
GH_TOKEN: ${{ github.token }}
278278
TARGET_SHA: ${{ needs.resolve_target.outputs.sha }}
279+
WORKFLOW_REF: ${{ github.ref_name }}
279280
RELEASE_PROFILE: ${{ inputs.release_profile }}
280281
RUN_RELEASE_SOAK: ${{ inputs.run_release_soak || inputs.release_profile == 'stable' || inputs.release_profile == 'full' }}
281282
PROVIDER: ${{ inputs.provider }}
@@ -309,6 +310,7 @@ jobs:
309310
bash workflow/scripts/github/find-reusable-release-validation.sh \
310311
--target-sha "$TARGET_SHA" \
311312
--workflow-sha "$GITHUB_SHA" \
313+
--workflow-ref "$WORKFLOW_REF" \
312314
--release-profile "$RELEASE_PROFILE" \
313315
--run-release-soak "$RUN_RELEASE_SOAK" \
314316
--inputs-json "$inputs_json" \

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,13 @@ jobs:
357357
run: |
358358
set -euo pipefail
359359
tooling_dir="${RUNNER_TEMP}/release-validation-tooling"
360-
mkdir -p "$tooling_dir"
360+
mkdir -p "${tooling_dir}/lib"
361361
gh api "repos/${GITHUB_REPOSITORY}/contents/scripts/validate-full-release-validation-evidence.mjs?ref=${WORKFLOW_SHA}" \
362362
--jq .content | base64 --decode > "${tooling_dir}/validate-full-release-validation-evidence.mjs"
363+
gh api "repos/${GITHUB_REPOSITORY}/contents/scripts/release-ci-summary.mjs?ref=${WORKFLOW_SHA}" \
364+
--jq .content | base64 --decode > "${tooling_dir}/release-ci-summary.mjs"
365+
gh api "repos/${GITHUB_REPOSITORY}/contents/scripts/lib/plain-gh.mjs?ref=${WORKFLOW_SHA}" \
366+
--jq .content | base64 --decode > "${tooling_dir}/lib/plain-gh.mjs"
363367
364368
- name: Checkout release tag
365369
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
@@ -429,6 +433,7 @@ jobs:
429433
RUN_JSON_FILE: ${{ runner.temp }}/full-release-validation-run.json
430434
TRUSTED_MAIN_REF: refs/remotes/origin/main
431435
VALIDATOR_FILE: ${{ runner.temp }}/release-validation-tooling/validate-full-release-validation-evidence.mjs
436+
STRICT_VALIDATOR_FILE: ${{ runner.temp }}/release-validation-tooling/release-ci-summary.mjs
432437
run: |
433438
set -euo pipefail
434439
manifest="${RUNNER_TEMP}/full-release-validation-manifest/full-release-validation-manifest.json"

‎docs/ci.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,11 @@ pnpm ci:full-release --sha <full-sha>
283283
GitHub workflow dispatch refs must be branches or tags, not raw commit SHAs. The
284284
helper pushes a temporary `release-ci/<sha>-...` branch at a trusted `main`
285285
workflow SHA, passes the requested target SHA through the workflow `ref` input,
286-
verifies every child workflow `headSha` matches the trusted workflow SHA, and
287-
deletes the temporary branch when the run completes. The umbrella verifier also
288-
fails if any child workflow ran at a different workflow SHA.
286+
reuses strict exact-target evidence when available, verifies every child
287+
workflow `headSha` matches the trusted workflow SHA, and deletes the temporary
288+
branch when the run completes. Pass `-f reuse_evidence=false` to force fresh
289+
validation. The umbrella verifier also fails if any child workflow ran at a
290+
different workflow SHA.
289291

290292
`release_profile` controls live/provider breadth passed into release checks. The
291293
manual release workflows default to `stable`; use `full` only when you

‎docs/reference/RELEASING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ This checklist is the public shape of the release flow. Private credentials, sig
168168
6. Run `OpenClaw NPM Release` with `preflight_only=true`. Before a tag exists, a full 40-character release-branch SHA is allowed for validation-only preflight. The preflight generates dependency release evidence for the exact checked-out dependency graph and stores it in the npm preflight artifact. Save the successful `preflight_run_id`.
169169
7. Kick off all pre-release tests with `Full Release Validation` for the release branch, tag, or full commit SHA. This is the one manual entrypoint for the four big release test boxes: Vitest, Docker, QA Lab, and Package. Save the `full_release_validation_run_id` and exact `full_release_validation_run_attempt`; both are required inputs for `OpenClaw NPM Release` and `OpenClaw Release Publish`.
170170
8. If validation fails, fix on the release branch and rerun the smallest failed file, lane, workflow job, package profile, provider, or model allowlist that proves the fix. Rerun the full umbrella only when the changed surface makes prior evidence stale.
171-
9. For a tagged beta candidate, run `pnpm release:candidate -- --tag vYYYY.M.PATCH-beta.N` from the matching `release/YYYY.M.PATCH` branch. For stable, also pass the required Windows source release: `pnpm release:candidate -- --tag vYYYY.M.PATCH --windows-node-tag vX.Y.Z`. The helper uses trusted `main` as the workflow source while each workflow targets the exact tag. Before it dispatches the full validation matrix, the helper deterministically renders the exact tag's GitHub release body and rejects a missing version heading, an over-limit body that cannot use the canonical compact form, or contribution-record base/target provenance that is not reachable from the tag. It also validates any explicit shipped-baseline exclusion metadata against the referenced cumulative tag records. It then runs the local generated-release checks, dispatches or verifies full release validation and npm preflight evidence, runs Parallels fresh/update proof against the exact prepared tarball plus Telegram package proof, records plugin npm and ClawHub plans, and prints the exact `OpenClaw Release Publish` command only after the evidence bundle is green.
171+
9. For a tagged beta candidate, run `pnpm release:candidate -- --tag vYYYY.M.PATCH-beta.N` from the matching `release/YYYY.M.PATCH` branch. For stable, also pass the required Windows source release: `pnpm release:candidate -- --tag vYYYY.M.PATCH --windows-node-tag vX.Y.Z`. The helper uses trusted `main` as the workflow source while each workflow targets the exact tag. It checkpoints immutable candidate/tooling identity and dispatched run IDs in `.artifacts/release-candidate/<tag>/release-candidate-state.json`; rerunning the same command resumes those exact runs, while any candidate, tooling, profile, or option drift fails closed. Before it dispatches the full validation matrix, the helper deterministically renders the exact tag's GitHub release body and rejects a missing version heading, an over-limit body that cannot use the canonical compact form, or contribution-record base/target provenance that is not reachable from the tag. It also validates any explicit shipped-baseline exclusion metadata against the referenced cumulative tag records. It then runs the local generated-release checks, dispatches or verifies full release validation and npm preflight evidence, runs Parallels fresh/update proof against the exact prepared tarball plus Telegram package proof, records plugin npm and ClawHub plans, and prints the exact `OpenClaw Release Publish` command only after the evidence bundle is green.
172172

173173
`OpenClaw Release Publish` dispatches the selected or all-publishable plugin packages to npm and the same set to ClawHub in parallel, then promotes the prepared OpenClaw npm preflight artifact with the matching dist-tag once plugin npm publish succeeds. The release checkout remains the product/data root, while planning and final verification execute from the exact trusted workflow-source checkout so an older release commit cannot silently use obsolete release tooling. Before any publish child starts, it renders and caches the exact GitHub release body. When the complete matching `CHANGELOG.md` section fits GitHub's 125,000-character limit and the renderer's matching 125,000-byte safety ceiling, the page contains that exact `## YYYY.M.PATCH` section including its heading. When the source section does not fit, the page keeps the exact grouped editorial notes and replaces the oversized contribution record with a stable link to the full record in the tag-pinned `CHANGELOG.md`; partial records and truncated bullets are never published. The workflow chooses that full or compact body before adding `### Release verification`; if the proof tail would exceed the limit, it keeps the canonical body and relies on the immutable attached evidence instead. Stable releases published to npm `latest` become the GitHub latest release, while stable maintenance releases kept on npm `beta` are created with GitHub `latest=false`. The workflow also uploads the preflight dependency evidence, the full-validation manifest, and postpublish registry verification evidence to the GitHub release for post-release incident response. It prints child run IDs immediately, auto-approves release environment gates the workflow token is allowed to approve, summarizes failed child jobs with log tails, creates the draft GitHub release page up front and promotes Windows and Android assets concurrently with the OpenClaw npm publish, closes out the release page and dependency evidence once those stages succeed, waits for ClawHub whenever OpenClaw npm is being published, then runs the trusted-main beta verifier and uploads postpublish evidence for the GitHub release, npm package, selected plugin npm packages, selected ClawHub packages, child workflow run IDs, and optional NPM Telegram run ID. The ClawHub bootstrap verifier requires the exact trusted-main workflow path and SHA, producer and terminal run attempts, release SHA, requested package set, immutable package artifact tuple, and terminal registry readback artifact; a successful legacy release-ref run is not accepted.
174174

@@ -280,7 +280,7 @@ A legacy fallback correction tag may reuse base-package evidence only when the c
280280
pnpm ci:full-release --sha <full-sha>
281281
```
282282

283-
The helper fetches current `origin/main`, pushes `release-ci/<workflow-sha>-...` at that trusted workflow commit, dispatches `Full Release Validation` from the temporary branch with `ref=<target-sha>` and `reuse_evidence=false`, verifies every child workflow `headSha` matches the pinned parent workflow SHA, then deletes the temporary branch. Pass `--workflow-sha <trusted-main-sha>` to pin an older commit that is still reachable from current `origin/main`. The workflow itself never writes repository refs. This keeps main-only release tooling available without adding tooling commits to the candidate and avoids proving a newer `main` child run by accident.
283+
The helper fetches current `origin/main`, pushes `release-ci/<workflow-sha>-...` at that trusted workflow commit, dispatches `Full Release Validation` from the temporary branch with `ref=<target-sha>`, reuses strict exact-target evidence when available, verifies every child workflow `headSha` matches the pinned parent workflow SHA, then deletes the temporary branch. Pass `-f reuse_evidence=false` to force a fresh run or `--workflow-sha <trusted-main-sha>` to pin an older commit that is still reachable from current `origin/main`. The workflow itself never writes repository refs. This keeps main-only release tooling available without adding tooling commits to the candidate and avoids proving a newer `main` child run by accident.
284284

285285
For release branch or tag validation, run it from the trusted `main` workflow ref and pass the release branch or tag as `ref`:
286286

‎docs/reference/full-release-validation.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ dispatches, the umbrella fails closed even when the child itself succeeds. For
3535
an immutable exact-commit proof, use
3636
`pnpm ci:full-release --sha <target-sha>`. The helper creates a temporary
3737
`release-ci/*` ref pinned to current trusted `origin/main`, passes the target
38-
SHA only as the candidate `ref`, disables evidence reuse, and deletes the ref
39-
after validation. Pass `--workflow-sha <trusted-main-sha>` to select an older
40-
workflow commit still reachable from current `origin/main`. The workflow never
41-
creates or updates repository refs itself.
38+
SHA only as the candidate `ref`, reuses strict exact-target evidence when
39+
available, and deletes the ref after validation. Pass
40+
`-f reuse_evidence=false` to force a fresh run or
41+
`--workflow-sha <trusted-main-sha>` to select an older workflow commit still
42+
reachable from current `origin/main`. The workflow never creates or updates
43+
repository refs itself.
4244

4345
`release_profile=stable` and `release_profile=full` always run the exhaustive
4446
live/Docker soak. Pass `run_release_soak=true` to include the same soak lanes
@@ -68,8 +70,9 @@ re-checks the immutable parent artifact, child runs, and dispatch logs. This is
6870
same-candidate rerun recovery only; it does not authorize cross-SHA reuse. For
6971
a changed candidate, rerun every package, artifact, install, Docker, or provider
7072
gate affected by that delta. Pass `reuse_evidence=false` to force a fresh full
71-
run. Evidence reuse runs only when the umbrella itself was dispatched from
72-
`main`; non-main workflow refs run the selected lanes fresh.
73+
run. Evidence reuse runs only from `main` or a canonical SHA-pinned
74+
`release-ci/*` ref whose workflow commit remains on trusted `main` lineage;
75+
other workflow refs run the selected lanes fresh.
7376

7477
Also for `rerun_group=all`, a `Verify Docker runtime image assets` job builds
7578
the `runtime-assets` Docker target with

0 commit comments

Comments
 (0)