Skip to content

check-pr-fully-clean.py is hard-coded to this repo and silently answers about the wrong PR elsewhere #1391

Description

@d-morrison

scripts/check-pr-fully-clean.py hard-codes Morrison-Lab/ai-config at line 57 (repos/Morrison-Lab/ai-config/commits/{sha}/check-runs) and takes no repo argument. Passing -R owner/repo is silently ignored, so running it against another repo's PR number answers about this repo's PR of that number.

Measured 2026-08-10, asking about Morrison-Lab/gha#445:

$ python3 scripts/check-pr-fully-clean.py 445 -R Morrison-Lab/gha
PR #445 (chore/lint-markdown-437): state=MERGED, HEAD=fe7a3100
...
RuntimeError: ... gh: No commit found for SHA: fe7a310054d43b20ffd8a37f07ac3849a9c22fa6 (HTTP 422)

gha#445 is feat/phi-study-id-detector and was open at the time. ai-config#445 is chore/lint-markdown-437 and is merged.

The crash is luck, not a guard. It only happened because ai-config's HEAD SHA does not exist in gha. A PR number whose two repos' SHAs both resolve --- or any invocation where the script's later steps tolerate the mismatch --- yields a clean, confidently wrong verdict. The only tell is the branch name in the first line of output, which a caller has no reason to read when they believe they named the repo.

Why this matters beyond a missing flag. shared/workflow/fully-clean.md calls this script "this corpus's verdict authority" and ardi mandates it, while hooks/no-handrolled-verdict-parse.py refuses a hand-rolled verdict grep until this script has answered for that PR. So in any repo other than this one, the corpus points sessions at an instrument that cannot answer, and a guard discourages the correct fallback. That is the over-broad-discharge shape algorithmatize-checks already describes: the guard goes quiet, and quiet reads as compliance.

Proposed fix

  1. Add -R/--repo, defaulting to the current checkout's gh repo view --json nameWithOwner rather than to a literal.
  2. Thread it through every hard-coded Morrison-Lab/ai-config occurrence --- grep -c 'Morrison-Lab/ai-config' scripts/check-pr-fully-clean.py reports 4, of which line 57 is the load-bearing one and the rest are prose citations, so derive the set rather than fixing the one line.
  3. Fail loudly on ambiguity rather than defaulting: if the cwd is not a git repo and no -R is given, exit non-zero naming the problem, per fail-fast. Defaulting to this repo is what makes the current behaviour silent.
  4. Regression test: a PR number valid in two repos returns different verdicts for each, and is seen to fail against the pre-fix script.

Meanwhile the fallback outside this repo is the hand parse fully-clean.md documents --- select on the **Claude finished body marker, take the last ### Verdict heading --- which is what no-handrolled-verdict-parse.py's ALLOW_HANDROLLED_VERDICT_PARSE=1 escape exists for.

Found while driving Morrison-Lab/gha#445 and ucdavis/bcs#615 from a bcs session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions