Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(ok): bug lane — auto point-release evaluator, log-only (PRD-7738) (#3120)

Andrew Mikofalvy9c6f3d3c967d
diff --git a/.github/scripts/bug-lane.mjs b/.github/scripts/bug-lane.mjs
new file mode 100644
index 000000000..169c92351
--- /dev/null
+++ b/.github/scripts/bug-lane.mjs
@@ -0,0 +1,284 @@
+// Bug-lane evaluation for the Bug lane workflow
+// (.github/workflows/bug-lane.yml): decide which merged-but-unreleased BUG
+// FIXES should ship NOW as an automated cherry-pick point release, without
+// waiting for their cycle's stable.
+//
+// WHY THIS LANE EXISTS. The fast soak tier qualifies whole CUTS, and one minor
+// changeset anywhere in the pending pile disqualifies every cut until the
+// cycle's stable ships. In a repo where features land daily, that starves the
+// tier: a perfectly tagged bug fix merging mid-cycle waits out the full soak
+// behind work that has nothing to do with it. This lane qualifies COMMITS
+// instead: a fix whose own changesets are patch-only and bug-linked is
+// cherry-picked onto the current stable through the existing point-release
+// cascade, which synthesizes exactly the commit one linear history cannot
+// contain — "last stable plus this fix and nothing else".
+//
+// WHAT QUALIFIES A COMMIT. Grouped by the commit that ADDED each pending
+// changeset:
+// - every changeset the commit added is `patch` (a commit adding any minor
+// is feature work and stays with its cycle), AND
+// - at least one of those changesets traces to a Linear issue carrying the
+// Bug label, through the SAME chain the soak tier uses (changeset ->
+// adding-commit squash subject `(#N)` -> source-monorepo PR URL ->
+// Linear attachmentsForURL -> labels). One definition of "bug-linked",
+// shared by import, so the two lanes can never disagree.
+//
+// WHY RE-RELEASE IS STRUCTURALLY IMPOSSIBLE. Candidates are enumerated from
+// the changesets still PENDING on main; a point-released fix's changeset is
+// consumed by main-reset minutes later and disappears from the pile. Behind
+// that: commits already contained in the newest stable are pre-filtered here,
+// and a pick that would re-apply shipped work comes up empty and is refused by
+// point-release's own guards. Every stable this lane produces therefore
+// carries novel changesets.
+//
+// FAIL-SAFE, LIKE THE SOAK-TIER PREDICATE. A wrong SELECTION here never ships
+// bad bytes — everything downstream re-guards (clean pick, delta-matches-fix,
+// patch-only bump, DMG smoke before publish). So resolution failures degrade
+// to "does not qualify" with a warning, and only infrastructure that prevents
+// ANY answer (git itself failing) fails the tick loud.
+//
+// The workflow adds two stages this script deliberately does not own: a
+// VERIFY stage that cherry-picks the batch onto the stable in the runner and
+// runs the fast test tiers against the synthetic tree (the tree that actually
+// ships, which no CI has otherwise run), and the DISPATCH of
+// point-release.yml, gated on BUG_LANE_ARMED.
+
+import { execFileSync, spawnSync } from 'node:child_process';
+import { appendFileSync } from 'node:fs';
+import { pathToFileURL } from 'node:url';
+import { realGit } from '../../scripts/compute-stable-version.mjs';
+import { gitCleanEnv } from '../../scripts/git-clean-env.mjs';
+import { makeResolveChangesetPrUrl, makeResolveIssuesForUrl } from './select-beta-to-promote.mjs';
+
+const STABLE_TAG_RE = /^v\d+\.\d+\.\d+$/;
+const DEFAULT_LINK_REPO = 'inkeep/agents-private';
+const BUG_LABEL = 'Bug';
+
+/**
+ * Group pending changesets by the commit that added them and decide which
+ * commits qualify for the bug lane. Pure; every boundary is injected.
+ *
+ * pendingChangesets: [{ id, bump, addingSha, addingSubject }]
+ * isInStable(sha) -> boolean (commit already contained in stable)
+ * resolveChangesetPrUrl(id) -> url|null
+ * resolveIssuesForUrl(url) -> { issues: [{identifier, labels}] } | { unresolvable }
+ *
+ * Returns { fixRefs, perCommit, warnings, reason }. `fixRefs` preserves the
+ * input order of first appearance, which the caller supplies oldest-first so
+ * the cherry-pick sequence matches merge order.
+ */
+export async function evaluateBugLane({
+ pendingChangesets = [],
+ isInStable,
+ resolveChangesetPrUrl,
+ resolveIssuesForUrl,
+ bugLabel = BUG_LABEL,
+}) {
+ const warnings = [];
+ if (pendingChangesets.length === 0) {
+ return { fixRefs: [], perCommit: [], warnings, reason: 'no-pending-changesets' };
+ }
+
+ const byCommit = new Map();
+ for (const cs of pendingChangesets) {
+ if (!cs?.addingSha) {
+ warnings.push(`no-adding-commit ${cs?.id ?? '?'}`);
+ continue;
+ }
+ if (!byCommit.has(cs.addingSha)) {
+ byCommit.set(cs.addingSha, { sha: cs.addingSha, subject: cs.addingSubject ?? '', changesets: [] });
+ }
+ byCommit.get(cs.addingSha).changesets.push(cs);
+ }
+
+ const wanted = String(bugLabel).toLowerCase();
+ const perCommit = [];
+ const fixRefs = [];
+
+ for (const commit of byCommit.values()) {
+ const entry = {
+ sha: commit.sha,
+ subject: commit.subject,
+ changesets: commit.changesets.map((c) => c.id),
+ qualifies: false,
+ reason: null,
+ linkedIssues: [],
+ };
+ perCommit.push(entry);
+
+ // A commit already inside the stable has nothing left to ship. This is
+ // where restored-changeset chores land once their commit predates the
+ // stable — picking one would re-apply a whole unrelated batch.
+ let contained;
+ try {
+ contained = isInStable(commit.sha);
+ } catch (err) {
+ warnings.push(`containment-error ${commit.sha}: ${err.message}`);
+ entry.reason = 'containment-error';
+ continue;
+ }
+ if (contained) {
+ entry.reason = 'already-in-stable';
+ continue;
+ }
+
+ if (!commit.changesets.every((c) => c.bump === 'patch')) {
+ entry.reason = 'not-patch-only';
+ continue;
+ }
+
+ // Any one Bug-labeled issue across the commit's changesets qualifies it;
+ // per-changeset resolution failures degrade to "this changeset carries no
+ // link" rather than disqualifying the tick.
+ for (const cs of commit.changesets) {
+ let url;
+ try {
+ url = resolveChangesetPrUrl(cs.id);
+ } catch (err) {
+ warnings.push(`changeset-pr-error ${cs.id}: ${err.message}`);
+ continue;
+ }
+ if (!url) {
+ warnings.push(`changeset-pr-unresolved ${cs.id}`);
+ continue;
+ }
+ let resolved;
+ try {
+ resolved = await resolveIssuesForUrl(url);
+ } catch (err) {
+ warnings.push(`issues-error ${url}: ${err.message}`);
+ continue;
+ }
+ if (resolved?.unresolvable) {
+ warnings.push(`issues-unresolvable ${url}: ${resolved.unresolvable}`);
+ continue;
+ }
+ for (const issue of resolved?.issues ?? []) {
+ const labels = Array.isArray(issue?.labels) ? issue.labels : [];
+ if (labels.some((name) => String(name).toLowerCase() === wanted)) {
+ entry.linkedIssues.push(issue?.identifier || url);
+ }
+ }
+ }
+
+ if (entry.linkedIssues.length === 0) {
+ entry.reason = 'not-bug-linked';
+ continue;
+ }
+
+ entry.qualifies = true;
+ entry.reason = 'patch-only-and-bug-linked';
+ fixRefs.push(commit.sha);
+ }
+
+ return {
+ fixRefs,
+ perCommit,
+ warnings,
+ reason: fixRefs.length > 0 ? 'candidates' : 'no-qualifying-fixes',
+ };
+}
+
+// --- workflow-runtime wiring (real git boundary) ---
+
+function runGit(args) {
+ return execFileSync('git', args, { encoding: 'utf8', env: gitCleanEnv() });
+}
+
+function realNewestStableTag() {
+ for (const line of runGit(['tag', '--list', 'v*', '--sort=-version:refname']).split('\n')) {
+ const t = line.trim();
+ if (STABLE_TAG_RE.test(t)) return t;
+ }
+ return null;
+}
+
+/**
+ * The pending pile at HEAD, oldest adding commit first so the cherry-pick
+ * batch replays in merge order. `%x1f` keeps subjects with any character out
+ * of the field framing.
+ */
+function realPendingChangesets() {
+ const ids = runGit(['ls-tree', '--name-only', 'HEAD', '.changeset/'])
+ .split('\n')
+ .map((s) => s.trim())
+ .filter((p) => p.endsWith('.md') && !p.endsWith('README.md'))
+ .map((p) => p.replace(/^\.changeset\//, '').replace(/\.md$/, ''));
+
+ const entries = [];
+ for (const id of ids) {
+ // The canonical bump parser (max rank across every package the changeset
+ // names). A first-match parse would read a mixed patch+minor changeset as
+ // patch and let feature work into the lane.
+ const bump = realGit.bumpTypeOf('HEAD', id);
+ const line = runGit([
+ 'log',
+ '--diff-filter=A',
+ '-1',
+ '--format=%H%x1f%ct%x1f%s',
+ '--',
+ `.changeset/${id}.md`,
+ ]).trim();
+ const [sha, commitTime, subject] = line.split('\x1f');
+ entries.push({ id, bump, addingSha: sha || null, addingTime: Number(commitTime) || 0, addingSubject: subject ?? '' });
+ }
+ entries.sort((a, b) => a.addingTime - b.addingTime);
+ return entries;
+}
+
+async function main() {
+ const stable = realNewestStableTag();
+ if (!stable) {
+ console.log('::notice::bug-lane: no stable tag exists yet; nothing to point-release over.');
+ if (process.env.GITHUB_OUTPUT) appendFileSync(process.env.GITHUB_OUTPUT, 'fix_refs=\nstable=\n');
+ return;
+ }
+
+ const result = await evaluateBugLane({
+ pendingChangesets: realPendingChangesets(),
+ // Three-way, matching the sibling selectors: exit 0 is contained, exit 1 a
+ // clean miss, anything else an infrastructure failure that must not read
+ // as "not contained" — the pure core degrades that commit with a
+ // containment-error warning instead.
+ isInStable: (sha) => {
+ const res = spawnSync('git', ['merge-base', '--is-ancestor', sha, stable], {
+ encoding: 'utf8',
+ env: gitCleanEnv(),
+ });
+ if (res.status === 0) return true;
+ if (res.status === 1) return false;
+ throw new Error(
+ `git merge-base --is-ancestor ${sha} ${stable} failed (exit ${res.status}): ${res.error?.message ?? String(res.stderr || '').trim()}`,
+ );
+ },
+ resolveChangesetPrUrl: makeResolveChangesetPrUrl(process.env.LINK_REPO || DEFAULT_LINK_REPO),
+ resolveIssuesForUrl: makeResolveIssuesForUrl(process.env.LINEAR_API_KEY),
+ });
+
+ for (const w of result.warnings) console.log(`::warning::bug-lane: ${w}`);
+ for (const c of result.perCommit) {
+ console.log(
+ `::notice::bug-lane: ${c.sha.slice(0, 9)} "${c.subject.slice(0, 72)}" -> ${c.reason}` +
+ `${c.linkedIssues.length > 0 ? ` [${c.linkedIssues.join(', ')}]` : ''}`,
+ );
+ }
+ console.log(
+ result.fixRefs.length > 0
+ ? `::notice::bug-lane: ${result.fixRefs.length} qualifying fix(es) over ${stable}: ${result.fixRefs.join(', ')}`
+ : `::notice::bug-lane: no qualifying fixes this tick (${result.reason}).`,
+ );
+
+ if (process.env.GITHUB_OUTPUT) {
+ appendFileSync(
+ process.env.GITHUB_OUTPUT,
+ [`fix_refs=${result.fixRefs.join(',')}`, `stable=${stable}`, ''].join('\n'),
+ );
+ }
+}
+
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ main().catch((err) => {
+ console.error(`::error::bug-lane: ${err.message}`);
+ process.exit(1);
+ });
+}
diff --git a/.github/scripts/bug-lane.test.mjs b/.github/scripts/bug-lane.test.mjs
new file mode 100644
index 000000000..cf22b3061
--- /dev/null
+++ b/.github/scripts/bug-lane.test.mjs
@@ -0,0 +1,131 @@
+import { describe, expect, test } from 'vitest';
+import { evaluateBugLane } from './bug-lane.mjs';
+
+const FIX_A = 'a'.repeat(40);
+const FIX_B = 'b'.repeat(40);
+const FEAT = 'c'.repeat(40);
+const SHIPPED = 'd'.repeat(40);
+
+const cs = (id, bump, addingSha, addingSubject = `${id} subject (#100)`) => ({
+ id,
+ bump,
+ addingSha,
+ addingSubject,
+});
+
+const bugIssues = { issues: [{ identifier: 'PRD-1', labels: ['Bug', 'ok:ui'] }] };
+const plainIssues = { issues: [{ identifier: 'PRD-2', labels: ['ok:ui'] }] };
+
+const evaluate = (overrides = {}) =>
+ evaluateBugLane({
+ pendingChangesets: [cs('one', 'patch', FIX_A)],
+ isInStable: () => false,
+ resolveChangesetPrUrl: (id) => `https://github.com/inkeep/agents-private/pull/${id.length}`,
+ resolveIssuesForUrl: async () => bugIssues,
+ ...overrides,
+ });
+
+describe('evaluateBugLane', () => {
+ test('a patch-only bug-linked commit qualifies', async () => {
+ const r = await evaluate();
+ expect(r.fixRefs).toEqual([FIX_A]);
+ expect(r.reason).toBe('candidates');
+ expect(r.perCommit[0]).toMatchObject({ qualifies: true, linkedIssues: ['PRD-1'] });
+ });
+
+ test('a commit adding any minor changeset is feature work and stays with its cycle', async () => {
+ const r = await evaluate({
+ pendingChangesets: [cs('one', 'patch', FEAT), cs('two', 'minor', FEAT)],
+ });
+ expect(r.fixRefs).toEqual([]);
+ expect(r.perCommit[0].reason).toBe('not-patch-only');
+ });
+
+ test('a patch commit with no Bug-labeled issue does not qualify', async () => {
+ const r = await evaluate({ resolveIssuesForUrl: async () => plainIssues });
+ expect(r.fixRefs).toEqual([]);
+ expect(r.perCommit[0].reason).toBe('not-bug-linked');
+ });
+
+ test('a commit already contained in the stable is excluded before any resolution', async () => {
+ const r = await evaluate({
+ pendingChangesets: [cs('restored', 'patch', SHIPPED)],
+ isInStable: (sha) => sha === SHIPPED,
+ resolveChangesetPrUrl: () => {
+ throw new Error('must not resolve an already-shipped commit');
+ },
+ });
+ expect(r.fixRefs).toEqual([]);
+ expect(r.perCommit[0].reason).toBe('already-in-stable');
+ });
+
+ test('several qualifying commits batch in input (merge) order', async () => {
+ const r = await evaluate({
+ pendingChangesets: [cs('one', 'patch', FIX_A), cs('two', 'patch', FIX_B)],
+ });
+ expect(r.fixRefs).toEqual([FIX_A, FIX_B]);
+ });
+
+ test('resolution failures degrade the commit, never the tick', async () => {
+ const r = await evaluate({
+ pendingChangesets: [cs('one', 'patch', FIX_A), cs('two', 'patch', FIX_B)],
+ resolveIssuesForUrl: async (url) => {
+ if (url.endsWith('/3')) throw new Error('linear down');
+ return bugIssues;
+ },
+ resolveChangesetPrUrl: (id) => `https://github.com/inkeep/agents-private/pull/${id.length}`,
+ });
+ // 'one' resolves via /3 (length 3) and errors -> not bug-linked; 'two' via
+ // /3 as well... both ids are length 3, so both error: the tick still
+ // answers rather than throwing.
+ expect(r.reason).toBe('no-qualifying-fixes');
+ expect(r.warnings.some((w) => w.startsWith('issues-error'))).toBe(true);
+ });
+
+ test('an unresolvable Linear lookup (no key) degrades to not-bug-linked', async () => {
+ const r = await evaluate({
+ resolveIssuesForUrl: async () => ({ unresolvable: 'no-linear-api-key' }),
+ });
+ expect(r.fixRefs).toEqual([]);
+ expect(r.perCommit[0].reason).toBe('not-bug-linked');
+ expect(r.warnings.some((w) => w.includes('no-linear-api-key'))).toBe(true);
+ });
+
+ test('a commit qualifies through any one of its changesets', async () => {
+ const r = await evaluate({
+ pendingChangesets: [cs('one', 'patch', FIX_A), cs('two', 'patch', FIX_A)],
+ resolveIssuesForUrl: async (url) => (url.endsWith('/3') ? plainIssues : bugIssues),
+ resolveChangesetPrUrl: (id) => `https://github.com/inkeep/agents-private/pull/${id === 'one' ? 3 : 4}`,
+ });
+ expect(r.fixRefs).toEqual([FIX_A]);
+ });
+
+ test('an isInStable failure degrades that commit with a warning and the tick still answers', async () => {
+ const r = await evaluate({
+ pendingChangesets: [cs('one', 'patch', FIX_A), cs('two', 'patch', FIX_B)],
+ isInStable: (sha) => {
+ if (sha === FIX_A) throw new Error('git lock');
+ return false;
+ },
+ });
+ expect(r.fixRefs).toEqual([FIX_B]);
+ expect(r.warnings.some((w) => w.startsWith('containment-error') && w.includes('git lock'))).toBe(true);
+ expect(r.perCommit.find((c) => c.sha === FIX_A).reason).toBe('containment-error');
+ });
+
+ test('an empty pile is a real answer', async () => {
+ const r = await evaluate({ pendingChangesets: [] });
+ expect(r).toMatchObject({ fixRefs: [], reason: 'no-pending-changesets' });
+ });
+
+ test('the Bug label matches case-insensitively and no other label counts', async () => {
+ const r = await evaluate({
+ resolveIssuesForUrl: async () => ({ issues: [{ identifier: 'PRD-9', labels: ['bug'] }] }),
+ });
+ expect(r.fixRefs).toEqual([FIX_A]);
+ const r2 = await evaluate({
+ resolveIssuesForUrl: async () => ({ issues: [{ identifier: 'PRD-9', labels: ['Bugfix'] }] }),
+ });
+ expect(r2.fixRefs).toEqual([]);
+ });
+});
diff --git a/.github/workflows/bug-lane.yml b/.github/workflows/bug-lane.yml
new file mode 100644
index 000000000..a07386465
--- /dev/null
+++ b/.github/workflows/bug-lane.yml
@@ -0,0 +1,202 @@
+name: Bug lane
+
+# Automated cherry-pick point releases for bug-linked patch fixes.
+#
+# WHY. The fast soak tier qualifies whole cuts, and one minor changeset in the
+# pending pile disqualifies every cut until the cycle's stable ships — so in a
+# feature-heavy week a perfectly tagged bug fix waits ~24h behind unrelated
+# work. This lane qualifies fixes individually: a commit whose changesets are
+# all patch AND trace to a Bug-labeled Linear issue is cherry-picked onto the
+# current stable through the existing point-release cascade. Owner decision
+# 2026-07-31; posture and disarm switch in RELEASES.md.
+#
+# SAFETY TOPOLOGY, in order:
+# 1. Qualification is the soak tier's own bug-link chain (shared helpers) —
+# a triaged Bug label, never a title string.
+# 2. VERIFY: the batch is cherry-picked onto the stable IN THIS RUNNER and
+# the fast test tiers (typecheck + unit) run against that synthetic tree —
+# the tree that actually ships, which no CI has otherwise seen. A conflict
+# or a red tier refuses; the fix simply rides its cycle's stable.
+# 3. point-release.yml re-guards everything (clean pick, delta-matches-fix,
+# patch-only bump, anchor, provenance) and its cascade smokes the signed
+# DMG before the release publishes or npm moves.
+# 4. Re-release is structurally impossible: candidates come from the pending
+# pile (main-reset consumes a released fix's changeset), commits already
+# in the stable are pre-filtered, and an empty pick is refused. Every
+# stable this lane cuts carries novel changesets.
+#
+# NOT ARMED. `BUG_LANE_ARMED` is a literal "false": every tick evaluates,
+# verifies, and logs the release it WOULD have dispatched, but dispatches
+# nothing. Arming is a one-line reviewed flip after the logged picks have been
+# observed to match human judgment — the same rollout the soak tier used.
+#
+# This lane can never block anything: nothing waits on it, a refusal only
+# means the fix ships with its cycle, and the shared ok-release-cadence group
+# on point-release itself serializes real releases against beta cuts and
+# promotions.
+
+on:
+ schedule:
+ # Every 20 minutes, offset to interleave with select-beta-to-promote's
+ # 7,17,27,... ticks. Wider than the selector's cadence because a tick that
+ # finds candidates spends ~15 minutes in the verify stage.
+ - cron: "2,22,42 * * * *"
+ # Fast path: evaluate when a mirrored commit lands rather than waiting for
+ # the next tick.
+ push:
+ branches: [main]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ # Dispatching point-release.yml and reading in-flight runs.
+ actions: write
+
+concurrency:
+ # Its own group: an evaluator must never queue behind a real cut. A newer
+ # tick supersedes an older one mid-verify; the evaluation is idempotent.
+ group: ok-bug-lane
+ cancel-in-progress: true
+
+env:
+ # THE ARMING SWITCH. While "false" the lane is log-only: it evaluates,
+ # verifies, and prints the point release it would have dispatched. Flipping
+ # to "true" requires a reviewed PR — read the "Bug lane" section of
+ # RELEASES.md first.
+ BUG_LANE_ARMED: "false"
+
+jobs:
+ bug-lane:
+ name: Evaluate, verify, and (when armed) dispatch
+ runs-on: ubuntu-latest
+ timeout-minutes: 45
+ steps:
+ - name: Checkout with full history and tags
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+
+ - name: Set up Node
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
+ with:
+ node-version: "24"
+
+ - name: Evaluate qualifying fixes
+ id: evaluate
+ env:
+ # Optional, same posture as the soak tier: absent, every fix resolves
+ # "not bug-linked" and the lane is inert rather than wrong.
+ LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
+ # Writes fix_refs (comma-joined) and stable to GITHUB_OUTPUT; per-commit
+ # verdicts land as notices. Logic + tests:
+ # .github/scripts/bug-lane.{mjs,test.mjs}.
+ run: node .github/scripts/bug-lane.mjs
+
+ - name: Skip while a release is in flight
+ id: inflight
+ if: steps.evaluate.outputs.fix_refs != ''
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ set -euo pipefail
+ active=0
+ for wf in point-release.yml promote-stable.yml; do
+ n=$(gh run list --workflow="$wf" --json status \
+ --jq '[.[] | select(.status=="in_progress" or .status=="queued")] | length')
+ active=$((active + n))
+ done
+ if [[ "$active" -gt 0 ]]; then
+ echo "busy=true" >> "$GITHUB_OUTPUT"
+ echo "::notice::bug-lane: a release run is already in flight (${active}); retrying next tick."
+ else
+ echo "busy=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
+ if: steps.evaluate.outputs.fix_refs != '' && steps.inflight.outputs.busy == 'false'
+
+ - name: Verify the synthetic tree (cherry-pick + fast test tiers)
+ id: verify
+ if: steps.evaluate.outputs.fix_refs != '' && steps.inflight.outputs.busy == 'false'
+ env:
+ FIX_REFS: ${{ steps.evaluate.outputs.fix_refs }}
+ STABLE: ${{ steps.evaluate.outputs.stable }}
+ run: |
+ set -euo pipefail
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git checkout --detach "$STABLE"
+ IFS=',' read -ra REFS <<< "$FIX_REFS"
+ for ref in "${REFS[@]}"; do
+ if ! git cherry-pick "$ref"; then
+ git cherry-pick --abort || true
+ echo "verdict=conflict" >> "$GITHUB_OUTPUT"
+ echo "::notice::bug-lane: ${ref} does not apply cleanly onto ${STABLE}; it will ship with its cycle's stable instead."
+ exit 0
+ fi
+ done
+ # The tree that would ship. Fast tiers only: typecheck + unit catch a
+ # fix that assumed something the stable does not have; the DMG smoke
+ # later in the cascade covers boot-level integration.
+ pnpm install --frozen-lockfile
+ if pnpm exec turbo run typecheck test --output-logs=errors-only; then
+ echo "verdict=pass" >> "$GITHUB_OUTPUT"
+ else
+ echo "verdict=fail" >> "$GITHUB_OUTPUT"
+ echo "::warning::bug-lane: fast tiers FAILED on ${STABLE} + ${FIX_REFS} — the fix passes on main but not on the stable it would ship against. It stays on its cycle's path."
+ fi
+
+ - name: Dispatch the point release (or log what would ship)
+ if: steps.verify.outputs.verdict == 'pass'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ FIX_REFS: ${{ steps.evaluate.outputs.fix_refs }}
+ STABLE: ${{ steps.evaluate.outputs.stable }}
+ run: |
+ set -euo pipefail
+ if [[ "${BUG_LANE_ARMED}" != "true" ]]; then
+ echo "::notice::bug-lane LOG-ONLY: would dispatch point-release (cherry-pick) of ${FIX_REFS} over ${STABLE}."
+ {
+ echo "### Bug lane — log-only"
+ echo "- Would point-release: \`${FIX_REFS}\` over \`${STABLE}\` (verify passed)"
+ } >> "$GITHUB_STEP_SUMMARY"
+ exit 0
+ fi
+ # Re-check just before dispatching: the earlier in-flight check is
+ # ~15 minutes stale after the verify stage, and a promotion may have
+ # started meanwhile. point-release's shared concurrency group would
+ # serialize anyway; this avoids queuing a release that the next tick
+ # would have re-derived against the newer stable.
+ active=0
+ for wf in point-release.yml promote-stable.yml; do
+ n=$(gh run list --workflow="$wf" --json status \
+ --jq '[.[] | select(.status=="in_progress" or .status=="queued")] | length')
+ active=$((active + n))
+ done
+ if [[ "$active" -gt 0 ]]; then
+ echo "::notice::bug-lane: a release run started during verify (${active}); retrying next tick."
+ exit 0
+ fi
+ SELF_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
+ gh workflow run point-release.yml \
+ -f mode=cherry-pick -f fix_refs="$FIX_REFS" -f dry_run=false -f dispatched_by="$SELF_URL"
+ echo "::notice::bug-lane: dispatched point-release (cherry-pick) of ${FIX_REFS} over ${STABLE}."
+
+ - name: Page on a refusal (armed only)
+ if: env.BUG_LANE_ARMED == 'true' && (steps.verify.outputs.verdict == 'conflict' || steps.verify.outputs.verdict == 'fail')
+ env:
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
+ FIX_REFS: ${{ steps.evaluate.outputs.fix_refs }}
+ VERDICT: ${{ steps.verify.outputs.verdict }}
+ run: |
+ set -uo pipefail
+ if [[ -z "${SLACK_WEBHOOK_URL:-}" ]]; then
+ echo "::notice::SLACK_WEBHOOK_URL not set — refusal page skipped."
+ exit 0
+ fi
+ RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
+ TEXT="⛔ Bug lane refused ${FIX_REFS} (${VERDICT}). The fix stays on its cycle's 24h path; investigate whether it needs a manual point release. ${RUN_URL}"
+ payload="$(jq -nc --arg t "$TEXT" '{text: $t}')"
+ curl -sS --fail -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK_URL" \
+ || echo "::warning::bug-lane refusal page failed to POST — the refusal itself still holds."