Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

nightly-watch: stress-gate exemption records in master-red, flake and nightly-red bodies

garrytan6856eb867dd1
diff --git a/docs/architecture/key-files/ci-health-and-test-guards.md b/docs/architecture/key-files/ci-health-and-test-guards.md
index b136fcbdc5..48eb5da7dc 100644
--- a/docs/architecture/key-files/ci-health-and-test-guards.md
+++ b/docs/architecture/key-files/ci-health-and-test-guards.md
@@ -7,8 +7,8 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `scripts/lib/gh-issue.ts` — the GitHub seam shared by the CI watchers. `inert()` makes run-derived text (job, step and test names, error text) safe to show an agent: control characters stripped, length capped, backticks and pipes replaced, mentions and links neutralized; `redactCredentials()` strips user:password from database URLs. `GitHubClient` is the one interface the watchers call (`restClient()` uses `GH_TOKEN`/`GITHUB_TOKEN` in Actions or the authenticated `gh api` locally; `download()` reads artifact archives without forwarding the token to blob storage). `findIssueByTitle` finds an issue by label and exact title, open first, else the most recently updated closed one; `listLabeled`, `getIssue` and `linkedPulls` (PRs cross-referencing an issue) back master-red and CI health; `fetchArtifactJson` + `readZipEntry` read one JSON file from a run artifact and return a reason instead of throwing.
- `.github/workflows/ci-health.yml` + `scripts/ci-health-report.ts` — CI health report. Reads one window (`--days`, default 7, or `--since/--until`, also dispatch inputs) of same-repository pull-request and push-to-master runs of test.yml and e2e.yml (runs, jobs, check-run annotations, issues; never logs, fork runs or fork artifacts), paging the whole window (`listRuns` splits a query over the 1000-result search cap). It reports first-attempt pass rates (`firstAttempt()`), the exit criteria (master >= 95%, PR >= 90%; met, missed or indeterminate when the window cannot be read in full), stress-gate failures, failure classes, cancellation and completion coverage, master-red time to first response, the nightly-watch residual, the test files with the most failure annotations, shard spread and the count of fork runs it did not read; an explicit window with a missed target opens a follow-up issue. Tests: `test/scripts/ci-health-report.test.ts`. Docs: `docs/ci-red-runbook.md#ci-health-report`.
- `scripts/lib/master-red.ts` — master-red reconciliation for push-to-master runs of Test and E2E Tests (`PUSH_ALLOWLIST`). Each watch evaluates every completed push run above the high-water mark (`evaluated`: run number, then attempt) stored in the newest `Master red: <workflow>` issue's `master-red:json` block (`applyRun` folds runs; cancelled runs change nothing); a missing or malformed block is rebuilt from the actions API (`pendingRuns`). It opens on red with the suspect range (`suspectRange`: compare plus commit-to-PR lookups), updates while red, closes when every previously failing job (E2E Tests: every failing file, from the manifest) ran and passed with complete evidence, records an incident that opened and closed between watches, and keeps a not-run-since failure open with the manual-close step. `externalPass` lets a scheduled run or an issue-bound E2E replay clear failures. Closing without a merged linked repair PR opens `flake` issues (`flakeFor`, `flake:json`); `closeFlakes` closes one after its repair PR merged and a later complete run passed its file and arm. Writes re-read the issue first and re-plan when it moved; a create race closes the newer duplicate. Tests: `test/scripts/nightly-issue.test.ts`. Docs: `docs/ci-red-runbook.md`.
-- `scripts/lib/ci-run.ts` — one run's failure evidence (`collectEvidence`): jobs, failing jobs' annotations and, for test.yml and e2e.yml, the `ci-manifest` artifact, returned as structured records (job, step, every failing test file and identity) apart from sanitized excerpts; a cancelled job is not run (listed in `cancelled`) unless its annotation says it timed out, and a red run whose only failures are aggregators of cancelled jobs is `ignored`; with `complete`/`problems` (an unreadable page, annotation or manifest is incomplete evidence, never zero failures). `reproduceCommand` builds `bun run test:stress <file> --iterations 10 [--postgres]` from a validated test path only.
-- `scripts/ci-manifest.ts` — the versioned failure and execution manifest (`gbrain-ci-manifest/v1`). The `executed-receipts` job of test.yml and e2e.yml builds it from every lane's receipts (via `scripts/ci-executed-counts.ts`, declared skips from the expected-deltas TSV), binds it to the workflow, event, SHA, run id and attempt, and uploads it as `ci-manifest`; `checkManifest` refuses a manifest for another run or attempt; `passedFiles` lists files that executed tests and failed none. Docs: `docs/ci-red-runbook.md#ci-failure-manifest`.
+- `scripts/lib/ci-run.ts` — one run's failure evidence (`collectEvidence`): jobs, failing jobs' annotations and, for test.yml and e2e.yml, the `ci-manifest` artifact, returned as structured records (job, step, every failing test file and identity) apart from sanitized excerpts; a cancelled job is not run (listed in `cancelled`) unless its annotation says it timed out, and a red run whose only failures are aggregators of cancelled jobs is `ignored`; with `complete`/`problems` (an unreadable page, annotation or manifest is incomplete evidence, never zero failures). `reproduceCommand` builds `bun run test:stress <file> --iterations 10 [--postgres]` from a validated test path only. `exemptionRows` turns failing identities with an exact test name and signature into the stress gate's `<!-- gbrain-stress-exemption -->` records (backend per `stressBackend`, owner `agent on release duty`), written into master-red, flake and nightly-red bodies; `test/fixtures/nightly-watch/stress-exemption-contract.ts` vendors the gate's parser so the tests prove it accepts them.
+- `scripts/ci-manifest.ts` — the versioned failure and execution manifest (`gbrain-ci-manifest/v1`). The `executed-receipts` job of test.yml and e2e.yml builds it from every lane's receipts (via `scripts/ci-executed-counts.ts`, declared skips from the expected-deltas TSV), binds it to the workflow, event, SHA, run id and attempt, and uploads it as `ci-manifest`; each failure carries the JUnit message (credentials redacted) and the stress gate's `failureSignature` (omitted when the message holds a credential); `checkManifest` refuses a manifest for another run or attempt; `passedFiles` lists files that executed tests and failed none. Docs: `docs/ci-red-runbook.md#ci-failure-manifest`.
- `scripts/release-gate.ts` — release.yml's `ci-gate` job. Polls the push-to-master runs of Test and E2E Tests on the release commit and writes `publish`/`sha`: both green publishes; a failed run publishes nothing and fails with the next step; a run cancelled by a newer push is followed to the next master commit with the same VERSION (published there) or marks the version superseded; non-master refs are refused; it fails with the backfill command after 110 minutes. Build, release, `latest-stable` and the publish jobs use the gated commit. Tests: `test/scripts/release-gate.test.ts`. Docs: `docs/RELEASING.md#release-ci-gate`.
- `scripts/regen-all.ts` — one entry point for every generated artifact (`ARTIFACTS`: regen and check command per artifact). `bun run regen:all` regenerates offline and keyless (provider keys and database URLs removed) and lists what changed; a second run changes nothing. `--check` is read-only and runs in `verify` as `check:regen-all`; `--goldens` also regenerates the offline contract goldens. Postgres goldens are named with their own commands, and `llms.txt` regenerates last because it inlines other generated docs. Tests: `test/scripts/regen-all.test.ts`.
- `scripts/ci-manifest-diff.sh` — parsed-JSON classification of manifest diffs for CI scoping: `version-only` (only the top-level `version` differs), `dependency-change` (any dependency field differs), `dependency-scope` (whether a changed-file list touches lockfiles, `patches/` or dependency fields) and `drop-version-only` (filters version-only `package.json` and `openclaw.plugin.json` entries out of a changed-file list, so a release bump does not widen the native scope). Used by test.yml's `changes` job (before `scripts/ci-native-scope.sh`) and its dependency-audit scope step. Tests: `test/scripts/ci-manifest-diff.test.ts`.
diff --git a/docs/ci-red-runbook.md b/docs/ci-red-runbook.md
index 80e804cf14..539436c809 100644
--- a/docs/ci-red-runbook.md
+++ b/docs/ci-red-runbook.md
@@ -61,7 +61,14 @@ response: a repair PR whose body says `Fixes #<issue>`.
A `flake` issue records one intermittent failure: the file, test name, lane,
arm, platform, failing job, failure signature, first red run, owner and an
expiry date 14 days out. The stress gate can exempt only a failure that matches
-an open issue's test name, backend and signature. Next step: run the reproduce
+an open issue's test name, backend and signature. The watcher writes those as
+`<!-- gbrain-stress-exemption -->` JSON records (file, exact test name,
+backend `pglite`, `pglite+postgres` or `postgres`, the gate's failure
+signature, owner `agent on release duty`, expiry) in `master-red`, `flake` and
+`nightly-red` bodies, one per failing test identity from the manifest. A
+failure without an exact test name, or whose message carries a credential,
+gets no record. Master-red and nightly-red records expire 14 days after the
+watcher last saw the failure; flake records at the flake's expiry. Next step: run the reproduce
line (`bun run test:stress <file> --iterations 10 [--postgres]`) until it fails,
find the race, and open a repair PR with `Fixes #<issue>`. Never widen a
timeout or weaken an assertion. When the signature names a runner, disk or
diff --git a/scripts/ci-manifest.ts b/scripts/ci-manifest.ts
index c0b2bd2e56..cea725facf 100644
--- a/scripts/ci-manifest.ts
+++ b/scripts/ci-manifest.ts
@@ -20,8 +20,9 @@
* counts as proof that a file passed. Exit 0 when written, 2 on usage error.
* Docs: docs/ci-red-runbook.md#ci-failure-manifest
*/
-import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
-import { buildSide, compare, DEFAULT_DELTAS, loadReceiptDir, parseDeltas, type DeltaRow, type Receipt } from './ci-executed-counts.ts';
+import { appendFileSync, existsSync, readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
+import { join } from 'node:path';
+import { buildSide, compare, DEFAULT_DELTAS, loadReceiptDir, parseDeltas, parseJUnit, type DeltaRow, type Receipt } from './ci-executed-counts.ts';
export const MANIFEST_SCHEMA = 'gbrain-ci-manifest/v1';
export const MANIFEST_ARTIFACT = 'ci-manifest';
@@ -29,7 +30,8 @@ export const MANIFEST_FILE = 'ci-manifest.json';
export const MANIFEST_DOCS = 'docs/ci-red-runbook.md#ci-failure-manifest';
export interface ManifestFile { file: string; lane: string; arm: string; executed: number; failed: number; skipped: number }
-export interface ManifestFailure { lane: string; file: string; test: string; arm: string }
+/** `signature` is the stress gate's failure signature of the JUnit failure message, so exemption records match its failures; it is omitted when the message carries a credential (then no exemption is offered). */
+export interface ManifestFailure { lane: string; file: string; test: string; arm: string; signature?: string; message?: string }
export interface CiManifest {
schema: typeof MANIFEST_SCHEMA;
workflow: string;
@@ -45,7 +47,7 @@ export interface CiManifest {
export interface ManifestBinding { workflow: string; event: string; sha: string; run_id: number; run_attempt: number }
/** `deltas` are the declared skips of docs/test-audit/2026-10-04/expected-deltas.tsv (a keyless lane declared empty is not a problem). */
-export function buildManifest(receipts: Receipt[], bind: ManifestBinding, deltas: { rows: DeltaRow[]; errors: string[] } = { rows: [], errors: [] }): CiManifest {
+export function buildManifest(receipts: Receipt[], bind: ManifestBinding, deltas: { rows: DeltaRow[]; errors: string[] } = { rows: [], errors: [] }, messages: Map<string, string> = new Map()): CiManifest {
const side = buildSide('manifest', receipts, new Map([[String(bind.run_id), bind.run_attempt]]));
const problems = compare(side, undefined, deltas).issues.map(i => i.detail);
if (!receipts.length) problems.push('no receipts were downloaded (every receipts-* upload is missing)');
@@ -60,7 +62,9 @@ export function buildManifest(receipts: Receipt[], bind: ManifestBinding, deltas
else entry.skipped++;
if (id.status === 'fail') {
entry.failed++;
- failures.push({ lane: id.lane, file: id.file, test: id.test, arm: id.arm });
+ const message = messages.get(`${id.file}\u001f${id.test}`);
+ const safe = message !== undefined && redactMessage(message) === message;
+ failures.push({ lane: id.lane, file: id.file, test: id.test, arm: id.arm, ...(message === undefined ? {} : { ...(safe ? { signature: failureSignature(message) } : {}), message: redactMessage(message).slice(0, 500) }) });
}
files.set(key, entry);
}
@@ -73,6 +77,54 @@ export function buildManifest(receipts: Receipt[], bind: ManifestBinding, deltas
};
}
+/**
+ * The stress gate's failure signature (scripts/stress/run.ts `failureSignature`):
+ * the first four non-empty lines of the failure message with ANSI codes,
+ * temp paths, UUIDs and numbers masked, capped at 200 characters. An
+ * exemption record matches a stress failure only when this is identical;
+ * test/scripts/nightly-issue.test.ts pins it against the gate's contract.
+ */
+export function failureSignature(message: string): string {
+ return message.replace(/\x1b\[[0-9;]*m/g, '').split('\n').map(l => l.trim()).filter(Boolean).slice(0, 4).join(' ')
+ .replace(/\/(?:private\/)?(?:tmp|var\/folders)\/\S+/g, '<tmp>')
+ .replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, '<uuid>')
+ .replace(/\b\d+(?:\.\d+)?\b/g, 'N').replace(/\s+/g, ' ').slice(0, 200);
+}
+
+const redactMessage = (text: string) => text
+ .replace(/\b(postgres(?:ql)?:\/\/[^:/@\s]+):[^@\s]*@/gi, '$1:***@')
+ .replace(/\b(PGPASSWORD|[A-Z_]*(?:TOKEN|API_KEY|SECRET))=\S+/g, '$1=***');
+
+const ENTITY: Record<string, string> = { lt: '<', gt: '>', amp: '&', quot: '"', apos: "'" };
+const decode = (t: string) => t.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi, (w, r: string) => (r[0] === '#' ? String.fromCodePoint(r[1] === 'x' ? parseInt(r.slice(2), 16) : Number(r.slice(1))) : ENTITY[r] ?? w));
+
+/** First JUnit failure message per failing test (`file\u001ftest`), paired in report order as the stress gate pairs them. */
+export function junitMessages(dir: string): Map<string, string> {
+ const out = new Map<string, string>();
+ const walk = (d: string) => {
+ for (const name of readdirSync(d)) {
+ const path = join(d, name);
+ if (statSync(path).isDirectory()) { walk(path); continue; }
+ if (!name.endsWith('.junit.xml')) continue;
+ const xml = readFileSync(path, 'utf8');
+ let failed;
+ try { failed = parseJUnit(xml).filter(c => c.status === 'fail'); } catch { continue; }
+ const messages: string[] = [];
+ for (const [, body] of xml.matchAll(/<testcase\b[^>]*?(?:\/>|>([\s\S]*?)<\/testcase>)/g)) {
+ const m = /<(?:failure|error)\b[^>]*?message="([^"]*)"/.exec(body ?? '');
+ if (m || /<(?:failure|error)\b/.test(body ?? '')) messages.push(decode(m?.[1] ?? 'failure without a message'));
+ }
+ failed.forEach((c, i) => {
+ const file = c.file.includes('test/') ? c.file.slice(c.file.indexOf('test/')) : c.file;
+ const key = `${file}\u001f${c.test}`;
+ if (!out.has(key) && messages[i] !== undefined) out.set(key, messages[i]!);
+ });
+ }
+ };
+ if (existsSync(dir)) walk(dir);
+ return out;
+}
+
/** Validate a downloaded manifest against the run it must describe; a mismatch is a problem string, never a silent pass. */
export function checkManifest(value: unknown, bind: Pick<ManifestBinding, 'sha' | 'run_id' | 'run_attempt'>): { manifest?: CiManifest; problem?: string } {
const m = value as Partial<CiManifest> | null;
@@ -106,7 +158,7 @@ function main(argv: string[]): number {
const receipts = existsSync(dir) ? loadReceiptDir(dir) : [];
const deltasPath = flag('--deltas') ?? DEFAULT_DELTAS;
const deltas = existsSync(deltasPath) ? parseDeltas(readFileSync(deltasPath, 'utf8')) : { rows: [], errors: [] };
- const manifest = buildManifest(receipts, { workflow: env.GITHUB_WORKFLOW ?? '', event: env.GITHUB_EVENT_NAME ?? '', sha: env.GITHUB_SHA, run_id: runId, run_attempt: attempt }, deltas);
+ const manifest = buildManifest(receipts, { workflow: env.GITHUB_WORKFLOW ?? '', event: env.GITHUB_EVENT_NAME ?? '', sha: env.GITHUB_SHA, run_id: runId, run_attempt: attempt }, deltas, junitMessages(dir));
writeFileSync(out, `${JSON.stringify(manifest, null, 2)}\n`);
const line = `ci-manifest: ${manifest.files.length} file/lane/arm entries, ${manifest.failures.length} failing tests, ${manifest.complete ? 'complete' : `INCOMPLETE (${manifest.problems.length} problems; nightly-watch will not clear failures from this run)`}.`;
console.log(line);
diff --git a/scripts/lib/ci-run.ts b/scripts/lib/ci-run.ts
index a9afec06bf..1fca487d2b 100644
--- a/scripts/lib/ci-run.ts
+++ b/scripts/lib/ci-run.ts
@@ -44,7 +44,8 @@ export interface JobInfo {
}
export interface Annotation { annotation_level: string; title?: string | null; message: string; path?: string }
-export interface FailedTest { file: string; test: string; lane: string; arm: string; job?: string; postgres: boolean }
+/** `test` is sanitized for display; `name` (the exact JUnit test name) and `signature` feed stress-gate exemption records only. */
+export interface FailedTest { file: string; test: string; lane: string; arm: string; job?: string; postgres: boolean; name?: string; signature?: string }
export interface FailedJob { job: string; job_id: number; step: string; conclusion: string; files: string[]; excerpt: string[]; owner_signal: boolean }
export interface RunEvidence {
verdict: 'red' | 'green' | 'ignored';
@@ -84,6 +85,33 @@ export function verdictOf(conclusion: string | null): RunEvidence['verdict'] {
}
/** `bun run test:stress <file> --iterations 10 [--postgres]`, or undefined when the path fails validation. */
+export const EXEMPTION_MARKER = 'gbrain-stress-exemption';
+export const EXEMPTION_OWNER = 'agent on release duty';
+export const EXEMPTION_DAYS = 14;
+export interface ExemptionRow { file: string; test: string; backend: string; signature: string; owner: string; expires: string }
+
+/** The stress gate's backend arm for a failing file: E2E files run on Postgres, Postgres-armed unit files on both arms, the rest on PGLite. */
+export function stressBackend(t: Pick<FailedTest, 'file' | 'postgres'>): string {
+ return t.file.startsWith('test/e2e/') ? 'postgres' : t.postgres ? 'pglite+postgres' : 'pglite';
+}
+
+/**
+ * Stress-gate exemption rows (scripts/stress/README.md): one per failing test
+ * identity with its exact test name and failure signature; identities without
+ * both (annotation-only failures, messages carrying credentials) get none.
+ */
+export function exemptionRows(tests: FailedTest[], expires: string): ExemptionRow[] {
+ const rows = new Map<string, ExemptionRow>();
+ for (const t of tests) {
+ if (!t.name || !t.signature || !TEST_FILE.test(t.file)) continue;
+ const row = { file: t.file, test: t.name, backend: stressBackend(t), signature: t.signature, owner: EXEMPTION_OWNER, expires };
+ rows.set(JSON.stringify([row.file, row.test, row.backend, row.signature]), row);
+ }
+ return [...rows.values()];
+}
+
+export const plusDays = (day: string, days: number) => new Date(Date.parse(`${day}T00:00:00Z`) + days * 86_400_000).toISOString().slice(0, 10);
+
export function reproduceCommand(file: string, postgres: boolean): string | undefined {
if (!TEST_FILE.test(file) || file.includes('..')) return undefined;
return `bun run test:stress ${file} --iterations 10${postgres ? ' --postgres' : ''}`;
@@ -165,7 +193,7 @@ export async function collectEvidence(client: GitHubClient, run: RunInfo, opts:
if (!m.complete) problems.push(`the ${MANIFEST_ARTIFACT} artifact is incomplete: ${m.problems.slice(0, 3).map(p => inert(p, 160)).join('; ')}${m.problems.length > 3 ? ` (+${m.problems.length - 3} more)` : ''}`);
for (const f of m.failures) {
if (!TEST_FILE.test(f.file)) continue;
- tests.push({ file: f.file, test: inert(f.test, 300), lane: inert(f.lane, 60), arm: inert(f.arm, 60), postgres: POSTGRES_SIGNAL.test(`${f.arm} ${f.lane}`) });
+ tests.push({ file: f.file, test: inert(f.test, 300), lane: inert(f.lane, 60), arm: inert(f.arm, 60), postgres: POSTGRES_SIGNAL.test(`${f.arm} ${f.lane}`), ...(f.signature && f.test.length <= 500 ? { name: f.test, signature: f.signature.slice(0, 200) } : {}) });
}
passed = [...passedFiles(m)].filter(f => TEST_FILE.test(f)).sort();
} else {
diff --git a/scripts/lib/master-red.ts b/scripts/lib/master-red.ts
index ecdf46f982..38e91c6294 100644
--- a/scripts/lib/master-red.ts
+++ b/scripts/lib/master-red.ts
@@ -31,7 +31,7 @@ import {
commentIssue, createIssue, ensureLabel, getIssue, inert, inertBlock, jsonBlock, linkedPulls, listLabeled, readJsonBlock, updateIssue,
type GitHubClient, type Issue,
} from './gh-issue.ts';
-import { collectEvidence, reproduceCommand, verdictOf, workflowFile, type EvidenceOptions, type FailedJob, type FailedTest, type RunEvidence, type RunInfo } from './ci-run.ts';
+import { collectEvidence, EXEMPTION_DAYS, EXEMPTION_MARKER, exemptionRows, plusDays, reproduceCommand, stressBackend, verdictOf, workflowFile, type EvidenceOptions, type FailedJob, type FailedTest, type RunEvidence, type RunInfo } from './ci-run.ts';
export const MR_LABEL = 'master-red';
export const FLAKE_LABEL = 'flake';
@@ -66,6 +66,8 @@ export interface MasterRedState {
tests: FailedTest[];
evidence: { run_id: number; complete: boolean; problems: string[] } | null;
blocked: string[];
+ /** Expiry of the stress-gate exemption records this issue carries (14 days after the watcher last saw it red). */
+ exemption_expires?: string;
rebuilt?: string;
}
export interface FlakeRecord {
@@ -76,6 +78,7 @@ export interface FlakeRecord {
lane: string;
arm: string;
platform: 'linux' | 'windows' | 'macos';
+ backend: string;
job: string;
signature: string;
first_seen: RunRef;
@@ -272,6 +275,10 @@ export function renderMasterRed(state: MasterRedState, repo: string, issue?: num
lines.push(`<details><summary>Every failing test file this incident (${new Set(state.tests.map(t => t.file)).size})</summary>`, '', ...filesList(state), '', '</details>', '');
}
for (const j of state.open_jobs.filter(x => x.excerpt.length)) lines.push(`Errors in \`${j.job}\` (sanitized excerpts):`, '~~~text', inertBlock(j.excerpt.join('\n')), '~~~', '');
+ const rows = state.status === 'red' && state.exemption_expires ? exemptionRows(state.tests, state.exemption_expires) : [];
+ if (rows.length) {
+ lines.push(`Stress-gate exemption records (${rows.length}): a PR's stress gate does not count a failure that matches one of these exactly (file, test name, backend, signature) until ${state.exemption_expires}; any other failure still fails. Docs: ${FLAKE_DOCS}`, '', jsonBlock(EXEMPTION_MARKER, rows), '');
+ }
lines.push('### Next step for the agent', '', nextStep(state, repo, issue), '', jsonBlock(MR_MARKER, state), '');
return lines.join('\n');
}
@@ -283,8 +290,8 @@ export function flakeFor(state: MasterRedState, t: FailedTest, issue: number, to
const expires = new Date(Date.parse(`${today}T00:00:00Z`) + FLAKE_EXPIRY_DAYS * 86_400_000).toISOString().slice(0, 10);
const reproduce = reproduceCommand(t.file, t.postgres) ?? null;
const record: FlakeRecord = {
- schema: FLAKE_SCHEMA, workflow: state.workflow, file: t.file, test: t.test, lane: t.lane, arm: t.arm, platform, job: jobName,
- signature: inert(job?.excerpt[0] ?? '', 200), first_seen: state.first_red!, master_red_issue: issue,
+ schema: FLAKE_SCHEMA, workflow: state.workflow, file: t.file, test: t.test, lane: t.lane, arm: t.arm, platform, backend: stressBackend(t), job: jobName,
+ signature: t.signature ?? inert(job?.excerpt[0] ?? '', 200), first_seen: state.first_red!, master_red_issue: issue,
owner: 'agent on release duty', opened: today, expires, reproduce,
};
const title = `Flake: ${inert(`${t.file}${t.test ? ` › ${t.test}` : ''}`, 200)}`;
@@ -304,6 +311,7 @@ export function flakeFor(state: MasterRedState, t: FailedTest, issue: number, to
'',
`Docs: ${FLAKE_DOCS}`,
'',
+ ...(() => { const rows = exemptionRows([t], expires); return rows.length ? [jsonBlock(EXEMPTION_MARKER, rows), ''] : []; })(),
jsonBlock(FLAKE_MARKER, record),
'',
].join('\n');
@@ -378,6 +386,7 @@ export async function planMasterRed(client: GitHubClient, repo: string, run: Run
for (const s of [...closed, state]) {
if (s.first_red && s.suspect?.note === 'not looked up yet') s.suspect = await suspectRange(client, s.suspect.from_sha, s.suspect.to_sha);
}
+ if (state.status === 'red' && evaluated.length) state.exemption_expires = plusDays(opts.today, EXEMPTION_DAYS);
const plan = decide(stored, state, closed, issue, repo, title, evaluated, opts.today);
plan.evidence = cache.get(run.id * 1000 + run.run_attempt);
return { plan, issue };
diff --git a/scripts/nightly-issue.ts b/scripts/nightly-issue.ts
index 8ce4015fe5..bf8fe0e522 100644
--- a/scripts/nightly-issue.ts
+++ b/scripts/nightly-issue.ts
@@ -34,7 +34,7 @@ import {
type GitHubClient, type Issue,
} from './lib/gh-issue.ts';
import {
- annotationFiles, collectEvidence, FAILING, OWNER_SIGNAL, pagedJobs, reproduceCommand, type Annotation, type EvidenceOptions, type JobInfo, type RunEvidence, type RunInfo,
+ annotationFiles, collectEvidence, EXEMPTION_DAYS, EXEMPTION_MARKER, exemptionRows, FAILING, OWNER_SIGNAL, pagedJobs, plusDays, reproduceCommand, type ExemptionRow, type Annotation, type EvidenceOptions, type JobInfo, type RunEvidence, type RunInfo,
} from './lib/ci-run.ts';
import { closeFlakes, externalPass, PUSH_ALLOWLIST, watchMasterRed, type MasterRedPlan } from './lib/master-red.ts';
@@ -186,7 +186,7 @@ function nextStepText(rec: IncidentRecord, assessment: Assessment): string {
}
}
-export function renderBody(rec: IncidentRecord, assessment: Assessment): string {
+export function renderBody(rec: IncidentRecord, assessment: Assessment, exemptions: ExemptionRow[] = []): string {
const lines = [
`Workflow **${inert(rec.workflow)}** (\`${rec.workflow_file}\`) — state: **${rec.state}**.`,
'',
@@ -227,11 +227,14 @@ export function renderBody(rec: IncidentRecord, assessment: Assessment): string
if (rec.evidence && !rec.evidence.complete) {
lines.push(`- Incomplete evidence: ${rec.evidence.problems.join('; ')}. This run's failures may be under-reported and it cannot close an incident. Docs: docs/ci-red-runbook.md#ci-failure-manifest`);
}
+ if (exemptions.length) {
+ lines.push('', `Stress-gate exemption records (${exemptions.length}; race-hunt and other failing tests): a PR's stress gate does not count a failure that matches one exactly (file, test name, backend, signature) until ${exemptions[0]!.expires}; any other failure still fails. Docs: docs/ci-red-runbook.md#flake-issues`, '', jsonBlock(EXEMPTION_MARKER, exemptions));
+ }
lines.push('', '### Next step for the agent', '', nextStepText(rec, assessment), '', jsonBlock(JSON_MARKER, rec), '');
return lines.join('\n');
}
-export function planIncident(run: RunInfo, assessment: Assessment, existing: Issue | undefined, lastGreenSha: string | null, repo: string, succeededJobs: string[], evidence?: RunEvidence): Plan {
+export function planIncident(run: RunInfo, assessment: Assessment, existing: Issue | undefined, lastGreenSha: string | null, repo: string, succeededJobs: string[], evidence?: RunEvidence, today?: string): Plan {
const title = `Nightly red: ${inert(run.name, 100)}`;
const previous = existing ? readJsonBlock<IncidentRecord>(existing.body, JSON_MARKER) : undefined;
const keepLabels = existing ? labelNames(existing).filter(l => l !== KNOWN_LABEL && l !== LABEL) : [];
@@ -288,7 +291,7 @@ export function planIncident(run: RunInfo, assessment: Assessment, existing: Iss
review_by_notified: [...notified, ...newlyPassed.map(r => `${r.job}|${r.review_by}`)],
...(evidence ? { files: evidence.files, evidence: { complete: evidence.complete, problems: evidence.problems.map(p => inert(p, 300)) } } : {}),
};
- const body = renderBody(record, assessment).replaceAll('{repo}', repo);
+ const body = renderBody(record, assessment, evidence && today ? exemptionRows(evidence.tests, plusDays(today, EXEMPTION_DAYS)) : []).replaceAll('{repo}', repo);
const labels = [LABEL, ...(assessment.state === 'red' ? [] : [KNOWN_LABEL]), ...keepLabels];
if (!existing) return { action: 'create', title, labels, body, record, reason: `new ${assessment.state} incident` };
@@ -335,7 +338,7 @@ export async function watchRun(opts: WatchOptions): Promise<WatchResult> {
`repos/{repo}/actions/workflows/${run.workflow_id}/runs?event=schedule&status=success&per_page=1`).catch(() => ({ workflow_runs: [] }));
const existing = await findIssueByTitle(client, LABEL, `Nightly red: ${inert(run.name, 100)}`);
const succeeded = evidence.jobs.filter(j => j.conclusion === 'success').map(j => j.name);
- const plan = planIncident(run, assessment, existing, greens.workflow_runs[0]?.head_sha ?? null, repo, succeeded, evidence);
+ const plan = planIncident(run, assessment, existing, greens.workflow_runs[0]?.head_sha ?? null, repo, succeeded, evidence, opts.today);
const fed = run.event === 'schedule' && PUSH_ALLOWLIST[run.name] ? await externalPass(client, repo, run, evidence, { dryRun: opts.dryRun, today: opts.today }) : undefined;
const flakesClosed = run.event === 'schedule' ? await closeFlakes(client, repo, run, evidence, opts.dryRun) : [];
if (opts.dryRun) return { plan, assessment, run, evidence, masterRed: fed, flakesClosed };
diff --git a/test/fixtures/nightly-watch/master-red/ci-manifest-37351182593.json b/test/fixtures/nightly-watch/master-red/ci-manifest-37351182593.json
index 678cae616e..7adf403a7b 100644
--- a/test/fixtures/nightly-watch/master-red/ci-manifest-37351182593.json
+++ b/test/fixtures/nightly-watch/master-red/ci-manifest-37351182593.json
@@ -72,103 +72,137 @@
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > a zero budget cannot admit a paid request for an empty legacy fact",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > abort after provider response installs nothing",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > an engine off-switch changed during provider work prevents installation",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > an incomplete provider result writes no partial batch",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > BIGSERIAL fact IDs retain exact identity and JSON-safe results",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > bounded runs bank progress, restart from remaining nulls, and are idempotent",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > concurrent text and visibility edits never receive a stale vector",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > cost cap rejects before any provider request",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > managed repair refuses installing a vector after the model changes",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > managed repair updates only physical vectors and preserves canonical rows and guards",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > missing valid provider usage retains a conservative reported charge",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > preview is read-only and scoped; null active facts only, with zero provider calls",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "expected N dimensions, not N",
+ "message": "expected 8 dimensions, not 1536"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > provider failure samples redact connection credentials and bearer tokens",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > source incarnation changes prevent installing vectors into a new identity",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > stops after a failed batch and resumes without re-embedding completed facts",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > unexpected billed usage cannot silently exceed the cap on the final batch",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
},
{
"lane": "backend-matrix",
"file": "test/e2e/fact-embedding-backfill-parity.test.ts",
"test": "postgres explicit fact embedding backfill > withdrawals recorded during embedding remain unembedded",
- "arm": "postgres-direct"
+ "arm": "postgres-direct",
+ "signature": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first",
+ "message": "Facts embedding dimensions differ from the configured model; inspect migrate embeddings --status first"
}
]
}
diff --git a/test/fixtures/nightly-watch/stress-exemption-contract.ts b/test/fixtures/nightly-watch/stress-exemption-contract.ts
new file mode 100644
index 0000000000..229c342ba8
--- /dev/null
+++ b/test/fixtures/nightly-watch/stress-exemption-contract.ts
@@ -0,0 +1,42 @@
+/**
+ * Vendored contract of the PR stress gate's exemption parser (lane D,
+ * origin/capy/gmw-d @ 60557b495: scripts/stress/gate.ts `parseExemptionBlocks`
+ * and scripts/stress/run.ts `failureSignature`, copied verbatim). The
+ * nightly-watch tests feed the issue bodies the watcher writes through it, so
+ * a format drift on either side fails test/scripts/nightly-issue.test.ts.
+ * When both branches are on master, import scripts/stress/gate.ts instead.
+ */
+export interface VendoredExemption { file: string; test: string; backend: string; signature: string; owner: string; expires: string }
+
+/** Stable failure signature: the first lines of the message with numbers, temp paths and UUIDs masked. */
+export function failureSignature(message: string): string {
+ return message.replace(/\x1b\[[0-9;]*m/g, '').split('\n').map(l => l.trim()).filter(Boolean).slice(0, 4).join(' ')
+ .replace(/\/(?:private\/)?(?:tmp|var\/folders)\/\S+/g, '<tmp>')
+ .replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi, '<uuid>')
+ .replace(/\b\d+(?:\.\d+)?\b/g, 'N').replace(/\s+/g, ' ').slice(0, 200);
+}
+
+const MARKER = '<!-- gbrain-stress-exemption -->';
+
+/** Every exemption block (`<!-- gbrain-stress-exemption -->` then a ```json object or array) in a text. */
+export function parseExemptionBlocks(text: string): VendoredExemption[] {
+ const out: VendoredExemption[] = [];
+ let at = text.indexOf(MARKER);
+ while (at !== -1) {
+ const rest = text.slice(at + MARKER.length).trimStart();
+ const m = /^```json\n([\s\S]*?)\n```/.exec(rest);
+ if (m) {
+ try {
+ const parsed = JSON.parse(m[1]!) as unknown;
+ for (const row of Array.isArray(parsed) ? parsed : [parsed]) {
+ const r = row as Record<string, unknown>;
+ if (['file', 'test', 'backend', 'signature', 'owner', 'expires'].every(k => typeof r[k] === 'string' && (r[k] as string).length > 0) && /^\d{4}-\d{2}-\d{2}$/.test(r.expires as string)) {
+ out.push({ file: r.file as string, test: r.test as string, backend: r.backend as string, signature: r.signature as string, owner: r.owner as string, expires: r.expires as string });
+ }
+ }
+ } catch { /* malformed block grants nothing */ }
+ }
+ at = text.indexOf(MARKER, at + MARKER.length);
+ }
+ return out;
+}
diff --git a/test/scripts/nightly-issue.test.ts b/test/scripts/nightly-issue.test.ts
index 131685e660..24a434360f 100644
--- a/test/scripts/nightly-issue.test.ts
+++ b/test/scripts/nightly-issue.test.ts
@@ -12,7 +12,8 @@ import { join } from 'node:path';
import { deflateRawSync } from 'node:zlib';
import { safeLoad } from 'js-yaml';
import { loadReceiptDir } from '../../scripts/ci-executed-counts.ts';
-import { buildManifest, checkManifest, MANIFEST_ARTIFACT, MANIFEST_SCHEMA, type CiManifest } from '../../scripts/ci-manifest.ts';
+import { buildManifest, checkManifest, failureSignature, junitMessages, MANIFEST_ARTIFACT, MANIFEST_SCHEMA, type CiManifest } from '../../scripts/ci-manifest.ts';
+import { failureSignature as gateSignature, parseExemptionBlocks } from '../fixtures/nightly-watch/stress-exemption-contract.ts';
import { inert, jsonBlock, labelNames, readJsonBlock, readZipEntry, type GitHubClient, type Issue } from '../../scripts/lib/gh-issue.ts';
import { FLAKE_MARKER, MR_MARKER, PUSH_ALLOWLIST, type FlakeRecord, type MasterRedState } from '../../scripts/lib/master-red.ts';
import {
@@ -739,7 +740,7 @@ describe('master-red: push-to-master runs', () => {
test('a flake outside the Postgres arms closes after its repair PR merged and a later complete run passed its file and arm', async () => {
const w = testWorld(T.g8352);
const rec: FlakeRecord = {
- schema: 'flake/v1', workflow: 'Test', file: 'test/unit-only.test.ts', test: 'ordering', lane: 'unit', arm: '', platform: 'linux', job: 'test (2)', signature: 'expected 7',
+ schema: 'flake/v1', workflow: 'Test', file: 'test/unit-only.test.ts', test: 'ordering', lane: 'unit', arm: '', platform: 'linux', backend: 'pglite', job: 'test (2)', signature: 'expected 7',
first_seen: { run_id: 1, run_number: 1, run_attempt: 1, sha: 'c'.repeat(40) }, master_red_issue: 1, owner: 'agent on release duty', opened: TODAY, expires: '2026-10-19', reproduce: null,
};
const flake: WorldIssue = { number: 50, title: 'Flake: test/unit-only.test.ts › ordering', state: 'open', labels: [{ name: 'flake' }], body: jsonBlock(FLAKE_MARKER, rec), created: 0, comments: [] };
@@ -844,3 +845,77 @@ describe('operator messages carry docs anchors that resolve', () => {
expect(missing).toEqual([]);
});
});
+
+describe('stress-gate exemption records (lane D contract: scripts/stress/README.md)', () => {
+ const e2eRed = async () => {
+ const w = new World();
+ w.addRun(E.g8470).addRun(E.r8486, `jobs-${E.r8486.id}.json`, mr('ci-manifest-37351182593.json'));
+ await go(w, E.r8486);
+ return w;
+ };
+ const manifestFailures = mr<CiManifest>('ci-manifest-37351182593.json').failures;
+
+ test('the master-red body carries one record per failing test identity that the stress gate parser accepts', async () => {
+ const w = await e2eRed();
+ const rows = parseExemptionBlocks(masterIssue(w, 'E2E Tests')!.body!);
+ expect(rows).toHaveLength(new Set(manifestFailures.map(f => `${f.test}|${f.signature}`)).size);
+ for (const row of rows) {
+ expect(row).toMatchObject({ file: 'test/e2e/fact-embedding-backfill-parity.test.ts', backend: 'postgres', owner: 'agent on release duty', expires: '2026-10-19' });
+ const source = manifestFailures.find(f => f.test === row.test)!;
+ expect(row.signature).toBe(gateSignature(source.message!));
+ }
+ expect(rows.map(r => r.test)).toContain('postgres explicit fact embedding backfill > preview is read-only and scoped; null active facts only, with zero provider calls');
+ });
+
+ test('the manifest signature is the gate\'s failureSignature of the JUnit message (numbers, temp paths, UUIDs, ANSI masked)', () => {
+ for (const msg of [
+ 'expected 8 dimensions, not 1536',
+ '\x1b[31merror\x1b[0m: ENOENT /tmp/gbrain-abc123/x.md\n at foo (src/a.ts:12:3)\n\n at bar\n at baz\n at qux',
+ 'job 3f2b8c1a-1111-2222-3333-444455556666 took 12.5s, limit 10s',
+ 'x'.repeat(400),
+ ]) expect(failureSignature(msg)).toBe(gateSignature(msg));
+ const dir = mkdtempSync(join(tmpdir(), 'junit-msg-'));
+ writeFileSync(join(dir, 'a.junit.xml'), '<?xml version="1.0"?><testsuites tests="2"><testsuite name="s" file="test/a.test.ts" tests="2"><testcase name="ok" classname="s" file="test/a.test.ts"/><testcase name="bad" classname="s" file="test/a.test.ts"><failure type="Error" message="expected 7 &amp; got 6">trace</failure></testcase></testsuite></testsuites>');
+ const messages = junitMessages(dir);
+ expect([...messages.values()]).toEqual(['expected 7 & got 6']);
+ });
+
+ test('flake issues carry their own record; a nightly-red body fed by a scheduled run carries records too', async () => {
+ const w = await e2eRed();
+ const n = masterIssue(w, 'E2E Tests')!.number;
+ w.addRun(E.g8493, `jobs-${E.g8493.id}.json`, mr('ci-manifest-37354832141.json'));
+ await go(w, E.g8493);
+ expect(w.issue(n).state).toBe('closed');
+ const flakes = w.labeled('flake');
+ expect(flakes.length).toBeGreaterThan(0);
+ for (const f of flakes) {
+ const rows = parseExemptionBlocks(f.body!);
+ expect(rows).toHaveLength(1);
+ expect(rows[0]).toMatchObject({ backend: 'postgres', owner: 'agent on release duty', expires: '2026-10-19' });
+ expect(readJsonBlock<FlakeRecord>(f.body, FLAKE_MARKER)!.signature).toBe(rows[0]!.signature);
+ }
+ expect(parseExemptionBlocks(w.issue(n).body!)).toEqual([]);
+
+ const nightly = new World();
+ const scheduled: RunInfo = { ...E.r8486, id: 999201, event: 'schedule', run_number: 8490 };
+ nightly.addRun(scheduled, `jobs-${E.r8486.id}.json`, { ...mr<CiManifest>('ci-manifest-37351182593.json'), run_id: scheduled.id, event: 'schedule' });
+ await go(nightly, scheduled);
+ const rows = parseExemptionBlocks(nightly.labeled('nightly-red')[0]!.body!);
+ expect(rows.length).toBeGreaterThan(0);
+ expect(rows.every(r => r.owner === 'agent on release duty' && r.expires === '2026-10-19')).toBe(true);
+ });
+
+ test('a failure without an exact test name or whose message carries a credential gets no record', async () => {
+ const w = testWorld(T.g8315, T.r8320);
+ await go(w, T.r8320);
+ expect(parseExemptionBlocks(masterIssue(w)!.body!)).toEqual([]);
+ const dir = mkdtempSync(join(tmpdir(), 'ci-manifest-cred-'));
+ writeFileSync(join(dir, 'unit--s1--primary.receipt'), `version=1\nlane=unit\nkind=primary\nshard=1\nof=1\narm=\nsha=${'a'.repeat(40)}\nroot=\nrun_id=5\nrun_attempt=1\nstarted=1\nexit=1\n`);
+ writeFileSync(join(dir, 'unit--s1--primary.files'), 'test/a.test.ts\n');
+ writeFileSync(join(dir, 'unit--s1--primary.junit.xml'), '<?xml version="1.0"?><testsuites tests="1"><testsuite name="test/a.test.ts" file="test/a.test.ts" tests="1"><testcase name="bad" file="test/a.test.ts"><failure message="connect postgresql://postgres:hunter2@db:5432/x failed"/></testcase></testsuite></testsuites>');
+ const m = buildManifest(loadReceiptDir(dir), { workflow: 'Test', event: 'push', sha: 'a'.repeat(40), run_id: 5, run_attempt: 1 }, undefined, junitMessages(dir));
+ expect(m.failures[0]!.signature).toBeUndefined();
+ expect(m.failures[0]!.message).toContain('postgres:***@');
+ expect(JSON.stringify(m)).not.toContain('hunter2');
+ });
+});