Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

chore(release): shard verification tests and report release progress (#1798)

Michael D'Angelo2b8a96907c0b
diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml
index 408a59732..971ef0a01 100644
--- a/.github/actionlint.yaml
+++ b/.github/actionlint.yaml
@@ -1,5 +1,5 @@
paths:
- .github/workflows/{container-release,node-github-release,node-release-cut,node-release}.yml:
+ .github/workflows/{container-release,node-github-release,node-release-cut,node-release,release-progress}.yml:
ignore:
# actionlint 1.7.12 predates GitHub's queue: max support. Keep release queuing.
# https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency
diff --git a/.github/scripts/release-progress.mjs b/.github/scripts/release-progress.mjs
new file mode 100644
index 000000000..e150803ba
--- /dev/null
+++ b/.github/scripts/release-progress.mjs
@@ -0,0 +1,399 @@
+import { appendFile } from "node:fs/promises";
+import { setTimeout } from "node:timers/promises";
+import {
+ createGitHubClient,
+ createGitRepository,
+ readVersionHistory,
+} from "../../sdk/typescript/scripts/release-pr.mjs";
+import { isMain } from "../../sdk/typescript/scripts/is-main.mjs";
+
+const marker = "<!-- codex-security-release-progress -->";
+const workflows = ["node-ci", "node-release", "node-github-release"];
+
+function status(value) {
+ if (!value) return "Not started";
+ const current = value.conclusion ?? value.status;
+ return (
+ {
+ success: "Passed",
+ failure: "Failed",
+ cancelled: "Cancelled",
+ timed_out: "Timed out",
+ action_required: "Needs attention",
+ skipped: "Skipped",
+ neutral: "Neutral",
+ waiting: "Waiting for approval",
+ queued: "Queued",
+ pending: "Queued",
+ requested: "Queued",
+ in_progress: "Running",
+ }[current] ?? current
+ );
+}
+
+function jobStatus(jobs, run) {
+ const failed = jobs.find((job) =>
+ ["failure", "cancelled", "timed_out", "action_required"].includes(
+ job.conclusion,
+ ),
+ );
+ if (failed) return status(failed);
+ if (jobs.length === 0)
+ return run?.status === "completed" ? "Not reached" : "Not started";
+ const unfinished = jobs.find((job) => job.status !== "completed");
+ if (unfinished) return status(unfinished);
+ return jobs.every((job) => job.conclusion === "skipped")
+ ? "Skipped"
+ : "Passed";
+}
+
+export function renderProgress(
+ runs,
+ jobs,
+ awaitingApproval,
+ awaitingContainerApproval = false,
+) {
+ const ci = runs["node-ci"];
+ const npm = runs["node-release"];
+ const github = runs["node-github-release"];
+ const npmJobs = jobs["node-release"] ?? [];
+ const githubJobs = jobs["node-github-release"] ?? [];
+ const row = (name, state, run, unrecorded = false) =>
+ `| ${name} | ${unrecorded ? "Not recorded" : state} | ${run ? `[View run](${run.html_url})` : "—"} |`;
+ const verification = npmJobs.filter(
+ (job) =>
+ job.name === "verify" ||
+ job.name.startsWith("native /") ||
+ job.name.startsWith("release tests /"),
+ );
+ const publisher = npmJobs.find((job) => job.name === "publish");
+ const verified = jobStatus(verification, npm);
+ const actionPublisher = githubJobs.find(
+ (job) => job.name === "publish matching Action",
+ );
+ const actionVerifier = githubJobs.find(
+ (job) => job.name === "verify matching Action",
+ );
+ const containerJobs = githubJobs.filter(
+ (job) =>
+ job.name === "publish matching container" ||
+ job.name.startsWith("publish matching container /"),
+ );
+ const containerState = jobStatus(containerJobs, github);
+ const containerFinished =
+ github?.conclusion === "success" ||
+ containerJobs.some(
+ (job) =>
+ job.name ===
+ "publish matching container / promote-verified-and-attested-release" &&
+ job.status === "completed",
+ );
+ const complete = github?.conclusion === "success";
+ return [
+ marker,
+ `<!-- release-progress-runs: ${JSON.stringify(
+ Object.fromEntries(
+ Object.entries(runs).map(([name, run]) => [name, run.id]),
+ ),
+ )} -->`,
+ complete ? "## Automated release complete" : "## Release progress",
+ "",
+ "| Stage | Status | Details |",
+ "| --- | --- | --- |",
+ row("Post-merge CI", status(ci), ci, !ci && Boolean(npm || github)),
+ row("npm release status", status(npm), npm, !npm && Boolean(github)),
+ row(
+ "Release verification",
+ verified === "Passed" && !publisher && !awaitingApproval
+ ? status(npm)
+ : verified,
+ npm,
+ !npm && Boolean(github),
+ ),
+ row(
+ "Protected npm publication",
+ awaitingApproval ? "Waiting for npm approval" : status(publisher),
+ npm,
+ !npm && Boolean(github),
+ ),
+ row(
+ "Start GitHub publication",
+ status(npmJobs.find((job) => job.name === "dispatch GitHub release")),
+ npm,
+ !npm && Boolean(github),
+ ),
+ row(
+ "Public npm package and provenance",
+ jobStatus(
+ githubJobs.filter(
+ (job) => job.name === "publish verified GitHub release",
+ ),
+ github,
+ ),
+ github,
+ ),
+ row(
+ "Published installation checks",
+ jobStatus(
+ githubJobs.filter((job) =>
+ job.name.startsWith("verify published installation /"),
+ ),
+ github,
+ ),
+ github,
+ ),
+ row(
+ "GitHub Action",
+ actionVerifier?.conclusion &&
+ !["success", "skipped"].includes(actionVerifier.conclusion)
+ ? status(actionVerifier)
+ : actionPublisher
+ ? status(actionPublisher)
+ : actionVerifier?.conclusion === "success"
+ ? github.status === "completed"
+ ? "Not reached"
+ : "Waiting to publish"
+ : status(actionVerifier),
+ github,
+ ),
+ row(
+ "Container image",
+ awaitingContainerApproval
+ ? "Waiting for container approval"
+ : containerState === "Passed" && !containerFinished
+ ? github?.status === "completed"
+ ? "Not reached"
+ : "Running"
+ : containerState,
+ github,
+ ),
+ row(
+ "Final release status",
+ status(
+ github?.status === "completed"
+ ? github
+ : (githubJobs.find((job) => job.name === "release status") ?? github),
+ ),
+ github,
+ ),
+ "",
+ awaitingApproval
+ ? "Approve the protected **npm** deployment in the linked release run."
+ : awaitingContainerApproval
+ ? "Approve the protected **container** deployment in the linked release run."
+ : "Progress updates do not change publication approvals or verification requirements.",
+ "GitHub Marketplace publication is a separate manual step.",
+ ].join("\n");
+}
+
+function workflowName(run) {
+ const path = run.path?.split("@", 1)[0];
+ return workflows.find((name) => path === `.github/workflows/${name}.yml`);
+}
+
+async function releaseCommit(github, run) {
+ const name = workflowName(run);
+ if (!name) return null;
+ if (name === "node-ci") {
+ return run.event === "push" && run.head_branch === "main"
+ ? run.head_sha
+ : null;
+ }
+ if (name === "node-release")
+ return ["push", "workflow_dispatch"].includes(run.event) &&
+ /^npm-v\d+\.\d+\.\d+$/u.test(run.head_branch)
+ ? run.head_sha
+ : null;
+ if (run.event !== "workflow_dispatch" || run.head_branch !== "main")
+ return null;
+ const tag = /^Publish (npm-v\d+\.\d+\.\d+)$/u.exec(run.display_title)?.[1];
+ if (!tag) return null;
+ const ref = await github.request("GET", `git/ref/tags/${tag}`);
+ return ref.object.type === "tag"
+ ? (await github.request("GET", `git/tags/${ref.object.sha}`)).object.sha
+ : ref.object.sha;
+}
+
+async function runJobs(github, id) {
+ const jobs = [];
+ for (let page = 1; ; page += 1) {
+ const result = await github.request(
+ "GET",
+ `actions/runs/${id}/jobs?filter=latest&per_page=100&page=${page}`,
+ );
+ jobs.push(...result.jobs);
+ if (jobs.length >= result.total_count) return jobs;
+ }
+}
+
+async function awaitingEnvironment(github, run, environment) {
+ if (!run || run.status === "completed") return false;
+ const deployments = await github.request(
+ "GET",
+ `actions/runs/${run.id}/pending_deployments`,
+ );
+ return deployments.some(
+ (deployment) => deployment.environment.name === environment,
+ );
+}
+
+export async function updateReleaseProgress(
+ github,
+ runId,
+ repo = createGitRepository(process.cwd()),
+) {
+ const incoming = await github.request("GET", `actions/runs/${runId}`);
+ const sha = await releaseCommit(github, incoming);
+ if (!sha) return { action: "ignored" };
+ const name = workflowName(incoming);
+ const version = (
+ name === "node-release" ? incoming.head_branch : incoming.display_title
+ )?.match(/npm-v(\d+\.\d+\.\d+)$/u)?.[1];
+ const findPull = async (commit) => {
+ const pulls = await github.list(`commits/${commit}/pulls?per_page=100`);
+ // The commit endpoint supplies the association; API 2026-03-10 omits merge_commit_sha.
+ return pulls.find((candidate) => {
+ const candidateVersion =
+ /^(?:chore\(release\)|release(?:\([^)]+\))?)!?: (\d+\.\d+\.\d+)$/u.exec(
+ candidate.title,
+ )?.[1];
+ return (
+ candidate.merged_at &&
+ candidate.base.ref === "main" &&
+ candidateVersion &&
+ (!version || candidateVersion === version)
+ );
+ });
+ };
+ let pull = await findPull(sha);
+ if (!pull && name !== "node-ci") {
+ // A successful follow-up fix can be tagged after the version bump fails CI.
+ const { baseVersion, baseCommit } = readVersionHistory(repo, sha);
+ if (baseVersion === version && baseCommit !== sha)
+ pull = await findPull(baseCommit);
+ }
+ if (!pull) return { action: "ignored" };
+ const comments = await github.list(
+ `issues/${pull.number}/comments?per_page=100`,
+ );
+ const previous = comments.find(
+ (comment) =>
+ comment.user?.login === "github-actions[bot]" &&
+ comment.body?.startsWith(marker),
+ );
+ const saved = previous?.body.match(
+ /<!-- release-progress-runs: (.+) -->/u,
+ )?.[1];
+ const ids = saved ? JSON.parse(saved) : {};
+ const runs = {};
+ for (const name of workflows) {
+ if (!ids[name]) continue;
+ try {
+ runs[name] = await github.request("GET", `actions/runs/${ids[name]}`);
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ }
+ }
+ if (name === "node-ci") {
+ const releasedSha =
+ runs["node-release"]?.head_sha ??
+ (runs["node-github-release"] &&
+ (await releaseCommit(github, runs["node-github-release"])));
+ if (releasedSha && releasedSha !== sha) return { action: "ignored" };
+ }
+ // A recovered release uses the tagged fix, not the original failed bump CI.
+ if (name !== "node-ci" && runs["node-ci"]?.head_sha !== sha)
+ delete runs["node-ci"];
+ const last = runs[name];
+ // Serialized release runs keep their active approval ahead of queued duplicates.
+ const prioritizeActive = name !== "node-ci" && incoming.id !== last?.id;
+ const active = (run) =>
+ prioritizeActive && ["in_progress", "waiting"].includes(run?.status);
+ if (
+ !last ||
+ (active(incoming) && !active(last)) ||
+ (active(incoming) === active(last) &&
+ ((incoming.run_started_at ?? incoming.created_at) >
+ (last.run_started_at ?? last.created_at) ||
+ ((incoming.run_started_at ?? incoming.created_at) ===
+ (last.run_started_at ?? last.created_at) &&
+ incoming.id >= last.id)))
+ )
+ runs[name] = incoming;
+ const jobs = Object.fromEntries(
+ await Promise.all(
+ Object.entries(runs).map(async ([name, run]) => [
+ name,
+ await runJobs(github, run.id),
+ ]),
+ ),
+ );
+ const [awaitingNpm, awaitingContainer] = await Promise.all([
+ awaitingEnvironment(github, runs["node-release"], "npm"),
+ awaitingEnvironment(github, runs["node-github-release"], "container"),
+ ]);
+ const body = renderProgress(runs, jobs, awaitingNpm, awaitingContainer);
+ if (previous?.body === body)
+ return { action: "unchanged", pull: pull.number };
+ await github.request(
+ previous ? "PATCH" : "POST",
+ previous
+ ? `issues/comments/${previous.id}`
+ : `issues/${pull.number}/comments`,
+ { body },
+ );
+ return { action: previous ? "updated" : "created", pull: pull.number };
+}
+
+export async function watchReleaseProgress(github, runId, wait = setTimeout) {
+ let previous;
+ for (;;) {
+ const run = await github.request("GET", `actions/runs/${runId}`);
+ const name = workflowName(run);
+ if (name === "node-ci" || !(await releaseCommit(github, run))) return;
+ const jobs = await runJobs(github, run.id);
+ const awaitingApproval = await awaitingEnvironment(
+ github,
+ run,
+ name === "node-release" ? "npm" : "container",
+ );
+ const current = renderProgress(
+ { [name]: run },
+ { [name]: jobs },
+ name === "node-release" && awaitingApproval,
+ name === "node-github-release" && awaitingApproval,
+ );
+ if (current !== previous) {
+ await github.request(
+ "POST",
+ "actions/workflows/release-progress.yml/dispatches",
+ {
+ ref: "main",
+ inputs: { "run-id": String(run.id) },
+ },
+ );
+ }
+ if (run.status === "completed") return;
+ previous = current;
+ await wait(30_000);
+ }
+}
+
+if (isMain(import.meta.url)) {
+ const github = createGitHubClient(
+ process.env.GITHUB_REPOSITORY,
+ process.env.GH_TOKEN,
+ );
+ if (process.env.RELEASE_PROGRESS_WATCH === "true") {
+ await watchReleaseProgress(github, process.env.RELEASE_RUN_ID);
+ } else {
+ const result = await updateReleaseProgress(
+ github,
+ process.env.RELEASE_RUN_ID,
+ );
+ console.log(JSON.stringify(result));
+ if (result.pull && process.env.GITHUB_OUTPUT) {
+ await appendFile(process.env.GITHUB_OUTPUT, `pull=${result.pull}\n`);
+ }
+ }
+}
diff --git a/.github/scripts/test_release_progress.mjs b/.github/scripts/test_release_progress.mjs
new file mode 100644
index 000000000..3c39db394
--- /dev/null
+++ b/.github/scripts/test_release_progress.mjs
@@ -0,0 +1,801 @@
+import assert from "node:assert/strict";
+import { test } from "node:test";
+import { execFileSync } from "node:child_process";
+import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { createGitRepository } from "../../sdk/typescript/scripts/release-pr.mjs";
+import {
+ renderProgress,
+ updateReleaseProgress,
+ watchReleaseProgress,
+} from "./release-progress.mjs";
+const sha = "a".repeat(40);
+const automationSha = "b".repeat(40);
+const marker = "<!-- codex-security-release-progress -->";
+const pull = {
+ number: 42,
+ title: "chore(release): 99.1.2",
+ merged_at: "2026-01-01T00:00:00Z",
+ base: { ref: "main" },
+};
+
+function run(id, name, extra = {}) {
+ return {
+ id,
+ name: name === "node-github-release" ? "Publish npm-v99.1.2" : name,
+ path: `.github/workflows/${name}.yml`,
+ head_sha: sha,
+ head_branch: name === "node-release" ? "npm-v99.1.2" : "main",
+ event: name === "node-ci" ? "push" : "workflow_dispatch",
+ display_title:
+ name === "node-github-release" ? "Publish npm-v99.1.2" : name,
+ html_url: `https://github.com/example/security-tool/actions/runs/${id}`,
+ created_at: `2026-01-01T00:${String(id).padStart(2, "0")}:00Z`,
+ status: "in_progress",
+ conclusion: null,
+ ...extra,
+ };
+}
+
+function job(name, conclusion = "success") {
+ return {
+ name,
+ status: conclusion ? "completed" : "in_progress",
+ conclusion,
+ };
+}
+
+function fixture(repo) {
+ const runs = new Map();
+ const jobs = new Map();
+ const deployments = new Map();
+ const errors = new Map();
+ const comments = [];
+ const requests = [];
+ const pulls = [structuredClone(pull)];
+ const commitPulls = new Map([[sha, pulls]]);
+ let tagCommit = sha;
+ let annotated = false;
+ const github = {
+ async list(path) {
+ requests.push({ method: "GET", path });
+ const commit = /^commits\/([0-9a-f]+)\/pulls\?per_page=100$/u.exec(
+ path,
+ )?.[1];
+ if (commit) return commitPulls.get(commit) ?? [];
+ if (path === "issues/42/comments?per_page=100") return comments;
+ throw new Error(`Unexpected list: ${path}`);
+ },
+ async request(method, path, body) {
+ requests.push({ method, path, body });
+ if (errors.has(path)) throw errors.get(path);
+ if (
+ method === "POST" &&
+ path === "actions/workflows/release-progress.yml/dispatches"
+ )
+ return;
+ if (method === "POST" && path === "issues/42/comments") {
+ comments.push({
+ id: 101,
+ user: { login: "github-actions[bot]" },
+ ...body,
+ });
+ return comments.at(-1);
+ }
+ if (method === "PATCH" && path === "issues/comments/101") {
+ Object.assign(
+ comments.find((comment) => comment.id === 101),
+ body,
+ );
+ return comments.find((comment) => comment.id === 101);
+ }
+ assert.equal(method, "GET");
+ if (path === "git/ref/tags/npm-v99.1.2")
+ return {
+ object: {
+ type: annotated ? "tag" : "commit",
+ sha: annotated ? "tag-object" : tagCommit,
+ },
+ };
+ if (path === "git/tags/tag-object") return { object: { sha: tagCommit } };
+ const match = /^actions\/runs\/(\d+)(.*)$/u.exec(path);
+ assert.ok(match, `Unexpected request: ${path}`);
+ const id = Number(match[1]);
+ if (!match[2]) {
+ assert.ok(runs.has(id), `Missing fixture run ${id}`);
+ return structuredClone(runs.get(id));
+ }
+ if (match[2] === "/pending_deployments") return deployments.get(id) ?? [];
+ const page = /^\/jobs\?filter=latest&per_page=100&page=(\d+)$/u.exec(
+ match[2],
+ );
+ assert.ok(page, `Unexpected request: ${path}`);
+ const all = jobs.get(id) ?? [];
+ const start = (Number(page[1]) - 1) * 100;
+ return { total_count: all.length, jobs: all.slice(start, start + 100) };
+ },
+ };
+ return {
+ runs,
+ jobs,
+ deployments,
+ errors,
+ comments,
+ requests,
+ pulls,
+ commitPulls,
+ tag(commit) {
+ tagCommit = commit;
+ },
+ annotate() {
+ annotated = true;
+ },
+ update: (id) => updateReleaseProgress(github, id, repo),
+ watch: (id, wait) => watchReleaseProgress(github, id, wait),
+ writes: () => requests.filter((request) => request.method !== "GET"),
+ body: () => comments.find((comment) => comment.id === 101)?.body,
+ };
+}
+
+test("ignores pull-request CI and unrelated or unmerged commits", async () => {
+ for (const scenario of [
+ "pull-request",
+ "ordinary",
+ "release-maintenance",
+ "unmerged",
+ "unassociated",
+ ]) {
+ const f = fixture();
+ f.runs.set(1, run(1, "node-ci"));
+ if (scenario === "pull-request") f.runs.get(1).event = "pull_request";
+ if (scenario === "ordinary") f.pulls[0].title = "fix: improve reporting";
+ if (scenario === "release-maintenance")
+ f.pulls[0].title = "chore(release): improve automation";
+ if (scenario === "unmerged") f.pulls[0].merged_at = null;
+ if (scenario === "unassociated") f.pulls.length = 0;
+ assert.equal((await f.update(1)).action, "ignored");
+ assert.equal(f.writes().length, 0);
+ }
+});
+
+test("accepts stable version-bump titles with breaking-change markers", async () => {
+ for (const title of [
+ "chore(release)!: 99.1.2",
+ "release!: 99.1.2",
+ "release(npm): 99.1.2",
+ ]) {
+ const f = fixture();
+ f.pulls[0].title = title;
+ f.runs.set(1, run(1, "node-ci"));
+ assert.equal((await f.update(1)).action, "created");
+ }
+});
+
+test("recognizes ref-qualified workflow paths for progress and observation", async () => {
+ for (const workflow of ["node-ci", "node-release", "node-github-release"]) {
+ const f = fixture();
+ const input = run(1, workflow, {
+ status: "completed",
+ conclusion: "failure",
+ });
+ input.path += `@${input.head_branch}`;
+ f.runs.set(1, input);
+ assert.equal((await f.update(1)).action, "created");
+ assert.ok(f.body().includes(`"${workflow}":1`));
+ await f.watch(1, () => assert.fail("must not poll a completed run"));
+ assert.equal(
+ f.requests.filter(({ path }) => path.endsWith("/dispatches")).length,
+ workflow === "node-ci" ? 0 : 1,
+ );
+ }
+});
+
+test("queued or cancelled duplicates cannot hide an active protected approval", async () => {
+ for (const [workflow, environment, jobName] of [
+ ["node-release", "npm", "verify"],
+ ["node-github-release", "container", "publish matching container / source"],
+ ]) {
+ for (const [queuedState, queuedArrivesFirst] of [
+ ["queued", false],
+ ["queued", true],
+ ["pending", false],
+ ["pending", true],
+ ]) {
+ const f = fixture();
+ f.runs.set(
+ 1,
+ run(1, workflow, {
+ status: environment === "npm" ? "waiting" : "in_progress",
+ }),
+ );
+ f.runs.set(
+ 2,
+ run(2, workflow, {
+ status: queuedState,
+ ...(queuedArrivesFirst
+ ? { run_started_at: "2026-01-01T00:03:00Z" }
+ : {}),
+ }),
+ );
+ f.jobs.set(1, [job(jobName)]);
+ f.deployments.set(1, [{ environment: { name: environment } }]);
+ if (queuedArrivesFirst) await f.update(2);
+ await f.update(1);
+ await f.update(2);
+ assert.match(
+ f.body(),
+ new RegExp(`Waiting for ${environment} approval`, "u"),
+ );
+ assert.ok(f.body().includes(`"${workflow}":1`));
+ assert.ok(
+ f
+ .body()
+ .includes(
+ "[View run](https://github.com/example/security-tool/actions/runs/1)",
+ ),
+ );
+ Object.assign(f.runs.get(2), {
+ status: "completed",
+ conclusion: "cancelled",
+ });
+ await f.update(2);
+ assert.ok(f.body().includes(`"${workflow}":1`));
+ Object.assign(f.runs.get(1), {
+ status: "completed",
+ conclusion: "success",
+ });
+ f.deployments.set(1, []);
+ Object.assign(f.runs.get(2), { status: "in_progress", conclusion: null });
+ f.jobs.set(2, [job(jobName, null)]);
+ await f.update(2);
+ assert.ok(f.body().includes(`"${workflow}":2`));
+ }
+ }
+});
+
+test("a new attempt of an older run supersedes a newer cancelled run", async () => {
+ const f = fixture();
+ f.runs.set(
+ 1,
+ run(1, "node-release", { status: "completed", conclusion: "failure" }),
+ );
+ f.runs.set(
+ 2,
+ run(2, "node-release", { status: "completed", conclusion: "cancelled" }),
+ );
+ await f.update(2);
+ Object.assign(f.runs.get(1), {
+ run_attempt: 2,
+ run_started_at: "2026-01-01T00:03:00Z",
+ status: "completed",
+ conclusion: "success",
+ });
+ f.jobs.set(1, [job("verify"), job("publish")]);
+ await f.update(1);
+ assert.match(f.body(), /"node-release":1/u);
+ assert.match(f.body(), /Protected npm publication \| Passed/u);
+ await f.update(2);
+ assert.match(f.body(), /"node-release":1/u);
+});
+
+test("successful verified recovery completes despite a failed npm retry", async () => {
+ const f = fixture();
+ f.runs.set(
+ 2,
+ run(2, "node-release", { status: "completed", conclusion: "failure" }),
+ );
+ f.jobs.set(2, [job("verify", "failure")]);
+ await f.update(2);
+ f.runs.set(
+ 3,
+ run(3, "node-github-release", {
+ status: "completed",
+ conclusion: "success",
+ }),
+ );
+ f.jobs.set(3, [job("release status")]);
+ await f.update(3);
+ assert.match(f.body(), /## Automated release complete/u);
+ assert.match(f.body(), /Release verification \| Failed/u);
+});
+
+test("completed prerequisites do not claim that later checks or Action publication passed", () => {
+ const body = renderProgress(
+ {
+ "node-release": run(2, "node-release"),
+ "node-github-release": run(3, "node-github-release"),
+ },
+ {
+ "node-release": [job("native / bundle")],
+ "node-github-release": [
+ job("verify matching Action"),
+ job("publish matching container / source"),
+ ],
+ },
+ false,
+ );
+ assert.match(body, /Release verification \| Running/u);
+ assert.match(body, /GitHub Action \| Waiting to publish/u);
+ assert.match(body, /Container image \| Running/u);
+});
+
+test("observer follows protected approval through completion without workflow events", async () => {
+ const f = fixture();
+ f.runs.set(2, run(2, "node-release"));
+ f.jobs.set(2, [job("verify", null)]);
+ let waits = 0;
+ await f.watch(2, async (milliseconds) => {
+ assert.equal(milliseconds, 30_000);
+ waits += 1;
+ if (waits === 2) {
+ f.jobs.set(2, [job("verify")]);
+ f.deployments.set(2, [{ environment: { name: "npm" } }]);
+ }
+ if (waits === 4) {
+ f.deployments.set(2, []);
+ Object.assign(f.runs.get(2), {
+ status: "completed",
+ conclusion: "success",
+ });
+ f.jobs.set(2, [
+ job("verify"),
+ job("publish"),
+ job("dispatch GitHub release"),
+ ]);
+ }
+ });
+ assert.equal(waits, 4);
+ assert.equal(f.writes().length, 3);
+ for (const request of f.writes()) {
+ assert.equal(
+ request.path,
+ "actions/workflows/release-progress.yml/dispatches",
+ );
+ assert.deepEqual(request.body, {
+ ref: "main",
+ inputs: { "run-id": "2" },
+ });
+ }
+ assert.equal(f.comments.length, 0);
+});
+
+test("observer refreshes final failures and ignores unrelated runs", async () => {
+ const f = fixture();
+ f.runs.set(3, run(3, "node-github-release"));
+ await f.watch(3, async () => {
+ Object.assign(f.runs.get(3), {
+ status: "completed",
+ conclusion: "failure",
+ });
+ f.jobs.set(3, [job("release status", "failure")]);
+ });
+ assert.equal(f.writes().length, 2);
+ f.runs.set(1, run(1, "node-ci"));
+ f.runs.set(4, run(4, "unrelated"));
+ for (const id of [1, 4])
+ await f.watch(id, () => assert.fail("must not poll"));
+ assert.equal(f.writes().length, 2);
+});
+
+test("tracks protected container approval and failed reusable workflow jobs", async () => {
+ const f = fixture();
+ f.runs.set(3, run(3, "node-github-release"));
+ f.jobs.set(3, [job("publish matching container / source")]);
+ f.deployments.set(3, [{ environment: { name: "container" } }]);
+ await f.update(3);
+ assert.match(f.body(), /Container image \| Waiting for container approval/u);
+ await f.watch(3, async () => {
+ f.deployments.set(3, []);
+ Object.assign(f.runs.get(3), {
+ status: "completed",
+ conclusion: "failure",
+ });
+ f.jobs.set(3, [
+ job("publish matching container / source"),
+ job("publish matching container / publish-linux-amd64", "failure"),
+ job("release status", "failure"),
+ ]);
+ });
+ await f.update(3);
+ assert.match(f.body(), /Container image \| Failed/u);
+ assert.match(f.body(), /Final release status \| Failed/u);
+ assert.doesNotMatch(f.body(), /## Automated release complete/u);
+});
+
+test("keeps one comment across CI, verification, and protected approval", async () => {
+ const f = fixture();
+ f.runs.set(1, run(1, "node-ci"));
+ assert.equal((await f.update(1)).action, "created");
+ f.runs.get(1).status = "completed";
+ f.runs.get(1).conclusion = "success";
+ f.runs.set(2, run(2, "node-release", { status: "waiting" }));
+ f.jobs.set(2, [
+ job("native / bundle"),
+ job("verify"),
+ ...[1, 2, 3, "mcp"].map((suite) => job(`release tests / ${suite}`)),
+ ]);
+ f.deployments.set(2, [{ environment: { name: "npm" } }]);
+ assert.equal((await f.update(2)).action, "updated");
+ assert.equal(f.comments.length, 1);
+ assert.match(f.body(), /Post-merge CI \| Passed/u);
+ assert.match(f.body(), /Release verification \| Passed/u);
+ assert.match(
+ f.body(),
+ /Protected npm publication \| Waiting for npm approval/u,
+ );
+ assert.match(f.body(), /runs\/2/u);
+ assert.deepEqual(
+ f.writes().map((request) => request.method),
+ ["POST", "PATCH"],
+ );
+ assert.equal((await f.update(2)).action, "unchanged");
+ assert.equal(f.writes().length, 2);
+});
+
+test("follows a release tagged on a successful fix back to its version-bump PR", async (t) => {
+ const root = mkdtempSync(join(tmpdir(), "release-progress-"));
+ t.after(() => rmSync(root, { recursive: true, force: true }));
+ const git = (...args) =>
+ execFileSync("git", ["-C", root, ...args], { encoding: "utf8" }).trim();
+ git("init", "--initial-branch=main");
+ git("config", "user.name", "Release Test");
+ git("config", "user.email", "[email protected]");
+ mkdirSync(join(root, "sdk/typescript"), { recursive: true });
+ const commit = (version, description) => {
+ writeFileSync(
+ join(root, "sdk/typescript/package.json"),
+ JSON.stringify({ name: "@openai/codex-security", version, description }),
+ );
+ git("add", ".");
+ git("commit", "-m", description);
+ return git("rev-parse", "HEAD");
+ };
+ commit("99.1.1", "previous release");
+ const bump = commit("99.1.2", "version bump");
+ const fix = commit("99.1.2", "fix release verification");
+ const f = fixture(createGitRepository(root));
+ f.commitPulls.set(bump, [structuredClone(pull)]);
+ f.commitPulls.set(fix, [
+ { ...pull, number: 43, title: "fix: release verification" },
+ ]);
+ f.tag(fix);
+ f.runs.set(
+ 1,
+ run(1, "node-ci", {
+ head_sha: bump,
+ status: "completed",
+ conclusion: "failure",
+ }),
+ );
+ await f.update(1);
+ assert.match(f.body(), /Post-merge CI \| Failed/u);
+ f.runs.set(2, run(2, "node-release", { head_sha: fix, status: "waiting" }));
+ f.jobs.set(2, [job("verify")]);
+ f.deployments.set(2, [{ environment: { name: "npm" } }]);
+ assert.equal((await f.update(2)).action, "updated");
+ assert.equal(f.comments.length, 1);
+ assert.match(f.body(), /Post-merge CI \| Not recorded/u);
+ assert.match(
+ f.body(),
+ /Protected npm publication \| Waiting for npm approval/u,
+ );
+ Object.assign(f.runs.get(2), { status: "completed", conclusion: "success" });
+ f.runs.set(
+ 3,
+ run(3, "node-github-release", {
+ head_sha: automationSha,
+ status: "completed",
+ conclusion: "success",
+ }),
+ );
+ assert.equal((await f.update(3)).action, "updated");
+ assert.match(f.body(), /## Automated release complete/u);
+ assert.equal(f.comments.length, 1);
+ const completed = f.body();
+ assert.equal((await f.update(1)).action, "ignored");
+ f.runs.set(
+ 4,
+ run(4, "node-ci", {
+ head_sha: fix,
+ status: "completed",
+ conclusion: "success",
+ }),
+ );
+ assert.equal((await f.update(4)).action, "ignored");
+ assert.equal(f.body(), completed);
+});
+
+test("continues a release backfill when saved workflow runs were deleted", async () => {
+ for (const deleted of [[1], [2], [3], [1, 2, 3]]) {
+ const f = fixture();
+ for (const [id, workflow] of [
+ [1, "node-ci"],
+ [2, "node-release"],
+ [3, "node-github-release"],
+ ]) {
+ f.runs.set(
+ id,
+ run(id, workflow, { status: "completed", conclusion: "success" }),
+ );
+ await f.update(id);
+ }
+ for (const id of deleted) {
+ f.runs.delete(id);
+ f.errors.set(
+ `actions/runs/${id}`,
+ Object.assign(new Error("Workflow run was deleted"), { status: 404 }),
+ );
+ }
+ f.runs.set(4, run(4, "node-github-release"));
+ assert.equal((await f.update(4)).action, "updated");
+ assert.equal(f.comments.length, 1);
+ assert.match(f.body(), /"node-github-release":4/u);
+ assert.match(f.body(), /Final release status \| Running/u);
+ if (deleted.includes(1))
+ assert.match(f.body(), /Post-merge CI \| Not recorded/u);
+ if (deleted.includes(2)) {
+ assert.match(f.body(), /npm release status \| Not recorded/u);
+ assert.match(f.body(), /Protected npm publication \| Not recorded/u);
+ }
+ f.requests.length = 0;
+ assert.equal((await f.update(4)).action, "unchanged");
+ for (const id of deleted)
+ assert.ok(!f.requests.some(({ path }) => path === `actions/runs/${id}`));
+ }
+});
+
+test("surfaces other errors while loading saved workflow runs", async () => {
+ for (const status of [401, 403, 500]) {
+ const f = fixture();
+ f.runs.set(1, run(1, "node-ci"));
+ await f.update(1);
+ const previous = f.body();
+ const error = Object.assign(new Error("Workflow run request failed"), {
+ status,
+ });
+ f.errors.set("actions/runs/1", error);
+ f.runs.set(2, run(2, "node-release"));
+ await assert.rejects(f.update(2), (caught) => caught === error);
+ assert.equal(f.body(), previous);
+ assert.equal(f.writes().length, 1);
+ }
+});
+
+test("does not ignore a missing incoming workflow run", async () => {
+ const f = fixture();
+ const error = Object.assign(new Error("Workflow run was deleted"), {
+ status: 404,
+ });
+ f.errors.set("actions/runs/1", error);
+ await assert.rejects(f.update(1), (caught) => caught === error);
+ await assert.rejects(
+ f.watch(1, () => assert.fail("must not poll a missing run")),
+ (caught) => caught === error,
+ );
+ assert.equal(f.writes().length, 0);
+});
+
+test("workflow results remain visible when no jobs start or every job is skipped", async () => {
+ for (const [workflow, stage, firstJob] of [
+ ["node-release", "npm release status", "verify"],
+ [
+ "node-github-release",
+ "Final release status",
+ "publish verified GitHub release",
+ ],
+ ]) {
+ for (const skipped of [false, true]) {
+ for (const [conclusion, label] of [
+ ["cancelled", "Cancelled"],
+ ["failure", "Failed"],
+ ["timed_out", "Timed out"],
+ ["startup_failure", "startup_failure"],
+ ]) {
+ const f = fixture();
+ f.runs.set(1, run(1, workflow));
+ f.jobs.set(
+ 1,
+ skipped
+ ? [
+ job(firstJob, "skipped"),
+ ...(workflow === "node-github-release"
+ ? [job("release status", "skipped")]
+ : []),
+ ]
+ : [],
+ );
+ let waits = 0;
+ await f.watch(1, async () => {
+ waits += 1;
+ Object.assign(f.runs.get(1), { status: "completed", conclusion });
+ });
+ assert.equal(waits, 1);
+ assert.equal(
+ f.requests.filter(({ path }) => path.endsWith("/dispatches")).length,
+ 2,
+ );
+ await f.update(1);
+ assert.ok(f.body().includes(`| ${stage} | ${label} |`));
+ assert.doesNotMatch(f.body(), /Automated release complete/u);
+ }
+ }
+ }
+});
+
+test("reports failed shards and cancelled publication without declaring completion", async () => {
+ for (const conclusion of ["failure", "cancelled"]) {
+ const f = fixture();
+ f.runs.set(2, run(2, "node-release", { status: "completed", conclusion }));
+ f.jobs.set(2, [
+ job("verify"),
+ job("release tests / 2", conclusion),
+ job("publish", "skipped"),
+ ]);
+ await f.update(2);
+ assert.match(f.body(), conclusion === "failure" ? /Failed/u : /Cancelled/u);
+ assert.doesNotMatch(f.body(), /## Automated release complete/u);
+ }
+});
+
+test("reports a failed handoff after npm publication succeeds", async () => {
+ for (const conclusion of ["failure", "cancelled"]) {
+ const f = fixture();
+ f.runs.set(2, run(2, "node-release", { status: "completed", conclusion }));
+ f.jobs.set(2, [
+ job("verify"),
+ job("publish"),
+ job("dispatch GitHub release", conclusion),
+ ]);
+ await f.update(2);
+ assert.match(f.body(), /Protected npm publication \| Passed/u);
+ assert.match(
+ f.body(),
+ conclusion === "failure"
+ ? /Start GitHub publication \| Failed/u
+ : /Start GitHub publication \| Cancelled/u,
+ );
+ assert.doesNotMatch(f.body(), /## Automated release complete/u);
+ }
+});
+
+test("Action verification failures take precedence over skipped publication", async () => {
+ const f = fixture();
+ f.runs.set(
+ 3,
+ run(3, "node-github-release", {
+ status: "completed",
+ conclusion: "failure",
+ }),
+ );
+ f.jobs.set(3, [
+ job("verify matching Action", "failure"),
+ job("publish matching Action", "skipped"),
+ job("release status", "failure"),
+ ]);
+ await f.update(3);
+ assert.match(f.body(), /GitHub Action \| Failed/u);
+ assert.doesNotMatch(f.body(), /GitHub Action \| Skipped/u);
+});
+
+test("resolves GitHub publication to the release tag, including annotated tags", async () => {
+ for (const annotated of [false, true]) {
+ const f = fixture();
+ if (annotated) f.annotate();
+ f.runs.set(
+ 3,
+ run(3, "node-github-release", {
+ head_sha: automationSha,
+ status: "completed",
+ conclusion: "success",
+ }),
+ );
+ f.jobs.set(3, [
+ job("publish verified GitHub release"),
+ job("verify published installation / linux"),
+ job("verify matching Action"),
+ job("publish matching Action"),
+ job("release status"),
+ ]);
+ await f.update(3);
+ assert.match(f.body(), /## Automated release complete/u);
+ assert.match(f.body(), /Post-merge CI \| Not recorded/u);
+ assert.match(f.body(), /Release verification \| Not recorded/u);
+ assert.match(f.body(), /Protected npm publication \| Not recorded/u);
+ assert.match(f.body(), /GitHub Action \| Passed/u);
+ assert.ok(
+ f.requests.some(
+ (request) => request.path === `commits/${sha}/pulls?per_page=100`,
+ ),
+ );
+ assert.ok(
+ !f.requests.some((request) =>
+ request.path.includes(`commits/${automationSha}`),
+ ),
+ );
+ }
+});
+
+test("shows partial publication failures and installation failures beyond the first page", async () => {
+ const f = fixture();
+ f.runs.set(
+ 3,
+ run(3, "node-github-release", {
+ status: "completed",
+ conclusion: "failure",
+ }),
+ );
+ f.jobs.set(3, [
+ job("publish verified GitHub release"),
+ ...Array.from({ length: 100 }, (_, i) =>
+ job(`verify published installation / ${i}`),
+ ),
+ job("verify published installation / windows", "failure"),
+ job("publish matching Action", "skipped"),
+ job("release status", "failure"),
+ ]);
+ await f.update(3);
+ assert.match(f.body(), /Public npm package and provenance \| Passed/u);
+ assert.match(f.body(), /Published installation checks \| Failed/u);
+ assert.match(f.body(), /GitHub Action \| Skipped/u);
+ assert.doesNotMatch(f.body(), /## Automated release complete/u);
+});
+
+test("late events cannot replace a newer run and reruns refresh the latest attempt", async () => {
+ const f = fixture();
+ f.runs.set(
+ 1,
+ run(1, "node-ci", { status: "completed", conclusion: "failure" }),
+ );
+ f.runs.set(
+ 2,
+ run(2, "node-ci", { status: "completed", conclusion: "success" }),
+ );
+ await f.update(2);
+ await f.update(1);
+ assert.match(f.body(), /Post-merge CI \| Passed/u);
+ assert.match(f.body(), /"node-ci":2/u);
+ f.runs.get(2).status = "in_progress";
+ f.runs.get(2).conclusion = null;
+ await f.update(2);
+ assert.match(f.body(), /Post-merge CI \| Running/u);
+});
+
+test("does not overwrite human comments containing the marker", async () => {
+ const f = fixture();
+ const human = {
+ id: 99,
+ user: { login: "maintainer" },
+ body: `${marker}\nMy notes`,
+ };
+ f.comments.push(human);
+ f.runs.set(1, run(1, "node-ci"));
+ await f.update(1);
+ assert.equal(f.comments.length, 2);
+ assert.equal(human.body, `${marker}\nMy notes`);
+});
+
+test("rejects workflow lookalikes and publication runs outside main or stable tags", async () => {
+ for (const input of [
+ run(1, "node-ci", { path: ".github/workflows/unrelated.yml" }),
+ run(1, "node-ci", { path: ".github/workflows/unrelated.yml@main" }),
+ run(2, "node-release", {
+ path: ".github/workflows/[email protected]",
+ }),
+ run(3, "node-github-release", {
+ path: "elsewhere/node-github-release.yml@main",
+ }),
+ run(2, "node-release", { event: "pull_request", head_branch: "feature" }),
+ run(2, "node-release", { head_branch: "main" }),
+ run(3, "node-github-release", { head_branch: "feature" }),
+ run(3, "node-github-release", { display_title: "Publish arbitrary-ref" }),
+ ]) {
+ const f = fixture();
+ f.runs.set(input.id, input);
+ assert.equal((await f.update(input.id)).action, "ignored");
+ await f.watch(input.id, () =>
+ assert.fail("must not poll an unrelated run"),
+ );
+ assert.equal(f.writes().length, 0);
+ }
+});
diff --git a/.github/workflows/node-ci.yml b/.github/workflows/node-ci.yml
index bcf114640..cfb239100 100644
--- a/.github/workflows/node-ci.yml
+++ b/.github/workflows/node-ci.yml
@@ -61,7 +61,8 @@ jobs:
while IFS= read -r -d '' path; do
case "$path" in
.github/workflows/* | .github/actions/* | .github/actionlint.yaml | .github/zizmor.yml | \
- docker/verify-container-compose.sh)
+ .github/scripts/release-progress.mjs | .github/scripts/test_release_progress.mjs | \
+ sdk/typescript/scripts/release-pr.mjs | docker/verify-container-compose.sh)
workflow_quality=true
;;
esac
diff --git a/.github/workflows/node-github-release.yml b/.github/workflows/node-github-release.yml
index 136881af4..156d3a59f 100644
--- a/.github/workflows/node-github-release.yml
+++ b/.github/workflows/node-github-release.yml
@@ -1,4 +1,5 @@
name: node-github-release
+run-name: Publish ${{ inputs.tag }}
on:
workflow_dispatch:
diff --git a/.github/workflows/node-release-cut.yml b/.github/workflows/node-release-cut.yml
index 88de7715d..e689f0b28 100644
--- a/.github/workflows/node-release-cut.yml
+++ b/.github/workflows/node-release-cut.yml
@@ -227,6 +227,7 @@ jobs:
--silent
- name: Dispatch the protected npm release
+ id: dispatch
if: steps.release.outputs.changed == 'true'
shell: bash
env:
@@ -234,6 +235,22 @@ jobs:
RELEASE_TAG: ${{ steps.release.outputs.tag }}
run: |
set -euo pipefail
- gh workflow run node-release.yml \
- --repo "$GITHUB_REPOSITORY" \
- --ref "$RELEASE_TAG"
+ run_id="$(gh api --method POST \
+ -H 'X-GitHub-Api-Version: 2026-03-10' \
+ "repos/$GITHUB_REPOSITORY/actions/workflows/node-release.yml/dispatches" \
+ -f "ref=$RELEASE_TAG" --jq '.workflow_run_id')"
+ printf 'run-id=%s\n' "$run_id" >> "$GITHUB_OUTPUT"
+
+ - name: Start release progress observer
+ if: steps.dispatch.outputs.run-id != ''
+ continue-on-error: true
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_RUN_ID: ${{ steps.dispatch.outputs.run-id }}
+ run: |
+ # Explicitly observe token-dispatched runs without relying on chained
+ # workflow_run events. Progress notification remains best-effort.
+ timeout --kill-after=5s 10s gh workflow run release-progress.yml \
+ --repo "$GITHUB_REPOSITORY" --ref main \
+ -f "run-id=$RELEASE_RUN_ID" -f watch=true
diff --git a/.github/workflows/node-release.yml b/.github/workflows/node-release.yml
index 60e8d22b8..f77318e10 100644
--- a/.github/workflows/node-release.yml
+++ b/.github/workflows/node-release.yml
@@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: read
- env:
+ env: &release-environment
NPM_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
PNPM_CONFIG_REGISTRY: https://openai.firewall.socket.dev/npm/
COREPACK_NPM_REGISTRY: https://openai.firewall.socket.dev/npm/
@@ -35,27 +35,32 @@ jobs:
version: ${{ steps.release.outputs.version }}
steps:
- - name: Checkout repository
+ - &checkout-release
+ name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- - name: Prepare native runtime
+ - &download-release-native
+ name: Prepare native runtime
uses: ./.github/actions/download-native
- - name: Set up Socket Firewall
+ - &setup-release-firewall
+ name: Set up Socket Firewall
uses: SocketDev/action@ba6de6cc0565af1f42295590380973573297e31f # v1.3.2
with:
mode: firewall-free
firewall-version: "1.15.0"
- - name: Set up Node.js
+ - &setup-release-node
+ name: Set up Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "22.13.0"
package-manager-cache: false
- - name: Activate Socket Firewall
+ - &activate-release-firewall
+ name: Activate Socket Firewall
shell: bash
run: |
set -euo pipefail
@@ -75,13 +80,15 @@ jobs:
printf 'PIP_INDEX_URL=%s\n' "$pypi_registry"
} >> "$GITHUB_ENV"
- - name: Set up Bun
+ - &setup-release-bun
+ name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: "1.3.14"
no-cache: true
- - name: Enable pnpm
+ - &setup-release-pnpm
+ name: Enable pnpm
shell: bash
run: corepack enable && corepack prepare "$(node -p 'require("./package.json").packageManager')" --activate
@@ -142,12 +149,14 @@ jobs:
node sdk/typescript/scripts/release-automation.mjs \
validate-release-notes "$RELEASE_VERSION" "$release_notes_file" >/dev/null
- - name: Install dependencies
+ - &install-release-dependencies
+ name: Install dependencies
run: |
sfw pnpm --dir sdk/typescript install --frozen-lockfile
sfw pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
- - name: Install ripgrep
+ - &install-release-ripgrep
+ name: Install ripgrep
run: |
sudo apt-get update
sudo apt-get install --yes ripgrep
@@ -158,8 +167,6 @@ jobs:
- name: Verify
run: |
pnpm --dir sdk/typescript run types
- pnpm --dir sdk/typescript run test
- pnpm --dir sdk/typescript run test:mcp
pnpm --dir sdk/typescript run format
- name: Pack
@@ -247,10 +254,59 @@ jobs:
retention-days: 30
compression-level: 0
+ test:
+ needs: native
+ if: github.repository == 'openai/codex-security'
+ name: release tests / ${{ matrix.suite }}
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ env: *release-environment
+ strategy:
+ fail-fast: false
+ matrix:
+ suite: [1, 2, 3, mcp]
+ steps:
+ - *checkout-release
+ - *download-release-native
+ - *setup-release-firewall
+ - *setup-release-node
+ - *activate-release-firewall
+ - *setup-release-bun
+ - *setup-release-pnpm
+ - *install-release-dependencies
+ - *install-release-ripgrep
+ - name: Build the plugin for TypeScript tests
+ if: matrix.suite != 'mcp'
+ run: pnpm --dir sdk/typescript run build:plugin
+ - name: Test TypeScript shard
+ if: matrix.suite != 'mcp'
+ working-directory: sdk/typescript
+ env:
+ TEMP: ${{ runner.temp }}
+ TMP: ${{ runner.temp }}
+ TMPDIR: ${{ runner.temp }}
+ CODEX_SECURITY_ALLOW_MACHINE_POLICY_TEST: "false"
+ run: node --experimental-strip-types scripts/run-ci-tests.mts ${{ matrix.suite }}/3
+ - name: Test MCP app
+ if: matrix.suite == 'mcp'
+ run: pnpm --dir sdk/typescript run test:mcp
+ - name: Upload test reports
+ if: always()
+ continue-on-error: true
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
+ with:
+ name: release-tests-${{ matrix.suite }}
+ path: |
+ sdk/typescript/reports/junit-*.xml
+ plugins/codex-security/mcp-app/reports/junit.xml
+ if-no-files-found: warn
+ retention-days: 14
+
publish:
if: github.repository == 'openai/codex-security'
name: publish
- needs: verify
+ needs: [verify, test]
runs-on: ubuntu-latest
environment: npm
permissions:
@@ -450,6 +506,7 @@ jobs:
steps:
- name: Dispatch the verified GitHub release
+ id: dispatch
shell: bash
env:
GH_TOKEN: ${{ github.token }}
@@ -457,8 +514,24 @@ jobs:
RELEASE_RUN_ID: ${{ github.run_id }}
run: |
set -euo pipefail
- gh workflow run node-github-release.yml \
- --repo "$GITHUB_REPOSITORY" \
- --ref main \
- -f "tag=$RELEASE_TAG" \
- -f "run_id=$RELEASE_RUN_ID"
+ run_id="$(gh api --method POST \
+ -H 'X-GitHub-Api-Version: 2026-03-10' \
+ "repos/$GITHUB_REPOSITORY/actions/workflows/node-github-release.yml/dispatches" \
+ -f ref=main \
+ -f "inputs[tag]=$RELEASE_TAG" \
+ -f "inputs[run_id]=$RELEASE_RUN_ID" --jq '.workflow_run_id')"
+ printf 'run-id=%s\n' "$run_id" >> "$GITHUB_OUTPUT"
+
+ - name: Start release progress observer
+ if: steps.dispatch.outputs.run-id != ''
+ continue-on-error: true
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_RUN_ID: ${{ steps.dispatch.outputs.run-id }}
+ run: |
+ # The downstream resolver waits for this workflow to finish. Keep the
+ # optional notification within its 60-second completion wait.
+ timeout --kill-after=5s 10s gh workflow run release-progress.yml \
+ --repo "$GITHUB_REPOSITORY" --ref main \
+ -f "run-id=$RELEASE_RUN_ID" -f watch=true
diff --git a/.github/workflows/release-progress.yml b/.github/workflows/release-progress.yml
new file mode 100644
index 000000000..1b377e704
--- /dev/null
+++ b/.github/workflows/release-progress.yml
@@ -0,0 +1,87 @@
+name: release-progress
+
+on:
+ workflow_run:
+ workflows: ["node-ci", "node-release", "node-github-release"]
+ types: [requested, in_progress, completed]
+ workflow_dispatch:
+ inputs:
+ run-id:
+ description: Release workflow run to refresh
+ required: true
+ type: string
+ watch:
+ description: Observe this run until it completes
+ type: boolean
+ default: false
+
+permissions: {}
+
+jobs:
+ report:
+ if: >-
+ github.repository == 'openai/codex-security' &&
+ (github.event_name != 'workflow_dispatch' || github.ref == 'refs/heads/main') &&
+ (github.event_name != 'workflow_run' ||
+ github.event.workflow_run.name != 'node-ci' ||
+ (github.event.workflow_run.event == 'push' &&
+ github.event.workflow_run.head_branch == 'main'))
+ name: update release PR
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ concurrency:
+ group: release-progress-${{ github.repository }}
+ queue: max
+ outputs:
+ pull: ${{ steps.update.outputs.pull }}
+ permissions:
+ actions: read
+ contents: read
+ pull-requests: write
+ steps:
+ - &checkout-automation
+ name: Checkout trusted release automation
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: refs/heads/main
+ fetch-depth: 0
+ persist-credentials: false
+ - &setup-node
+ name: Set up Node.js
+ uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
+ with:
+ node-version: "24.15.0"
+ package-manager-cache: false
+ - name: Update release progress
+ id: update
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_RUN_ID: ${{ inputs.run-id || github.event.workflow_run.id }}
+ run: node .github/scripts/release-progress.mjs
+
+ watch:
+ needs: report
+ if: >-
+ needs.report.outputs.pull != '' &&
+ ((github.event_name == 'workflow_dispatch' && inputs.watch) ||
+ (github.event_name == 'workflow_run' &&
+ github.event.action == 'in_progress' &&
+ github.event.workflow_run.name != 'node-ci'))
+ name: observe release milestones
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ concurrency:
+ group: release-progress-watch-${{ inputs.run-id || github.event.workflow_run.id }}
+ cancel-in-progress: true
+ permissions:
+ actions: write
+ contents: read
+ steps:
+ - *checkout-automation
+ - *setup-node
+ - name: Refresh changed milestones
+ env:
+ GH_TOKEN: ${{ github.token }}
+ RELEASE_RUN_ID: ${{ inputs.run-id || github.event.workflow_run.id }}
+ RELEASE_PROGRESS_WATCH: "true"
+ run: node .github/scripts/release-progress.mjs
diff --git a/.github/workflows/test-quality.yml b/.github/workflows/test-quality.yml
index 2709427aa..6fd7690bf 100644
--- a/.github/workflows/test-quality.yml
+++ b/.github/workflows/test-quality.yml
@@ -32,7 +32,7 @@ jobs:
if: ${{ !cancelled() && (inputs.native-artifacts-ready || needs.native.result == 'success') }}
name: ${{ matrix.os }} / ${{ matrix.mode }}
runs-on: ${{ matrix.os }}
- timeout-minutes: ${{ matrix.os == 'windows-latest' && (matrix.mode == 'baseline' && 90 || matrix.mode == 'parallel' && 60) || 30 }}
+ timeout-minutes: ${{ matrix.os == 'windows-latest' && (matrix.mode == 'baseline' || matrix.mode == 'parallel') && 90 || 30 }}
env:
CODEX_SECURITY_PROPERTY_SEED: ${{ github.event_name == 'pull_request' && 1 || github.run_number }}
strategy:
diff --git a/.github/workflows/workflow-quality.yml b/.github/workflows/workflow-quality.yml
index ac5ad90d1..d45a443de 100644
--- a/.github/workflows/workflow-quality.yml
+++ b/.github/workflows/workflow-quality.yml
@@ -39,5 +39,7 @@ jobs:
run: |
actionlint -color
shellcheck docker/verify-container-compose.sh
+ - name: Test release progress reporting
+ run: node --test .github/scripts/test_release_progress.mjs
- name: Check workflow security
run: zizmor --offline --strict-collection --min-severity medium --format github --config .github/zizmor.yml .github
diff --git a/.github/zizmor.yml b/.github/zizmor.yml
index 37c764767..db89c1c8b 100644
--- a/.github/zizmor.yml
+++ b/.github/zizmor.yml
@@ -3,6 +3,8 @@ rules:
ignore:
# Labels only: no checkout or execution of pull request code.
- node-release-labels.yml:3
+ # Reads run metadata and comments using helpers checked out from protected main.
+ - release-progress.yml:3
# Requires successful push CI on main and verifies commit ancestry before tagging.
- node-release-cut.yml:3
# The protected-main dispatcher reads event metadata and never checks out PR code.
diff --git a/RELEASING.md b/RELEASING.md
index e2c8d0f10..b778f8a9a 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -272,7 +272,10 @@ for that exact commit:
1. `node-release-cut` verifies that the version increased, checks the reviewed
summary, and creates the exact `npm-vX.Y.Z` tag.
2. `node-release` installs the committed dependency graph, tests and packs the
- package, publishes it to npm, and records npm provenance.
+ package, publishes it to npm, and records npm provenance. Three TypeScript
+ test shards and the MCP tests run in parallel with package verification.
+ Every shard and package check must pass before the protected npm job can
+ publish the verified archive.
3. `node-github-release` verifies the public package, provenance, tag, and
archive before publishing the GitHub release. It prepends the reviewed
summary to GitHub's categorized notes.
@@ -314,6 +317,31 @@ registry errors fail immediately.
`sdk/typescript/_bundled_plugin/` directory is not a committed release input;
do not prepare a release by editing or committing files there.
+The merged release PR receives one progress comment covering post-merge CI,
+release verification, protected npm approval, public-package provenance,
+installation checks, Action publication, and container approval and publication.
+It links to the relevant workflow
+runs and updates at workflow boundaries. Each automatic release dispatch starts
+a separate observer using the returned run ID; this does not depend on chained
+`workflow_run` events from the built-in token. The observer checks release jobs
+every 30 seconds, including while protected approval is pending, and requests a refresh
+when a milestone changes. Reruns update the same comment using their latest
+results. Queued duplicates keep the active run and its approval link visible.
+Historical stages without a recorded run are marked **Not recorded**. Completion
+covers the automated workflows; Marketplace publication remains a separate step.
+
+Observers are subject to GitHub's job time limit. To resume observation after a
+long approval wait, run `release-progress` on `main` with the release `run-id`
+and `watch` enabled. GitHub publication starts its own observer after npm succeeds.
+
+The observer and comment writer execute only helpers from protected `main`.
+Only the comment writer can update PR comments, and only the observer can request
+a refresh. Both run outside the publication workflows. Verification and
+publication jobs retain their existing permissions. The dispatch jobs use their
+existing Actions permission for a best-effort notification bounded to 15 seconds,
+within the downstream resolver's 60-second completion wait. Progress-reporting
+failures do not block publication; workflow results remain authoritative.
+
Monitor all three workflows and the final status in `node-github-release`.
The automated release is complete when npm and GitHub publication, exact-version
install checks, and applicable Action and container publication have succeeded.
diff --git a/sdk/typescript/scripts/release-pr.mjs b/sdk/typescript/scripts/release-pr.mjs
index faa2193c6..df1e67013 100644
--- a/sdk/typescript/scripts/release-pr.mjs
+++ b/sdk/typescript/scripts/release-pr.mjs
@@ -286,7 +286,7 @@ export function createGitRepository(directory) {
};
}
-export async function readReleaseHistory(repo, mainSha, github) {
+export function readVersionHistory(repo, mainSha) {
repo.ensureCommit(mainSha);
const packageText = repo.readFile(mainSha, packagePath);
const baseVersion = releaseVersion(JSON.parse(packageText));
@@ -300,6 +300,14 @@ export async function readReleaseHistory(repo, mainSha, github) {
baseCommit = sha;
}
+ return { baseVersion, baseCommit, packageText };
+}
+
+export async function readReleaseHistory(repo, mainSha, github) {
+ const { baseVersion, baseCommit, packageText } = readVersionHistory(
+ repo,
+ mainSha,
+ );
const commits = repo
.git("rev-list", "--first-parent", "--reverse", `${baseCommit}..${mainSha}`)
.trim()
diff --git a/sdk/typescript/tests-ts/classify-severity-records.test.ts b/sdk/typescript/tests-ts/classify-severity-records.test.ts
index 46bf803ee..dc157b5ee 100644
--- a/sdk/typescript/tests-ts/classify-severity-records.test.ts
+++ b/sdk/typescript/tests-ts/classify-severity-records.test.ts
@@ -415,7 +415,7 @@ test("canonical records use majority voting and highest severity for a three-way
});
test.each([2, 3, 10])(
- "canonical review %s must succeed before returning any assessment",
+ "canonical review %p must succeed before returning any assessment",
async (failedRun) => {
for (const invalid of [false, true]) {
let calls = 0;
@@ -446,7 +446,7 @@ test.each([2, 3, 10])(
);
test.each([2, 3])(
- "canonical cancellation during review %s never returns a partial vote",
+ "canonical cancellation during review %p never returns a partial vote",
async (canceledRun) => {
const controller = new AbortController();
let calls = 0;
@@ -510,7 +510,7 @@ test.each([1, 2, 4, 10])(
);
test.each([0, -1, 11, 1.5, NaN, Infinity])(
- "rejects invalid canonical run count %s before host work",
+ "rejects invalid canonical run count %p before host work",
async (classificationRuns) => {
let calls = 0;
await expect(
diff --git a/sdk/typescript/tests-ts/classify-severity.test.ts b/sdk/typescript/tests-ts/classify-severity.test.ts
index e0488fcdc..90d7a8b63 100644
--- a/sdk/typescript/tests-ts/classify-severity.test.ts
+++ b/sdk/typescript/tests-ts/classify-severity.test.ts
@@ -284,7 +284,7 @@ test("votes independently for each imported report and retains the winning answe
});
test.each([2, 3, 10])(
- "does not return a partial vote when review %s fails or is invalid",
+ "does not return a partial vote when review %p fails or is invalid",
async (failedRun) => {
for (const invalid of [false, true]) {
const { codex, calls } = fakeCodex((call: number) => {
@@ -304,7 +304,7 @@ test.each([2, 3, 10])(
);
test.each([1, 2, 3])(
- "cancellation after review %s stops classification",
+ "cancellation after review %p stops classification",
async (canceledRun) => {
const controller = new AbortController();
const { codex, calls } = fakeCodex((call: number) => {
@@ -336,7 +336,7 @@ test.each([1, 2, 4, 10])(
);
test.each([0, -1, 11, 1.5, NaN, Infinity])(
- "rejects invalid local run count %s before model work",
+ "rejects invalid local run count %p before model work",
async (classificationRuns) => {
const { codex, calls } = fakeCodex(assessed);
await expect(
diff --git a/sdk/typescript/tests-ts/cli-authentication.test.ts b/sdk/typescript/tests-ts/cli-authentication.test.ts
index 6fa3f9082..103fcb8ef 100644
--- a/sdk/typescript/tests-ts/cli-authentication.test.ts
+++ b/sdk/typescript/tests-ts/cli-authentication.test.ts
@@ -860,96 +860,100 @@ describe("CLI authentication", () => {
).toBe(17);
});
- test("keeps delegated credentials in the configured Codex home", async () => {
- const root = await temporaryDirectory("codex-security-login-home-");
- const repository = join(root, "repository");
- const relativeHome = join(repository, ".codex-security-home");
- const tildeHome = join(root, ".codex-security-home");
- const mountedHome = join(root, "mounted-codex-home");
- const defaultHome = join(root, ".codex");
- await mkdir(repository, { mode: 0o700 });
- await mkdir(relativeHome, { mode: 0o700 });
- await mkdir(tildeHome, { mode: 0o700 });
- await mkdir(mountedHome, { mode: 0o700 });
- await mkdir(defaultHome, { mode: 0o700 });
- try {
- for (const [configuredHome, expectedHome, userHome] of [
- [".codex-security-home", relativeHome, root],
- ["~/.codex-security-home", tildeHome, root],
- [mountedHome, mountedHome, join(root, "missing-home")],
- ...(process.platform === "win32"
- ? []
- : ([
- ["", defaultHome, root],
- [" ", defaultHome, root],
- ] as const)),
- ] as const) {
- const credentialAncestors = [
- join(expectedHome, "state"),
- join(expectedHome, "state", "plugins"),
- join(expectedHome, "state", "plugins", "codex-security"),
- join(
- expectedHome,
- "state",
- "plugins",
- "codex-security",
- "codex-home",
- ),
- ];
- const credentialHome = credentialAncestors.at(-1)!;
- await mkdir(credentialHome, { recursive: true, mode: 0o700 });
- if (process.platform !== "win32") {
- for (const path of [expectedHome, ...credentialAncestors]) {
- await chmod(path, 0o700);
+ test(
+ "keeps delegated credentials in the configured Codex home",
+ async () => {
+ const root = await temporaryDirectory("codex-security-login-home-");
+ const repository = join(root, "repository");
+ const relativeHome = join(repository, ".codex-security-home");
+ const tildeHome = join(root, ".codex-security-home");
+ const mountedHome = join(root, "mounted-codex-home");
+ const defaultHome = join(root, ".codex");
+ await mkdir(repository, { mode: 0o700 });
+ await mkdir(relativeHome, { mode: 0o700 });
+ await mkdir(tildeHome, { mode: 0o700 });
+ await mkdir(mountedHome, { mode: 0o700 });
+ await mkdir(defaultHome, { mode: 0o700 });
+ try {
+ for (const [configuredHome, expectedHome, userHome] of [
+ [".codex-security-home", relativeHome, root],
+ ["~/.codex-security-home", tildeHome, root],
+ [mountedHome, mountedHome, join(root, "missing-home")],
+ ...(process.platform === "win32"
+ ? []
+ : ([
+ ["", defaultHome, root],
+ [" ", defaultHome, root],
+ ] as const)),
+ ] as const) {
+ const credentialAncestors = [
+ join(expectedHome, "state"),
+ join(expectedHome, "state", "plugins"),
+ join(expectedHome, "state", "plugins", "codex-security"),
+ join(
+ expectedHome,
+ "state",
+ "plugins",
+ "codex-security",
+ "codex-home",
+ ),
+ ];
+ const credentialHome = credentialAncestors.at(-1)!;
+ await mkdir(credentialHome, { recursive: true, mode: 0o700 });
+ if (process.platform !== "win32") {
+ for (const path of [expectedHome, ...credentialAncestors]) {
+ await chmod(path, 0o700);
+ }
}
+ await writeFile(
+ join(credentialHome, "config.toml"),
+ 'cli_auth_credentials_store = "file"\n',
+ );
+ const environment = {
+ PATH: process.env["PATH"],
+ HOME: userHome,
+ USERPROFILE: userHome,
+ CODEX_HOME: configuredHome,
+ };
+ const run = (args: string[], input?: string): number | null =>
+ spawnSync(
+ process.execPath,
+ [join(import.meta.dir, "../src/cli.ts"), ...args],
+ {
+ cwd: repository,
+ env: environment,
+ input,
+ encoding: "utf8",
+ },
+ ).status;
+ expect(run(["login", "--with-api-key"], "synthetic-key\n")).toBe(0);
+ expect(await stat(join(credentialHome, "auth.json"))).toBeDefined();
+ await expect(stat(join(repository, "auth.json"))).rejects.toThrow();
+ expect(run(["login", "status"])).toBe(0);
+ expect(run(["logout"])).toBe(0);
}
- await writeFile(
- join(credentialHome, "config.toml"),
- 'cli_auth_credentials_store = "file"\n',
- );
- const environment = {
- PATH: process.env["PATH"],
- HOME: userHome,
- USERPROFILE: userHome,
- CODEX_HOME: configuredHome,
- };
- const run = (args: string[], input?: string): number | null =>
+ expect(
spawnSync(
process.execPath,
- [join(import.meta.dir, "../src/cli.ts"), ...args],
+ [join(import.meta.dir, "../src/cli.ts"), "login", "--help"],
{
cwd: repository,
- env: environment,
- input,
+ env: {
+ PATH: process.env["PATH"],
+ HOME: root,
+ USERPROFILE: root,
+ Codex_Home: " ",
+ },
encoding: "utf8",
},
- ).status;
- expect(run(["login", "--with-api-key"], "synthetic-key\n")).toBe(0);
- expect(await stat(join(credentialHome, "auth.json"))).toBeDefined();
- await expect(stat(join(repository, "auth.json"))).rejects.toThrow();
- expect(run(["login", "status"])).toBe(0);
- expect(run(["logout"])).toBe(0);
+ ).status,
+ ).toBe(0);
+ } finally {
+ await rm(root, { recursive: true, force: true });
}
- expect(
- spawnSync(
- process.execPath,
- [join(import.meta.dir, "../src/cli.ts"), "login", "--help"],
- {
- cwd: repository,
- env: {
- PATH: process.env["PATH"],
- HOME: root,
- USERPROFILE: root,
- Codex_Home: " ",
- },
- encoding: "utf8",
- },
- ).status,
- ).toBe(0);
- } finally {
- await rm(root, { recursive: true, force: true });
- }
- }, 60_000);
+ },
+ process.platform === "win32" ? 120_000 : 60_000,
+ );
test("reports selected scan credentials without contaminating JSON output", async () => {
const { stdout, stderr, runCli } = createCliTest(main, { stderr: true });
diff --git a/sdk/typescript/tests-ts/cli-diagnostics.test.ts b/sdk/typescript/tests-ts/cli-diagnostics.test.ts
index 01a4638b2..8c305e83f 100644
--- a/sdk/typescript/tests-ts/cli-diagnostics.test.ts
+++ b/sdk/typescript/tests-ts/cli-diagnostics.test.ts
@@ -26,7 +26,7 @@ describe("CLI diagnostics", () => {
["validate", "Synthetic finding"],
["verify-fix", "Synthetic finding"],
["init"],
- ])("does not format a success result after %j fails", async (...command) => {
+ ])("does not format success after %j fails (case %#)", async (...command) => {
for (const flags of [["--full-output"], ["--token-count"]]) {
const { stdout, stderr, runCli } = createCliTest(main);
const deps = dependencies();
diff --git a/sdk/typescript/tests-ts/cli-scan-failures.test.ts b/sdk/typescript/tests-ts/cli-scan-failures.test.ts
index 72ba3b292..5cf40bbdd 100644
--- a/sdk/typescript/tests-ts/cli-scan-failures.test.ts
+++ b/sdk/typescript/tests-ts/cli-scan-failures.test.ts
@@ -448,7 +448,7 @@ test.each(commands.slice(1))(
for (const command of ["rerun", "resume"]) {
test.each([true, false, undefined])(
- `${command} restores owner suggestions from its saved recipe (%s)`,
+ `${command} restores owner suggestions from its saved recipe (%p)`,
async (ownerSuggestions) => {
let observed: boolean | undefined;
let called = false;
diff --git a/sdk/typescript/tests-ts/cli-skill-native-config.test.ts b/sdk/typescript/tests-ts/cli-skill-native-config.test.ts
index 83b3e0520..007ce942a 100644
--- a/sdk/typescript/tests-ts/cli-skill-native-config.test.ts
+++ b/sdk/typescript/tests-ts/cli-skill-native-config.test.ts
@@ -19,7 +19,7 @@ import {
import { capture } from "./cli-fixtures.js";
test.each([0, 23])(
- "native configuration fixture preserves early exit %s with its input still open",
+ "native configuration fixture preserves early exit %p with its input still open",
async (exitCode) => {
const child = spawn(
process.execPath,
diff --git a/sdk/typescript/tests-ts/findings-store.test.ts b/sdk/typescript/tests-ts/findings-store.test.ts
index 66788fe35..d300c10d5 100644
--- a/sdk/typescript/tests-ts/findings-store.test.ts
+++ b/sdk/typescript/tests-ts/findings-store.test.ts
@@ -324,7 +324,7 @@ print(db.execute("SELECT COUNT(*) FROM finding_embeddings").fetchone()[0])`;
for (const location of ["vector", "extension", "boxed extension"] as const) {
test.each([NaN, Infinity, -Infinity])(
- `rejects %s in a later entry's ${location} without changing stored findings`,
+ `rejects %p in a later entry's ${location} without changing stored findings`,
async (value) => {
const { store, environment } = await fixture();
const original = embedded(1);
diff --git a/sdk/typescript/tests-ts/hosted-scan.test.ts b/sdk/typescript/tests-ts/hosted-scan.test.ts
index 4b45a063a..8a8de296c 100644
--- a/sdk/typescript/tests-ts/hosted-scan.test.ts
+++ b/sdk/typescript/tests-ts/hosted-scan.test.ts
@@ -77,7 +77,7 @@ test("hosted owner artifact is opt-in and included in the completed receipt", as
});
test.each([false, true])(
- "owner failure preserves the completed hosted scan (cancel=%s)",
+ "owner failure preserves the completed hosted scan (cancel=%p)",
async (cancel) => {
const controller = new AbortController();
const suggestion = spyOn(
@@ -1257,7 +1257,7 @@ test("ordinary SDK rejects the removed hosted option instead of using local infe
});
test.each([true, false])(
- "hosted owner inference uses only the hosted callback (supplied=%s)",
+ "hosted owner inference uses only the hosted callback (supplied=%p)",
async (supplied) => {
const input = await fixture();
const run = mock(async () => ({
diff --git a/sdk/typescript/tests-ts/release-automation.test.ts b/sdk/typescript/tests-ts/release-automation.test.ts
index 04580c724..107e8d4d4 100644
--- a/sdk/typescript/tests-ts/release-automation.test.ts
+++ b/sdk/typescript/tests-ts/release-automation.test.ts
@@ -493,6 +493,32 @@ function verifySignatureFixture(options: SignatureAuditFixture = {}) {
);
}
+type WorkflowContract = {
+ concurrency?: Record<string, unknown>;
+ jobs: Record<
+ string,
+ {
+ permissions?: Record<string, string>;
+ env?: Record<string, string>;
+ needs?: string | string[];
+ environment?: string;
+ if?: string;
+ strategy?: { matrix: Record<string, unknown>; "fail-fast"?: boolean };
+ concurrency?: Record<string, unknown>;
+ "continue-on-error"?: boolean;
+ steps?: {
+ name?: string;
+ uses?: string;
+ run?: string;
+ if?: string;
+ "continue-on-error"?: boolean;
+ with?: Record<string, unknown>;
+ env?: Record<string, string>;
+ }[];
+ }
+ >;
+};
+
function workflowStepShell(workflow: string, stepName: string): string {
const parsed = Bun.YAML.parse(workflow) as {
jobs: Record<string, { steps?: { name?: string; run?: string }[] }>;
@@ -2520,6 +2546,85 @@ describe("GitHub release workflow safeguards", () => {
);
});
+ test("requires every release test shard before protected publication", () => {
+ const { jobs } = Bun.YAML.parse(
+ protectedReleaseWorkflow,
+ ) as WorkflowContract;
+ expect(jobs["test"]?.strategy?.matrix["suite"]).toEqual([1, 2, 3, "mcp"]);
+ expect(jobs["test"]?.strategy?.["fail-fast"]).toBe(false);
+ expect(jobs["test"]?.permissions).toEqual({ contents: "read" });
+ expect(jobs["test"]?.env).toEqual(jobs["verify"]?.env);
+ expect(jobs["publish"]?.needs).toEqual(["verify", "test"]);
+ expect(jobs["publish"]?.environment).toBe("npm");
+ expect(jobs["publish"]?.permissions).toEqual({
+ contents: "read",
+ "id-token": "write",
+ });
+ expect(
+ jobs["publish"]?.steps?.find(
+ (step) => step.name === "Download verified package",
+ )?.with,
+ ).toMatchObject({
+ "artifact-ids": "${{ needs.verify.outputs.artifact-id }}",
+ "digest-mismatch": "error",
+ });
+ expect(
+ jobs["test"]?.steps?.find((step) => step.name === "Test TypeScript shard")
+ ?.run,
+ ).toContain("scripts/run-ci-tests.mts ${{ matrix.suite }}/3");
+ expect(
+ jobs["test"]?.steps?.find((step) => step.name === "Test MCP app")?.run,
+ ).toContain("run test:mcp");
+ });
+
+ test("isolates optional release comments from verification and publishing", () => {
+ const { jobs } = Bun.YAML.parse(
+ protectedReleaseWorkflow,
+ ) as WorkflowContract;
+ const progress = Bun.YAML.parse(
+ readFileSync(
+ new URL(
+ "../../../.github/workflows/release-progress.yml",
+ import.meta.url,
+ ),
+ "utf8",
+ ),
+ ) as WorkflowContract;
+ expect(jobs["verify"]?.permissions).toEqual({ contents: "read" });
+ expect(progress.jobs["report"]?.["continue-on-error"]).toBe(true);
+ expect(progress.jobs["report"]?.permissions).toEqual({
+ actions: "read",
+ contents: "read",
+ "pull-requests": "write",
+ });
+ const checkout = progress.jobs["report"]?.steps?.find(
+ (step: { uses?: string }) => step.uses?.startsWith("actions/checkout@"),
+ );
+ expect(checkout?.with).toMatchObject({
+ ref: "refs/heads/main",
+ "persist-credentials": false,
+ });
+ expect(progress.concurrency).toBeUndefined();
+ expect(progress.jobs["report"]?.concurrency?.["queue"]).toBe("max");
+ expect(progress.jobs["watch"]?.permissions).toEqual({
+ actions: "write",
+ contents: "read",
+ });
+ expect(progress.jobs["watch"]?.["continue-on-error"]).toBe(true);
+ expect(progress.jobs["watch"]?.if).toContain(
+ "github.event.action == 'in_progress'",
+ );
+ expect(progress.jobs["watch"]?.if).toContain("inputs.watch");
+ expect(progress.jobs["watch"]?.steps?.[0]?.with).toEqual(checkout?.with);
+ expect(
+ progress.jobs["watch"]?.steps?.at(-1)?.env?.["RELEASE_PROGRESS_WATCH"],
+ ).toBe("true");
+ const publication = (
+ Bun.YAML.parse(githubReleaseWorkflow) as WorkflowContract
+ ).jobs;
+ expect(publication["installed"]?.needs).toBe("release");
+ });
+
test("dispatches GitHub releases after publishing with isolated permissions", () => {
expect(protectedReleaseWorkflow).toContain(
[
@@ -2619,33 +2724,71 @@ describe("GitHub release workflow safeguards", () => {
},
);
- test("dispatches the exact protected run and release tag from trusted main", async () => {
- const script = workflowStepShell(
- protectedReleaseWorkflow,
- "Dispatch the verified GitHub release",
- );
- const mock = "gh() { printf '%s\\n' \"$@\"; }";
- const result = await runShell(`${mock}\n${script}`, {
- GITHUB_REPOSITORY: releaseRepository,
- RELEASE_RUN_ID: releaseRun,
- RELEASE_TAG: "npm-v0.1.2",
- });
-
- expect(result.status).toBe(0);
- expect(result.stdout.trim().split("\n")).toEqual([
- "workflow",
- "run",
- "node-github-release.yml",
- "--repo",
- releaseRepository,
- "--ref",
- "main",
- "-f",
- "tag=npm-v0.1.2",
- "-f",
- `run_id=${releaseRun}`,
- ]);
- });
+ test.each([
+ {
+ workflow: releaseCutWorkflow,
+ step: "Dispatch the protected npm release",
+ target: "node-release.yml",
+ fields: ["-f", "ref=npm-v0.1.2"],
+ },
+ {
+ workflow: protectedReleaseWorkflow,
+ step: "Dispatch the verified GitHub release",
+ target: "node-github-release.yml",
+ fields: [
+ "-f",
+ "ref=main",
+ "-f",
+ "inputs[tag]=npm-v0.1.2",
+ "-f",
+ `inputs[run_id]=${releaseRun}`,
+ ],
+ },
+ ])(
+ "dispatches $target with exact release inputs and records its run",
+ async ({ workflow, step, target, fields }) => {
+ const script = workflowStepShell(workflow, step);
+ const output = join(directories.create("release-dispatch-"), "output");
+ writeFileSync(output, "");
+ const mock = "gh() { printf '%s\\n' \"$@\" >&2; printf '12345\\n'; }";
+ const env = {
+ GITHUB_REPOSITORY: releaseRepository,
+ RELEASE_RUN_ID: releaseRun,
+ RELEASE_TAG: "npm-v0.1.2",
+ GITHUB_OUTPUT: output,
+ };
+ const result = await runShell(`${mock}\n${script}`, env);
+ expect(result.status).toBe(0);
+ expect(result.stderr.trim().split("\n")).toEqual([
+ "api",
+ "--method",
+ "POST",
+ "-H",
+ "X-GitHub-Api-Version: 2026-03-10",
+ `repos/${releaseRepository}/actions/workflows/${target}/dispatches`,
+ ...fields,
+ "--jq",
+ ".workflow_run_id",
+ ]);
+ expect(readFileSync(output, "utf8")).toBe("run-id=12345\n");
+ writeFileSync(output, "");
+ const failed = await runShell(`gh() { return 1; }\n${script}`, env);
+ expect(failed.status).toBe(1);
+ expect(readFileSync(output, "utf8")).toBe("");
+ const parsed = Bun.YAML.parse(workflow) as WorkflowContract;
+ const notification = Object.values(parsed.jobs)
+ .flatMap((job) => job.steps ?? [])
+ .find((step) => step.name === "Start release progress observer");
+ expect(notification?.["continue-on-error"]).toBe(true);
+ expect(notification?.if).toBe("steps.dispatch.outputs.run-id != ''");
+ expect(notification?.run).toContain(
+ "timeout --kill-after=5s 10s gh workflow run release-progress.yml",
+ );
+ expect(notification?.run).toContain(
+ '-f "run-id=$RELEASE_RUN_ID" -f watch=true',
+ );
+ },
+ );
test("serializes every GitHub release and historical backfill", () => {
expect(githubReleaseWorkflow).toMatch(
@@ -3934,7 +4077,10 @@ describe("GitHub release workflow safeguards", () => {
test.each([
{ title: "fix: retitle an internal change", expectedLabel: "bug" },
- { title: "feat: retitle an internal change", expectedLabel: "enhancement" },
+ {
+ title: "feat: retitle an internal change",
+ expectedLabel: "enhancement",
+ },
{
title: "docs: retitle an internal change",
expectedLabel: "documentation",
diff --git a/sdk/typescript/tests-ts/scan-owner-suggestions.test.ts b/sdk/typescript/tests-ts/scan-owner-suggestions.test.ts
index 9ad6819b6..9f26eb0f2 100644
--- a/sdk/typescript/tests-ts/scan-owner-suggestions.test.ts
+++ b/sdk/typescript/tests-ts/scan-owner-suggestions.test.ts
@@ -131,7 +131,7 @@ test("rejects a changed checkout before starting owner inference", async () => {
});
test.each([true, false])(
- "subdirectory owners use Git-root paths (root collision=%s)",
+ "subdirectory owners use Git-root paths (root collision=%p)",
async (collision) => {
const { repository, result } = await fixture();
const service = join(repository, "service");
diff --git a/sdk/typescript/tests-ts/scan-progress.test.ts b/sdk/typescript/tests-ts/scan-progress.test.ts
index 71dd38cf7..ba963c52a 100644
--- a/sdk/typescript/tests-ts/scan-progress.test.ts
+++ b/sdk/typescript/tests-ts/scan-progress.test.ts
@@ -47,7 +47,7 @@ test.each([
["discovery", -1, 13],
["discovery", 14, 13],
] as const)(
- "rejects invalid saved progress (%s, %s/%s)",
+ "rejects invalid saved progress (%s, %p/%p)",
(phase, completed, total) => {
expect(() =>
scanProgressFromWorkbench(savedProgress(phase, completed, total)),
diff --git a/sdk/typescript/tests-ts/workflow-quality.test.ts b/sdk/typescript/tests-ts/workflow-quality.test.ts
index 6b81be85e..7ebb0a4f0 100644
--- a/sdk/typescript/tests-ts/workflow-quality.test.ts
+++ b/sdk/typescript/tests-ts/workflow-quality.test.ts
@@ -65,6 +65,24 @@ bashTest(
],
["pull_request", false, [".github/actionlint.yaml"], "true"],
["pull_request", false, [".github/zizmor.yml"], "true"],
+ [
+ "pull_request",
+ false,
+ [".github/scripts/release-progress.mjs"],
+ "true",
+ ],
+ [
+ "pull_request",
+ false,
+ [".github/scripts/test_release_progress.mjs"],
+ "true",
+ ],
+ [
+ "pull_request",
+ false,
+ ["sdk/typescript/scripts/release-pr.mjs"],
+ "true",
+ ],
["pull_request", false, ["docker/verify-container-compose.sh"], "true"],
["pull_request", false, ["sdk/typescript/src/index.ts"], "false"],
["pull_request", false, ["README.md"], "false"],