fix(mention): skip the bot's own review on someone else's PR - #916
fix(mention): skip the bot's own review on someone else's PR#916tend-agent wants to merge 2 commits into
Conversation
tend-agent
left a comment
There was a problem hiding this comment.
The gate itself is right, and its placement holds up under trace: REVIEW_AUTHOR is only ever set on the pull_request_review arm of the dispatch case, so the second clause can't read a stale value from an issue_comment; the earlier APPROVED + empty-body gate stays load-bearing for the bot's own PRs rather than becoming dead; and all four mention regtests that carry the verify block are updated (test_extras_apply_path_regtest.out renders tend-review, so it's correctly untouched). Suite passes at 380 locally.
Three things on the prose and the test, none blocking.
The header comment now says the two skips are keyed "on the review being terminal for the bot rather than on authorship", while the new gate's own comment eleven lines later says "Keyed on author alone". Both are describing the same gate in opposite terms — "authorship" means self-authorship of the review in the first and review-author as the key in the second. That block's whole job is to steer a future editor away from a blanket self-review skip, so a framing that reads as "these aren't author-keyed" is the wrong signal to leave there.
The rationale in the gate comment — pushing unbidden to another author's branch is barred by conduct rules — is narrower than the set of PRs the gate covers. On a Dependabot/renovate PR the review skill's step 8 explicitly directs pushing the fix, so "no author role left to act in" isn't why mention is skippable there; it's skippable because tend-review pushes that fix in its own session and never needed a mention run. The behaviour is right either way, but as written the comment will read as an oversight to whoever next debugs a bot-authored PR that stopped waking mention.
The last assertion in the new test doesn't discriminate. run.index("reviews/$PAYLOAD_ID/comments") < run.index("BOT_REVIEWS=$(") holds on the pre-change template too (the inline fetch has always preceded the heuristic), so the third ordering the docstring claims to pin isn't pinned by anything except the gate slice bounds. Anchoring the right-hand side to the gate's own index makes it fail pre-change, like the other two.
The #849 overlap is called correctly — that one is only reachable on bot-authored PRs once this gate lands, since everything it targets on someone else's PR is now caught here first. Both edit this same header comment, so whichever is second wants the rebase you flagged.
|
All three addressed in 5a3e441. The header comment no longer denies the gates are author-keyed — it says they are, and that each is additionally narrowed to a case that leaves the run nothing to do, which is the steer against a blanket self-review skip stated without the contradiction. On the rationale: confirmed against the review skill, which directs pushing the fix on Dependabot/renovate PRs rather than stopping at analysis. So the conduct-rules clause was the wrong load-bearing reason. Reframed to what actually covers both cases — whatever the review warranted, the The third assertion now anchors its right-hand side to the gate's own index rather than to |
Problem
tend-mention's verify gate starts a full billable session for every non-empty-body review the bot leaves on a same-repo PR someone else authored. The session reads the PR, recognises the trigger as its own review, and exits silently — it can only ever no-op: the bot is the reviewer, the findings are addressed to the PR's author, and pushing unbidden to another author's branch is barred byrunning-in-ci's conduct rules, so there is no author role left to act in.For a
pull_request_reviewevent the gate falls through to the participation heuristic, which counts the triggering review itself —BOT_REVIEWSis never empty, soshould_run=trueis unconditional. #747's gate is the same shape narrowed to one leg (approvedand empty body), which excludes every review in #915's evidence: five occurrences in one 24h window on PRQL/prql,APPROVEDandCOMMENTEDalike, bodies 455–1920 chars, $1.79 booked plus one run that hit the account's session limit before it could bill.Solution
One author-keyed gate between the
PR_AUTHORresolution and theBOT_REVIEWSheuristic. Placement is the whole design, in three directions:PR_AUTHORshort-circuit, which has already exitedshould_run=truewhen the PR is the bot's own. A review the bot's review workflow leaves on a bot-authored PR is the reviewer role handing work to the author role and must keep firing (Allow tend-mention to trigger on bot's own reviews #166, tend-mention: bot-authored review with actionable findings on bot's own PR is silently swallowed by self-loop guards #761) — an author-keyed gate placed any earlier would swallow it.BOT_REVIEWS, which is what misreads the triggering review as prior engagement.Keyed on author alone: reusing #747's
REVIEW_STATE/ empty-body clauses here would let every bodiedCOMMENTEDreview straight through.Fork PRs are unaffected either way — the
relayjob'shead.repo.full_name == github.repositorycondition already means a bot review on a fork PR never dispatches.Testing
test_mention_skips_bot_review_on_another_authors_prpins the gate and all three orderings, and asserts the state/body clauses are absent from it. It fails on the pre-change template at the first assertion.test_mention_self_comment_skip_spares_review_submissionshad its APPROVED-gate slice narrowed to end at the inline-comment fetch, so it keeps discriminating between the two gates rather than passing on either. Full generator suite: 380 passed.pre-commitclean on the changed files.Relationship to #849
Complementary, not overlapping. #849 (for #866) drops the synthetic zero-body
COMMENTEDcontainer GitHub wraps around an inline reply, on any PR including the bot's own — where this gate cannot reach, becausePR_AUTHOR == botexits first. This one drops real bodied reviews on other authors' PRs, which #849's-z "$COMMENT_BODY"clause excludes. Both touchmention.yaml.j2; whichever lands second will need a one-line rebase on the header comment listing the self-review skips.Closes #915 — automated triage