Skip to content

mention: skip issue_comment.edited retrigger on commenter self-edit - #574

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

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

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

Skip the duplicate tend-mention agent run when a commenter edits their own issue_comment within ~2 minutes of posting and the edit did not add an @<bot>-mention. The original created event is the canonical trigger; the edited retrigger currently fires a second handle job that does the agent's full context-load and then exits silently via the recheck-before-posting dedup, paying ~2–7 min of agent wall-time per occurrence.

Why this shape, why now

This is the 6th cumulative occurrence of the human-comment-edit retrigger pattern (April: 4, May: 2). The 6th was logged in this run: Oxygen66 (author_association: NONE) created issue #2856 comment 4508170976 at 12:16:12Z and edited it at 12:16:53Z (41s later, no @worktrunk-bot added). Both tend-mention runs (26225338575, 26225369828) reached the same handle job; the second ran ~1.7min of agent time and silent-exited. The accumulated evidence and 6th-occurrence action threshold were set by prior review-reviewers runs — see the evidence gist and run 25313817498's verdict (the 5-condition filter sketched there is what this PR implements).

Filter shape

Skip when all five conditions hold (none alone is sufficient):

  1. event_name == issue_comment
  2. action == edited
  3. sender.login == comment.user.login (commenter is editing their own comment, not a maintainer editing the bot's comment)
  4. comment.updated_at - comment.created_at < 120s (refinement window, not a stale edit days later)
  5. comment.body does not contain @<bot> (already exits true above on @-mention, so this is implicit and is the reason the new block sits after the @-mention check)

What this does NOT affect

  • Edit-to-summon (@<bot> added to an existing comment): exits true at the prior @-mention check before this filter runs.
  • Maintainer editing the bot's comment (e.g. correcting a typo): sender != comment.user.login, so the filter does not skip — the agent runs.
  • Stale edits days after creation: 120s window excludes them — the agent runs.
  • pull_request_review_comment events: this filter only applies to issue_comment events. The PR review-comment subscription is already types: [edited]-only, so there is no created-vs-edited duplication on that surface.
  • Bot editing its own tracking comments (e.g. review-runs PATCHing a month-long tracking comment): the edit is far outside the 120s window, so the filter does not skip — the existing self-conversation-guard silent-exit pattern still handles it.

Relation to the documented non-issue rule

The review-reviewers skill's non-issue list states that "sender-based or commenter-based filters on tend-mention are not the accepted shape" — the rationale is PR #154/#203/#212, which all gated on the bot's own authorship. This filter is structurally different: it gates on the editor matching the comment's author (human or otherwise), without referencing the bot's identity. If the maintainer judges that the rule's letter still covers this shape, closing this PR without merge would be useful signal — we'd then tighten the non-issue paragraph to call out commenter-self-edit filters explicitly and downgrade the cumulative counter to record-only-permanent.

Test plan

  • uv run --project generator pytest generator/tests/ — 97 passed
  • uvx pre-commit run --files generator/src/tend/templates/mention.yaml.j2 — clean
  • Generated workflow parses as valid YAML; actionlint finds no issues
  • Visual diff confirms the new block sits between the @-mention check (exits true) and the bot-engagement check, so all three documented case shapes route correctly
  • Maintainer review: confirm filter shape is acceptable given the non-issue paragraph

Evidence accumulated across runs: evidence gist. Tracking issue: review-reviewers-tracking: 2026-05.

When a commenter edits their own issue_comment within 2 minutes of posting
without adding an @-mention, treat the original `created` event as the
canonical trigger and skip the `edited` retrigger before the agent runs.

The full handle job currently runs end-to-end on both events; the second
silent-exits via recheck-before-posting dedup, paying a few minutes of agent
wall-time per occurrence. The filter is narrow: edit-to-summon, maintainer
edits of the bot's comments, and stale edits days later all still run.

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

Copy link
Copy Markdown
Owner

but if there's an edit, don't we want to handle that like a new comment and check whether it's relevant?

@tend-agent

Copy link
Copy Markdown
Collaborator Author

You're right — an edit can change relevance, and this filter would drop the case where the created run decides not to respond and the edit (within 120s) adds substantive content without @bot. The dedup-recheck handles "bot already responded"; it can't handle "the edited content would now merit a response" because the agent never runs to re-evaluate the new body.

Empirically all 6 observed cases were typo-class refinements (no relevance change), but that's not structural proof — it could just reflect that the sample doesn't contain a relevance-changing edit. The savings (~2 min × 6 occurrences over 2 months) are modest against that structural risk.

If you want to close in favor of the existing dedup-recheck silent-exit being the correct cost, I'll update the review-reviewers non-issue paragraph to call out commenter-self-edit filters explicitly so this doesn't get re-proposed.

@max-sixty

Copy link
Copy Markdown
Owner

yes please

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Closing per the decision above — the dedup-recheck silent-exit is the correct cost, since an edit can change relevance and a skipped retrigger has no recovery path.

Follow-up PR updates the review-reviewers non-issue paragraph to call out commenter-self-edit filters explicitly, so this shape doesn't get re-proposed.

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.

2 participants