Skip to content

fix: readiness is unknown, not a failure, on HTTP 403 from the check reads - #228

Merged
bketelsen merged 1 commit into
mainfrom
lucilla/pr-triage-readiness-403
Nov 9, 2026
Merged

bketelsen merged 1 commit into
mainfrom
lucilla/pr-triage-readiness-403

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

In a private repository, the readiness step of pr-triage.yml fails on every ready-for-human label: the job token (contents: read, pull-requests: write) cannot read check runs or commit statuses, and GitHub answers HTTP 403 (bketelsen/fleet run 42646228960: GET /repos/bketelsen/fleet/commits/<sha>/check-runs failed: HTTP 403). This PR makes that case "readiness unknown" instead of a red run.

  • scripts/lib/risk-paths.mjs: the GitHub client error for a non-2xx answer now carries status (the HTTP status). The message is the same text as before, and no export changes, so vendored copies keep working.
  • scripts/lib/pr-triage.mjs: on labeled, a 403 (read from error.status, not from the message) on the check-run read or the commit-status read gives the outcome unknown: a ::notice:: annotation, a log line and a ## Readiness summary line, no label change, no comment, exit 0. Any other HTTP status or a network error still fails the step. The synchronize rule (head-moved) reads no checks and works in private repositories as before.
  • .github/workflows/pr-triage.yml: both embedded copies re-synced (npm run sync:risk-paths-workflow). No permission, trigger or if: change.
  • docs/specs/pr-triage.md: rule D (readiness unknown, only 403) and rule F (private repositories get only the head-moved rule; a secondary rate limit, also HTTP 403, gives unknown and not a red run; the label stays in both cases).

Why not ask for checks: read and statuses: read: a reusable workflow cannot get more than its caller grants, so every caller would need a change first. ADR-0076 required checks still gate the merge; ADR-0077 already calls this guard best effort.

Risk tier

Risk tier: 3 — highest. The PR touches these paths of the base .github/risk-paths.json (L2, risk:high):

  • .github/workflows/pr-triage.yml: only the 2 embedded library copies change (generated; npm run check:risk-paths checks them). Permissions stay permissions: {} at the top and contents: read, pull-requests: write for the job. No trigger, action or if: change.
  • scripts/lib/pr-triage.mjs: the new path only reads and then stops. It adds no API call, and it writes nothing to GitHub. It can only keep a label that the step would otherwise not have removed either (a failed run also keeps the label), so it never weakens a removal that works today. The narrow catch is guarded: 500, 404 and a 403 in the message text only all still fail.
  • scripts/lib/risk-paths.mjs: 1 added property on the thrown error. No new export, no changed message, no new request.

Under pull_request_target, core's local caller resolves to the base branch, so this PR's own run uses the old code. Private callers (bketelsen/fleet, frostyard/apt-publisher) take the fix with a pin bump to the merge SHA.

Docs housekeeping

  • No new doc; the spec is changed beside the code that implements it
  • No new ADR: the step's permissions and triggers do not change (ADR-0077 limits apply)
  • Conformance aliases (ADR-0029) untouched

Verification

  • npm run verify: docs, organization, risk-paths (workflow in sync), 725 tests, 0 failures
  • node scripts/check-corrections.mjs: 35 lines ok (1 new line, promoted_to the test file)
  • actionlint .github/workflows/pr-triage.yml clean
  • Guard tests fail without the fix (both library files at main): "labeled with HTTP 403 on the check runs is readiness unknown…", "…on the commit statuses…", "main on labeled with HTTP 403 on the check runs passes with a notice and makes no change" (real client and main, fake fetch), "an HTTP error from the client carries the status and keeps its message". With a catch-all instead of the 403 check, the 4 tests "labeled with … still fails the step and changes nothing" (500 and 404 on check runs, 500 on statuses, 403 only in the message) fail.

Cross-review

  • Coder: Anthropic Claude (claude-opus-5.5). Reviewer: openai/gpt-6.1-sol, read only.
  • Base 17c84bf8b91e8ea76577e3b79859990a4a75ae01, head 83a4a7c6b101ad7c84cc6f1b2c7f4576d3c10fcc. All 6 changed paths. Generated heredocs excluded from line-by-line review; the reviewer confirmed that both match their sources and that the workflow outside them is unchanged.
  • Result: Ready, Blocking: none, no findings.
  • Revert test (scratch worktree at the head, both library files checked out from the base, node --test test/pr-triage.test.mjs): "labeled with HTTP 403 on the check runs is readiness unknown…", "labeled with HTTP 403 on the commit statuses is readiness unknown…", "main on labeled with HTTP 403 on the check runs passes with a notice and makes no change" and "an HTTP error from the client carries the status and keeps its message" fail on their assertions. CI green at the head.

…reads

In a private repository the job token (contents: read, pull-requests: write)
cannot read check runs or commit statuses, so the readiness step on labeled
failed with HTTP 403 (bketelsen/fleet run 42646228960). The GitHub client now
carries the HTTP status in error.status (message unchanged); the readiness
step reads a 403 from either check read as readiness unknown: a notice and a
summary line, no label change, no comment, exit 0. Every other error still
fails the step. Job permissions do not change.
@github-actions github-actions Bot added the risk:high Touches a path in .github/risk-paths.json label Nov 9, 2026
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 9, 2026
@bketelsen
bketelsen merged commit 267421d into main Nov 9, 2026
6 checks passed
@bketelsen
bketelsen deleted the lucilla/pr-triage-readiness-403 branch November 9, 2026 15:49
This was referenced Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants