fix: respond to actionable bot self-reviews instead of self-loop-exiting#762
fix: respond to actionable bot self-reviews instead of self-loop-exiting#762tend-agent wants to merge 4 commits into
Conversation
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
left a comment
There was a problem hiding this comment.
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.
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>
|
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>
|
Right — the trigger and the verify gate are unchanged. The gate already fired Trimmed both surfaces in 36f7684 — same behavior, fewer words:
256 tests pass, mention regtest snapshots regenerated. |
Closes #761.
Problem
When
tend-reviewand 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-mentiontriggers correctly and Claude runs to completion, but the run reads aCHANGES_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=truefor an actionable self-review; #749 only skips empty-bodyAPPROVEDones. The silent exit comes from two prompt-layer guards with no reviewer/author carve-out:pull_request_reviewprompt 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
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, orCOMMENTEDwith 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.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,
synchronizere-runstend-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."