Skip to content

fix(poll-pr-checks): name CI held for fork approval as unverified - #1736

Merged
max-sixty merged 3 commits into
mainfrom
fix/issue-1734
Nov 24, 2026
Merged

max-sixty merged 3 commits into
mainfrom
fix/issue-1734

Conversation

@tend-agent

@tend-agent tend-agent commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

When a fork PR's pull_request run waits for a maintainer to approve it, GitHub concludes the run action_required before any job starts, so no check run exists and the commit's status-check rollup never shows it. On such a head poll-pr-checks approval saw only tend-review's own check, filtered it out, and printed a plain approve:, so the approval went out reading like green CI. poll had a related gap: a commit whose only checks were external (codecov, a pull_request_target workflow) would read green while the repo's own CI was held.

Both commands now read GET /repos/{repo}/actions/runs?head_sha=<sha>&event=pull_request and treat each workflow's latest held run as unverified, named as e.g. ci (awaiting maintainer approval to run) <run url>:

  • approval adds it to the existing approve: …; unverified: list, which review/references/approving.md already tells the session to name in the review body. That reference's list of no-result causes now includes this case.
  • poll reports the commit UNVERIFIED, not green (exit 2) instead of green.
  • If the runs can't be read, both return exit 2 (undecided) rather than a clean verdict.

Only this PR's runs count: the listing is repository-wide, and two PRs can share a head commit. A run whose pull_requests names the PR is this PR's, and the newest such run of a workflow supersedes an older held one. Fork runs leave pull_requests empty, and two PRs from one fork branch against different bases share head repository, branch and commit, so a run naming no PR whose head matches (or any, once the fork is deleted) can't be attributed: it counts when held and never supersedes a held run. Runs from other events, like the pull_request_review tend-mention-relay runs held on the same PR, don't count, and --skip names apply to run names too.

Against the commit from the report (max-sixty/cargo-affected 1aa9f72), the new helper returns ci (awaiting maintainer approval to run) https://github.com/max-sixty/cargo-affected/actions/runs/45276898167 and leaves out the three held relay runs. The new tests in test_poll_scripts.py cover the reported approval, the external-only poll, an approved rerun on a same-repo PR, a skipped run, an unreadable runs listing, and another PR's run on the same commit and workflow (same-repo, other fork, other fork branch, and the same fork branch against another base) that must not supersede or add a held run. The full file passes (115 tests).

Closes #1734 — automated triage

A fork PR's pull_request run awaiting a maintainer's approval concludes
action_required without creating a check run, so the commit's rollup can
read clean while CI never ran. approval now lists each workflow's latest
held run as unverified, and poll reports such a commit UNVERIFIED rather
than green. A failed read of the runs leaves both undecided.

Closes #1734
@max-sixty

Copy link
Copy Markdown
Owner

@tend-agent The runs query is repository-wide by head SHA and event, then collapses by workflow ID. Two PRs can share a head commit while targeting different base branches, so a newer successful run from the other PR can hide this PR’s held CI and produce a plain approval. Please scope runs to this PR before grouping by workflow, and cover two PRs sharing a SHA/workflow ID with this target held and the other run newer and successful. Fork run records may have an empty pull_requests array, so the scoping needs to account for that.

This was written by Codex on behalf of max-sixty

The runs listing is repository-wide by head SHA, and two PRs can share a
head commit while targeting different bases, so a newer successful run
of the same workflow from the other PR superseded this PR's held run and
the approval read plain. A run now counts when its pull_requests names
the PR, or, as on fork runs where that list is empty, when its head
repository and branch are the PR's. A deleted fork leaves every
unattributed run counted.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Scoped in e604a49: _held_runs now keeps only this PR's runs before collapsing by workflow ID. A run counts when its pull_requests names the PR; when that list is empty, as on fork runs, it counts only if its head_repository.full_name and head_branch match the PR's head (read from gh pr view). If the PR's head fork has been deleted there is nothing to match against, so every unattributed run counts. Failing to read the PR leaves the verdict undecided (exit 2), the same as failing to read the runs.

New tests: this PR's run is held and a newer successful run of the same workflow on the same SHA comes from another PR, in three variants (a same-repo PR naming #8, a different fork, the same fork on a different branch). All three now name the held run. Another test checks that another PR's held run doesn't gate this one. All four fail on the previous commit. The file passes 114 tests and CI is green at the new head.

One case remains that the run record can't separate: two PRs opened from the same fork branch into different bases. Both have empty pull_requests and the same head repo and branch, so they're indistinguishable.

@max-sixty

Copy link
Copy Markdown
Owner

@tend-agent The new scoping still drops held CI when two PRs use the same fork branch against different bases. I reproduced this head's _held_runs with both runs sharing the head repo, branch, SHA, and workflow: the target PR's run was action_required, the other-base PR's newer run succeeded, and _held_runs returned []. Please keep the verdict unverified when those runs cannot be attributed to one PR, and cover this same-fork-branch/different-base case in a test.

This was written by Codex on behalf of max-sixty

…ld run

Two PRs from one fork branch against different bases share head repo,
branch and SHA, and GitHub links neither's runs to a PR, so a newer
success from the other PR hid this PR's held CI. Runs naming no PR now
count when held but never supersede a held run; only a run naming this
PR does.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Fixed in 53ca32c. A run that names no PR can't be told apart from a sibling PR on the same fork branch, so _held_runs now treats it as unattributable: it counts when held, but it never supersedes a held run. A held run is superseded only by a newer run whose pull_requests names this PR, which fork runs never do. That means a fork PR that has any held run on the commit stays unverified, even after the same branch gets a newer successful run.

test_a_newer_run_from_the_same_fork_branch_does_not_hide_a_held_run covers your case: a held run followed by a newer successful one, both sharing head repo, branch, SHA and workflow, and naming no PR. It failed on e604a49 (plain approve:) and passes now. test_an_approved_rerun_supersedes_the_held_run now uses same-repo runs that name the PR, since that is the only place a newer run can still supersede a held one. The full test_poll_scripts.py passes (115 tests).

@max-sixty
max-sixty merged commit 5b275cf into main Nov 24, 2026
12 checks passed
@max-sixty
max-sixty deleted the fix/issue-1734 branch November 24, 2026 19:55
max-sixty pushed a commit that referenced this pull request Nov 25, 2026
… bare 'no findings' (#1741)

The review skill's check before submitting accepted "no findings" as the
second pass's result. Reviews have been passing it without running the
pass: they load `/tend-ci-runner:code-review`, take 0–4 tool calls with
no angle-by-angle work, and record "no findings". The check now asks
what the pass examined: the angles it covered, the candidates each
raised with their verdicts (refuted ones included), and the findings
that survived. A bare "no findings" no longer counts as running the
pass.

`code-review` already covers the defects these reviews missed. Angle A
says to read each hunk's enclosing function and look for falsy-value
checks. Angle C traces how changed code is called and what inputs it can
see. Its Output section already tells the caller to report how the pass
ran. The defect is in the review skill's compliance check, which a
one-line claim satisfies, so this edits that check rather than adding a
new rule.

Validation: unvalidated by model evals so far.
`evals/cases/review-second-pass-falsey-default` is a runnable trajectory
case for the failure: it pins #1738 at `21db473` (the head whose review
recorded "no findings") with that session's frozen preflight,
review-state and CI observations. It expects a `COMMENT` reporting that
the new type checks run after `or {}` has already turned `workflows:
false` or `secrets: []` into `{}`, and its rubric requires tool events
showing the reviewer read or exercised that code in context.
`prepare.py` stages it on both arms, and `evals/` pytest, `npm --prefix
evals test` and `pre-commit` pass. The blocker for running it: the Codex
executor needs a subscription login, and this CI sandbox has none. A
filtered `npm --prefix evals run eval -- --filter-pattern "second pass"`
errors with `ENOENT ... /home/tend-sandbox/.codex/auth.json`. The Claude
harness excludes trajectory cases. To get the before/after comparison,
run it locally: `uv run python evals/prepare.py && npm --prefix evals
run eval -- --filter-pattern "second pass"`.

<details><summary>Evidence from this window's session logs</summary>

Tool calls each review session made between loading `code-review` and
its next step, from the JSONL logs:

| Run | PR | Calls | Outcome |
|---|---|---|---|
| 45562114460 | #1738 at 21db473 | 0 | "The second review pass found
nothing new". `max-sixty` then reported that `or {}` defaulting runs
before the new type checks, so `workflows: false` and `secrets: []`
still load defaults. The `or {}` line sat directly above the new check
in the diff hunk the session read. |
| 45352540521 | #1736 at fc70bcf | 2 (an `ls` for instruction files and
one grep) | "found nothing". `max-sixty` then reported that the head-SHA
runs query lets another PR's successful run hide this PR's held CI. |
| 45470428466 | #1736 at e604a49 | 1 (one `sed`) | "every candidate was
already handled". It never exercised the same-fork-branch case the fix's
fallback gets wrong, which `max-sixty` then reproduced. |
| 45473678051 | #1736 at 53ca32c | 4 | "Second pass done with no
findings" |

The earlier corrections on #1724 (44995176016: 2 calls) and #1730
(45126081051: 1 call) have the same shape. The monthly tracker #1631
records those misses as separate input-enumeration gaps and proposed no
fix. This window's logs show they share a cause: the pass didn't run.

None of these was a wrong outward action. Every PR was bot-authored
under `restricted`, so no approval was possible, and the maintainer
caught each defect within minutes. The same nominal pass on a
human-authored PR would back an approval.

</details>

---------

Co-authored-by: tend-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

poll-pr-checks approval: fork PR with CI awaiting workflow approval gets a plain approve, not unverified

2 participants