Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Fix OpenKnowledge release alert spam and verification (#4943)
Andrew Mikofalvy49d051b48980
diff --git a/.github/scripts/bug-lane-refusal-key.mjs b/.github/scripts/bug-lane-refusal-key.mjsnew file mode 100644index 000000000..383bf72d4--- /dev/null+++ b/.github/scripts/bug-lane-refusal-key.mjs@@ -0,0 +1,25 @@+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint directly, outside Turbo. */+import { createHash } from 'node:crypto';+import { pathToFileURL } from 'node:url';++export function refusalKey({ verdict, stable, fixRefs, survivingRefs, failures, day }) {+ const files = [...new Set(failures.map((failure) => failure.split(' > ')[0]))].sort();+ const identity =+ verdict === 'fail' && files.length > 0+ ? [verdict, stable, files, day]+ : [verdict, fixRefs, survivingRefs];+ return createHash('sha256').update(JSON.stringify(identity)).digest('hex').slice(0, 32);+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ console.log(+ refusalKey({+ verdict: process.env.VERDICT,+ stable: process.env.STABLE,+ fixRefs: process.env.FIX_REFS,+ survivingRefs: process.env.SURVIVING_REFS,+ failures: JSON.parse(process.env.FAILURES || '[]'),+ day: new Date().toISOString().slice(0, 10),+ }),+ );+}diff --git a/.github/scripts/bug-lane-refusal-key.test.mjs b/.github/scripts/bug-lane-refusal-key.test.mjsnew file mode 100644index 000000000..babc78cfe--- /dev/null+++ b/.github/scripts/bug-lane-refusal-key.test.mjs@@ -0,0 +1,38 @@+import { expect, test } from 'vitest';+import { refusalKey } from './bug-lane-refusal-key.mjs';++const refusal = {+ verdict: 'fail',+ stable: 'v0.77.8',+ fixRefs: 'a',+ survivingRefs: 'a',+ failures: ['src/acp/launch.test.ts > missing uvx'],+ day: '2026-09-24',+};++test('another batch blocked in the same failing suites stays in the same daily incident', () => {+ expect(+ refusalKey({+ ...refusal,+ fixRefs: 'a,b',+ survivingRefs: 'b',+ failures: ['src/acp/launch.test.ts > another case', ...refusal.failures],+ }),+ ).toBe(refusalKey(refusal));+});++test.each([+ { stable: 'v0.77.9' },+ { day: '2026-09-25' },+ { failures: ['src/different.test.ts > failed'] },+ { verdict: 'could-not-verify' },+])('a changed base, suite, day or verdict re-arms the notification: %j', (change) => {+ expect(refusalKey({ ...refusal, ...change })).not.toBe(refusalKey(refusal));+});++test('unknown failures and conflicts retain per-batch identity', () => {+ for (const verdict of ['conflict', 'could-not-verify', 'fail']) {+ const input = { ...refusal, verdict, failures: [] };+ expect(refusalKey({ ...input, fixRefs: 'different' })).not.toBe(refusalKey(input));+ }+});diff --git a/.github/scripts/bug-lane-refusal-payload.mjs b/.github/scripts/bug-lane-refusal-payload.mjsindex 3bc7729a4..8e8b4689a 100644--- a/.github/scripts/bug-lane-refusal-payload.mjs+++ b/.github/scripts/bug-lane-refusal-payload.mjs@@ -206,7 +206,9 @@ export function buildSlackPayload({ verdict, stable, refs, runUrl, failures = []actionLine({ verdict, refs }),'',...(runUrl ? [`<${runUrl}|Run log>`] : []),- '_Further identical refusals stay silent; the lane pages again only if the refusal changes._',+ verdict === 'fail' && failures.length > 0+ ? '_Further identical refusals stay silent. Named verification failures are grouped by stable and failing suite for the UTC day, even when the queued fixes change._'+ : '_Further identical refusals stay silent; a changed verdict or queued/surviving batch pages again._',].join('\n');return {diff --git a/.github/scripts/bug-lane-refusal-payload.test.mjs b/.github/scripts/bug-lane-refusal-payload.test.mjsindex 4da2b2b27..7e29dcda6 100644--- a/.github/scripts/bug-lane-refusal-payload.test.mjs+++ b/.github/scripts/bug-lane-refusal-payload.test.mjs@@ -1,7 +1,9 @@+// biome-ignore-all lint/suspicious/noTemplateCurlyInString: shell and GitHub expression fixtures must remain literal.import { readdirSync, readFileSync } from 'node:fs';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { describe, expect, test } from 'vitest';+import {actionLine,buildHeadline,@@ -415,6 +417,27 @@ describe('buildSlackPayload', () => {expect(body).toMatch(/Further identical refusals stay silent/);});+ test('the footer describes the suppression rule for the actual verdict', () => {+ for (const verdict of ['conflict', 'could-not-verify', 'fail']) {+ const text = JSON.stringify(+ buildSlackPayload({ verdict, stable: 'v1.0.0', refs: [], runUrl: '', failures: [] }),+ );+ expect(text).toContain('queued/surviving batch pages again');+ expect(text).not.toContain('grouped by stable');+ }+ expect(+ JSON.stringify(+ buildSlackPayload({+ verdict: 'fail',+ stable: 'v1.0.0',+ refs: [],+ runUrl: '',+ failures: ['src/test.ts > case'],+ }),+ ),+ ).toContain('grouped by stable and failing suite');+ });+test('has no emoji and no header block', () => {const payload = buildSlackPayload({ verdict: 'conflict', stable: 'v1', refs, runUrl: '' });expect(payload.blocks).toHaveLength(1);diff --git a/.github/scripts/download-candidate-dmg.mjs b/.github/scripts/download-candidate-dmg.mjsnew file mode 100644index 000000000..a295585a4--- /dev/null+++ b/.github/scripts/download-candidate-dmg.mjs@@ -0,0 +1,56 @@+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint directly, outside Turbo. */+import { execFileSync } from 'node:child_process';+import { appendFileSync, mkdirSync } from 'node:fs';+import { join } from 'node:path';+import { pathToFileURL } from 'node:url';++const DESKTOP_IDENTITY_SPLIT_COMMIT = '15cd5fd9c2644d9af05609d501a5f068a1da106c';++export function candidateIdentity(comparisonStatus) {+ if (comparisonStatus === 'behind') return 'legacy';+ if (comparisonStatus === 'ahead' || comparisonStatus === 'identical') return 'beta';+ throw new Error(`Cannot establish candidate product identity: ${comparisonStatus}`);+}++export function selectDmgAsset(assets, identity) {+ const names = assets+ .map((asset) => asset.name)+ .filter((name) => /^OpenKnowledge(?:-Beta)?-(?:arm64|x64|universal)\.dmg$/.test(name));+ if (names.length !== 1) return null;+ if (identity === 'beta' && names[0].startsWith('OpenKnowledge-Beta-')) return names[0];+ if (identity === 'legacy' && !names[0].startsWith('OpenKnowledge-Beta-')) return names[0];+ return null;+}++function ghText(args, timeout = 30_000) {+ return execFileSync('gh', args, { encoding: 'utf8', timeout });+}++export function downloadCandidateDmg({ candidate, dir, gh = ghText }) {+ if (!/^v\d+\.\d+\.\d+-beta\.\d+$/.test(candidate ?? '')) {+ throw new Error('A beta CANDIDATE tag is required');+ }+ const meta = JSON.parse(gh(['release', 'view', candidate, '--json', 'assets']));+ const comparison = JSON.parse(+ gh([+ 'api',+ `repos/{owner}/{repo}/compare/${DESKTOP_IDENTITY_SPLIT_COMMIT}...${candidate}?per_page=1`,+ '--jq',+ '{status}',+ ]),+ );+ const identity = candidateIdentity(comparison.status);+ const asset = selectDmgAsset(meta.assets, identity);+ if (asset === null) throw new Error(`No unique ${identity} DMG in ${candidate}`);+ mkdirSync(dir, { recursive: true });+ gh(['release', 'download', candidate, '--pattern', asset, '--dir', dir], 300_000);+ return join(dir, asset);+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ const dmgPath = downloadCandidateDmg({+ candidate: process.env.CANDIDATE,+ dir: join(process.env.RUNNER_TEMP, 'fast-tier-dmg'),+ });+ appendFileSync(process.env.GITHUB_OUTPUT, `dmg_path=${dmgPath}\n`);+}diff --git a/.github/scripts/download-candidate-dmg.test.mjs b/.github/scripts/download-candidate-dmg.test.mjsnew file mode 100644index 000000000..eec45a815--- /dev/null+++ b/.github/scripts/download-candidate-dmg.test.mjs@@ -0,0 +1,129 @@+import { execFileSync } from 'node:child_process';+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { delimiter, join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { describe, expect, test } from 'vitest';+import {+ candidateIdentity,+ downloadCandidateDmg,+ selectDmgAsset,+} from './download-candidate-dmg.mjs';++test.skipIf(process.platform === 'win32')(+ 'the macOS CLI transport projects an oversized GitHub comparison before buffering it',+ () => {+ const dir = mkdtempSync(join(tmpdir(), 'ok-candidate-cli-'));+ try {+ writeFileSync(+ join(dir, 'gh'),+ `#!/usr/bin/env node+const fs = require('node:fs');+const path = require('node:path');+const args = process.argv.slice(2);+if (args[0] === 'api') {+ const response = { status: 'ahead', files: [{ patch: 'x'.repeat(2 * 1024 * 1024) }] };+ const jq = args.indexOf('--jq');+ process.stdout.write(JSON.stringify(jq >= 0 && args[jq + 1] === '{status}' ? { status: response.status } : response));+} else if (args[1] === 'view') {+ process.stdout.write(JSON.stringify({ assets: [{ name: 'OpenKnowledge-Beta-arm64.dmg' }] }));+} else if (args[1] === 'download') {+ fs.writeFileSync(path.join(args[args.indexOf('--dir') + 1], args[args.indexOf('--pattern') + 1]), 'fixture DMG');+} else { process.exit(2); }+`,+ { mode: 0o755 },+ );+ const output = join(dir, 'output');+ execFileSync(+ process.execPath,+ [fileURLToPath(new URL('./download-candidate-dmg.mjs', import.meta.url))],+ {+ env: {+ ...process.env,+ PATH: `${dir}${delimiter}${process.env.PATH}`,+ CANDIDATE: 'v0.78.0-beta.5',+ RUNNER_TEMP: dir,+ GITHUB_OUTPUT: output,+ },+ stdio: 'pipe',+ },+ );+ const path = readFileSync(output, 'utf8').trim().slice('dmg_path='.length);+ expect(readFileSync(path, 'utf8')).toBe('fixture DMG');+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ },+);++test.each([+ { candidate: 'v0.77.9-beta.0', status: 'behind', name: 'OpenKnowledge-arm64.dmg' },+ { candidate: 'v0.78.0-beta.5', status: 'ahead', name: 'OpenKnowledge-Beta-arm64.dmg' },+])(+ 'the download boundary composes GitHub ancestry and inventory for $candidate',+ ({ candidate, status, name }) => {+ const dir = mkdtempSync(join(tmpdir(), 'ok-candidate-download-'));+ try {+ const path = downloadCandidateDmg({+ candidate,+ dir,+ gh: (args) => {+ if (args[0] === 'api') {+ expect(args).toEqual([+ 'api',+ `repos/{owner}/{repo}/compare/15cd5fd9c2644d9af05609d501a5f068a1da106c...${candidate}?per_page=1`,+ '--jq',+ '{status}',+ ]);+ return JSON.stringify({ status });+ }+ if (args[1] === 'view') {+ expect(args).toEqual(['release', 'view', candidate, '--json', 'assets']);+ return JSON.stringify({ assets: [{ name }] });+ }+ expect(args).toEqual(['release', 'download', candidate, '--pattern', name, '--dir', dir]);+ writeFileSync(join(dir, name), 'downloaded inventory fixture');+ return '';+ },+ });+ expect(readFileSync(path, 'utf8')).toBe('downloaded inventory fixture');+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+ },+);++describe('candidate DMG inventory', () => {+ test.each([+ { name: 'OpenKnowledge-arm64.dmg', identity: 'legacy' },+ { name: 'OpenKnowledge-Beta-arm64.dmg', identity: 'beta' },+ ])('accepts $name only for its historical product identity $identity', ({ name, identity }) => {+ expect(selectDmgAsset([{ name }, { name: `${name}.blockmap` }], identity)).toBe(name);+ });++ test.each(+ [+ [],+ [{ name: 'unrelated.dmg' }],+ [{ name: '../OpenKnowledge-arm64.dmg' }],+ [{ name: 'OpenKnowledge-arm64.dmg' }, { name: 'OpenKnowledge-Beta-arm64.dmg' }],+ ].map((assets) => ({ assets })),+ )('refuses missing, unknown or ambiguous installers: $assets', ({ assets }) => {+ expect(selectDmgAsset(assets, 'legacy')).toBeNull();+ expect(selectDmgAsset(assets, 'beta')).toBeNull();+ });++ test('never accepts a Stable artifact for a split-identity Beta tag', () => {+ expect(selectDmgAsset([{ name: 'OpenKnowledge-arm64.dmg' }], 'beta')).toBeNull();+ expect(selectDmgAsset([{ name: 'OpenKnowledge-Beta-arm64.dmg' }], 'legacy')).toBeNull();+ expect(selectDmgAsset([{ name: 'OpenKnowledge-arm64.dmg' }], 'unknown')).toBeNull();+ });++ test('requires proven ancestry across the product-identity split', () => {+ expect(candidateIdentity('behind')).toBe('legacy');+ expect(candidateIdentity('ahead')).toBe('beta');+ expect(candidateIdentity('identical')).toBe('beta');+ expect(() => candidateIdentity('diverged')).toThrow('Cannot establish');+ expect(() => candidateIdentity(undefined)).toThrow('Cannot establish');+ });+});diff --git a/.github/scripts/evaluate-smoke-alarm.mjs b/.github/scripts/evaluate-smoke-alarm.mjsindex 5655338ca..c065dcf2c 100644--- a/.github/scripts/evaluate-smoke-alarm.mjs+++ b/.github/scripts/evaluate-smoke-alarm.mjs@@ -1,4 +1,5 @@#!/usr/bin/env node+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint directly, outside Turbo. */import { execFileSync } from 'node:child_process';import { appendFileSync } from 'node:fs';@@ -9,6 +10,7 @@ export const STALE_FAST_TIER_WINDOW_DAYS = 14;const SMOKE_JOB_NAME = "Smoke the fast-tier candidate's DMG";const DISPATCH_STEP_NAME = 'Dispatch promote-stable for the smoke-proven candidate';+const DISPATCH_RECEIPT_STEP_NAME = 'Record a successful fast-tier dispatch';export function evaluateAlarm({history,@@ -28,7 +30,7 @@ export function evaluateAlarm({}if (streak >= consecutiveThreshold) {reasons.push(- `${streak} consecutive fast-tier candidates did not pass the DMG smoke (threshold ${consecutiveThreshold}) — the gate looks persistently broken, not merely unlucky`,+ `${streak} consecutive fast-tier attempts did not complete successfully (threshold ${consecutiveThreshold}); latest failing stage: ${qualified[0]?.failureStage ?? 'unknown'}`,);}@@ -40,7 +42,7 @@ export function evaluateAlarm({const qualifiedInWindow = inWindow.filter((h) => h.qualified);if (qualifiedInWindow.length > 0 && !inWindow.some((h) => h.promoted)) {reasons.push(- `${qualifiedInWindow.length} cut(s) qualified for the fast tier in the last ${windowDays} days but none was promoted through it — the tier is armed and reaching nothing`,+ `${qualifiedInWindow.length} qualified attempt(s) in the sampled history dated within the last ${windowDays} days, with no successful fast-tier dispatch observed`,);}@@ -51,20 +53,44 @@ export function buildHistory({ runs, jobsForRun }) {return runs.map((run) => {const jobs = jobsForRun(run.databaseId ?? run.id) ?? [];const smoke = jobs.find((j) => j.name === SMOKE_JOB_NAME);- if (!smoke || smoke.conclusion === 'skipped' || smoke.conclusion === 'cancelled') {+ if (+ !smoke ||+ (smoke.status && smoke.status !== 'completed') ||+ smoke.conclusion === 'skipped' ||+ smoke.conclusion === 'cancelled'+ ) {return { at: run.createdAt, qualified: false, verdict: null, promoted: false };}const dispatch = (smoke.steps ?? []).find((s) => s.name === DISPATCH_STEP_NAME);- const promoted = dispatch?.conclusion === 'success';+ const receipt = (smoke.steps ?? []).find((s) => s.name === DISPATCH_RECEIPT_STEP_NAME);+ if (receipt?.conclusion === 'skipped' && dispatch?.conclusion === 'success') {+ return { at: run.createdAt, qualified: false, verdict: null, promoted: false };+ }+ const promoted = (receipt ?? dispatch)?.conclusion === 'success';return {at: run.createdAt,qualified: true,verdict: promoted ? 'pass' : 'non-pass',promoted,+ failureStage: promoted+ ? null+ : ((smoke.steps ?? []).find((s) => s.conclusion === 'failure')?.name ??+ 'Smoke or dispatch'),};});}+export function alarmObservation({ history, nowMs, armed }) {+ const { alarm, reasons } = evaluateAlarm({ history, nowMs, armed });+ const qualified = history.filter((entry) => entry.qualified);+ return {+ alarm,+ reasons,+ observed: armed && (alarm || qualified[0]?.promoted === true),+ incident: alarm ? (qualified[0]?.failureStage ?? 'No fast-tier dispatch') : '',+ };+}+const TRANSIENT_HISTORY_FAILURE =/timeout|timed out|rate.?limit|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN|socket hang up|\b5\d{2}\b|Bad Gateway|Service Unavailable/i;@@ -88,6 +114,8 @@ function main() {'--workflow=select-beta-to-promote.yml','--limit','60',+ '--status',+ 'completed','--json','databaseId,createdAt',]);@@ -99,10 +127,15 @@ function main() {console.log(`${classifyHistoryFailure(err?.message ?? String(err))}Could not read run history for the aggregate alarm: ${err?.message ?? String(err)}`,);+ return;}const armed = process.env.FAST_TIER_ARMED === 'true';- const { alarm, reasons } = evaluateAlarm({ history, nowMs: Date.now(), armed });+ const { alarm, reasons, observed, incident } = alarmObservation({+ history,+ nowMs: Date.now(),+ armed,+ });if (!alarm) {console.log('No aggregate smoke alarm: the fast tier is either healthy or intentionally off.');} else {@@ -113,7 +146,7 @@ function main() {if (process.env.GITHUB_OUTPUT) {appendFileSync(process.env.GITHUB_OUTPUT,- `alarm=${alarm}\nreasons=${reasons.join('; ').replace(/\r?\n/g, ' ')}\n`,+ `observed=${observed}\nalarm=${alarm}\nincident=${incident.replace(/\r?\n/g, ' ')}\nreasons=${reasons.join('; ').replace(/\r?\n/g, ' ')}\n`,);}}diff --git a/.github/scripts/evaluate-smoke-alarm.test.mjs b/.github/scripts/evaluate-smoke-alarm.test.mjsindex 032e62718..bc4a457a2 100644--- a/.github/scripts/evaluate-smoke-alarm.test.mjs+++ b/.github/scripts/evaluate-smoke-alarm.test.mjs@@ -3,6 +3,7 @@ import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { describe, expect, test } from 'vitest';import {+ alarmObservation,buildHistory,CONSECUTIVE_NON_PASS_THRESHOLD,classifyHistoryFailure,@@ -26,11 +27,46 @@ const notQualified = (over = {}) =>const run = (history) => evaluateAlarm({ history, nowMs: NOW });+describe('incident reporter observations', () => {+ test('an armed failure supplies a stable incident identity', () => {+ expect(+ alarmObservation({ history: [cut({ failureStage: 'Download' })], nowMs: NOW, armed: true }),+ ).toMatchObject({ observed: true, alarm: true, incident: 'Download' });+ });++ test('an observed successful dispatch can announce recovery', () => {+ expect(alarmObservation({ history: [passing()], nowMs: NOW, armed: true })).toMatchObject({+ observed: true,+ alarm: false,+ incident: '',+ });+ });++ test.each([[], [notQualified()], [passing()], [cut()]])(+ 'disarming never clears an acknowledgement: %j',+ (...history) => {+ expect(alarmObservation({ history, nowMs: NOW, armed: false }).observed).toBe(false);+ },+ );++ test('no qualifying evidence cannot announce recovery', () => {+ for (const history of [[], [notQualified()]]) {+ expect(alarmObservation({ history, nowMs: NOW, armed: true }).observed).toBe(false);+ }+ });++ test('a below-threshold refusal is not evidence of recovery', () => {+ expect(+ alarmObservation({ history: [cut(), passing()], nowMs: NOW, armed: true }).observed,+ ).toBe(false);+ });+});+describe('condition 1 — consecutive non-pass verdicts', () => {test('fires at exactly the threshold', () => {const r = run([cut({ at: daysAgo(1) }), cut({ at: daysAgo(2) }), cut({ at: daysAgo(3) })]);expect(r.alarm).toBe(true);- expect(r.reasons.join(' ')).toContain('3 consecutive fast-tier candidates');+ expect(r.reasons.join(' ')).toContain('3 consecutive fast-tier attempts');expect(CONSECUTIVE_NON_PASS_THRESHOLD).toBe(3);});@@ -66,7 +102,7 @@ describe('condition 2 — armed but never promoting', () => {test('fires when a qualifying cut sits inside the window with no promotion', () => {const r = run([cut({ at: daysAgo(3) })]);expect(r.alarm).toBe(true);- expect(r.reasons.join(' ')).toContain('armed and reaching nothing');+ expect(r.reasons.join(' ')).toContain('no successful fast-tier dispatch observed');});test('stays silent when a promotion happened inside the window', () => {@@ -85,7 +121,7 @@ describe('condition 2 — armed but never promoting', () => {test('a promotion that has aged out of the window no longer counts as healthy', () => {const r = run([cut({ at: daysAgo(2) }), passing({ at: daysAgo(20) })]);expect(r.alarm).toBe(true);- expect(r.reasons.join(' ')).toContain('armed and reaching nothing');+ expect(r.reasons.join(' ')).toContain('no successful fast-tier dispatch observed');});});@@ -257,6 +293,63 @@ describe('classifyHistoryFailure', () => {});describe('buildHistory run-id fallback', () => {+ test('a successful no-op dispatch step is not a promotion receipt', () => {+ const history = buildHistory({+ runs: [{ id: 42, createdAt: daysAgo(1) }],+ jobsForRun: () => [+ {+ name: "Smoke the fast-tier candidate's DMG",+ status: 'completed',+ conclusion: 'success',+ steps: [+ {+ name: 'Dispatch promote-stable for the smoke-proven candidate',+ conclusion: 'success',+ },+ { name: 'Record a successful fast-tier dispatch', conclusion: 'skipped' },+ ],+ },+ ],+ });+ expect(history[0].promoted).toBe(false);+ expect(run([...history, ...history, ...history]).alarm).toBe(false);+ });++ test('an in-progress smoke is not a failed attempt', () => {+ const history = buildHistory({+ runs: [{ id: 42, createdAt: daysAgo(1) }],+ jobsForRun: () => [+ { name: "Smoke the fast-tier candidate's DMG", status: 'in_progress', conclusion: null },+ ],+ });+ expect(history[0].qualified).toBe(false);+ });++ test('download failure is identified without claiming an executed smoke failure', () => {+ const history = buildHistory({+ runs: [{ id: 42, createdAt: daysAgo(1) }],+ jobsForRun: () => [+ {+ name: "Smoke the fast-tier candidate's DMG",+ status: 'completed',+ conclusion: 'failure',+ steps: [+ { name: "Download the candidate's DMG", conclusion: 'failure' },+ { name: 'Smoke the DMG', conclusion: 'skipped' },+ ],+ },+ ],+ });+ expect(history[0]).toMatchObject({+ qualified: true,+ promoted: false,+ failureStage: "Download the candidate's DMG",+ });+ expect(run([...history, ...history, ...history]).reasons[0]).toContain(+ "Download the candidate's DMG",+ );+ });+test('falls back to run.id when databaseId is absent', () => {const seen = [];buildHistory({diff --git a/.github/scripts/release-alert-state.mjs b/.github/scripts/release-alert-state.mjsnew file mode 100644index 000000000..913ad07ce--- /dev/null+++ b/.github/scripts/release-alert-state.mjs@@ -0,0 +1,58 @@+/* biome-ignore-all lint/suspicious/noUndeclaredEnvVars: GitHub Actions invokes this entrypoint directly, outside Turbo. */+import { appendFileSync, readFileSync, writeFileSync } from 'node:fs';+import { pathToFileURL } from 'node:url';++export async function notifyReleaseIncident({+ statePath,+ incident,+ text,+ nowMs = Date.now(),+ send,+ reminderMs = 86_400_000,+}) {+ let previous = { incident: null, notifiedAt: 0 };+ try {+ previous = JSON.parse(readFileSync(statePath, 'utf8'));+ } catch (error) {+ if (error.code !== 'ENOENT') throw error;+ }+ if (+ (previous.incident !== null && typeof previous.incident !== 'string') ||+ !Number.isFinite(previous.notifiedAt)+ )+ throw new Error('Invalid release alert state');+ const changed = previous.incident !== incident;+ const reminder = incident !== null && nowMs - previous.notifiedAt >= reminderMs;+ const notify = changed || reminder;+ if (notify) await send(text);+ writeFileSync(+ statePath,+ JSON.stringify({+ incident,+ notifiedAt: notify ? nowMs : previous.notifiedAt,+ }),+ );+ return { notified: notify };+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ const webhook = process.env.SLACK_RELEASES_WEBHOOK_URL || process.env.SLACK_WEBHOOK_URL;+ const { notified } = await notifyReleaseIncident({+ statePath: process.env.ALERT_STATE_PATH,+ incident: process.env.ALERT_INCIDENT || null,+ text: process.env.ALERT_TEXT,+ send: async (text) => {+ if (!webhook)+ throw new Error('No release Slack webhook configured; leaving alert unacknowledged');+ const response = await fetch(webhook, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ text }),+ signal: AbortSignal.timeout(30_000),+ });+ if (!response.ok) throw new Error(`Slack delivery failed (${response.status})`);+ },+ });+ if (process.env.GITHUB_OUTPUT)+ appendFileSync(process.env.GITHUB_OUTPUT, `notified=${notified}\n`);+}diff --git a/.github/scripts/release-alert-state.test.mjs b/.github/scripts/release-alert-state.test.mjsnew file mode 100644index 000000000..788eb31a7--- /dev/null+++ b/.github/scripts/release-alert-state.test.mjs@@ -0,0 +1,133 @@+import { execFile } from 'node:child_process';+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { createServer } from 'node:http';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { fileURLToPath } from 'node:url';+import { promisify } from 'node:util';+import { afterEach, expect, test } from 'vitest';+import { notifyReleaseIncident } from './release-alert-state.mjs';++const dirs = [];+afterEach(() => {+ for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true });+});++function fixture() {+ const dir = mkdtempSync(join(tmpdir(), 'release-alert-'));+ dirs.push(dir);+ const sent = [];+ const statePath = join(dir, 'state.json');+ return {+ statePath,+ sent,+ run: (over = {}) =>+ notifyReleaseIncident({+ statePath,+ incident: 'download',+ text: 'download failed',+ nowMs: 1000,+ send: async (text) => sent.push(text),+ ...over,+ }),+ };+}++test('repeated failures stay silent despite changing counts and run URLs', async () => {+ const f = fixture();+ await f.run();+ await f.run({ nowMs: 2000, text: '59 attempts; another run URL' });+ expect(f.sent).toEqual(['download failed']);+});++test('a changed cause, recovery and recurrence each page once', async () => {+ const f = fixture();+ await f.run();+ await f.run({ incident: 'smoke', text: 'smoke failed' });+ await f.run({ incident: null, text: 'recovered' });+ await f.run({ incident: null, text: 'recovered' });+ await f.run();+ expect(f.sent).toEqual(['download failed', 'smoke failed', 'recovered', 'download failed']);+});++test('a persistent incident gets at most one daily reminder', async () => {+ const f = fixture();+ await f.run();+ await f.run({ nowMs: 43_200_000 });+ await f.run({ nowMs: 86_401_000 });+ await f.run({ nowMs: 86_402_000 });+ expect(f.sent).toHaveLength(2);+});++test('failed delivery preserves state and retries on the next observation', async () => {+ const f = fixture();+ await f.run();+ const before = readFileSync(f.statePath, 'utf8');+ await expect(+ f.run({+ incident: null,+ send: async () => {+ throw new Error('Slack down');+ },+ }),+ ).rejects.toThrow('Slack down');+ expect(readFileSync(f.statePath, 'utf8')).toBe(before);+ await f.run({ incident: null, text: 'recovered' });+ expect(f.sent).toEqual(['download failed', 'recovered']);+});++test('initial healthy observation does not announce a recovery', async () => {+ const f = fixture();+ await f.run({ incident: null });+ expect(f.sent).toEqual([]);+});++test('corrupt acknowledgement state fails visibly instead of flooding or claiming recovery', async () => {+ const f = fixture();+ writeFileSync(f.statePath, '{}');+ await expect(f.run()).rejects.toThrow('Invalid release alert state');+ expect(f.sent).toEqual([]);+});++test('the CLI delivers through HTTP, persists success, suppresses repeats and retries failure', async () => {+ const f = fixture();+ const messages = [];+ let status = 500;+ const server = createServer(async (request, response) => {+ let body = '';+ for await (const chunk of request) body += chunk;+ messages.push(JSON.parse(body));+ response.writeHead(status).end(status === 200 ? 'ok' : 'unavailable');+ });+ await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));+ const webhook = `http://127.0.0.1:${server.address().port}/slack`;+ const run = () =>+ promisify(execFile)(+ process.execPath,+ [fileURLToPath(new URL('./release-alert-state.mjs', import.meta.url))],+ {+ env: {+ ...process.env,+ ALERT_STATE_PATH: f.statePath,+ GITHUB_OUTPUT: `${f.statePath}.outputs`,+ ALERT_INCIDENT: 'download',+ ALERT_TEXT: 'real HTTP probe',+ SLACK_RELEASES_WEBHOOK_URL: webhook,+ SLACK_WEBHOOK_URL: 'http://127.0.0.1:1/must-not-use',+ },+ },+ );+ try {+ await expect(run()).rejects.toThrow('Slack delivery failed (500)');+ status = 200;+ await run();+ await run();+ expect(messages).toEqual([{ text: 'real HTTP probe' }, { text: 'real HTTP probe' }]);+ expect(readFileSync(`${f.statePath}.outputs`, 'utf8')).toBe('notified=true\nnotified=false\n');+ } finally {+ server.closeAllConnections();+ await new Promise((resolve, reject) =>+ server.close((error) => (error ? reject(error) : resolve())),+ );+ }+});diff --git a/.github/scripts/release-cascade-shape.test.mjs b/.github/scripts/release-cascade-shape.test.mjsindex 3eed73854..0a7a56655 100644--- a/.github/scripts/release-cascade-shape.test.mjs+++ b/.github/scripts/release-cascade-shape.test.mjs@@ -1,11 +1,12 @@// biome-ignore-all lint/suspicious/noTemplateCurlyInString: shell and GitHub expression fixtures must remain literal.+import { execFileSync } from 'node:child_process';+import { createHash } from 'node:crypto';import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';import { createRequire } from 'node:module';import { tmpdir } from 'node:os';import { dirname, join } from 'node:path';import { fileURLToPath } from 'node:url';import { afterAll, describe, expect, test } from 'vitest';-import { DESKTOP_VARIANTS } from '../../packages/desktop/src/shared/desktop-variant.ts';import { buildSlackPayload } from './build-smoke-alert-payload.mjs';import { selectPromotion } from './select-beta-to-promote.mjs';import { smokePackagedDmg, VERDICT } from './smoke-packaged-dmg.mjs';@@ -623,7 +624,8 @@ describe('the bug lane verifies the synthetic tree at the same bar as main', ()expect(sigFrom).toBeGreaterThan(-1);expect(sigTo).toBeGreaterThan(sigFrom);const sig = bugLaneVerify.slice(sigFrom, sigTo);- expect(sig).toContain('"$VERDICT"');+ expect(sig).toContain('VERDICT: ${{ steps.verify.outputs.verdict }}');+ expect(sig).toContain('bug-lane-refusal-key.mjs');expect(verify).toContain('TIER_VERDICT=could-not-verify');expect(bugLaneVerify).not.toContain('budget_blown');});@@ -638,6 +640,35 @@ describe('the bug lane verifies the synthetic tree at the same bar as main', ()expect(bugLaneVerify).toContain('actions/cache/restore@');});+ test('a missing grouping helper still emits a usable batch-based paging key', () => {+ const scratch = mkdtempSync(join(tmpdir(), 'ok-refusal-key-'));+ try {+ const output = join(scratch, 'output');+ const script = bugLaneVerifyStep('Refusal signature')+ .split('run: |')[1]+ .split('\n')+ .map((line) => line.replace(/^ {10}/, ''))+ .join('\n');+ const stdout = execFileSync('bash', ['-c', script], {+ encoding: 'utf8',+ env: {+ ...process.env,+ RUNNER_TEMP: scratch,+ GITHUB_OUTPUT: output,+ GITHUB_SHA: '0000000000000000000000000000000000000000',+ VERDICT: 'fail',+ FIX_REFS: 'a,b',+ SURVIVING_REFS: 'a',+ },+ });+ const expected = createHash('sha256').update('fail|a,b|a').digest('hex').slice(0, 32);+ expect(stdout).toContain('retaining batch-based paging');+ expect(readFileSync(output, 'utf8')).toContain(`sig=${expected}`);+ } finally {+ rmSync(scratch, { recursive: true, force: true });+ }+ });+test('the marker is gated on DELIVERY, not on the page step succeeding', () => {const refusalPage = bugLaneVerifyStep('Page on a refusal (armed only)');expect(refusalPage).toContain('echo "delivered=${delivered}" >> "$GITHUB_OUTPUT"');@@ -770,10 +801,6 @@ describe('every release-pipeline post prefers the releases webhook', () => {label: "the bug lane's partial-drop notice",step: () => stepAfter(bugLaneVerify, 'Notify on a partial drop', 'Page on a refusal'),},- {- label: 'the fast-tier refusal',- step: () => stepAfter(selectBeta, 'Record a fast-tier refusal'),- },{label: "the Linear stamp's failure page",step: () => stepAfter(linearRelease, 'Alert on failed stamping'),@@ -794,8 +821,39 @@ describe('every release-pipeline post prefers the releases webhook', () => {expect(alarm).toContain('SLACK_RELEASES_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }}',);- expect(alarm).toContain('post "${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}" Slack');- expect(alarm).not.toContain('post "${SLACK_WEBHOOK_URL:-}" Slack');+ expect(alarm).toContain('node .github/scripts/release-alert-state.mjs');+ const reporter = readFileSync(+ join(WORKFLOWS, '..', 'scripts', 'release-alert-state.mjs'),+ 'utf8',+ );+ expect(reporter).toContain(+ 'process.env.SLACK_RELEASES_WEBHOOK_URL || process.env.SLACK_WEBHOOK_URL',+ );+ });++ test('fast-tier attempts have one incident reporter and save only successful acknowledgements', () => {+ const refusal = workflowStep(+ selectBeta,+ 'select-beta-to-promote.yml',+ 'Record a fast-tier refusal',+ );+ expect(refusal).not.toContain('curl');+ expect(refusal).not.toContain('SLACK_WEBHOOK_URL');+ expect(stepAfter(selectBeta, 'Page the release channel')).toContain(+ "if: steps.alarm.outputs.observed == 'true'",+ );+ expect(stepAfter(selectBeta, 'Remember the smoke incident acknowledgement')).toContain(+ "if: steps.page.outcome == 'success' && steps.page.outputs.notified == 'true'",+ );+ });++ test('bug verification provisions the native runtime before testing the stable tree', () => {+ const setup = bugLaneVerify.indexOf('- name: Setup uv for ACP package acquisition tests');+ expect(setup).toBeGreaterThan(-1);+ expect(setup).toBeLessThan(bugLaneVerify.indexOf('- name: Verify the synthetic tree'));+ expect(bugLaneVerifyStep('Verify ACP package acquisition prerequisites')).toContain(+ 'uvx --version',+ );});});@@ -895,8 +953,10 @@ describe('public desktop product variants stay independently buildable', () => {}});- test('the fast-tier smoke downloads the Beta product artifact', () => {- expect(selectBeta).toContain(`--pattern '${DESKTOP_VARIANTS.beta.artifactName}-*.dmg'`);+ test('the fast-tier smoke resolves the candidate inventory, including legacy Beta artifacts', () => {+ expect(selectBeta).toContain('node .github/scripts/download-candidate-dmg.mjs');+ expect(selectBeta).toContain('DMG: ${{ steps.download.outputs.dmg_path }}');+ expect(selectBeta).not.toContain("--pattern 'OpenKnowledge-Beta-*.dmg'");});});diff --git a/.github/workflows/bug-lane-verify.yml b/.github/workflows/bug-lane-verify.ymlindex 40e9ceba2..caaaa72f8 100644--- a/.github/workflows/bug-lane-verify.yml+++ b/.github/workflows/bug-lane-verify.yml@@ -134,6 +134,19 @@ jobs:- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5+ - name: Setup uv for ACP package acquisition tests+ uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2+ with:+ version: '0.11.28'+ enable-cache: false++ - name: Verify ACP package acquisition prerequisites+ run: |+ uv --version+ uvx --version+ curl --version+ python3 --version+- name: Verify the synthetic tree (cherry-pick + fast test tiers)id: verifyenv:@@ -609,37 +622,6 @@ jobs:# qualify, so the signature moves and the lane re-pages -- and the page# itself tells the reader to check recent runs rather than wait.#- # A refusal is a STANDING ANSWER, not an event. The refused ref stays in- # the pending pile and re-qualifies and re-conflicts on every tick, so a- # page-per-tick turns one durable fact into a message every 20 minutes- # until the cycle's stable consumes it — ~70 identical pages, which is- # how a channel gets muted.- #- # Page once per DISTINCT refusal instead. The signature is the verdict- # plus the refs it is about, so a genuinely new refusal — a different- # ref, or the same ref reaching a different verdict — still pages at- # once. That list is the WHOLE signature: `VERDICT|FIX_REFS|SURVIVING_REFS`- # and nothing else. Everything else the page renders — which tests went- # red, the stable tag, which refs were dropped and what they collided- # with, the tickets that qualified them — is deliberately outside it, so- # a second refusal that differs only in those stays quiet. The reasoning- # is split between the stable-tag paragraph and the comment above the- # `sig=` printf; stating what IS hashed rather than listing what is not- # is what keeps this accurate as the page grows.- # The cache is only a "have I said this already" marker; if it misses- # (eviction, or a tick cancelled between paging and saving) the lane- # re-pages, which is the safe direction to fail.- #- # The stable tag is DELIBERATELY not in the signature, so a refusal that- # survives a stable roll stays quiet rather than re-paging against the- # new stable. Two reasons. The operator's move does not change when the- # stable does — it is still "wait for the cycle, or point-release by- # hand" — and stables currently roll several times a day, so including it- # would restore a good fraction of the flood for a fact already reported.- # The suppression is bounded either way: a refused ref keeps its- # changeset pending only until a cut that DOES contain it ships, which- # the ordinary beta-to-stable cadence guarantees within a cycle. If that- # ever stops being true, put "$STABLE" back in the printf below.- name: Refusal signatureid: refusalif: env.BUG_LANE_ARMED == 'true' && (steps.verify.outputs.verdict == 'conflict' || steps.verify.outputs.verdict == 'fail' || steps.verify.outputs.verdict == 'could-not-verify')@@ -647,23 +629,15 @@ jobs:VERDICT: ${{ steps.verify.outputs.verdict }}FIX_REFS: ${{ inputs.fix_refs }}SURVIVING_REFS: ${{ steps.verify.outputs.surviving_refs }}+ STABLE: ${{ inputs.stable }}+ FAILURES: ${{ steps.verify.outputs.failures }}run: |set -euo pipefail- # The failure list is deliberately OUTSIDE this signature, for the- # same reason the stable is: it is the churniest input the page has.- # A red tier is usually red for many tests at once, and a name that- # differs by a shard index, a temp path or one flaky sibling would- # mint a fresh signature every tick and restore the flood this- # suppression exists to stop. The cost is real and bounded: if the- # same batch keeps refusing while the CAUSE moves, only the first- # cause is paged. That is the right trade — the first page already- # tells an operator the lane is refusing and hands them the run log,- # which carries every subsequent cause.- #- # `could-not-verify` is its own verdict, so it distinguishes itself- # here for free: a tick that could not verify can no longer suppress- # the genuinely red tick behind it for the same ref set.- sig="$(printf '%s|%s|%s' "$VERDICT" "$FIX_REFS" "$SURVIVING_REFS" | sha256sum | cut -c1-32)"+ if ! git show "${GITHUB_SHA}:.github/scripts/bug-lane-refusal-key.mjs" > "${RUNNER_TEMP}/bug-lane-refusal-key.mjs" \+ || ! sig="$(node "${RUNNER_TEMP}/bug-lane-refusal-key.mjs")"; then+ echo "::warning::Could not group the refusal; retaining batch-based paging."+ sig="$(printf '%s|%s|%s' "$VERDICT" "$FIX_REFS" "$SURVIVING_REFS" | sha256sum | cut -c1-32)"+ fiecho "sig=${sig}" >> "$GITHUB_OUTPUT"echo "marker=${RUNNER_TEMP}/bug-lane-refusal-marker" >> "$GITHUB_OUTPUT"@@ -691,7 +665,7 @@ jobs:{echo "### Bug lane — refusal still standing, page suppressed"echo "Verdict \`${VERDICT}\`, signature \`${SIG}\`, already paged on an earlier tick."- echo "The channel stays quiet by design; this refusal re-pages only if it changes."+ echo "For named verification failures, grouping is per stable and failing suite for the UTC day. Conflicts, timeouts and unnamed failures use verdict and batch identity. Batch details remain in each run."} >> "$GITHUB_STEP_SUMMARY"echo "::notice::bug-lane: refusal ${SIG} already paged; suppressing the duplicate page."diff --git a/.github/workflows/select-beta-to-promote.yml b/.github/workflows/select-beta-to-promote.ymlindex 46cda8877..10bfbbddf 100644--- a/.github/workflows/select-beta-to-promote.yml+++ b/.github/workflows/select-beta-to-promote.yml@@ -341,21 +341,19 @@ jobs:pnpm install --frozen-lockfile- name: Download the candidate's DMG+ id: downloadenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}CANDIDATE: ${{ needs.evaluate.outputs.fast_tier_candidate }}- run: |- set -euo pipefail- mkdir -p "${RUNNER_TEMP}/fast-tier-dmg"- gh release download "$CANDIDATE" --pattern 'OpenKnowledge-Beta-*.dmg' --dir "${RUNNER_TEMP}/fast-tier-dmg"+ run: node .github/scripts/download-candidate-dmg.mjs- name: Smoke the DMGid: smokeenv:CANDIDATE: ${{ needs.evaluate.outputs.fast_tier_candidate }}+ DMG: ${{ steps.download.outputs.dmg_path }}run: |set -uo pipefail- DMG="$(find "${RUNNER_TEMP}/fast-tier-dmg" -maxdepth 1 -name '*.dmg' | head -1)"if [[ -z "$DMG" ]]; thenecho "verdict=error" >> "$GITHUB_OUTPUT"echo "::warning::No .dmg downloaded for ${CANDIDATE}; refusing the fast tier (the 24h path is unaffected)."@@ -367,6 +365,7 @@ jobs:node .github/scripts/smoke-packaged-dmg.mjs "$DMG" || true- name: Dispatch promote-stable for the smoke-proven candidate+ id: dispatchif: steps.smoke.outputs.verdict == 'pass'env:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}@@ -383,36 +382,22 @@ jobs:fiSELF_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"gh workflow run promote-stable.yml -f beta_tag="$CANDIDATE" -f dispatched_by="$SELF_URL"+ echo "dispatched=true" >> "$GITHUB_OUTPUT"echo "::notice::Fast tier: dispatched promote-stable for ${CANDIDATE} after its DMG smoked clean."+ - name: Record a successful fast-tier dispatch+ if: steps.dispatch.outputs.dispatched == 'true'+ run: echo "The smoke-proven candidate was dispatched."+- name: Record a fast-tier refusal- if: steps.smoke.outputs.verdict != 'pass'+ if: failure() || steps.smoke.outputs.verdict != 'pass'env:CANDIDATE: ${{ needs.evaluate.outputs.fast_tier_candidate }}VERDICT: ${{ steps.smoke.outputs.verdict }}- SLACK_RELEASES_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }}- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}run: |set -uo pipefailecho "::notice::Fast tier refused for ${CANDIDATE} (verdict=${VERDICT:-unknown}). The 24h tier is unaffected; this beta promotes normally once it has soaked."- # Per-refusal page. A fast-tier tick can fire at 03:00 on a Sunday;- # without this the only trace of the gate biting is a job notice- # nobody is watching, which makes the gate decorative. Best-effort:- # a failed POST is a warning, never a job failure — the refusal- # itself already protected the release.- WEBHOOK_URL="${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}"- if [[ -z "$WEBHOOK_URL" ]]; then- echo "::notice::No Slack webhook secret set — refusal page skipped."- exit 0- fi- RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"- TEXT="⛔ Fast-tier DMG smoke REFUSED for ${CANDIDATE} (verdict=${VERDICT:-unknown}). The beta stays on the 24h soak; investigate the smoke before it promotes. ${RUN_URL}"- payload="$(jq -nc --arg t "$TEXT" '{text: $t}')"- if curl -sS --fail -X POST -H 'Content-type: application/json' --data "$payload" "$WEBHOOK_URL"; then- echo "Posted the fast-tier refusal page."- else- echo "::warning::Fast-tier refusal page failed to POST — the refusal itself still holds."- fi+ echo "Fast tier refused for ${CANDIDATE}; verdict=${VERDICT:-unknown}. The aggregate incident reporter owns Slack notifications." >> "$GITHUB_STEP_SUMMARY"# Aggregate silent-failure alarm.#@@ -427,9 +412,6 @@ jobs:# that fired continuously while the tier was off would train responders to# ignore it.#- # Schedule-only: the alarm is about a trend, so evaluating it on every push- # would add noise without adding signal. Stateless — it derives history from- # this workflow's own run records and writes nothing back.aggregate-smoke-alarm:name: Aggregate DMG-smoke alarmif: github.event_name == 'schedule'@@ -457,34 +439,37 @@ jobs:FAST_TIER_ARMED: ${{ env.FAST_TIER_ARMED }}run: node .github/scripts/evaluate-smoke-alarm.mjs- # Routed to the same channel as the per-cut smoke alert, not to a- # workflow annotation alone — an annotation on a scheduled job nobody- # opens is indistinguishable from silence. Slack only, for the reason the- # per-cut alert is: Discord carries shipped releases, not gate health.+ - name: Restore the smoke incident acknowledgement+ if: steps.alarm.outputs.observed == 'true'+ uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4+ with:+ path: ${{ runner.temp }}/smoke-incident.json+ key: smoke-incident-v1-${{ github.run_id }}-${{ github.run_attempt }}+ restore-keys: smoke-incident-v1-+- name: Page the release channel- if: steps.alarm.outputs.alarm == 'true'+ id: page+ if: steps.alarm.outputs.observed == 'true'+ continue-on-error: trueenv:SLACK_RELEASES_WEBHOOK_URL: ${{ secrets.SLACK_RELEASES_WEBHOOK_URL }}SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}REASONS: ${{ steps.alarm.outputs.reasons }}+ ALERT_INCIDENT: ${{ steps.alarm.outputs.incident }}+ ALERT_STATE_PATH: ${{ runner.temp }}/smoke-incident.jsonrun: |- set -uo pipefail+ set -euo pipefailRUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"- TEXT="🚨 DMG SMOKE GATE ALARM — ${REASONS}. Investigate before trusting the fast tier. ${RUN_URL}"- # `text` only: `content` was Discord's field, and Slack is now the- # sole recipient.- payload="$(jq -nc --arg t "$TEXT" '{text: $t}')"- post() {- local webhook="$1" label="$2"- if [[ -z "$webhook" ]]; then- echo "::notice::${label} webhook not set — skipping the ${label} aggregate alarm."- return 0- fi- if curl -sS --fail -X POST -H 'Content-type: application/json' --data "$payload" "$webhook"; then- echo "Posted the ${label} aggregate alarm."- else- echo "::warning::${label} aggregate alarm failed to POST — the alarm condition still holds."- fi- }- post "${SLACK_RELEASES_WEBHOOK_URL:-${SLACK_WEBHOOK_URL:-}}" Slack- echo "::warning::DMG smoke gate alarm: ${REASONS}"+ if [[ -n "$ALERT_INCIDENT" ]]; then+ export ALERT_TEXT="🚨 Fast-tier gate incident — ${REASONS}. Repeated attempts stay silent; a persistent incident reminds daily. ${RUN_URL}"+ else+ export ALERT_TEXT="✅ Fast-tier gate recovered: a successful dispatch is visible in the sampled history. ${RUN_URL}"+ fi+ node .github/scripts/release-alert-state.mjs++ - name: Remember the smoke incident acknowledgement+ if: steps.page.outcome == 'success' && steps.page.outputs.notified == 'true'+ uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4+ with:+ path: ${{ runner.temp }}/smoke-incident.json+ key: smoke-incident-v1-${{ github.run_id }}-${{ github.run_attempt }}diff --git a/AGENTS.md b/AGENTS.mdindex 8d7a2451a..54fa460db 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -47,6 +47,10 @@ pnpm run dev- `packages/server` - local collaboration server- `docs` - documentation site+## Process safety++Never signal a pid you did not spawn. No literal `0`, `1`, or `-1`, numeric fallback, or unvalidated parsed number may reach `process.kill` or the reaper. Validate lock-file PIDs with `isValidLockPid()`. Gate: `ok/no-sentinel-signal-target`.+## Comment policy**Write no comments.** Explanation belongs in names, types, tests, the commit message, the PR body, or a doc — a comment is the one place it rots unseen. This inverts the usual open-source norm, so it surprises people; it is deliberate, and `pnpm run lint` enforces it.diff --git a/packages/server/src/acp/managed-runtime-flow.integration.test.ts b/packages/server/src/acp/managed-runtime-flow.integration.test.tsindex f2eb92230..88dd7df40 100644--- a/packages/server/src/acp/managed-runtime-flow.integration.test.ts+++ b/packages/server/src/acp/managed-runtime-flow.integration.test.ts@@ -192,6 +192,10 @@ describe('package admission after runtime preparation', () => {);const empty = join(home, 'empty');mkdirSync(empty);+ if (source === 'login-shell') {+ writeExecutable(join(empty, 'node'), "process.stdout.write('v1.0.0\\n');");+ writeExecutable(join(empty, 'npx'), 'process.exit(0);');+ }let bytes: Buffer;if (process.platform === 'win32') {const zip = new ZipFile();