Repository navigation
fix(mention): skip the bot's own review on someone else's PR - #916
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 |
# Conflicts: # generator/src/tend/templates/mention.yaml.j2 # generator/tests/_regtest_outputs/test_generate.test_sandbox_levers_regtest.out # generator/tests/_regtest_outputs/test_generate.test_workflow_minimal_codex_regtest[mention].out # generator/tests/_regtest_outputs/test_generate.test_workflow_minimal_regtest[mention].out # generator/tests/_regtest_outputs/test_generate.test_workflow_with_setup_regtest[mention].out # generator/tests/test_generate.py
## Problem `tend-mention` starts a full billable session every time **someone other than the bot approves a PR with an empty review body and no inline comments**. The session reads the PR, finds nothing addressed to it, and exits silently. It can only ever no-op: a bare `APPROVED` asks for nothing, and the bot is barred from merging, so there is no role left for it to act in. `verify` has two terminal-review gates and both key on `REVIEW_AUTHOR`: the empty-body `APPROVED` gate (#747) and the synthetic reply-container gate (#849/#866). A third party's approval matches neither, so it falls through to the `PR_AUTHOR == bot` short-circuit on a bot-authored PR — or to `BOT_REVIEWS`, which counts the triggering review itself — and `should_run=true` is unconditional. Structural: there is no decision point, so the same shape recurs every time a human approves one of the bot's PRs without typing anything. Distinct from the three issues already open or closed on this path. #747 fixed the bot's *own* empty-body approval; #866 targets the synthetic empty-body `COMMENTED` container GitHub creates for an inline reply; #915/#916 target the bot's *own* content-bearing review on someone else's PR. All three are author-keyed by design; this is the residual their author-keying leaves behind, and it was named as such in the evidence log two days before this run. ## Evidence Three occurrences on `PRQL/prql`, all traced to the review record rather than inferred from the run: | When | PR | Approver | Review | Handle job | |---|---|---|---|---| | 2026-08-10 | [#6164](PRQL/prql#6164) | `kgutwin` | `APPROVED`, empty body, no inline comments | [31395281267](https://github.com/PRQL/prql/actions/runs/31395281267) — 2 m 10 s, published nothing | | 2026-08-12 08:18Z | [#6185](PRQL/prql#6185) | `vanillajonathan` | `4914418538`, `APPROVED`, body length 0, `pulls/6185/comments` empty | [31577748274](https://github.com/PRQL/prql/actions/runs/31577748274) — 08:18:45Z→08:20:35Z (110 s), published nothing | | 2026-08-12 13:27Z | [#6186](PRQL/prql#6186) | `kgutwin` | `4916991960`, `APPROVED`, body length 0, zero inline comments | [31601473217](https://github.com/PRQL/prql/actions/runs/31601473217) — 13:27:22Z→13:28:51Z (89 s), published nothing | The third one's session log says why it published nothing, in five tool calls: *"The trigger was a plain approval (`APPROVED`, empty body, no inline comments) from @kgutwin on PR #6186, which is already **MERGED**. No questions, no requested changes, no unaddressed comments anywhere on the thread. Per the review-response rules, a plain approval gets no reply, so I'm not posting anything."* The model reaches the right verdict every time; the cost is that it has to boot to reach it. ## Solution A third clause on the same gate chain, inside the `pull_request_review` block and after the `@`-mention scan, so a mention buried in an inline comment still summons the bot: ```bash if [ "$REVIEW_STATE" = "approved" ] \ && [ -z "$COMMENT_BODY" ] \ && [ -z "$INLINE" ]; then echo "should_run=false" >> "$GITHUB_OUTPUT" exit 0 fi ``` It costs no extra API call — `$INLINE` is already fetched a few lines above for the mention scan. Two narrowings, both load-bearing: - **`approved`, not any state.** A human's reply to one of the bot's review threads also arrives as an empty-body review container, but `COMMENTED`. Widening the state here would silence the bot on every human reply to its own threads — the same trap `test_mention_skips_bot_reply_container` pins from the author side, since `pull_request_review_comment` subscribes to `edited` only. - **`$INLINE` empty, not reply-only.** An approval whose nits live in inline comments is a request addressed to the PR's author, and on a bot-authored PR that is a role the bot has to act in. Only a review with nothing in it anywhere is terminal. The two author-keyed gates stay as they are: the bot's own empty-body `APPROVED` is skipped before the `$INLINE` fetch, which keeps that path one API call cheaper. ## Gate assessment - **Evidence level: High** — a consistent pattern across three sessions on two PRs and two approvers, spanning two days. High needs 2–3; this is 3. - **Structural, not stochastic.** The gate condition is author-keyed in the workflow YAML, so replaying any of these three scenarios ten times boots the agent ten times. The model's judgement is not involved and is not at fault. - **Change type: targeted fix** — one clause on an existing chain, reusing data already fetched. Normal bar, met by Gate 1. - Both gates passed. Evidence log: https://gist.github.com/192514ea2c36586f9b7f842a482d62ab (`review-reviewers evidence: PRQL/prql 2026-08`), where this finding was recorded at one occurrence on 2026-08-10 and at two on 2026-08-12 before crossing here. ## Testing `test_mention_skips_third_party_bare_approval` compares the whole gate condition with whitespace normalized, so an author clause added later — or the `$INLINE` clause dropped — fails on equality rather than sliding past an `in` check. It fails on `main` (`ValueError: substring not found`). The four `mention` regtest snapshots are updated. Full generator suite: 420 passed. --------- Co-authored-by: tend-agent <[email protected]>
The release's last step: all eight generated workflows move from `max-sixty/tend/[email protected]` to `@0.1.15`, which now exists as a tag. The behaviour tend itself gains, having shipped it to adopters first: - **`tend-review` gets the examined-HEAD gate** ([#903](#903)). Concurrency drops to `cancel-in-progress: false` and the pre-check skips a queued run whose live HEAD already carries the `tend-review/<pr>` stamp, so a push mid-review queues behind the session instead of throwing away what it had read. - **`tend-mention` stops booting sessions that can only no-op** ([#849](#849), [#916](#916), [#955](#955)), and its verify gate fetches a review's inline comments when deciding engagement. - **`tend-notifications`** carries the pre-check's setup guard, so a run that finds an empty inbox does no setup either. Generated by `uvx tend@latest init`; the hand-maintained `review-reviewers.yaml` is restamped onto `@0.1.15` in the same branch, so `.github/workflows/` holds one action ref. `pre-commit run --all-files` (actionlint included) is clean. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Automated nightly regeneration of tend's workflow files. **tend version:** 0.1.14 → 0.1.15 **Notable changes** - **Rate-limit handling**: a maintainer can approve past the spike limit (max-sixty/tend#874), and `tend-mention` now skips comments on `tend-rate-limit`-labelled issues as well as `tend-outage` ones — the same self-trigger loop guard, widened to every issue tend files about its own health. - **Review flow**: a push is queued behind an examined-HEAD gate instead of cancelling the in-flight review (max-sixty/tend#903), the review is submitted before a fix is pushed (max-sixty/tend#834), a force-push triggers a re-review rather than trusting the re-anchored SHA (max-sixty/tend#884), and the `/code-review` second pass is unconditional (max-sixty/tend#937). - **CI monitoring**: both the check poll and the `gh run rerun --failed` poll now end terminally when the cap is hit instead of reading as done (max-sixty/tend#876, max-sixty/tend#951), and a failed GitHub-status probe no longer reads as "no incident" (max-sixty/tend#913). - **Nightly**: conflicted bot PRs are test-merged locally instead of filtered on the lazy `mergeable` field (max-sixty/tend#898), and mention runs skip the bot's own review and a third party's content-free approval (max-sixty/tend#916, max-sixty/tend#955). - **`tend check`**: an unreadable ruleset bypass list is reported as unknown rather than ungated (max-sixty/tend#825), environment names are read one per line and addressed encoded (max-sixty/tend#879), and `credential-environments` no longer points at the setting it rejects (max-sixty/tend#900) — this repo currently `SKIP`s that check, so its wording should improve here. Full comparison: max-sixty/tend@0.1.14...0.1.15 Co-authored-by: worktrunk-bot <[email protected]>
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