Skip to content

Commit 4b29c1f

Browse files
committed
fix(release): keep polling before decision artifacts exist
Handle GitHub's current missing-artifact message without abandoning active full validation, while preserving early blocker decisions. Covers #129104.
1 parent 0497cd9 commit 4b29c1f

3 files changed

Lines changed: 97 additions & 13 deletions

File tree

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ the artifacts and may differ when only one collector needed a retry.
6868
The helper creates a temporary `release-ci/*` ref pinned to the Tooling SHA,
6969
passes the Validation SHA as both the candidate ref and `expected_sha`, and
7070
deletes the temporary ref after successful validation and strict evidence
71-
verification. If Release Decision reports a blocker while Diagnostic Drain is
72-
still collecting failures, the helper exits nonzero immediately and keeps both
73-
temporary refs for reruns and diagnosis. The Validation SHA equals the Code
74-
SHA for product validation or the Release SHA for changelog-only validation; it
75-
is not a third release identity. The workflow rejects malformed or mismatched
76-
expected SHAs before child dispatch. Every child must report the same Tooling
77-
SHA. Pass
71+
verification. The helper reads Release Decision artifacts while the parent is
72+
active so blockers can surface while Diagnostic Drain collects failures. A
73+
not-yet-created artifact remains an unavailable polling result; terminal
74+
handling and temporary-ref cleanup wait for the parent to complete with a
75+
conclusion. Failed validations retain both refs for reruns and diagnosis. The
76+
Validation SHA equals the Code SHA for product validation or the Release SHA
77+
for changelog-only validation; it is not a third release identity. The workflow
78+
rejects malformed or mismatched expected SHAs before child dispatch. Every
79+
child must report the same Tooling SHA. Pass
7880
`-f reuse_evidence=false` to force a fresh run. Regular release-branch runs
7981
require `--workflow-sha` with the recorded full SHA, which must remain reachable
8082
from current `origin/main`. The helper rejects a pinned Tooling SHA that does

‎scripts/full-release-validation-at-sha.mts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,9 @@ export function tryReadReleaseDecision(
627627
if (result.status !== 0) {
628628
const stderr = stringValue(result.stderr);
629629
if (
630-
/no valid artifacts found|artifact .* not found|could not find any artifacts/iu.test(stderr)
630+
/no valid artifacts found|artifact .* not found|could not find any artifacts|no artifact matches any of the names or patterns provided/iu.test(
631+
stderr,
632+
)
631633
) {
632634
return undefined;
633635
}
@@ -716,7 +718,7 @@ function waitForWorkflowRun(parentRunId: string, workflowSha: string) {
716718
);
717719
}
718720
}
719-
if (suite?.status === "completed") {
721+
if (suite?.status === "completed" && stringValue(suite.conclusion)) {
720722
if (suite.conclusion === "success") {
721723
return suite;
722724
}

‎test/scripts/full-release-validation-at-sha.test.ts‎

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,30 @@ function runGit(cwd: string, args: string[]): string {
5353
}).trim();
5454
}
5555

56-
function createDispatchFixture(options: { workflowSource?: string } = {}) {
56+
function createDispatchFixture(
57+
options: {
58+
parentRunStates?: Array<{ conclusion: string | null; status: string }>;
59+
workflowSource?: string;
60+
} = {},
61+
) {
5762
const root = mkdtempSync(join(tmpdir(), "openclaw-release-dispatch-"));
5863
const origin = join(root, "origin.git");
5964
const checkout = join(root, "checkout");
6065
const binDir = join(root, "bin");
6166
const gitCallsPath = join(root, "git-calls.jsonl");
6267
const ghCallsPath = join(root, "gh-calls.jsonl");
68+
const parentRunIndexPath = join(root, "parent-run-index.txt");
69+
const preloadPath = join(root, "immediate-poll.mjs");
6370
const releaseRef = "release/2026.8.1";
6471
mkdirSync(checkout);
6572
mkdirSync(binDir);
6673
writeFileSync(gitCallsPath, "");
6774
writeFileSync(ghCallsPath, "");
75+
writeFileSync(parentRunIndexPath, "0");
76+
writeFileSync(
77+
preloadPath,
78+
'const wait = Atomics.wait; Atomics.wait = (array, index, value, timeout) => timeout === undefined ? wait(array, index, value) : "timed-out";\n',
79+
);
6880

6981
execFileSync("git", ["init", "--bare", origin], { stdio: "ignore" });
7082
execFileSync("git", ["init", "-b", "main"], { cwd: checkout, stdio: "ignore" });
@@ -149,6 +161,8 @@ process.exit(result.status ?? 1);
149161
const fs = require("node:fs");
150162
const args = process.argv.slice(2);
151163
fs.appendFileSync(process.env.MOCK_GH_CALLS, JSON.stringify(args) + "\\n");
164+
const parentRunStates = ${JSON.stringify(options.parentRunStates ?? [{ conclusion: "success", status: "completed" }])};
165+
const parentRunIndexPath = ${JSON.stringify(parentRunIndexPath)};
152166
if (args[0] === "workflow" && args[1] === "run") {
153167
const declaredInputs = new Set(JSON.parse(process.env.MOCK_WORKFLOW_INPUTS));
154168
for (let index = 0; index < args.length; index += 1) {
@@ -163,9 +177,13 @@ if (args[0] === "workflow" && args[1] === "run") {
163177
}
164178
console.log("https://github.com/openclaw/openclaw/actions/runs/123");
165179
} else if (args[0] === "api" && args.at(-1).endsWith("/actions/runs/123")) {
166-
console.log(JSON.stringify({ status: "completed", conclusion: "success", head_sha: process.env.MOCK_WORKFLOW_SHA, run_attempt: 1 }));
180+
const index = Number(fs.readFileSync(parentRunIndexPath, "utf8"));
181+
const state = parentRunStates[Math.min(index, parentRunStates.length - 1)];
182+
fs.writeFileSync(parentRunIndexPath, String(index + 1));
183+
console.log(JSON.stringify({ ...state, head_sha: process.env.MOCK_WORKFLOW_SHA, run_attempt: 1 }));
167184
} else if (args[0] === "run" && args[1] === "download") {
168-
console.error("no valid artifacts found");
185+
const index = Number(fs.readFileSync(parentRunIndexPath, "utf8")) - 1;
186+
console.error(parentRunStates[index]?.status === "queued" ? "no artifact matches any of the names or patterns provided" : "no valid artifacts found");
169187
process.exit(1);
170188
} else {
171189
console.error("unexpected gh call: " + args.join(" "));
@@ -189,6 +207,13 @@ if (args[0] === "workflow" && args[1] === "run") {
189207
encoding: "utf8",
190208
env: {
191209
...process.env,
210+
...(options.parentRunStates
211+
? {
212+
NODE_OPTIONS: [process.env.NODE_OPTIONS, "--import", preloadPath]
213+
.filter(Boolean)
214+
.join(" "),
215+
}
216+
: {}),
192217
MOCK_GH_CALLS: ghCallsPath,
193218
MOCK_GIT_CALLS: gitCallsPath,
194219
MOCK_REAL_PATH: process.env.PATH,
@@ -573,7 +598,7 @@ describe("full-release-validation-at-sha", () => {
573598
expect(source).not.toContain("attempt < 480");
574599
});
575600

576-
it("binds early release decisions to the exact parent attempt and tooling SHA", () => {
601+
it("binds release decisions to the exact parent attempt and tooling SHA", () => {
577602
const payload = {
578603
kind: "openclaw.full-release-decision",
579604
mode: "decision",
@@ -827,6 +852,61 @@ describe("full-release-validation-at-sha", () => {
827852
}
828853
});
829854

855+
it("retries an absent decision artifact through a parent status regression", () => {
856+
const fixture = createDispatchFixture({
857+
parentRunStates: [
858+
{ conclusion: null, status: "in_progress" },
859+
{ conclusion: null, status: "queued" },
860+
{ conclusion: null, status: "in_progress" },
861+
{ conclusion: "success", status: "completed" },
862+
],
863+
});
864+
try {
865+
const result = fixture.run(["--workflow-sha", fixture.workflowSha]);
866+
expect(result.status, result.stderr).toBe(0);
867+
const calls = fixture.readCalls(fixture.ghCallsPath);
868+
const parentPolls = calls
869+
.map((args, index) => ({ args, index }))
870+
.filter(({ args }) => args[0] === "api" && args[1]?.endsWith("/actions/runs/123"));
871+
const artifactDownloads = calls
872+
.map((args, index) => ({ args, index }))
873+
.filter(({ args }) => args[0] === "run" && args[1] === "download");
874+
expect(parentPolls).toHaveLength(4);
875+
expect(artifactDownloads).toHaveLength(4);
876+
expect(artifactDownloads[1]?.index).toBeGreaterThan(parentPolls[1]?.index ?? Infinity);
877+
expect(artifactDownloads[1]?.index).toBeLessThan(parentPolls[2]?.index ?? -Infinity);
878+
expect(result.stdout).toContain("Parent run status: queued/pending");
879+
expect(runGit(fixture.origin, ["for-each-ref", "--format=%(refname)", "refs/heads"])).toBe(
880+
"refs/heads/main\nrefs/heads/release/2026.8.1",
881+
);
882+
} finally {
883+
fixture.cleanup();
884+
}
885+
});
886+
887+
it("waits for a terminal conclusion across every nonterminal parent state", () => {
888+
const fixture = createDispatchFixture({
889+
parentRunStates: [
890+
{ conclusion: null, status: "requested" },
891+
{ conclusion: null, status: "waiting" },
892+
{ conclusion: null, status: "pending" },
893+
{ conclusion: null, status: "completed" },
894+
{ conclusion: "success", status: "completed" },
895+
],
896+
});
897+
try {
898+
const result = fixture.run(["--workflow-sha", fixture.workflowSha]);
899+
expect(result.status, result.stderr).toBe(0);
900+
const calls = fixture.readCalls(fixture.ghCallsPath);
901+
expect(
902+
calls.filter((args) => args[0] === "api" && args[1]?.endsWith("/actions/runs/123")),
903+
).toHaveLength(5);
904+
expect(calls.filter((args) => args[0] === "run" && args[1] === "download")).toHaveLength(5);
905+
} finally {
906+
fixture.cleanup();
907+
}
908+
});
909+
830910
it("dispatches non-main tooling only when its exact protected tag is supplied", () => {
831911
const fixture = createDispatchFixture();
832912
try {

0 commit comments

Comments
 (0)