Repository navigation
feat: PR triage workflow that binds ready-for-human to the head commit (ADR-0077) - #220
Merged
Merged
Conversation
…t (ADR-0077) Replace the reusable risk-paths workflow with pr-triage.yml. Its levels step keeps the risk:high behavior of ADR-0068. A new readiness step removes ready-for-human when the PR head moves after the label, or when the label comes while CI at the head is not green. It writes 1 marker comment first, then removes the label, so a re-run repairs a half-done revocation. Core's caller uses the local pr-triage.yml with the labeled type. The gate checks both embedded libraries. Callers that pin the old risk-paths.yml stay valid at their pinned SHA until they move.
The check-runs API default is filter=latest; make it explicit and state the policy in the spec: the step counts the latest run of each check name, as GitHub's checks rollup does, so an older failed run that a re-run replaced does not revoke ready-for-human. A test pins the query, and .memory/corrections.jsonl records the guard.
Contributor
Author
Cross-review record
Revert testIn a scratch worktree at
|
bketelsen
approved these changes
Nov 9, 2026
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ready-for-humansays that the review passed and CI is green at the PR head, but the label names no commit. A later push, or a label added while CI is red or pending, leaves a false claim on the merge list. This PR makes core's reusable workflow remove the label in those 2 cases, for every PR of every repository with a caller, with no agent runtime (ADR-0077, new). Context: the merge-lane replay in #218..github/workflows/pr-triage.ymlreplacesrisk-paths.yml(agit mv, then edits). 1 jobpr-triage, 2 steps:levels: therisk:highbehavior of ADR-0068, unchanged. It does not run onlabeled.readiness(new,scripts/lib/pr-triage.mjs): onsynchronizewith the label in the payload, reasonhead-moved; onlabeledwithready-for-human, it reads the check runs and commit statuses at the head (all pages; its ownpr-triage*runs left out) and revokes when any is not green. Revocation writes 1 marker comment first, thenDELETEs the label (200 and 404 count as done; other errors fail the step). A re-run after a failed delete finds the marker and writes no second comment.!cancelled()in theirif:); adependabot-shadowinput is reserved and unused.$RUNNER_TEMP/pr-triage/.npm run sync:risk-paths-workflowrewrites both;npm run check:risk-pathsfails when either drifts and names it.scripts/lib/risk-paths.mjs: 5 new API methods on 1 shared paginator;escapeCell,NAME_PATTERN,commandValueexported. Every old export and result is unchanged, so vendored copies keep working.risk-paths-caller.yml, same file name) uses./.github/workflows/pr-triage.ymlwith typesopened, synchronize, reopened, edited, labeled; job idpr-triage(the readiness step leaves out checks by that prefix).docs/specs/pr-triage.md(contract, triggers, check evaluation, revoke order, limits), ADR-0077, risk-paths spec section E points to it, baseline row B6 acceptspr-triage.ymlor, until a repository moves, the olderrisk-paths.yml. Callers in other repositories pin a core SHA (ADR-0021), so the old workflow keeps working for them until they move.repository-surfaces-risk-paths-wrong-path.jsonnow uses.github/risk-paths.yamlas its wrong path (same diagnostic), sorisk-paths.ymlnames only the old caller.Limits (in the spec): best effort, not proof of the reviewed SHA; a delay of seconds to minutes; a failed run leaves a stale label and a red
pr-triagecheck; a push and a label in the same second can remove a correct label (the error removes, never keeps); review at A, push B, CI on B green, then the label: kept. Exact binding needs the reviewed SHA in the label act (autonomy gate).ADR number: 0077. A parallel change may take 0076; if this PR merges first, the gap stays or this ADR is renumbered before merge.
Risk tier
Risk tier: 3 — highest. The PR touches these risk paths of
.github/risk-paths.json:.github/workflows/pr-triage.yml,.github/workflows/risk-paths-caller.yml(.github/workflows/**): safe because the job keepspermissions: {}at the top,contents: read+pull-requests: writein the job (the same as today), no checkout, no secret butgithub.token, SHA-pinnedsetup-node, and only core code at the caller's pinned (in core: base) commit. Underpull_request_targetcore's local caller resolves to the base branch, so this PR's own workflow change runs only after merge..github/risk-paths.json: thewhyof.github/workflows/**renamed; 2 new entries (scripts/lib/pr-triage.mjs,scripts/sync-risk-paths-workflow.mjs). Nothing removed.scripts/lib/risk-paths.mjs: additive API methods and exports; the labeling job is unchanged (test/risk-paths.test.mjspasses).scripts/lib/pr-triage.mjs(new): it only comments and removesready-for-human; it never adds a label, approves or merges.scripts/check-risk-paths.mjsmatches by glob but is unchanged; the sync script it calls now checks 2 blocks.Docs housekeeping
TEMPLATE.mddocs/README.mdVerification
npm run verify: docs, organization, scripts, corrections, risk-paths ("workflow in sync"), 469 tests, 0 failuresnode scripts/check-docs.mjsgreen (105 docs, 1985 links)permissions: {}, no checkout;actionlintclean; YAML parsespr-triage.mjsagainst a local fake API madeGET comments→POST comment→DELETE labelfor asynchronizewith the label, and thelevelsstep read the list at the base SHAgit grep -n 'risk-paths\.yml' -- ':!docs/adr' ':!CHANGELOG*'shows only the B6 row and risk-paths spec line 95, both of which accept the old caller during the move