Skip to content

fix(review): skip re-review when bot pushes to already-approved PR - #154

Closed
tend-agent wants to merge 1 commit into
mainfrom
hourly/review-24048605638
Closed

tend-agent wants to merge 1 commit into
mainfrom
hourly/review-24048605638

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

  • Add pre-flight check to skip review when the bot pushes a commit to a PR it already approved
  • Prevents redundant approval spam on third-party PRs (Dependabot, renovate) where the bot iterates on CI fixes

Evidence

Run ID: 24044816094 (tend-notifications on PRQL/prql)

On PRQL/prql#5774 (Dependabot cargo patch bump), a maintainer asked @prql-bot fix CI. The notifications handler pushed multiple fix commits. Each push triggered a new tend-review run, producing 5 bot approvals on the same PR:

Review Timestamp Source run Status
1 17:21:41Z Initial review success
2 18:41:00Z 24045334184 cancelled
3 18:44:03Z 24045467036 cancelled
4 18:52:37Z 24045654923 cancelled
5 18:57:57Z 24045947651 success

Cancelled runs still managed to approve before the cancellation signal arrived. Run 24045654923 also pushed a code fix from within a review context.

Root cause: The pre-flight check sees a new HEAD (the bot's own commit) and proceeds with an incremental review, which re-approves because the changes are trivial.

Classification: Structural — recurs whenever the bot pushes to a PR it already reviewed. Gate 1: High confidence (4 redundant approvals in one incident). Gate 2: Targeted fix (14 lines of guidance added to pre-flight).

Test plan

  • Verify on next Dependabot PR where bot pushes a fix: only 1 approval should appear
  • Verify bot still reviews new human-authored commits normally (PR_AUTHOR != BOT_LOGIN check)
  • Verify self-authored PR reviews still work (condition excludes PR_AUTHOR == BOT_LOGIN)

🤖 Generated with Claude Code

When the bot pushes a fix commit to a third-party PR (e.g., Dependabot) that
it already approved, the triggered tend-review run would re-approve redundantly.
On PRQL/prql#5774, this produced 5 approvals from the same bot — each push
from the notifications handler triggered a new review that re-approved.

Add a pre-flight check: if the bot's last review was APPROVED and the latest
commit was authored by the bot (on a non-self-authored PR), exit silently.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label Apr 6, 2026
@max-sixty

Copy link
Copy Markdown
Owner

but presumably this does require a new review, no? why is this case special?

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Fair point — a bot-pushed commit could still introduce issues worth catching.

The problem this was solving: when the bot pushes fix commits to a third-party PR (e.g., Dependabot), each push triggers a new review run. The concurrency group cancels the previous run, but the cancelled run often manages to post an approval before the cancellation signal arrives. This produced 5 approvals on a single PR in the observed incident.

But skipping the review entirely is too aggressive — the better fix is probably to suppress the approval rather than the review. For example, the bot could still review its own commits but skip posting a new APPROVE if one already exists. That way it catches regressions without spamming approvals.

I'll close this in favor of a more targeted approach unless you'd prefer a different direction.

@max-sixty max-sixty closed this Apr 7, 2026
tend-agent pushed a commit that referenced this pull request Apr 10, 2026
review-reviewers has now made two attempts to "fix" tend-review
re-approving on bot-pushed fix commits — #154 and #212. Both were
closed by the maintainer as solving a non-problem ("bot PRs should
not be treated differently from any other PR"). Add a "Non-issues"
section to review-reviewers so the judgment doesn't repeat, and
document the principle in the review skill itself so the intent is
visible where the behavior lives.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty pushed a commit that referenced this pull request Apr 10, 2026
## Summary

- Add a **"Non-issues: do not flag these"** section to
`review-reviewers/SKILL.md` so the hourly judgment doesn't keep
re-discovering the same non-problem.
- Document in `review/SKILL.md` that commit and PR authorship don't
affect review behavior — reviewing/re-approving after a bot-pushed fix
is expected.

## Evidence — two prior rejections of the same fix

`review-reviewers` has now made two attempts to guard `tend-review` from
re-approving on bot-pushed fix commits. Both were closed by the
maintainer as solving a non-problem.

| PR | Title | Closed | Maintainer feedback |
|---|---|---|---|
| [#154](#154) | `fix(review):
skip re-review when bot pushes to already-approved PR` | 2026-04-07 |
"but presumably this does require a new review, no? why is this case
special?" |
| [#212](#212) | `fix(review):
skip APPROVE when incremental commits are bot-authored` | 2026-04-10
01:07Z | "this is totally fine — we should *not* treat a bot PR
differently from any other PR. We should make that clear in our docs" |

The second rejection explicitly asked for the principle to be
documented. This PR does that.

## Root cause

Run
[24219300860](https://github.com/max-sixty/tend/actions/runs/24219300860)
(prior `review-reviewers` run at 23:59Z) observed a `tend-review` run on
max-sixty/worktrunk#2041 submitting a fourth APPROVED review on a
bot-authored commit pushed by `tend-notifications`, classified it as
"Structural — recurs whenever the bot pushes to a PR it already
reviewed," and filed #212. The judgment was wrong: commit authorship is
not a review-logic problem. Run
[24220122739](https://github.com/max-sixty/tend/actions/runs/24220122739)
(`tend-review` on #212) then correctly executed the new logic the PR
added, but the PR's premise was rejected by the maintainer minutes later
in run
[24221123712](https://github.com/max-sixty/tend/actions/runs/24221123712).

The underlying 5-stacked-approvals incident that originally motivated
#154 ([PRQL/prql#5774](PRQL/prql#5774)) was a
*concurrency* issue — cancelled runs racing to POST approvals before
SIGTERM arrived — not a review-logic issue. This is called out in the
new "Non-issues" entry so it isn't confused for the same pattern in
future.

## Gate assessment

| Gate | Result |
|---|---|
| **Evidence level** | Critical — two closed PRs with explicit
maintainer rejection, plus an explicit "make that clear in our docs"
request |
| **Occurrences** | 3 independent instances (PR #154 authoring run, PR
#212 authoring run 24219300860, and each closure) |
| **Classification** | **Structural** — the skill has no guidance
distinguishing expected re-approval from a loop; it will make the same
judgment again without a fix |
| **Change type** | **Targeted fix** — 21 lines total across two files,
no restructuring |
| **Passes Gate 1 (confidence)** | Yes — Critical bar is 1 occurrence;
this has 2 |
| **Passes Gate 2 (magnitude)** | Yes — targeted fix at normal threshold
|

## Test plan

- [ ] Next time a `tend-review` run re-approves after
`tend-notifications` or `tend-ci-fix` pushes a fix, the subsequent
`review-reviewers` run should not flag it as a behavioral problem.
- [ ] The `review` skill continues reviewing bot-pushed fixes normally
(no behavior change — only documentation added).

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
tend-agent pushed a commit that referenced this pull request Apr 14, 2026
…as non-issue

Add `tend-mention` self-triggers from bot-authored comments to the non-issues
list. Multiple review-reviewers runs have observed this pattern (bot posts a
comment → `issue_comment` event fires `tend-mention` → Claude exits silently
via the self-conversation guard) and one prior PR (#203) attempted sender-
based filtering, which the maintainer closed without merge — same authorship-
keyed-guard pattern rejected in #154 and #212. Recording this explicitly
prevents future runs from re-drafting similar PRs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty pushed a commit that referenced this pull request Apr 14, 2026
## Summary

Add a second entry to the `review-reviewers` **Non-issues** list so
future
hourly runs don't re-draft sender-based filters for `tend-mention`. The
entry
covers the case where the bot's own `issue_comment` (e.g., posting on a
user
issue where it previously replied, or its own tracking issue) fires
`tend-mention`, which then exits silently via the prompt's
self-conversation
guard.

## Evidence

Three self-trigger runs on `max-sixty/tend` in the past ~2 hours (window
15:18Z–16:17Z on 2026-04-14), each spun up Claude and exited silently:

| Run | Trigger | Cost | Turns |
|---|---|---|---|
|
[24407340908](https://github.com/max-sixty/tend/actions/runs/24407340908)
| `tend-agent` comment on `review-reviewers-tracking` #133 | $0.47 | 12
|
|
[24409523729](https://github.com/max-sixty/tend/actions/runs/24409523729)
| `tend-agent` triage comment on issue #269 | $0.20 | 6 |
|
[24410231240](https://github.com/max-sixty/tend/actions/runs/24410231240)
| `tend-agent` comment on tracking issue #133 | $0.22 | 7 |

All three exit with reasoning like "self-trigger, no role boundary,
exiting
silently" — the prompt-level guard works correctly, just at a few
hundred
tokens of cost per occurrence.

## Why no workflow fix

[#203](#203) ("fix: filter bot
self-triggers in tend-mention workflow") proposed exactly this sender
filter
for `pull_request_review` / `pull_request_review_comment` events on
2026-04-09. @max-sixty closed it without merge or comment, matching the
pattern of earlier closures of authorship-keyed guards
([#154](#154),
[#212](#212)) already called out
in the
non-issues list. Extending the same sender filter to `issue_comment`
would
fit the same rejected shape, so this PR only updates the skill to
prevent
future runs from re-drafting it.

## Gate assessment

- **Evidence level**: High — 3 occurrences this run, structural (every
bot
comment on a participated-in issue fires `tend-mention` verify→handle),
and
  direct prior-art signal (#203 closed by maintainer).
- **Classification**: Structural (deterministic from workflow logic) —
same
  condition always produces the wasted Claude invocation.
- **Change type**: Targeted simplification — adds one bullet to an
existing
  warning list. No workflow or generator changes.
- **Passes both gates**: yes (structural 1+ occurrence sufficient for
  removal/simplification; change is one-paragraph docs).

## Test plan

- [ ] Rendered non-issues list reads sensibly and cites #203 / #268
accurately

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
tend-agent added a commit that referenced this pull request May 10, 2026
Remove links to specific past PRs (#154, #212, #263, #203, #268, #392, #375, #305, #318) from review-reviewers and running-in-ci, restating each as a structural rule (what shape is accepted, what shape is not). Extend "Authoring skills" in the root CLAUDE.md with a parallel "No specific past-case references" bullet so future skill edits don't re-introduce them.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Behavioral issues found by review-reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants