Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

Show the weekly benchmark in every stable release plan, ready to hold a measured drop (GST-3606) (#4755)

Garry Tana9c746fa0c5c
diff --git a/.github/workflows/weekly-release.yml b/.github/workflows/weekly-release.yml
index 534e5862d..ce4495b93 100644
--- a/.github/workflows/weekly-release.yml
+++ b/.github/workflows/weekly-release.yml
@@ -15,7 +15,9 @@ name: Stable release
# security input, naming a GHSA, CVE or #<n> the script ties to the released
# commits) and a regression cut (the regression input, naming a
# regression-labelled #<n> and the earlier stable release v<X> the behavior
-# worked in). Run it by hand with a
+# worked in). Every cut plan also prints the weekly benchmark's BENCHMARK: line
+# (crew/lib/release-benchmark.ts); benchmark_waiver lets a hand cut past a
+# standing HOLD once holds are switched on. Run it by hand with a
# ref for a hotfix, or with dry_run to see the plan and change nothing. A pull request that touches
# the release tooling runs the dry run against main with a read-only token,
# which is the only pre-merge exercise of the real workflow. The candidate's
@@ -47,6 +49,10 @@ on:
description: 'Regression cut (needs ref): the reason, naming the regression-labelled #<n> it fixes and the earlier stable release v<X> it worked in; passes the 72-hour floor once verified and lands in the release notes'
type: string
default: ''
+ benchmark_waiver:
+ description: 'Hand cut past a weekly benchmark HOLD: why the measured drop is accepted or explained; written to the tag message (docs/releases.md#weekly-benchmark); not with daily'
+ type: string
+ default: ''
daily:
description: 'Run the daily check now (an important change past 24 h, a forced cut at 7 days, the regular cut on Monday or Thursday) instead of a plain cut; no ref, security or regression'
type: boolean
@@ -58,6 +64,7 @@ on:
- 'crew/scripts/release-notes.ts'
- 'crew/scripts/release-cadence.ts'
- 'lib/changelog-fragments.ts'
+ - 'crew/lib/release-benchmark.ts'
# One cut at a time; a second dispatch waits for the first. A pull request's
# dry run is its own group.
@@ -110,6 +117,7 @@ jobs:
RELEASE_REF: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
SECURITY_REASON: ${{ github.event_name == 'workflow_dispatch' && inputs.security || '' }}
REGRESSION_REASON: ${{ github.event_name == 'workflow_dispatch' && inputs.regression || '' }}
+ BENCHMARK_WAIVER: ${{ github.event_name == 'workflow_dispatch' && inputs.benchmark_waiver || '' }}
DAILY: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.daily)) && 'true' || 'false' }}
run: |
set -euo pipefail
@@ -125,8 +133,8 @@ jobs:
echo "::error::a regression cut needs ref: the full SHA of the fix commit on main"
exit 1
fi
- if [ "$DAILY" = true ] && [ -n "$RELEASE_REF$SECURITY_REASON$REGRESSION_REASON" ]; then
- echo "::error::the daily check picks its own candidate: run ref, security or regression without daily"
+ if [ "$DAILY" = true ] && [ -n "$RELEASE_REF$SECURITY_REASON$REGRESSION_REASON$BENCHMARK_WAIVER" ]; then
+ echo "::error::the daily check picks its own candidate: run ref, security, regression or benchmark_waiver without daily"
exit 1
fi
args=(--repo "$GITHUB_REPOSITORY" --summary "$GITHUB_STEP_SUMMARY")
@@ -135,6 +143,7 @@ jobs:
[ -n "$RELEASE_REF" ] && args+=(--ref "$RELEASE_REF")
[ -n "$SECURITY_REASON" ] && args+=(--security "$SECURITY_REASON")
[ -n "$REGRESSION_REASON" ] && args+=(--regression "$REGRESSION_REASON")
+ [ -n "$BENCHMARK_WAIVER" ] && args+=(--benchmark-waiver "$BENCHMARK_WAIVER")
echo "## Stable release ($([ "$DRY_RUN" = true ] && echo 'dry run' || echo 'cut')$([ "$DAILY" = true ] && echo ', daily check'), $GITHUB_EVENT_NAME)" >> "$GITHUB_STEP_SUMMARY"
bun --no-env-file --config=/dev/null --no-install run crew/scripts/release-cut.ts "${args[@]}"
diff --git a/changelog.d/stable-release-reads-weekly-benchmark.md b/changelog.d/stable-release-reads-weekly-benchmark.md
new file mode 100644
index 000000000..a81cccb93
--- /dev/null
+++ b/changelog.d/stable-release-reads-weekly-benchmark.md
@@ -0,0 +1,3 @@
+### For contributors
+
+- **Every stable release plan now prints the weekly benchmark's result, so you can see whether this week's gstack measurably fixes more or fewer bugs than the current stable release.** The release tool reads the weekly record gstack-evals publishes, and a measured drop will hold the regular cut once holding is switched on after two weekly records. Security, data-loss and regression fixes still ship. A hand-run cut can pass a hold with the new `benchmark_waiver` input. See docs/releases.md#weekly-benchmark.
diff --git a/crew/lib/release-benchmark.ts b/crew/lib/release-benchmark.ts
new file mode 100644
index 000000000..08dca7543
--- /dev/null
+++ b/crew/lib/release-benchmark.ts
@@ -0,0 +1,135 @@
+/**
+ * release-benchmark: the stable cut reads gstack-evals' weekly benchmark (docs/releases.md#weekly-benchmark).
+ * Garry, 2026-11-21: "Is Gstack this week significantly better than last week?" gstack-evals measures the release
+ * candidate against stable and no gstack every Saturday and publishes weekly.json on a GitHub release tagged
+ * weekly-<yyyy>-w<nn> (-r<k> for a re-measure or correction; lanes/weekly-stable in garrytan/gstack-evals). The
+ * newest record by run start that is not INCOMPLETE decides, the same rule gstack-evals' own resolver uses, so both
+ * sides agree on whether a HOLD stands. A HOLD never goes stale; GAIN, NO_CHANGE and FLAG lines stop counting at
+ * their stale_after time. With BENCHMARK.hold false (the first two weekly records) the cut only prints the
+ * BENCHMARK: line. Repo-local type imports only, so gstack-evals' shim still loads release-cut.ts in a bare clone.
+ */
+import type { ImportantChange, Trigger } from '../scripts/release-cadence';
+import type { Gh, Git } from '../scripts/release-cut';
+
+export const BENCHMARK = { repo: 'garrytan/gstack-evals', asset: 'weekly.json', hold: false } as const;
+export const VERDICTS = ['HOLD', 'GAIN', 'NO_CHANGE', 'INCOMPLETE'] as const;
+export type Verdict = (typeof VERDICTS)[number];
+const TAG = /^weekly-\d{4}-w\d{2}(-r\d+)?$/;
+const SHA = /^[0-9a-f]{40}$/;
+const DAY = 86_400_000;
+const URGENT = new Set(['security', 'data-loss', 'regression']);
+
+export interface ModelRow { host?: string; n: number; d: number; lo: number; hi: number; vs_none?: { d: number; lo: number; hi: number } }
+export interface WeeklyRecord {
+ tag: string; week: string; verdict: Verdict; start: number;
+ candidate: { sha: string }; stable: { tag: string; sha: string };
+ models: Record<string, ModelRow>; flags: string[]; incomplete_reason: string | null; stale_after: string | null;
+}
+export type Records = { ok: true; records: WeeklyRecord[] } | { ok: false; why: string };
+export interface BenchmarkStatus { state: 'none' | 'clear' | 'hold' | 'unreadable'; line: string; record: WeeklyRecord | null }
+export interface Gate { action: 'pass' | 'wait' | 'refuse'; code?: 'REFUSED_BENCHMARK' | 'STABLE_STALE' | 'BENCHMARK_UNKNOWN'; line?: string; level?: 'notice' | 'warning' | 'error' }
+
+const clean = (s: unknown) => String(s).replace(/[\u0000-\u001f\u007f]+/g, ' ');
+const short = (s: string) => clean(s.trim()).slice(0, 200);
+const retried = (gh: Gh, args: string[]) => { const r = gh(args); return r.status === 0 ? r : gh(args); };
+const num = (x: unknown) => typeof x === 'number' && Number.isFinite(x);
+const f1 = (x: number) => (x >= 0 ? '+' : '') + x.toFixed(1);
+
+/** One record, checked: schema 1, a known verdict, a run start, 40-hex shas, numeric model rows, and a verdict its model rows agree with (HOLD exactly when some row's interval lies wholly below 0). A vs_none with a non-numeric field is dropped, since it never decides; text is stripped of control characters so it cannot start a workflow command in the job log. */
+export function parseRecord(tag: string, text: string): WeeklyRecord | string {
+ let r: any;
+ try { r = JSON.parse(text); } catch { return tag + "'s " + BENCHMARK.asset + ' is not JSON'; }
+ if (r?.schema !== 1) return tag + ': schema ' + r?.schema + ', not 1';
+ if (!VERDICTS.includes(r.verdict)) return tag + ': verdict ' + r.verdict + ' is not ' + VERDICTS.join(', ');
+ const start = Date.parse(r.window?.start);
+ if (!Number.isFinite(start)) return tag + ': window.start is not a time';
+ if (!SHA.test(r.candidate?.sha ?? '') || !SHA.test(r.stable?.sha ?? '')) return tag + ': candidate or stable is not a 40-hex sha';
+ const models = (r.models && typeof r.models === 'object' ? r.models : {}) as Record<string, ModelRow>;
+ const rows: Record<string, ModelRow> = {};
+ for (const [id, m] of Object.entries(models)) {
+ if (![m?.n, m?.d, m?.lo, m?.hi].every(num)) return tag + ': model row ' + clean(id) + ' is not numeric';
+ const v = m.vs_none;
+ rows[clean(id)] = { host: m.host, n: m.n, d: m.d, lo: m.lo, hi: m.hi, ...(v && [v.d, v.lo, v.hi].every(num) ? { vs_none: { d: v.d, lo: v.lo, hi: v.hi } } : {}) };
+ }
+ if (Object.values(rows).some((m) => m.hi < 0) !== (r.verdict === 'HOLD')) return tag + ': verdict ' + r.verdict + ' disagrees with its model rows (verdict mismatch)';
+ return {
+ tag, week: clean(r.week ?? tag), verdict: r.verdict, start, candidate: { sha: r.candidate.sha }, stable: { tag: clean(r.stable.tag ?? '?'), sha: r.stable.sha },
+ models: rows, flags: Array.isArray(r.flags) ? r.flags.map(clean) : [], incomplete_reason: r.incomplete_reason == null ? null : clean(r.incomplete_reason),
+ stale_after: typeof r.stale_after?.verdict === 'string' ? r.stale_after.verdict : null,
+ };
+}
+
+/** Every published weekly record, each list or download retried once; any failure makes the whole read unreadable, so an older record never decides past a newer one nobody could read. */
+export function readRecords(gh: Gh, repo: string = BENCHMARK.repo): Records {
+ const list = retried(gh, ['release', 'list', '--repo', repo, '--limit', '200', '--json', 'tagName']);
+ if (list.status !== 0) return { ok: false, why: 'gh release list failed: ' + short(list.stderr) };
+ let tags: string[];
+ try { tags = (JSON.parse(list.stdout) as { tagName: string }[]).map((x) => x.tagName).filter((t) => TAG.test(t)); } catch { return { ok: false, why: 'gh release list did not return JSON' }; }
+ const records: WeeklyRecord[] = [];
+ for (const tag of tags) {
+ const d = retried(gh, ['release', 'download', tag, '--repo', repo, '-p', BENCHMARK.asset, '-O', '-']);
+ if (d.status !== 0) return { ok: false, why: 'gh release download ' + tag + ' failed: ' + short(d.stderr) };
+ const rec = parseRecord(tag, d.stdout);
+ if (typeof rec === 'string') return { ok: false, why: rec };
+ records.push(rec);
+ }
+ return { ok: true, records };
+}
+
+/** gstack-evals' order (lanes/weekly-stable/cli.ts holdFromReleases: run start, then resolve.ts byWeekDesc): newest run first, and on a tie a -r<k> correction before the record it follows. */
+const byTag = (a: string, b: string) => (a.slice(0, 15) !== b.slice(0, 15) ? (a.slice(0, 15) < b.slice(0, 15) ? 1 : -1) : Number(b.slice(17) || 0) - Number(a.slice(17) || 0));
+export const newestFirst = (records: WeeklyRecord[]) => [...records].sort((a, b) => b.start - a.start || byTag(a.tag, b.tag));
+
+function summary(r: WeeklyRecord): string {
+ const rows = Object.entries(r.models).map(([id, m]) => id + ' ' + f1(m.d) + ' [' + f1(m.lo) + ', ' + f1(m.hi) + '] on ' + m.n + ' pairs' + (m.vs_none ? '; vs no gstack ' + f1(m.vs_none.d) + ' [' + f1(m.vs_none.lo) + ', ' + f1(m.vs_none.hi) + ']' : ''));
+ return r.verdict + ' ' + r.tag + ' candidate=' + r.candidate.sha.slice(0, 12) + ' stable=' + r.stable.tag + (rows.length ? ' ' + rows.join('; ') : '') + '; ' + r.flags.length + ' flag' + (r.flags.length === 1 ? '' : 's');
+}
+
+/** What the records say about cutting candidate over stable. A HOLD applies when its commit is in the candidate and not yet on stable. */
+export function benchmarkStatus(o: { read: Records; git: Git; candidate: string; stable: string | null; now: number; hold?: boolean }): BenchmarkStatus {
+ const mode = ' (' + ((o.hold ?? BENCHMARK.hold) ? 'holding' : 'report only') + ')';
+ if (!o.read.ok) return { state: 'unreadable', line: 'BENCHMARK: unreadable (' + o.read.why + ')' + mode, record: null };
+ const sorted = newestFirst(o.read.records), r = sorted.find((x) => x.verdict !== 'INCOMPLETE') ?? null, newest = sorted[0];
+ const later = newest && newest !== r ? '; the newer ' + newest.tag + ' is INCOMPLETE (' + (newest.incomplete_reason ?? 'no reason given') + ')' : '';
+ if (!r) return { state: 'none', line: 'BENCHMARK: none (' + (newest ? 'every record is INCOMPLETE' + later : 'no weekly record published yet') + ')' + mode, record: null };
+ if (r.verdict !== 'HOLD') {
+ const stale = r.stale_after !== null && o.now > Date.parse(r.stale_after);
+ return { state: 'clear', line: 'BENCHMARK: ' + (stale ? 'stale (' + Math.floor((o.now - r.start) / DAY) + ' d) ' : '') + summary(r) + later + mode, record: r };
+ }
+ const held = r.candidate.sha;
+ if (!o.git(['cat-file', '-e', held + '^{commit}']).ok) return { state: 'unreadable', line: 'BENCHMARK: unreadable (the held commit ' + held.slice(0, 12) + ' is not in this clone) ' + summary(r) + mode, record: r };
+ if (o.stable && o.git(['merge-base', '--is-ancestor', held, o.stable]).ok) return { state: 'clear', line: 'BENCHMARK: ' + summary(r) + '; the held commit is already on stable, so GStack Minder picks fix-forward or rollback (docs/releases.md#rolling-stable-back)' + later + mode, record: r };
+ if (!o.git(['merge-base', '--is-ancestor', held, o.candidate]).ok) return { state: 'clear', line: 'BENCHMARK: ' + summary(r) + '; the candidate ' + o.candidate.slice(0, 12) + ' does not contain the held commit' + later + mode, record: r };
+ return { state: 'hold', line: 'BENCHMARK: ' + summary(r) + later + mode, record: r };
+}
+
+const WAIVE = "a later weekly record on a newer commit replaces the HOLD; or revert, or cut by hand: gh workflow run weekly-release.yml -f ref=<sha> -f benchmark_waiver='<why>' -f dry_run=false (docs/releases.md#weekly-benchmark)";
+
+/**
+ * What the cut does about the status (Garry's "Do it", 2026-11-23: A1 to E1). trigger is the daily check's trigger,
+ * or 'hand' for a plain or --ref cut. Urgent spans (important: security, data-loss or regression) and exception cuts
+ * pass with the held commit riding along. A regular or blocker-only cut waits quietly; the 7-day forced cut is
+ * STABLE_STALE, red, so someone fixes, reverts or waives (E1); a hand cut is refused. Unreadable records hold back only
+ * a regular cut, for a day; every other cut goes ahead with a warning.
+ */
+export function benchmarkGate(s: BenchmarkStatus, o: { hold?: boolean; trigger: Trigger | 'hand' | null; important: ImportantChange[]; exception: string | null; waiver: string | null }): Gate {
+ if (!(o.hold ?? BENCHMARK.hold)) return { action: 'pass' };
+ if (s.state === 'unreadable') {
+ if (o.trigger === 'regular') return { action: 'wait', code: 'BENCHMARK_UNKNOWN', level: 'notice', line: 'BENCHMARK_UNKNOWN: the weekly records could not be read, so a HOLD cannot be ruled out; the regular cut waits for the next daily run' };
+ return { action: 'pass', level: 'warning', line: 'BENCHMARK: this ' + (o.trigger ?? 'finishing') + ' cut goes ahead without the weekly benchmark check' };
+ }
+ if (s.state !== 'hold' || o.trigger === null) return { action: 'pass' };
+ const held = s.record!.candidate.sha.slice(0, 12) + ' (' + s.record!.tag + ')';
+ const urgent = o.exception ?? o.important.filter((c) => URGENT.has(c.kind)).map((c) => c.kind).join(', ');
+ if (urgent) return { action: 'pass', level: 'warning', line: 'BENCHMARK: HOLD on ' + held + ' bypassed by ' + urgent + '; the held commit ships with the fix' };
+ if (o.waiver) return { action: 'pass', level: 'warning', line: 'BENCHMARK: HOLD on ' + held + ' waived: ' + o.waiver };
+ if (o.trigger === 'forced') return { action: 'refuse', code: 'STABLE_STALE', level: 'error', line: 'STABLE_STALE: stable is 7 days old and the weekly benchmark holds ' + held + '; ' + WAIVE };
+ if (o.trigger === 'hand') return { action: 'refuse', code: 'REFUSED_BENCHMARK', level: 'error', line: 'REFUSED_BENCHMARK: the weekly benchmark holds ' + held + '; ' + WAIVE };
+ return { action: 'wait', code: 'REFUSED_BENCHMARK', level: 'notice', line: 'REFUSED_BENCHMARK: the ' + o.trigger + ' cut waits: the weekly benchmark holds ' + held + '; ' + WAIVE };
+}
+
+/** The waiver an earlier run of this cut wrote into its annotated tag, so a retry of a half-finished cut is not held again. */
+export function waiverFromTag(git: Git, tag: string): string | null {
+ const t = git(['tag', '-l', '--format=%(contents)', tag]);
+ return t.ok ? /^Benchmark-waiver: (.+)$/m.exec(t.out)?.[1]?.trim() ?? null : null;
+}
diff --git a/crew/scripts/release-cut.ts b/crew/scripts/release-cut.ts
index b74e3f537..7a201571f 100755
--- a/crew/scripts/release-cut.ts
+++ b/crew/scripts/release-cut.ts
@@ -9,7 +9,7 @@
* Thursday) and by hand (--ref <sha on main> for a hotfix). Dry runs print the
* plan and change nothing.
*
- * bun crew/scripts/release-cut.ts --repo owner/name [--ref <sha>] [--security <reason> | --regression <reason>] [--daily [--fragments-dir <dir>]] [--dry-run]
+ * bun crew/scripts/release-cut.ts --repo owner/name [--ref <sha>] [--security <reason> | --regression <reason>] [--benchmark-waiver <why the HOLD is accepted>] [--daily [--fragments-dir <dir>]] [--dry-run]
* [--summary <file>] [--required-check <name>] [--backstop-check <name>] [--notes-ref <ref>]
*
* The checkout needs origin's full history (fetch-depth 0). Green, for a
@@ -68,10 +68,11 @@ import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { spawnSync } from '../../lib/spawn-sync';
-import { FLOOR_HOURS, IMPORTANT_FLOOR_HOURS, SCHEDULED_GRACE_HOURS, decideDaily, importantChanges, type DailyDecision } from './release-cadence';
+import { FLOOR_HOURS, IMPORTANT_FLOOR_HOURS, SCHEDULED_GRACE_HOURS, decideDaily, importantChanges, type DailyDecision, type ImportantChange, type Trigger } from './release-cadence';
import { KIND_LABEL, NOTES_CAP, changeSources, changelogEntries, compareVersions, releaseKind, releaseNotes } from './release-notes';
import { bucketClass } from '../../lib/ci-gate';
import { headCheckRows, type AsideRuns } from '../../lib/ci-head-checks';
+import { BENCHMARK, benchmarkGate, benchmarkStatus, readRecords, waiverFromTag, type BenchmarkStatus, type Records } from '../lib/release-benchmark';
export { FLOOR_HOURS, SCHEDULED_GRACE_HOURS };
export { NOTES_CAP, changelogEntries, compareVersions, releaseKind, releaseNotes };
@@ -512,13 +513,13 @@ export function planRelease(o: PlanOptions): PlanResult {
export interface CutResult { ok: boolean; lines: string[] }
/** Tag, push stable and create the release for a plan; each step is skipped when already done. */
-export function cutRelease(p: Plan, o: { repo: string; git: Git; gh: Gh; notesDir?: string }): CutResult {
+export function cutRelease(p: Plan, o: { repo: string; git: Git; gh: Gh; notesDir?: string; waiver?: string | null }): CutResult {
const { git, gh } = o;
const lines: string[] = [];
const existing = git(['rev-parse', '--verify', '-q', 'refs/tags/' + p.tag + '^{commit}']);
if (existing.ok && existing.out !== p.sha) return { ok: false, lines: ['TAG: ' + p.tag + ' already names ' + existing.out.slice(0, 12) + ', not ' + p.sha.slice(0, 12)] };
if (!existing.ok) {
- const message = 'gstack ' + p.tag + ' (' + releaseKind(p.hotfix, p.exception) + ' release)' + (p.exception ? '\n\n' + KIND_LABEL[p.exception.kind] + ': ' + p.exception.reason + '\nVerified: ' + p.exception.evidence : '');
+ const message = 'gstack ' + p.tag + ' (' + releaseKind(p.hotfix, p.exception) + ' release)' + (p.exception ? '\n\n' + KIND_LABEL[p.exception.kind] + ': ' + p.exception.reason + '\nVerified: ' + p.exception.evidence : '') + (o.waiver ? '\n\nBenchmark-waiver: ' + o.waiver : '');
const t = git(['tag', '-a', p.tag, p.sha, '-m', message]);
if (!t.ok) return { ok: false, lines: [...lines, 'TAG: failed: ' + t.out] };
const push = git(['push', 'origin', 'refs/tags/' + p.tag]);
@@ -577,7 +578,7 @@ export function describePlan(p: Plan, dryRun: boolean): string[] {
* important changes are still waiting on the gate. A plan that cleared while the daily check itself
* cannot date stable is held as FLOOR_UNKNOWN, so a null decision never reaches a cut.
*/
-export function planDaily(o: PlanOptions & { fragmentsDir?: string }): { planned: PlanResult; decision: DailyDecision | null; lines: string[] } {
+export function planDaily(o: PlanOptions & { fragmentsDir?: string }): { planned: PlanResult; decision: DailyDecision | null; lines: string[]; important: ImportantChange[] } {
const { git, gh, repo } = o;
const planned = planRelease({ ...o, floorHours: IMPORTANT_FLOOR_HOURS });
const stable = git(['rev-parse', '--verify', '-q', 'refs/remotes/origin/stable^{commit}']);
@@ -594,14 +595,15 @@ export function planDaily(o: PlanOptions & { fragmentsDir?: string }): { planned
const waiting = main.ok ? importantChanges(git, prev, main.out, o.fragmentsDir) : [];
const why = moved && moved.at === null ? moved.why : 'origin/main does not resolve';
const held: PlanResult = planned.ok ? { ok: false, code: 'FLOOR_UNKNOWN', message: why + '; the daily check cannot pick a trigger, so nothing is cut', next: 'none until the next daily run can date stable', plan: planned.plan } : planned;
- return { planned: held, decision: null, lines: waiting.length ? ['IMPORTANT_UNGATED: ' + waiting.map(c => c.kind + ' in ' + (c.pr ? '#' + c.pr : c.commit.slice(0, 12))).join(', ') + ' is on main but no cut can run (below)'] : [] };
+ return { planned: held, decision: null, lines: waiting.length ? ['IMPORTANT_UNGATED: ' + waiting.map(c => c.kind + ' in ' + (c.pr ? '#' + c.pr : c.commit.slice(0, 12))).join(', ') + ' is on main but no cut can run (below)'] : [], important: [] };
}
- if (planned.ok && planned.plan.stableAt) return { planned, decision: { action: 'cut', trigger: null, lines: ['DAILY: cut (finishing the cut that already moved stable)'] }, lines: [] };
+ if (planned.ok && planned.plan.stableAt) return { planned, decision: { action: 'cut', trigger: null, lines: ['DAILY: cut (finishing the cut that already moved stable)'] }, lines: [], important: [] };
+ const important = importantChanges(git, prev, sha, o.fragmentsDir);
const decision = decideDaily({
now: o.now?.() ?? Date.now(), scheduled: Boolean(o.scheduled), candidate: sha, stableMovedAt: moved?.at ?? null, gatedChanges: sha !== prev, mainAhead: main.out !== prev,
- important: importantChanges(git, prev, sha, o.fragmentsDir), ungated: importantChanges(git, sha, main.out, o.fragmentsDir), releasePr: !noReleasePr,
+ important, ungated: importantChanges(git, sha, main.out, o.fragmentsDir), releasePr: !noReleasePr,
});
- return { planned, decision, lines: [] };
+ return { planned, decision, lines: [], important };
}
function arg(name: string): string | undefined {
@@ -615,15 +617,16 @@ if (import.meta.main) {
const summary = arg('--summary');
const security = arg('--security');
const regression = arg('--regression');
+ const waiverArg = arg('--benchmark-waiver');
const empty = (flag: string, value: string | undefined) => process.argv.includes(flag) && (!value || value.startsWith('--'));
- if (!repo || empty('--security', security) || empty('--regression', regression)) {
- console.error('usage: release-cut.ts --repo owner/name [--ref <sha>] [--security <reason naming GHSA-…|CVE-…|#n> | --regression <reason naming #n and the v<X> it worked in>] [--daily [--fragments-dir <dir>]] [--dry-run] [--summary <file>] [--required-check <name>] [--backstop-check <name>] [--notes-ref <ref>]');
+ if (!repo || empty('--security', security) || empty('--regression', regression) || empty('--benchmark-waiver', waiverArg)) {
+ console.error('usage: release-cut.ts --repo owner/name [--ref <sha>] [--security <reason naming GHSA-…|CVE-…|#n> | --regression <reason naming #n and the v<X> it worked in>] [--benchmark-waiver <why the HOLD is accepted>] [--daily [--fragments-dir <dir>]] [--dry-run] [--summary <file>] [--required-check <name>] [--backstop-check <name>] [--notes-ref <ref>]');
process.exit(2);
}
const scheduled = process.env.GITHUB_EVENT_NAME === 'schedule';
const daily = process.argv.includes('--daily');
- if (daily && (arg('--ref') || security !== undefined || regression !== undefined)) {
- console.error('release-cut.ts: --daily picks its own candidate and trigger; run --ref, --security or --regression without it');
+ if (daily && (arg('--ref') || security !== undefined || regression !== undefined || waiverArg !== undefined)) {
+ console.error('release-cut.ts: --daily picks its own candidate and trigger; run --ref, --security, --regression or --benchmark-waiver without it');
process.exit(2);
}
const git = gitIn(process.cwd());
@@ -636,9 +639,13 @@ if (import.meta.main) {
};
const options = { repo, ref: arg('--ref'), git, gh: runGh, requiredCheck: arg('--required-check'), backstopCheck: arg('--backstop-check'), notesRef: arg('--notes-ref'), scheduled, security, regression };
let planned: PlanResult;
+ let trigger: Trigger | 'hand' | null = 'hand';
+ let important: ImportantChange[] = [];
if (daily) {
const day = planDaily({ ...options, fragmentsDir: arg('--fragments-dir') });
planned = day.planned;
+ trigger = day.decision?.trigger ?? null;
+ important = day.important;
emit([...(day.decision?.lines ?? []), ...day.lines]);
// A day with no trigger or a trigger still under its floor is the policy working: exit 0 with a
// notice. A due cut that cannot run (NO_RELEASE_PR, STABLE_STALE) goes red so someone acts; a dry
@@ -661,11 +668,23 @@ if (import.meta.main) {
if (planned.code !== 'NOTHING_NEW' && planned.code !== 'NO_GREEN_COMMIT') annotate(hold ? (planned.code === 'NO_RELEASE_PR' ? 'warning' : 'notice') : 'error', planned.code, planned.code + ': ' + planned.message + (planned.next ? ' NEXT_ALLOWED: ' + planned.next : ''));
process.exit(planned.code === 'NOTHING_NEW' || (dryRun && planned.code === 'NO_GREEN_COMMIT') || hold ? 0 : 1);
}
- emit(describePlan(planned.plan, dryRun));
+ // The weekly benchmark (crew/lib/release-benchmark.ts): every cut plan prints its BENCHMARK: line; with
+ // BENCHMARK.hold on, a standing HOLD waits, goes red or refuses the cut as benchmarkGate says.
+ const p = planned.plan;
+ const waiver = waiverArg !== undefined ? sanitizeReason(waiverArg) : p.tagExists === 'same' ? waiverFromTag(git, p.tag) : null;
+ const benchOf = (read: Records) => benchmarkStatus({ read, git, candidate: p.sha, stable: p.prevStable, now: Date.now() });
+ let bench: BenchmarkStatus;
+ try { bench = benchOf(readRecords(runGh)); } catch (e) { bench = benchOf({ ok: false, why: 'the records could not be judged: ' + String(e).replace(/\s+/g, ' ').slice(0, 200) }); }
+ const gate = benchmarkGate(bench, { trigger: p.stableAt ? null : trigger, important: trigger === 'hand' ? importantChanges(git, p.prevStable, p.sha) : important, exception: p.exception?.kind ?? null, waiver });
+ const described = describePlan(p, dryRun && gate.action === 'pass'), at = described.findIndex(l => l.startsWith('DRY_RUN:'));
+ described.splice(at < 0 ? described.length : at, 0, bench.line, ...(gate.line ? [gate.line] : []));
+ emit(described);
+ if (gate.level && gate.line) annotate(gate.action === 'refuse' && dryRun ? 'warning' : gate.level, gate.code ?? 'BENCHMARK', gate.line);
+ if (gate.action !== 'pass') process.exit(gate.action === 'refuse' && !dryRun ? 1 : 0);
if (summary) fs.appendFileSync(summary, '\n<details><summary>Release notes</summary>\n\n' + planned.plan.notes + '\n</details>\n');
else console.log('--- notes ---\n' + planned.plan.notes);
if (dryRun) process.exit(0);
- const cut = cutRelease(planned.plan, { repo, git, gh: runGh });
+ const cut = cutRelease(planned.plan, { repo, git, gh: runGh, waiver: BENCHMARK.hold && bench.state === 'hold' ? waiver : null });
emit(cut.lines);
process.exit(cut.ok ? 0 : 1);
}
diff --git a/crew/test/release-benchmark.test.ts b/crew/test/release-benchmark.test.ts
new file mode 100644
index 000000000..3b4b8ea59
--- /dev/null
+++ b/crew/test/release-benchmark.test.ts
@@ -0,0 +1,209 @@
+/**
+ * release-benchmark (free): the stable cut reads gstack-evals' weekly benchmark records (docs/releases.md#weekly-benchmark).
+ * Records here have the shape gstack-evals' lanes/weekly-stable/read.ts weekRecord writes (schema 1). The newest record
+ * by run start that is not INCOMPLETE decides; a HOLD never goes stale; with the hold switched on, urgent cuts pass, a
+ * regular cut waits, the 7-day forced cut goes red and a hand cut is refused (Garry's "Do it", 2026-11-23).
+ */
+import { describe, expect, test } from 'bun:test';
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { BENCHMARK, benchmarkGate, benchmarkStatus, newestFirst, parseRecord, readRecords, waiverFromTag, type BenchmarkStatus, type Records, type WeeklyRecord } from '../lib/release-benchmark';
+import type { ImportantChange } from '../scripts/release-cadence';
+import type { Gh, Git } from '../scripts/release-cut';
+
+const sha = (c: string) => c.repeat(40);
+const HELD = sha('a'), STABLE = sha('b'), CAND = sha('c'), OTHER = sha('d');
+const DAY = 86_400_000;
+const NOW = Date.parse('2026-12-10T12:00:00Z');
+
+function rec(verdict: string, o: { week?: string; start?: string; cand?: string; hi?: number } = {}) {
+ const start = o.start ?? '2026-11-28T06:00:00Z', ran = verdict !== 'INCOMPLETE';
+ const hi = o.hi ?? (verdict === 'HOLD' ? -0.8 : 4.0);
+ return {
+ schema: 1, week: o.week ?? '2026-W48', task_set: 'v1', candidate: { sha: o.cand ?? HELD }, stable: { tag: 'v1.103.0.0', sha: STABLE }, window: { start, end: start }, verdict,
+ mdd_points: 5.5, interval: 0.95,
+ models: ran ? { 'claude-opus-5-5': { host: 'claude-code', n: 390, d: hi - 4, lo: hi - 8, hi, vs_none: { d: -2.1, lo: -6, hi: 1.7 } } } : {},
+ areas: [], flags: ['gpt-6.2-sol not run'], incomplete_reason: ran ? null : 'the smoke failed', stopped_early: false,
+ stale_after: { verdict: verdict === 'HOLD' ? null : new Date(Date.parse(start) + 9 * DAY).toISOString(), flags: new Date(Date.parse(start) + 9 * DAY).toISOString() },
+ realized: null, results_check: 'pass', prereg: 'x', results: 'x', run: 'x',
+ };
+}
+const parsed = (tag: string, r: object) => parseRecord(tag, JSON.stringify(r)) as WeeklyRecord;
+const records = (...rs: [string, object][]): Records => ({ ok: true, records: rs.map(([tag, r]) => parsed(tag, r)) });
+
+/** Ancestry as a set of [ancestor, descendant] pairs; every listed sha exists. */
+function fakeGit(edges: [string, string][], o: { missing?: string[]; tags?: Record<string, string> } = {}): Git {
+ return (args) => {
+ if (args[0] === 'cat-file') return { ok: !(o.missing ?? []).some((m) => args[2]!.startsWith(m)), out: '' };
+ if (args[0] === 'merge-base') return { ok: args[2] === args[3] || edges.some(([a, d]) => a === args[2] && d === args[3]), out: '' };
+ if (args[0] === 'tag') { const t = o.tags?.[args[3]!]; return t === undefined ? { ok: true, out: '' } : { ok: true, out: t }; }
+ return { ok: false, out: 'unexpected git ' + args.join(' ') };
+ };
+}
+const inCandidate = fakeGit([[STABLE, CAND], [HELD, CAND], [STABLE, HELD]]);
+const status = (read: Records, git: Git = inCandidate, hold = true) => benchmarkStatus({ read, git, candidate: CAND, stable: STABLE, now: NOW, hold });
+const urgent = (kind: ImportantChange['kind']): ImportantChange[] => [{ kind, path: 'changelog.d/x.md', commit: OTHER, pr: '1' }];
+
+describe('release-benchmark: reading the records', () => {
+ test('parseRecord checks schema, verdict, run start, shas and numbers, and refuses a verdict its model rows contradict', () => {
+ expect(parsed('weekly-2026-w48', rec('NO_CHANGE')).verdict).toBe('NO_CHANGE');
+ expect(parseRecord('t', 'not json')).toContain('is not JSON');
+ expect(parseRecord('t', JSON.stringify({ ...rec('GAIN'), schema: 2 }))).toContain('schema 2, not 1');
+ expect(parseRecord('t', JSON.stringify({ ...rec('GAIN'), verdict: 'FLAG' }))).toContain('verdict FLAG is not');
+ expect(parseRecord('t', JSON.stringify({ ...rec('GAIN'), window: { start: 'soon' } }))).toContain('window.start is not a time');
+ expect(parseRecord('t', JSON.stringify({ ...rec('GAIN'), candidate: { sha: 'abc' } }))).toContain('not a 40-hex sha');
+ expect(parseRecord('t', JSON.stringify({ ...rec('HOLD'), models: { m: { n: 1, d: 'x', lo: 0, hi: -1 } } }))).toContain('is not numeric');
+ expect(parseRecord('t', JSON.stringify({ ...rec('NO_CHANGE', { hi: -0.1 }) }))).toContain('verdict mismatch');
+ expect(parseRecord('t', JSON.stringify({ ...rec('HOLD', { hi: 0.4 }) }))).toContain('verdict mismatch');
+ expect(parsed('t', rec('INCOMPLETE')).models).toEqual({});
+ });
+
+ test('a vs_none with a non-numeric field is dropped rather than crashing the cut, and record text cannot start a workflow command', () => {
+ const odd = (vs: unknown) => ({ ...rec('NO_CHANGE'), models: { 'claude-opus-5-5': { host: 'claude-code', n: 390, d: 0, lo: -4, hi: 4, vs_none: vs } } });
+ for (const vs of [{ d: null, lo: null, hi: null }, {}, null]) {
+ const s = status(records(['weekly-2026-w48', odd(vs)]));
+ expect(s.state).toBe('clear');
+ expect(s.line).toContain('claude-opus-5-5 +0.0 [-4.0, +4.0] on 390 pairs; 1 flag');
+ }
+ expect(status(records(['weekly-2026-w48', rec('NO_CHANGE')])).line).toContain('; vs no gstack -2.1 [-6.0, +1.7]');
+ const injected = status(records(['weekly-2026-w48', rec('NO_CHANGE')], ['weekly-2026-w49', { ...rec('INCOMPLETE', { week: '2026-W49', start: '2026-12-05T06:00:00Z' }), incomplete_reason: 'x\n::stop-commands::tok' }]));
+ expect(injected.line).toContain('the newer weekly-2026-w49 is INCOMPLETE (x ::stop-commands::tok)');
+ expect(injected.line).not.toContain('\n');
+ });
+
+ test('readRecords lists weekly tags only, retries each call once, and any failure makes the whole read unreadable', () => {
+ const calls: string[][] = [];
+ let flaky = 1;
+ const gh: Gh = (args) => {
+ calls.push(args);
+ if (args[1] === 'list') return flaky-- > 0 ? { status: 1, stdout: '', stderr: 'HTTP 502' } : { status: 0, stdout: JSON.stringify([{ tagName: 'weekly-2026-w48' }, { tagName: 'v1.0.0' }, { tagName: 'weekly-2026-w48-r1' }]), stderr: '' };
+ return { status: 0, stdout: JSON.stringify(rec(args[2] === 'weekly-2026-w48' ? 'HOLD' : 'NO_CHANGE')), stderr: '' };
+ };
+ const read = readRecords(gh);
+ expect(read.ok && read.records.map((r) => r.tag)).toEqual(['weekly-2026-w48', 'weekly-2026-w48-r1']);
+ expect(calls.filter((c) => c[1] === 'list')).toHaveLength(2);
+ expect(calls[0]).toEqual(['release', 'list', '--repo', BENCHMARK.repo, '--limit', '200', '--json', 'tagName']);
+ expect(calls.find((c) => c[1] === 'download')).toEqual(['release', 'download', 'weekly-2026-w48', '--repo', BENCHMARK.repo, '-p', 'weekly.json', '-O', '-']);
+ const down: Gh = (args) => (args[1] === 'list' ? { status: 0, stdout: '[{"tagName":"weekly-2026-w48"}]', stderr: '' } : { status: 1, stdout: '', stderr: 'not found' });
+ expect(readRecords(down)).toEqual({ ok: false, why: 'gh release download weekly-2026-w48 failed: not found' });
+ const bad: Gh = (args) => (args[1] === 'list' ? { status: 0, stdout: '[{"tagName":"weekly-2026-w48"}]', stderr: '' } : { status: 0, stdout: '{', stderr: '' });
+ expect(readRecords(bad).ok).toBe(false);
+ });
+
+ test('newest first by run start, and a -r<k> correction before the record it follows', () => {
+ const rs = records(['weekly-2026-w48', rec('HOLD')], ['weekly-2026-w48-r1', rec('NO_CHANGE')], ['weekly-2026-w49', rec('GAIN', { start: '2026-12-05T06:00:00Z' })]);
+ expect(newestFirst(rs.ok ? rs.records : []).map((r) => r.tag)).toEqual(['weekly-2026-w49', 'weekly-2026-w48-r1', 'weekly-2026-w48']);
+ });
+});
+
+describe('release-benchmark: which record decides', () => {
+ test('no records is none; only INCOMPLETE records is none and says why', () => {
+ expect(status({ ok: true, records: [] })).toMatchObject({ state: 'none', line: 'BENCHMARK: none (no weekly record published yet) (holding)' });
+ const s = status(records(['weekly-2026-w48', rec('INCOMPLETE')]));
+ expect(s.state).toBe('none');
+ expect(s.line).toContain('every record is INCOMPLETE; the newer weekly-2026-w48 is INCOMPLETE (the smoke failed)');
+ });
+
+ test('a HOLD whose commit is in the candidate and not on stable holds, and the line carries the numbers', () => {
+ const s = status(records(['weekly-2026-w48', rec('HOLD')]));
+ expect(s.state).toBe('hold');
+ expect(s.line).toBe('BENCHMARK: HOLD weekly-2026-w48 candidate=aaaaaaaaaaaa stable=v1.103.0.0 claude-opus-5-5 -4.8 [-8.8, -0.8] on 390 pairs; vs no gstack -2.1 [-6.0, +1.7]; 1 flag (holding)');
+ });
+
+ test('HOLD lifetime: never stale, not cleared by INCOMPLETE weeks, replaced by any later reading (bridge weeks included)', () => {
+ const late = NOW + 30 * DAY;
+ const held = (read: Records, now = NOW) => benchmarkStatus({ read, git: inCandidate, candidate: CAND, stable: STABLE, now, hold: true }).state;
+ expect(held(records(['weekly-2026-w48', rec('HOLD')]), late)).toBe('hold');
+ expect(held(records(['weekly-2026-w48', rec('HOLD')], ['weekly-2026-w49', rec('INCOMPLETE', { start: '2026-12-05T06:00:00Z' })], ['weekly-2026-w50', rec('INCOMPLETE', { start: '2026-12-12T06:00:00Z' })], ['weekly-2026-w51', rec('INCOMPLETE', { start: '2026-12-19T06:00:00Z' })]), late)).toBe('hold');
+ expect(held(records(['weekly-2026-w48', rec('HOLD')], ['weekly-2026-w49', rec('NO_CHANGE', { start: '2026-12-05T06:00:00Z', cand: OTHER })]))).toBe('clear');
+ const bridge = { ...rec('NO_CHANGE', { start: '2026-12-05T06:00:00Z', cand: OTHER }), flags: ['bridge week: the rig changed'] };
+ expect(held(records(['weekly-2026-w48', rec('HOLD')], ['weekly-2026-w49', bridge]))).toBe('clear');
+ expect(held(records(['weekly-2026-w48', rec('HOLD')], ['weekly-2026-w48-r1', rec('NO_CHANGE', { cand: OTHER })]))).toBe('clear');
+ const newer = status(records(['weekly-2026-w48', rec('NO_CHANGE', { cand: OTHER })], ['weekly-2026-w49', rec('HOLD', { start: '2026-12-05T06:00:00Z' })]));
+ expect(newer.state).toBe('hold');
+ expect(newer.record!.tag).toBe('weekly-2026-w49');
+ });
+
+ test('a HOLD already on stable, one the candidate lacks, or one missing from the clone does not hold', () => {
+ const one = records(['weekly-2026-w48', rec('HOLD')]);
+ const onStable = status(one, fakeGit([[HELD, STABLE], [STABLE, CAND], [HELD, CAND]]));
+ expect(onStable.state).toBe('clear');
+ expect(onStable.line).toContain('the held commit is already on stable');
+ expect(status(one, fakeGit([[STABLE, CAND]])).line).toContain('does not contain the held commit');
+ const missing = status(one, fakeGit([], { missing: ['a'] }));
+ expect(missing.state).toBe('unreadable');
+ expect(missing.line).toContain('is not in this clone');
+ });
+
+ test('staleness drops only GAIN, NO_CHANGE and FLAG readings, nine days after their run started', () => {
+ for (const v of ['GAIN', 'NO_CHANGE']) {
+ const r = records(['weekly-2026-w48', rec(v, { cand: OTHER })]);
+ expect(benchmarkStatus({ read: r, git: inCandidate, candidate: CAND, stable: STABLE, now: Date.parse('2026-12-06T00:00:00Z') }).line).not.toContain('stale');
+ const s = benchmarkStatus({ read: r, git: inCandidate, candidate: CAND, stable: STABLE, now: Date.parse('2026-12-08T00:00:00Z') });
+ expect(s.state).toBe('clear');
+ expect(s.line).toContain('BENCHMARK: stale (9 d) ' + v);
+ expect(s.line).toEndWith('(report only)');
+ }
+ });
+
+ test('an unreadable read says why', () => {
+ expect(status({ ok: false, why: 'gh release list failed: HTTP 502' })).toMatchObject({ state: 'unreadable', line: 'BENCHMARK: unreadable (gh release list failed: HTTP 502) (holding)' });
+ });
+});
+
+describe('release-benchmark: what the cut does (benchmarkGate)', () => {
+ const hold = status(records(['weekly-2026-w48', rec('HOLD')]));
+ const unreadable: BenchmarkStatus = { state: 'unreadable', line: 'x', record: null };
+ const gate = (s: BenchmarkStatus, trigger: Parameters<typeof benchmarkGate>[1]['trigger'], o: Partial<Parameters<typeof benchmarkGate>[1]> = {}) =>
+ benchmarkGate(s, { hold: true, trigger, important: [], exception: null, waiver: null, ...o });
+
+ test('report only (the shipped default) never stops a cut', () => {
+ expect(BENCHMARK.hold).toBe(false);
+ for (const t of ['regular', 'forced', 'important', 'hand'] as const) expect(benchmarkGate(hold, { trigger: t, important: [], exception: null, waiver: null })).toEqual({ action: 'pass' });
+ });
+
+ test('a HOLD: regular and blocker-only cuts wait, the forced cut is STABLE_STALE, a hand cut is refused', () => {
+ expect(gate(hold, 'regular')).toMatchObject({ action: 'wait', code: 'REFUSED_BENCHMARK', level: 'notice' });
+ expect(gate(hold, 'important', { important: urgent('blocker') })).toMatchObject({ action: 'wait', code: 'REFUSED_BENCHMARK' });
+ const forced = gate(hold, 'forced');
+ expect(forced).toMatchObject({ action: 'refuse', code: 'STABLE_STALE', level: 'error' });
+ expect(forced.line).toContain('STABLE_STALE: stable is 7 days old and the weekly benchmark holds aaaaaaaaaaaa (weekly-2026-w48)');
+ expect(forced.line).toContain('benchmark_waiver');
+ expect(gate(hold, 'hand')).toMatchObject({ action: 'refuse', code: 'REFUSED_BENCHMARK', level: 'error' });
+ });
+
+ test('urgent spans, exception cuts and waivers pass and say the held commit ships', () => {
+ for (const k of ['security', 'data-loss', 'regression'] as const) {
+ const g = gate(hold, 'important', { important: [...urgent('blocker'), ...urgent(k)] });
+ expect(g.action).toBe('pass');
+ expect(g.line).toContain('bypassed by ' + k + '; the held commit ships with the fix');
+ }
+ expect(gate(hold, 'hand', { exception: 'security' })).toMatchObject({ action: 'pass', level: 'warning' });
+ expect(gate(hold, 'hand', { waiver: 'the drop is the new /ship prompt, accepted' }).line).toBe('BENCHMARK: HOLD on aaaaaaaaaaaa (weekly-2026-w48) waived: the drop is the new /ship prompt, accepted');
+ });
+
+ test('a finishing cut (no trigger) and a clear status pass', () => {
+ expect(gate(hold, null)).toEqual({ action: 'pass' });
+ expect(gate({ state: 'clear', line: 'x', record: null }, 'regular')).toEqual({ action: 'pass' });
+ });
+
+ test('unreadable records hold back only a regular cut, for a day; everything else goes ahead with a warning', () => {
+ expect(gate(unreadable, 'regular')).toMatchObject({ action: 'wait', code: 'BENCHMARK_UNKNOWN', level: 'notice' });
+ for (const t of ['important', 'forced', 'hand'] as const) expect(gate(unreadable, t)).toMatchObject({ action: 'pass', level: 'warning' });
+ });
+
+ test('a waiver written into the tag is read back for a retry of a half-finished cut', () => {
+ const git = fakeGit([], { tags: { 'v1.104.0.0': 'gstack v1.104.0.0 (hotfix release)\n\nBenchmark-waiver: accepted after review\n' } });
+ expect(waiverFromTag(git, 'v1.104.0.0')).toBe('accepted after review');
+ expect(waiverFromTag(git, 'v1.0.0')).toBeNull();
+ });
+});
+
+describe('release-benchmark: gstack-evals still loads release-cut.ts', () => {
+ test('the module imports only types, and release-cut keeps the exports the weekly resolver imports', async () => {
+ const src = fs.readFileSync(path.join(import.meta.dir, '..', 'lib', 'release-benchmark.ts'), 'utf8');
+ expect(src.split('\n').filter((l) => l.startsWith('import ') && !l.startsWith('import type '))).toEqual([]);
+ const cut = await import('../scripts/release-cut');
+ for (const k of ['gitIn', 'runGh', 'readTrainNotes', 'gateVerdict', 'WINDOW_DAYS', 'WINDOW_COMMITS']) expect((cut as Record<string, unknown>)[k]).toBeDefined();
+ });
+});
diff --git a/crew/test/release-cut.test.ts b/crew/test/release-cut.test.ts
index d809e48f9..d07f83bb1 100644
--- a/crew/test/release-cut.test.ts
+++ b/crew/test/release-cut.test.ts
@@ -18,6 +18,7 @@ import {
gateVerdict, gitIn, planRelease, readTrainNotes, releaseNotes, sanitizeReason, stableMovedAt, verifyRegression, verifySecurity, type Gh, type Git, type TrainEvidence,
} from '../scripts/release-cut';
import { changeLine, changeSources, changesIn, type NotesSources } from '../scripts/release-notes';
+import { BENCHMARK, waiverFromTag } from '../lib/release-benchmark';
const bases: string[] = [];
// A cut made a moment ago clears the 72-hour floor at this clock.
@@ -577,6 +578,20 @@ describe('release-cut: train evidence gates a commit whose backstop never settle
});
describe('release-cut: cutting, hotfixes and the forward-only stable', () => {
+ // Value: protects=a benchmark waiver cutRelease writes into the annotated tag is the one waiverFromTag reads back, so a retry of a half-finished cut is not
+ // held again; fails_when=the tag message's waiver label or layout drifts from the reader's pattern; why_new=the waiverFromTag test parses a hand-written
+ // message; seam=none; no_claim=none beyond protects
+ test('a waiver cutRelease writes into the tag is read back by waiverFromTag', () => {
+ const f = fixture();
+ const first = planRelease({ repo: f.repo, git: f.git, gh: f.gh });
+ expect(first.ok).toBe(true);
+ if (!first.ok) return;
+ expect(waiverFromTag(f.git, first.plan.tag)).toBeNull();
+ const cut = cutRelease(first.plan, { repo: f.repo, git: f.git, gh: f.gh, notesDir: f.base, waiver: 'accepted after review' });
+ expect(cut.ok, cut.lines.join('\n')).toBe(true);
+ expect(waiverFromTag(f.git, first.plan.tag)).toBe('accepted after review');
+ });
+
test('a cut tags, moves stable and publishes; re-running reports nothing new; a hotfix ref promotes a later main commit with a compare link', () => {
const f = fixture();
const first = planRelease({ repo: f.repo, git: f.git, gh: f.gh });
@@ -743,7 +758,11 @@ describe.skipIf(process.platform === 'win32')('release-cut: the workflow entry p
expect(written).toContain('<details><summary>Release notes</summary>');
expect(written).toContain('- Fourth trims the preamble.');
expect(execFileSync('git', ['ls-remote', f.origin, 'refs/heads/stable', 'refs/tags/v1.0.3'], { encoding: 'utf8', timeout: 30_000 }).trim()).toBe('');
- expect(fs.readFileSync(path.join(f.base, 'gh.log'), 'utf8')).not.toContain('gh release');
+ // The only release calls a dry run makes read gstack-evals' weekly benchmark records; none touches this repo's releases.
+ const releaseCalls = fs.readFileSync(path.join(f.base, 'gh.log'), 'utf8').split('\n').filter(l => l.startsWith('gh release'));
+ expect(releaseCalls.length).toBeGreaterThan(0);
+ expect(releaseCalls.filter(l => !l.startsWith('gh release list --repo ' + BENCHMARK.repo + ' '))).toEqual([]);
+ expect(dry.stdout).toContain('BENCHMARK: unreadable (gh release list failed');
const usage = run('--dry-run');
expect(usage.status).toBe(2);
diff --git a/docs/releases.md b/docs/releases.md
index ca1ce0dfe..32d1d6570 100644
--- a/docs/releases.md
+++ b/docs/releases.md
@@ -371,6 +371,51 @@ Unlike a security cut, a regression cut does not pass `FLOOR_UNKNOWN`. The
floor counts from the regression release, so the next scheduled cut may be
held.
+<a id="weekly-benchmark"></a>
+## Weekly benchmark
+
+Garry, 2026-11-21: "Is Gstack this week significantly better than last week?" Every Saturday at 06:00 UTC,
+gstack-evals measures the release candidate against `stable` and against no gstack. The candidate is the newest
+commit this tool reads as green and gated. The run uses 130 real Python bug fixes with Claude Opus 5.5 in Claude Code.
+gstack-evals publishes the result by Monday 10:00 UTC as `weekly.json` on a release of garrytan/gstack-evals tagged
+`weekly-<yyyy>-w<nn>`, or `-r<k>` for a re-measure or correction. A published record is never edited. The runbook is
+`lanes/weekly-stable` in that repository.
+
+Every cut plan, dry runs included, prints one `BENCHMARK:` line read from those records
+(`crew/lib/release-benchmark.ts`):
+
+- The newest record by run start that isn't INCOMPLETE decides. That's the rule gstack-evals' own resolver uses, so
+ both sides agree on whether a HOLD stands.
+- A HOLD (the candidate measurably fixed fewer bugs than stable) never goes stale. It stands until a later week's
+ record replaces it. A GAIN or NO_CHANGE reading prints as `stale` 9 days after its run started.
+- A HOLD applies only while its commit is in the candidate and not yet on `stable`. A HOLD whose commit already
+ reached `stable` is printed, and the choice between fixing forward and [rolling back](#rolling-stable-back) is
+ made by hand.
+- A record that can't be read prints `unreadable`, and so does a record whose verdict disagrees with its own model
+ rows. Every list and download is retried once. A no-gstack comparison (`vs_none`) with a missing or non-numeric
+ number is left out of the line instead.
+
+**Holding is off for the first two weekly records** (`BENCHMARK.hold` is `false`), so for now the line is only
+reported. Once two records have arrived on time with their results checks passed, a one-line change turns it on.
+From then on, a standing HOLD does this:
+
+| Cut | What happens |
+|---|---|
+| Its span holds an `important: security`, `data-loss` or `regression` change, or it is a security or regression cut | Cuts, with a warning that the held commit ships with the fix |
+| Regular (Monday or Thursday), or important with only `blocker` changes | `REFUSED_BENCHMARK`: waits, with a notice and exit 0 |
+| Forced (`stable` 7 days old) | `STABLE_STALE` naming the hold: red, so someone fixes, reverts or waives (Garry, 2026-11-23: a HOLD outlasts the 7-day rule) |
+| Hand-run | `REFUSED_BENCHMARK`: exit 1 |
+
+When the records can't be read, a regular cut waits for the next daily run (`BENCHMARK_UNKNOWN`), and every other cut
+goes ahead with a warning. To cut past a HOLD on purpose, run the workflow by hand with the reason:
+
+```bash
+gh workflow run weekly-release.yml -f ref=<full sha> -f benchmark_waiver="<why the drop is accepted or explained>" -f dry_run=false
+```
+
+The sanitized reason goes into the tag message as `Benchmark-waiver:`, and a retry of a half-finished cut reads it
+back from there. `benchmark_waiver` is refused beside `daily`.
+
## Channels
| Channel | Follows | Who |
@@ -495,7 +540,7 @@ The step summary carries the same plan plus the full release notes.
A pull request that touches `.github/workflows/weekly-release.yml`,
`crew/scripts/release-cut.ts`, `crew/scripts/release-notes.ts`,
-`crew/scripts/release-cadence.ts` or `lib/changelog-fragments.ts` runs the same dry run against main as its own job
+`crew/scripts/release-cadence.ts`, `lib/changelog-fragments.ts` or `crew/lib/release-benchmark.ts` runs the same dry run against main as its own job
(`Dry run against main`, read-only token), once plain and once as the daily
check, so a change to the release tooling is exercised against real check runs
before it merges.
@@ -583,4 +628,7 @@ reset --hard 'v<good version>'`. Its next update check fast-forwards it to
| `IMPORTANT_UNGATED: ...` | an important change landed but no green, gated commit holds it yet; informational |
| `NO_RELEASE_PR: ...` | the candidate's VERSION is already released on an earlier commit (no release PR landed since that cut): the Captain stamps a release PR. A plain cut always reports it; the daily check reports it only when a trigger is due. Exit 1 (0, with a warning, on a dry run) |
| `NOTES_MISSING: ...` | the CHANGELOG at the candidate has no entry for its version, or a version in the span lists no change ([Release notes](#release-notes)); nothing is tagged or published. Exit 1 |
-| `STABLE_STALE: ...` | stable is 7 days old and main moved, but nothing newer is green and gated; exit 1 (0 on a dry run) |
+| `STABLE_STALE: ...` | stable is 7 days old and main moved, but nothing newer is green and gated, or the weekly benchmark holds the candidate ([Weekly benchmark](#weekly-benchmark)); exit 1 (0 on a dry run) |
+| `BENCHMARK: <verdict> <tag> ...`, `BENCHMARK: none (...)`, `stale` or `unreadable` | the weekly benchmark's reading for this cut, ending `(report only)` or `(holding)` ([Weekly benchmark](#weekly-benchmark)) |
+| `REFUSED_BENCHMARK: ...` | with holding on, a standing HOLD keeps the commit off stable: a regular or blocker-only daily cut waits (exit 0), a hand cut exits 1 (0 on a dry run) |
+| `BENCHMARK_UNKNOWN: ...` | with holding on, the weekly records could not be read and a HOLD cannot be ruled out: the regular cut waits for the next daily run; exit 0 |
diff --git a/test/weekly-release-workflow.test.ts b/test/weekly-release-workflow.test.ts
index bbd68f31d..f4c7baab7 100644
--- a/test/weekly-release-workflow.test.ts
+++ b/test/weekly-release-workflow.test.ts
@@ -40,7 +40,8 @@ describe('weekly-release.yml', () => {
expect(wf.on.workflow_dispatch.inputs.regression).toMatchObject({ type: 'string', default: '' });
expect(wf.on.workflow_dispatch.inputs.dry_run).toMatchObject({ type: 'boolean', default: true });
expect(wf.on.workflow_dispatch.inputs.ref).toMatchObject({ type: 'string', default: '' });
- expect(wf.on.pull_request).toEqual({ paths: ['.github/workflows/weekly-release.yml', 'crew/scripts/release-cut.ts', 'crew/scripts/release-notes.ts', 'crew/scripts/release-cadence.ts', 'lib/changelog-fragments.ts'] });
+ expect(wf.on.pull_request).toEqual({ paths: ['.github/workflows/weekly-release.yml', 'crew/scripts/release-cut.ts', 'crew/scripts/release-notes.ts', 'crew/scripts/release-cadence.ts', 'lib/changelog-fragments.ts', 'crew/lib/release-benchmark.ts'] });
+ expect(wf.on.workflow_dispatch.inputs.benchmark_waiver).toMatchObject({ type: 'string', default: '' });
expect(wf.concurrency).toEqual({ group: "weekly-release-${{ github.event.pull_request.number || 'cut' }}", 'cancel-in-progress': false });
expect(wf.permissions).toEqual({});
expect(Object.keys(wf.jobs)).toEqual(['cut', 'dry-run']);
@@ -70,7 +71,10 @@ describe('weekly-release.yml', () => {
expect(plan.run).toContain(BUN_RUN + ' "${args[@]}"');
expect(plan.env!.DAILY).toBe("${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.daily)) && 'true' || 'false' }}");
expect(plan.run).toContain('[ "$DAILY" = true ] && args+=(--daily)');
- expect(plan.run).toContain('if [ "$DAILY" = true ] && [ -n "$RELEASE_REF$SECURITY_REASON$REGRESSION_REASON" ]; then');
+ expect(plan.run).toContain('if [ "$DAILY" = true ] && [ -n "$RELEASE_REF$SECURITY_REASON$REGRESSION_REASON$BENCHMARK_WAIVER" ]; then');
+ expect(plan.env!.BENCHMARK_WAIVER).toBe("${{ github.event_name == 'workflow_dispatch' && inputs.benchmark_waiver || '' }}");
+ expect(plan.run).toContain('[ -n "$BENCHMARK_WAIVER" ] && args+=(--benchmark-waiver "$BENCHMARK_WAIVER")');
+ expect(plan.run).not.toContain('inputs.benchmark_waiver');
expect(plan.run).not.toContain('inputs.daily');
expect(cut.steps.find(s => s.name === 'Fetch stable and the tags')!.run).toContain("git fetch --quiet origin '+refs/heads/stable:refs/remotes/origin/stable'");
});