Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
14d65c0
fix(packs): give gateway-moved pack agents a usable model (#16731)
hivecommons-hive[bot] Nov 5, 2026
71112de
🐛 fix(packs): clarify gateway model reconciliation logs (#16734)
Karibhou Nov 5, 2026
036caab
fix(packs): retain gateway model after override loss (#16735)
Karibhou Nov 5, 2026
7b41a87
docs: fix ACMM recommendation route reference (#16741)
Karibhou Nov 5, 2026
d1760fd
docs: correct ACMM advisor source citations (#16745)
Karibhou Nov 5, 2026
fed4d35
🐛 fix(ioscan): do not fleet-report an unconfigured classifier as a ru…
hivecommons-hive[bot] Nov 5, 2026
be9e1f8
🐛 fix(scheduler): align kick header with merged-history read policy (…
thatguywob Nov 5, 2026
3dafad3
🐛 fix: keep superseder decision questions parked (#16687)
thatguywob Nov 5, 2026
bdd2e87
📖 docs: correct pack level handler citation (#16747)
thatguywob Nov 5, 2026
e87d792
🐛 fix(packs): retain gateway placement after override loss (#16744)
thatguywob Nov 5, 2026
2a2d206
📖 docs: distinguish unconfigured ioscan from backend failures (#16751)
thatguywob Nov 5, 2026
b497c2e
🐛 fix: respect ntfy rate-limit cooldowns (#16691)
thatguywob Nov 5, 2026
102d718
✨ feat(settings): expose merge-train controls in Auto-merge (#16680)
thatguywob Nov 5, 2026
b693082
🐛 fix: wait for review spool test persistence before cleanup (#16726)
thatguywob Nov 5, 2026
6741d85
🐛 fix: decision pills no longer flash disabled while the viewer's rol…
clubanderson Nov 5, 2026
f2ca9bf
🐛 fix: approved PRs queued behind the train front no longer say they …
clubanderson Nov 5, 2026
a69ec8e
📖 docs: clarify merged PR history reads across quality policies (#16713)
thatguywob Nov 5, 2026
9face47
test(crux): cover resume-handle walk bounds and id guards (#16762)
hivecommons-hive[bot] Nov 5, 2026
cd7169d
🐛 fix(github): post the prow/lgtm warning once with a live context (#…
hivecommons-hive[bot] Nov 5, 2026
2aa61de
🐛 fix: approval decision text no longer says 'merge sweep' (#16768)
clubanderson Nov 5, 2026
7d240ec
✨ feat: PR in progress chevron names the actor with their kind icon (…
clubanderson Nov 5, 2026
f60d687
📖 docs: link the community meeting for newcomers (#16766)
Karibhou Nov 5, 2026
6ed3e5e
✨ feat(github): auto-approve gated Actions runs for trusted actors (#…
hivecommons-hive[bot] Nov 5, 2026
4b9f022
🐛 fix(stream): watchdog restarts ffmpeg and the pod when the channel …
clubanderson Nov 5, 2026
b1d367f
🐛 fix(dashboard): Let hive decide preview says why it failed instead …
clubanderson Nov 5, 2026
fd40cce
📖 docs: correct Prow LGTM error comment (#16773)
Karibhou Nov 5, 2026
e5fd0f1
fix(github): workflow auto-approval ledger owns its invariants, retri…
hivecommons-hive[bot] Nov 5, 2026
8428a3b
fix(stage-labels): treat GitHub 5xx on commit status as transient in …
hivecommons-hive[bot] Nov 5, 2026
7d06372
🐛 fix: keep navigation label visible on phones (#16769)
Karibhou Nov 5, 2026
cc04eb8
🐛 fix: classify REST reserve shedding as rate limiting (#16793)
hivecommons-hive[bot] Nov 5, 2026
9d18db9
fix: include kick freshness refusal categories in reports (#16777)
Karibhou Nov 5, 2026
9f35f77
fix(gh-wrapper): allow staff merged-only pr list reads on v5 (#16759)
hivecommons-hive[bot] Nov 5, 2026
fc4445f
fix: avoid contributor sweep status outage self-reports (#16780)
Karibhou Nov 5, 2026
7e38edf
📖 docs: document all fail-closed status-500 exclusions (#16797)
mendezr Nov 5, 2026
3b7f68b
🐛 fix: keep routine action nudges out of fleet self-reports (#16796)
mendezr Nov 5, 2026
59a3404
🐛 fix(entrypoint): pre-create token caches for ACMM pack agents (#16808)
hivecommons-hive[bot] Nov 5, 2026
4d66f71
🐛 fix: skip absent inactive agent config sync (#16800)
mendezr Nov 5, 2026
173fe08
🐛 fix: explain how to resume paused agents (#16825)
Karibhou Nov 5, 2026
faa0125
🐛 fix: hide obsolete upgrade status after later rolls (#16826)
Karibhou Nov 5, 2026
222ccc7
🐛 fix: leave held dependency-bot branches to the bot instead of mergi…
hanthor Nov 5, 2026
fcc0c5c
🐛 fix: keep in-place adoption when a maintainer pushes the new head (…
hanthor Nov 5, 2026
2a20bfe
🐛 fix: remove lapsed agent claimed-by labels from parked issues (#16849)
hanthor Nov 6, 2026
f0d3f1a
🐛 fix: park fork-guard-only heads instead of nudging and adopting the…
hanthor Nov 6, 2026
b52b732
fix(fleetreport): review-watcher 5xx retry is not an unclassified err…
hivecommons-hive[bot] Nov 6, 2026
5eca43b
🐛 fix(blocked): release only the App-applied blocked label from tooli…
hivecommons-hive[bot] Nov 6, 2026
7a38c99
fix(github): annotate the lapsed claimed-by label removal as gated (#…
hivecommons-hive[bot] Nov 6, 2026
567cf11
🐛 fix: leave dependency-bot branches to the bot on every base-sync pa…
hanthor Nov 6, 2026
4236257
🐛 fix: keep a contributor PR's security hold when a sibling perspecti…
hanthor Nov 6, 2026
8a0b0d5
🐛 fix: blocked-on marker names an issue, not only a PR (#16848)
hanthor Nov 6, 2026
bb8b382
fix(github): verify base-refresh commits by signature and fail closed…
hivecommons-hive[bot] Nov 6, 2026
27c5e4e
fix(selfreport): classify watchdog agent credential failures (#16866)
hivecommons-hive[bot] Nov 6, 2026
42f8b2d
fix(notify): cap ntfy Retry-After cooldown at the fallback ceiling (#…
hivecommons-hive[bot] Nov 6, 2026
564f1db
chore(changelog): name the stage-drift fragment after the fix it desc…
hivecommons-hive[bot] Nov 6, 2026
8eb619c
fix(review): read scope-effective verdicts in the security hold check…
hivecommons-hive[bot] Nov 6, 2026
ad756b4
🐛 fix(dashboard): surface blocked-on-issue target in the stage tracke…
hivecommons-hive[bot] Nov 6, 2026
0712422
🌱 images: bump omp 18.16.0 -> 18.17.0 (#16874)
clubanderson Nov 6, 2026
c55159f
fix(backend-smoke): assert on captured output with here-strings, not …
hivecommons-hive[bot] Nov 6, 2026
4d338c7
fix(backend-smoke): poll the tmux pane with here-strings, not echo | …
hivecommons-hive[bot] Nov 6, 2026
8b5a160
🐛 fix(crux): recognise front matter behind a UTF-8 BOM (#16879)
hivecommons-hive[bot] Nov 6, 2026
ad46955
🐛 fix: stabilize same-head stage verdicts and suppress reversals (#16…
mendezr Nov 6, 2026
edfd616
🐛 fix(agentparse): select list categories deterministically (#16883)
mendezr Nov 6, 2026
b3d47c9
🐛 fix(dashboard): a hive without project.org no longer reports repos …
hivecommons-hive[bot] Nov 6, 2026
44169eb
📖 docs: disabled /mcp/knowledge returns 401 to anonymous callers, not…
hivecommons-hive[bot] Nov 6, 2026
5b3a2f1
refactor(dashboard): qualify repo names once in buildReposWithForge (…
hivecommons-hive[bot] Nov 6, 2026
d992946
🐛 fix(dashboard): a hive without project.org no longer reports '/repo…
hivecommons-hive[bot] Nov 6, 2026
d9a9583
ci: native-queue-policy re-triggers queue instead of cancelling the e…
hivecommons-hive[bot] Nov 6, 2026
7f32a83
docs: note PR-target re-triggers queue behind the in-flight native-qu…
hivecommons-hive[bot] Nov 6, 2026
e8a89bc
🐛 fix(hub): selfreport relay joins an open issue of the same keyworde…
hivecommons-hive[bot] Nov 6, 2026
1a06285
🐛 fix: export contributor fix-pr settings (#16959)
Karibhou Nov 6, 2026
7470d89
🐛 fix(dashboard): seed merged-ledger test at now, not now-1m (#16964)
hivecommons-hive[bot] Nov 7, 2026
994cea1
📖 docs: refresh Codex model snapshot provenance (#16965)
hivecommons-hive[bot] Nov 7, 2026
a2500ce
🐛 fix: workflow-path fence approval survives the hive's own base refr…
hanthor Nov 7, 2026
c333dce
fix(crux/pushbroker): gate outgoing diffs on every exact-shape secret…
hivecommons-hive[bot] Nov 7, 2026
f42b8fa
test(crux/logscrub): pin that a skipped FindSecret match does not hid…
hivecommons-hive[bot] Nov 7, 2026
c6f898b
🌱 images: bump omp 18.17.0 -> 18.18.0 (#16971)
clubanderson Nov 7, 2026
7befd73
🌱 images: bump claude 2.1.318 -> 2.1.319 (#16970)
clubanderson Nov 7, 2026
9883d0d
🐛 fix(dashboard): merged-ledger test is deterministic across the UTC …
hivecommons-hive[bot] Nov 7, 2026
4fbd8cb
🌱 images: bump codex 0.166.0 -> 0.167.0 (#16873)
clubanderson Nov 7, 2026
9c1f374
🐛 fix(automerge): prevent stage reconciler oscillation on needs-decis…
hivecommons-hive[bot] Nov 7, 2026
c7ad0cd
test(stageengine): cover reconciler dampener suppression path (#16982)
hivecommons-hive[bot] Nov 7, 2026
7c291af
🐛 fix(ci): native-queue-policy skips the evidence wait on cosmetic la…
hivecommons-hive[bot] Nov 7, 2026
9a485a7
🐛 fix(crux/toolapprove): hold every write tool to the guardrail paths…
hivecommons-hive[bot] Nov 7, 2026
4f8f849
🌱 Forward-merge v5 into v6 (82 commits, manual: conflicts)
clubanderson Nov 7, 2026
3e788b5
📖 docs: re-resolve governor_config.go citations after the v5 CI field…
clubanderson Nov 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5,095 changes: 5,095 additions & 0 deletions .ci-log.txt

Large diffs are not rendered by default.

107 changes: 76 additions & 31 deletions .github/scripts/native-queue-policy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const BUILD_CHECKS = {
const SHA = /^[a-f0-9]{40}$/;
const BLOCKED_LABEL = /^(hold|needs-human|release-in-progress|do-not-merge(?:\/.*)?)$/i;
const MAX_QUEUE_PAGES = 10;
const POLICY_CHECK_NAME = 'native-queue-policy';
const POLICY_CHECK_SOURCE = ['native-queue-policy.yml', ['pull_request_target']];

const closedNoop = (pr) => `PR #${pr.number} is closed; nothing to evaluate`;

Expand Down Expand Up @@ -111,43 +113,49 @@ function evidenceForHead(runs, head, checks) {
});
}

// Every Actions workflow shares one App id, so a same-named check run proves
// nothing: bind it to the expected workflow file, event, head, suite and job.
async function assertActionsProvenance(github, repo, number, head, run, source, workflows) {
const url = new URL(run.details_url);
const prefix = `/${repo.owner}/${repo.repo}/actions/runs/`;
const id = url.pathname.startsWith(prefix) && url.pathname.slice(prefix.length).split('/')[0];
if (url.hostname !== 'github.com' || !/^[0-9]+$/.test(id)) {
throw new Error(`Invalid Actions provenance for ${run.name}`);
}
const runID = Number(id);
if (!workflows.has(runID)) {
const { data: workflow } = await github.rest.actions.getWorkflowRun({ ...repo, run_id: runID });
const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, {
...repo, run_id: runID, per_page: 100, filter: 'latest',
});
workflows.set(runID, { workflow, jobs });
}
const { workflow, jobs } = workflows.get(runID);
const [file, events] = source;
if (workflow.path !== `.github/workflows/${file}` || !events.includes(workflow.event) ||
workflow.head_sha !== head || workflow.id !== runID) {
throw new Error(`Unexpected workflow/event/head for ${run.name} on #${number}`);
}
// details_url is only a locator. The API-owned suite and job identities
// must independently bind this exact check run to the expected workflow.
const checkURL = `https://api.github.com/repos/${repo.owner}/${repo.repo}/check-runs/${run.id}`;
if (!Number.isSafeInteger(run.check_suite?.id) ||
run.check_suite.id !== workflow.check_suite_id ||
!jobs.some(job => job.run_id === runID && job.name === run.name &&
job.head_sha === head && job.check_run_url === checkURL &&
job.status === 'completed' && job.conclusion === run.conclusion)) {
throw new Error(`Check suite/job identity mismatch for ${run.name} on #${number}`);
}
}

async function assertEvidence(github, repo, number, head, checks) {
const runs = await github.paginate(github.rest.checks.listForRef, {
...repo, ref: head, per_page: 100, filter: 'latest',
});
const workflows = new Map();
for (const { run, source } of evidenceForHead(runs, head, checks)) {
if (!source) continue; // Probot DCO is deliberately not impersonated.
const url = new URL(run.details_url);
const prefix = `/${repo.owner}/${repo.repo}/actions/runs/`;
const id = url.pathname.startsWith(prefix) && url.pathname.slice(prefix.length).split('/')[0];
if (url.hostname !== 'github.com' || !/^[0-9]+$/.test(id)) {
throw new Error(`Invalid Actions provenance for ${run.name}`);
}
const runID = Number(id);
if (!workflows.has(runID)) {
const { data: workflow } = await github.rest.actions.getWorkflowRun({ ...repo, run_id: runID });
const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, {
...repo, run_id: runID, per_page: 100, filter: 'latest',
});
workflows.set(runID, { workflow, jobs });
}
const { workflow, jobs } = workflows.get(runID);
const [file, events] = source;
if (workflow.path !== `.github/workflows/${file}` || !events.includes(workflow.event) ||
workflow.head_sha !== head || workflow.id !== runID) {
throw new Error(`Unexpected workflow/event/head for ${run.name} on #${number}`);
}
// details_url is only a locator. The API-owned suite and job identities
// must independently bind this exact check run to the expected workflow.
const checkURL = `https://api.github.com/repos/${repo.owner}/${repo.repo}/check-runs/${run.id}`;
if (!Number.isSafeInteger(run.check_suite?.id) ||
run.check_suite.id !== workflow.check_suite_id ||
!jobs.some(job => job.run_id === runID && job.name === run.name &&
job.head_sha === head && job.check_run_url === checkURL &&
job.status === 'completed' && job.conclusion === run.conclusion)) {
throw new Error(`Check suite/job identity mismatch for ${run.name} on #${number}`);
}
await assertActionsProvenance(github, repo, number, head, run, source, workflows);
}
}

Expand Down Expand Up @@ -217,6 +225,43 @@ async function evaluate(args) {
}
}

// A labeled/unlabeled event only matters when the label is one assertEligible
// reads (BLOCKED_LABEL); every other flip cannot change the verdict.
function isCosmeticLabelFlip({ eventName, payload }) {
return eventName === 'pull_request_target' &&
['labeled', 'unlabeled'].includes(payload.action) &&
typeof payload.label?.name === 'string' &&
!BLOCKED_LABEL.test(payload.label.name);
}

// A cosmetic flip skips the evidence wait but must not mint a fresh passing
// required check: replay the latest completed `success` run of this check on
// the head (rejecting one not from this workflow) and still read live PR
// eligibility. Returns null when there is nothing to replay — no completed
// run, or the latest one did not succeed (a failed, cancelled or timed-out
// wait) — so the caller falls through to the full evidence wait instead of
// pinning that earlier verdict onto every later stage-label flip.
async function replayLastVerdict({ github, context, currentCheckRunId }) {
const repo = context.repo;
const event = context.payload.pull_request;
const { data: pr } = await github.rest.pulls.get({ ...repo, pull_number: event.number });
if (pr.state === 'closed') return closedNoop(pr);
assertEligible(pr, event.head.sha, event.base.ref);
const runs = await github.paginate(github.rest.checks.listForRef, {
...repo, ref: pr.head.sha, check_name: POLICY_CHECK_NAME, per_page: 100, filter: 'all',
});
const prior = runs
.filter(r => r.name === POLICY_CHECK_NAME && r.status === 'completed' &&
r.head_sha === pr.head.sha && r.app?.id === ACTIONS_APP_ID && r.id !== currentCheckRunId)
.sort((a, b) => b.id - a.id)[0];
if (!prior) return null;
// A same-named job from any other workflow shares the Actions App id; only
// a run of this workflow file on this event may be replayed.
await assertActionsProvenance(github, repo, pr.number, pr.head.sha, prior, POLICY_CHECK_SOURCE, new Map());
if (prior.conclusion !== 'success') return null;
return `PR #${pr.number}: replayed ${POLICY_CHECK_NAME} run ${prior.id} (success) on ${pr.head.sha}`;
}

async function evaluateOnce({ github, context }) {
const repo = context.repo;
if (context.eventName === 'pull_request_target') {
Expand Down Expand Up @@ -270,7 +315,7 @@ async function evaluateOnce({ github, context }) {
module.exports = {
ACTIONS_APP_ID, DCO_APP_ID, POLICY_CHECKS, BUILD_CHECKS,
PendingEvidence, membersForGroup, assertEligible, evidenceForHead, closedNoop, evaluate,
isTransientAPIError,
isTransientAPIError, isCosmeticLabelFlip, replayLastVerdict, BLOCKED_LABEL,
ProviderUnavailable,
DCO_ENUMERATION_SUMMARY_PREFIX, DCO_ENUMERATION_SUMMARY_FALLBACK,
DCO_PROVIDER_UNAVAILABLE_TEXT, DCO_PROVIDER_RUNBOOK,
Expand Down
106 changes: 105 additions & 1 deletion .github/scripts/native-queue-policy.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('node:assert/strict');
const {
ACTIONS_APP_ID, DCO_APP_ID, POLICY_CHECKS, BUILD_CHECKS,
PendingEvidence, membersForGroup, assertEligible, evidenceForHead, closedNoop, evaluate,
isTransientAPIError,
isTransientAPIError, isCosmeticLabelFlip, replayLastVerdict,
ProviderUnavailable,
DCO_ENUMERATION_SUMMARY_PREFIX,
DCO_ENUMERATION_SUMMARY_FALLBACK,
Expand Down Expand Up @@ -387,3 +387,107 @@ test('API failure is never interpreted as an empty successful member list', asyn
f.github.graphql = async () => { throw new Error('403 queue read forbidden'); };
await assert.rejects(evaluate(f), /403/);
});

test('isCosmeticLabelFlip is true only for unread labels on label events', () => {
const ctx = (eventName, action, label) => ({ eventName, payload: { action, ...(label && { label: { name: label } }) } });
assert.equal(isCosmeticLabelFlip(ctx('pull_request_target', 'labeled', 'size/L')), true);
assert.equal(isCosmeticLabelFlip(ctx('pull_request_target', 'unlabeled', 'size/L')), true);
assert.equal(isCosmeticLabelFlip(ctx('pull_request_target', 'labeled', 'hold')), false);
assert.equal(isCosmeticLabelFlip(ctx('pull_request_target', 'labeled', 'do-not-merge/foo')), false);
assert.equal(isCosmeticLabelFlip(ctx('pull_request_target', 'synchronize', 'size/L')), false);
assert.equal(isCosmeticLabelFlip(ctx('merge_group', 'checks_requested')), false);
assert.equal(isCosmeticLabelFlip(ctx('pull_request_target', 'labeled')), false);
});

function replayFixture(priorRuns, labels = [], workflowOverride = {}) {
const f = fixture('pull_request_target');
f.state.prs[0].labels = labels;
const head = sha(11);
f.state.listed = [];
const runs = clone(priorRuns).map(r => ({
name: 'native-queue-policy', head_sha: head, app: { id: ACTIONS_APP_ID },
check_suite: { id: 5000 + r.id },
details_url: `https://github.com/acme/widget/actions/runs/${3000 + r.id}/job/1`, ...r,
}));
f.github.rest.actions.getWorkflowRun = async ({ run_id: id }) => ({ data: {
id, check_suite_id: id + 2000, path: '.github/workflows/native-queue-policy.yml',
event: 'pull_request_target', head_sha: head, ...workflowOverride,
} });
f.github.paginate = async (method, args) => {
if (method === 'jobs') {
const run = runs.find(r => 3000 + r.id === args.run_id);
if (!run) return [];
return [{
id: 200000 + run.id, run_id: args.run_id, name: run.name, head_sha: head,
check_run_url: `https://api.github.com/repos/acme/widget/check-runs/${run.id}`,
status: 'completed', conclusion: run.conclusion,
}];
}
assert.equal(method, 'checks');
f.state.listed.push(args);
return clone(runs);
};
return f;
}

test('cosmetic flip replays the latest completed success on the same head', async () => {
const f = replayFixture([
{ id: 5, status: 'completed', conclusion: 'failure' },
{ id: 7, status: 'completed', conclusion: 'success' },
{ id: 9, status: 'in_progress', conclusion: null },
]);
assert.match(await replayLastVerdict(f), /run 7 \(success\)/);
assert.equal(f.state.listed[0].ref, sha(11));
});

test('cosmetic flip has nothing to replay without a prior success and falls through', async () => {
// A failed, cancelled (timed-out) or absent prior run must not be pinned
// onto every later stage-label flip: null sends the caller to the full wait.
assert.equal(await replayLastVerdict(replayFixture([
{ id: 5, status: 'completed', conclusion: 'success' },
{ id: 7, status: 'completed', conclusion: 'failure' },
])), null);
assert.equal(await replayLastVerdict(replayFixture([
{ id: 5, status: 'completed', conclusion: 'success' },
{ id: 7, status: 'completed', conclusion: 'cancelled' },
])), null);
assert.equal(await replayLastVerdict(replayFixture([
{ id: 9, status: 'in_progress', conclusion: null },
])), null);
assert.equal(await replayLastVerdict(replayFixture([])), null);
const own = replayFixture([{ id: 8, status: 'completed', conclusion: 'success' }]);
assert.equal(await replayLastVerdict({ ...own, currentCheckRunId: 8 }), null);
});

test('cosmetic flip still honours a live hold even after a prior success', async () => {
const f = replayFixture([{ id: 7, status: 'completed', conclusion: 'success' }], [{ name: 'hold' }]);
await assert.rejects(replayLastVerdict(f), /held/);
});

test('replay ignores runs with a different name, head_sha or app id', async () => {
for (const change of [
{ name: 'other-check' }, { head_sha: sha(99) }, { app: { id: DCO_APP_ID } }, { app: undefined },
]) {
assert.equal(
await replayLastVerdict(replayFixture([{ id: 7, status: 'completed', conclusion: 'success', ...change }])),
null);
}
});

test('replay rejects a same-named success run from another workflow', async () => {
const run = { id: 7, status: 'completed', conclusion: 'success' };
for (const override of [
{ path: '.github/workflows/forged.yml' },
{ event: 'pull_request' },
{ head_sha: sha(99) },
{ check_suite_id: 1 },
]) {
await assert.rejects(replayLastVerdict(replayFixture([run], [], override)), /Unexpected workflow|identity mismatch/);
}
await assert.rejects(replayLastVerdict(replayFixture([
{ ...run, details_url: 'https://example.com/acme/widget/actions/runs/3007/job/1' },
])), /Invalid Actions provenance/);
await assert.rejects(replayLastVerdict(replayFixture([
{ ...run, details_url: 'https://github.com/acme/widget/actions/runs/3008/job/1' },
])), /Unexpected workflow|identity mismatch/);
});
32 changes: 32 additions & 0 deletions .github/scripts/test-native-queue-workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ def test_owned_gate_uses_trusted_base_not_member_code(self):
manifest = yaml.safe_load((ROOT / ".github/release-lines.yml").read_text())
self.assertEqual(manifest["pinned"]["native-queue-policy.yml"], ["v6", "-v4"])

def test_owned_gate_retriggers_never_cancel_the_evidence_wait(self):
# Stage-label flips re-fire the PR-target run every few minutes; a
# cancelling concurrency group would never let the bounded evidence
# wait finish (#16942). Re-triggers must still run (a hold added after
# a green run must turn the check red) but must queue, not cancel.
data = workflow("native-queue-policy.yml")
events = data.get("on", data.get(True))
for action in ("edited", "labeled", "unlabeled"):
self.assertIn(action, events["pull_request_target"]["types"])
concurrency = data["concurrency"]
self.assertIn("github.event.pull_request.number", concurrency["group"])
self.assertIs(concurrency["cancel-in-progress"], False)

def test_cosmetic_label_flips_skip_the_evidence_wait(self):
# Only labels matching the policy's BLOCKED_LABEL are read; any other
# labeled/unlabeled flip must skip the 22.5 min wait (#16945) while
# the job still concludes successfully.
steps = workflow("native-queue-policy.yml")["jobs"]["policy"]["steps"]
gate = next(s for s in steps
if s.get("name") == "Replay last verdict for cosmetic label flips")
self.assertEqual(gate["id"], "label-flip")
self.assertIn("isCosmeticLabelFlip", gate["with"]["script"])
self.assertIn("replayLastVerdict", gate["with"]["script"])
# Nothing to replay (no prior success, or a transient API error) must
# fall through to the full wait rather than fail or fabricate a pass.
self.assertIn("replayed === null", gate["with"]["script"])
self.assertIn("isTransientAPIError(error)", gate["with"]["script"])
self.assertIn("cosmetic = false", gate["with"]["script"])
wait = next(s for s in steps if s.get("name", "").startswith("Validate exact-head evidence"))
self.assertIn("steps.label-flip.outputs.cosmetic != 'true'", wait["if"])
self.assertLess(steps.index(gate), steps.index(wait))

def test_dependabot_runs_the_same_trusted_pr_verifier(self):
verifier = workflow("pr-verifier.yml")
events = verifier.get("on", verifier.get(True))
Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/native-queue-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ permissions:

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }}
# Serialise per PR but never cancel: the evidence wait below runs up to
# 22.5 min, and every stage-label flip re-fires this workflow. With
# cancel-in-progress the check could never reach a verdict on a PR the
# hive is actively staging (#16942). The queued run re-reads the mutable
# PR state after the current one finishes, so fail-closed is preserved.
cancel-in-progress: false

jobs:
policy:
Expand All @@ -34,7 +39,38 @@ jobs:
persist-credentials: false
- name: Test policy behavior
run: node --test .github/scripts/native-queue-policy.test.cjs .github/scripts/diagnose-dco-provider.test.cjs
- name: Replay last verdict for cosmetic label flips
id: label-flip
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const { isCosmeticLabelFlip, replayLastVerdict, isTransientAPIError } = require('./.github/scripts/native-queue-policy.cjs');
let cosmetic = isCosmeticLabelFlip(context);
if (cosmetic) {
core.info('Label "' + context.payload.label.name + '" is not read by the policy; replaying the last completed verdict instead of waiting for evidence.');
try {
const replayed = await replayLastVerdict({github, context});
if (replayed === null) {
// No prior success on this head (never evaluated, or the last
// wait failed/timed out): run the authoritative wait instead of
// pinning that verdict onto every later cosmetic flip.
core.info('No successful native-queue-policy run on this head to replay; running the full evidence wait.');
cosmetic = false;
} else {
core.info(replayed);
}
} catch (error) {
if (isTransientAPIError(error)) {
core.info('GitHub API ' + error.status + ' while replaying; running the full evidence wait (which retries) instead.');
cosmetic = false;
} else {
core.setFailed(error.message);
}
}
}
core.setOutput('cosmetic', String(cosmetic));
- name: Validate exact-head evidence (bounded wait for PR providers)
if: steps.label-flip.outputs.cosmetic != 'true'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/stream-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ jobs:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

# The supervisor scripts have no Go test lane; shellcheck them and run
# the watchdog decision tests (fake ffmpeg, stubbed Twitch check) here,
# the only job that sees src/deploy/stream changes.
- name: Shell scripts (shellcheck + watchdog tests)
run: |
set -euo pipefail
cd src/deploy/stream
shellcheck -x entrypoint.sh stream-watchdog.sh healthcheck.sh public-safe-gate.sh test-stream-watchdog.sh
bash test-stream-watchdog.sh

- name: Resolve tags
id: ref
env:
Expand Down
Loading
Loading