Skip to content

fix: respond to actionable bot self-reviews instead of self-loop-exiting#762

Open
tend-agent wants to merge 4 commits into
mainfrom
fix/self-review-loop-guard-29055429013
Open

fix: respond to actionable bot self-reviews instead of self-loop-exiting#762
tend-agent wants to merge 4 commits into
mainfrom
fix/self-review-loop-guard-29055429013

Conversation

@tend-agent

@tend-agent tend-agent commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #761.

Problem

When tend-review and the PR author are the same bot account (tend-on-tend, or any consumer using one bot for both authoring and reviewing), an actionable self-review is silently swallowed. tend-mention triggers correctly and Claude runs to completion, but the run reads a CHANGES_REQUESTED / COMMENTED-with-findings review on the bot's own PR, treats it as the bot talking to itself, and exits without acting. The finding only gets actioned when a human asks by hand.

The verify gate is already correct — it fires should_run=true for an actionable self-review; #749 only skips empty-body APPROVED ones. The silent exit comes from two prompt-layer guards with no reviewer/author carve-out:

  • The system-prompt self-loop guard was absolute: "before responding to a comment or review, confirm the triggering actor isn't the bot itself."
  • The non-mention pull_request_review prompt branch said only "respond appropriately … if the review approves or is between humans, exit silently" — it never named the bot-authored-review case, so it read as "between humans / self."

running-in-ci's Self-conversation Guard already documents the exception ("only respond if there is a distinct role boundary, e.g. you are the reviewer on your own PR"), but neither of the two surfaces above carried it, and the system prompt wins.

Fix — both surfaces #761 names

  1. shared/system-prompt.md — the self-loop guard now carves out the role boundary: an actionable review the bot's review workflow posted on the bot's own PR (CHANGES_REQUESTED, or COMMENTED with findings/questions) is reviewer-to-author feedback, not a self-loop — address it. A bot approval or an ask-free bot comment still exits silently.
  2. generator/src/tend/templates/mention.yaml.j2 — the non-mention review branch now positively instructs that a review your own review workflow posted on your own PR is your reviewer role speaking, so action it; exit silently only for a plain approval or a review with no actionable content.

The system prompt is composed at runtime by all three harness actions, so no workflow regeneration is needed for surface 1; surface 2 regenerates the mention regtest snapshots (updated here). Reaches adopters at the next release. All 256 generator tests pass.

Relationship to other issues/PRs

Loop consideration

If addressing the review pushes a commit, synchronize re-runs tend-review, which posts a fresh review — the same re-trigger loop that already exists for human-authored reviews, bounded by review eventually approving (terminal, gate-skipped), the mention dedup guard, and the findings actually getting resolved. Triggering here is the intended behavior.

Requested by @max-sixty in max-sixty/worktrunk#3394: "let's fix that … We need to trigger in this case."

The system-prompt self-loop guard was absolute ("confirm the triggering
actor isn't the bot itself"), so when tend-review posts a
CHANGES_REQUESTED / COMMENTED-with-findings review on the bot's own PR,
the tend-mention handle session read it as the bot talking to itself and
exited silently — overriding the handle prompt's own "if the review
requests changes or asks questions, respond appropriately."

The verify gate already lets these through (#749 only skips empty-body
APPROVED self-reviews), and running-in-ci's Self-conversation Guard
already carves out the reviewer/author role boundary. This aligns the
terse system-prompt guard with that carve-out so an actionable bot
self-review gets addressed instead of swallowed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Second half of the actionable-self-review fix. The non-mention
pull_request_review prompt branch said only 'respond appropriately',
leaving the bot-authored-review-on-own-PR case to be (mis)read as a
self-loop. Add a positive instruction that a review your own review
workflow posted on your own PR is your reviewer role speaking — action
it — and exit silently only for a plain approval or a review with no
actionable content.

Together with the system-prompt guard carve-out, this fully addresses
tend#761 (both surfaces it names).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tend-agent tend-agent changed the title prompt: respond to actionable bot self-reviews instead of self-loop-exiting fix: respond to actionable bot self-reviews instead of self-loop-exiting Jul 9, 2026

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The self-review carve-out reads well and I verified the layering: the verify gate already lets an actionable bot self-review through (it skips only approved + empty-body), and the in-process render preserves the em-dash — the ? in the regenerated snapshots is the usual pytest-regtest non-ASCII normalization, consistent with the em-dashes already in that file, so no functional concern there.

One thing the rewrite dropped, though: the review branch lost its bystander off-ramp. The old text was "If the review approves or is between humans, exit silently"; the new text is "Exit silently only for a plain approval or a review with no actionable content." The only forecloses the between-participants case — a human requesting changes on another human's PR where the bot previously participated (so the verify gate fires should_run=true) now falls under "requests changes → respond appropriately (make the change and push)", pulling the bot into a review it's a bystander to.

The sibling comment-fallback branch right below still keeps its off-ramp ("If the conversation is between other participants, exit silently"), so the two fallbacks are now asymmetric — which reads as an unintended side effect of the rewrite rather than an intended scope change. Suggestion inline restores the bystander exit while keeping the self-review carve-out.

Note: applying the suggestion changes the source template only — the 3 test_workflow_*_regtest[mention] snapshots need regenerating (uv run pytest tests/ -k mention --regtest-reset) in the same commit or the regtests fail.

Comment thread generator/src/tend/templates/mention.yaml.j2 Outdated
The self-review carve-out rewrite dropped the between-participants
off-ramp the old text carried ('or is between humans, exit silently').
The 'only for a plain approval or a review with no actionable content'
foreclosed the bystander case, so a human-to-human change request on a
PR the bot merely participated in would be actioned — asymmetric with
the comment-fallback branch, which still exits on between-other-
participants reviews. Restore the exit while keeping the self-review
carve-out.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@max-sixty

Copy link
Copy Markdown
Owner

but then the trigger hasn't changed; only the guidance?

I'm less of a fan of the guidance; it seems overly verbose

Same behavior, fewer words. @max-sixty found the added guidance overly
verbose; the trigger/gate is unchanged (this was always a prompt-layer
fix), so trim both surfaces to the minimum that still names the
reviewer-on-own-PR role boundary and keeps the bystander off-ramp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Right — the trigger and the verify gate are unchanged. The gate already fired should_run=true for these (#749 only skips empty-body APPROVED self-reviews); the bug was purely at the prompt/guidance layer, so guidance is all that moved.

Trimmed both surfaces in 36f7684 — same behavior, fewer words:

  • system-prompt guard: 8 lines → 6, folded the carve-out into the guard sentence itself.
  • mention review branch: dropped the parenthetical and the "your reviewer role speaking" restatement, kept the "including when you authored the review" clause and the bystander off-ramp.

256 tests pass, mention regtest snapshots regenerated.

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.

tend-mention: bot-authored review with actionable findings on bot's own PR is silently swallowed by self-loop guards

2 participants