Skip to content

The pending review-request list is neither bot-filtered nor team-aware, and the two readers of it disagree

Id: TD-PPagop-26081403 · Status: resolved · Filed: 2026-08-14 · Resolved: 2026-08-14 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/385

Requirement 38a’s candidate rule reads an already-pending review request as proof that a human has been asked — lib/handoff.sh’s ensure_human_reviewer reports already on a non-empty requested_reviewers list, and scripts/gather-human-visibility-hygiene.sh’s read-only no_candidate re-check drops the violation on a non-empty reviewRequests. Both were added in PR #358, to stop a live CODEOWNERS auto-request being misread as skip\tno-candidate (agent-ops #350, #353, #355). Neither reader qualifies what is in that list, and they do not qualify it in the same way.

A bot in the list counts as a human. Every other candidate list feeding the same decision strikes bots off: _handoff_known_reviewers filters (.user.type // "User") == "Bot" and a [bot]-suffixed login, and the gatherer’s own known_other filters endswith("[bot]"). The pending read is [.requested_reviewers[]?.login] with no filter, and the gatherer’s is a bare length. So a bot sitting in requested_reviewers answers requirement 38a: ensure_human_reviewer returns already<TAB><bot-login>, the sweep logs no warning, no human is ever asked, and — because the guarantee fails by not warning — gather-human-visibility-hygiene.sh has nothing to re-check and the gap never becomes an item. The realistic way a bot gets there is Copilot code review, auto-requested into requested_reviewers as a Bot-type account when a repository ruleset enables it: a repo-settings change, which no test or lint in this repository would notice.

A requested team counts for one reader and not the other. gh pr view --json reviewRequests populates its array with requested teams as well as users; ensure_human_reviewer reads only .requested_reviewers[].login, and never looks at .requested_teams. On a pull request whose only pending request is a team, the gatherer drops the violation while the sweep keeps emitting no legal review-request candidate every cycle — a warning re-logged forever that can never become an item, the inverse of the loop PR #358 fixed and with the same “produces no clearing event” property. The gatherer’s own comment asserts the opposite (“the sweep’s own next pass would report already or requested for this pull request, never no-candidate again”), which is exactly the claim that fails in this case.

Neither shape is live in this repository today: CODEOWNERS names two user accounts, no ruleset requests Copilot, and no team is ever requested. That is why it was filed rather than fixed inside PR #358 — deciding what counts as a human reviewer is a requirement question, not a bug fix, and the answer changes requirement 38a’s own wording.

Suggested fix: give the pending list the same bot filter the other two candidate lists already carry — select(((.type // "User") == "Bot") or (.login | endswith("[bot]")) | not) in ensure_human_reviewer, and the matching select (rather than a bare length) in the gatherer — and decide deliberately whether a requested team answers requirement 38a. If it does, ensure_human_reviewer must read .requested_teams too, so both readers agree; if it does not, the gatherer must stop counting teams. test/handoff.test.sh’s ensure_human_reviewer stub prints $tmp_dir/pending verbatim rather than applying the --jq it is handed, so covering the bot case needs the stub to carry reviewer objects (login plus type) and filter them, the way its /reviews branch already does.

Referenced from: requirement 38a and requirement 38e, docs/IMPLEMENTATION-PIPELINE-SPEC.md.