Skip to content

fix(mention): skip no-op sessions for undirected bot comments - #608

Merged
max-sixty merged 2 commits into
mainfrom
fix/issue-606
Jun 5, 2026
Merged

max-sixty merged 2 commits into
mainfrom
fix/issue-606

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

tend-mention's verify job short-circuits to should_run=true for any issue_comment event on a bot-authored PR, without inspecting the comment author. Undirected bot notifications (deploy status from cloudflare-workers-and-pages[bot], CI bots, etc.) then spin up a full agent session that always exits silently — pure waste. Because deploy bots edit their comment to update status and the workflow listens on issue_comment: [created, edited], each notification fires two no-op sessions.

Solution

Add a guard in the verify script between the existing @<bot> mention check and the PR-author short-circuit:

if [ "$EVENT_NAME" = "issue_comment" ] && [ "$COMMENT_AUTHOR_TYPE" = "Bot" ]; then
  echo "should_run=false" >> "$GITHUB_OUTPUT"
  exit 0
fi

COMMENT_AUTHOR_TYPE is wired from github.event.comment.user.type (the public-API-visible Bot/User discriminator).

Ordering matters: the @-mention check runs first, so legitimate summons (e.g. another bot writing @<our-bot>) are still honored; the new guard runs before the PR-author short-circuit, which is what was producing the no-op sessions.

Tend's own bot accounts are PAT-based user accounts (user.type == "User"), so this does not affect tend-on-tend behavior — only true GitHub App / Bot accounts.

Testing

  • Added test_mention_verify_skips_bot_comments_without_mention asserting the guard is generated, COMMENT_AUTHOR_TYPE is wired, and the guard sits between the mention check and the PR-author short-circuit.
  • Regenerated three regression snapshots (test_workflow_minimal_regtest[mention], test_workflow_with_setup_regtest[mention], test_workflow_minimal_codex_regtest[mention]).
  • Full generator suite: 243 passed.

Closes #606 — automated triage

Undirected bot comments (deploy notifications, CI status) on bot-authored
PRs were falling through to the PR-author short-circuit in `verify`, which
fired a full agent session per comment. Since deploy bots edit their
comment to update status and we subscribe to both `created` and `edited`,
each notification produced two no-op sessions.

Add a guard between the @-mention check and the PR-author short-circuit:
for `issue_comment` events whose `comment.user.type == "Bot"`, set
`should_run=false`. The mention check still runs first, so legitimate
human or bot summons (`@<bot>`) are preserved.

Closes #606

Co-Authored-By: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

but don't we want to know about some bot comments?

what are some cases where this is really noisy?

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Good question — the guard is narrower than it might look. We still react to bot comments in three cases:

  1. Any bot that @-mentions us — the mention check at mention.yaml.j2:80 runs before the new guard, so a CI bot or human-impersonating bot writing @tend-agent is still honored.
  2. Review events from bots — the guard scopes to EVENT_NAME = issue_comment, so pull_request_review / pull_request_review_comment from a bot reviewer (CodeRabbit, Greptile, etc.) still go through.
  3. issues events authored by a bot — also unaffected; the early-exit at line 75 fires first.

What we're dropping is the residual case: a bot posting a conversational issue_comment on a bot-authored PR without naming us. Those sessions always exited silently because there's nothing for the agent to do.

Where it's actually noisy — the trigger was the Cloudflare Pages deploy bot on bot-authored regen PRs, called out in #606 with evidence from diffplug/dormouse#93:

Source bot Pattern Sessions per PR
cloudflare-workers-and-pages[bot] Posts deploy status, then edits the same comment as the build progresses 2 per push (created + edited), recurring on every nightly regen PR
Vercel / Netlify preview bots Same shape (post + edit) Same
Renovate / Dependabot status comments on their own PRs One per status change 1+ per PR

On dormouse the Cloudflare case alone was ~$0.45 per regen PR for sessions that did nothing. Any repo with a deploy-preview bot and bot-authored PRs (nightly regens, dependency bumps) hits the same multiplier.

Happy to narrow it further if you'd prefer — e.g. limit the guard to bot-authored PRs only, so undirected bot comments on human-authored PRs would still spin up a session (currently they'd also hit the engagement-history branch and usually run, but we'd be preserving that path explicitly).

@max-sixty

Copy link
Copy Markdown
Owner

ok, let's proceed but add a TODO that we should reassess in the future.

in the future, we could consider quick pass of a fast model to avoid kicking off a 1T param model to see it was an inane bot comment

A small/fast-model content check could replace the blanket skip with
content-aware filtering — flagged per maintainer review on #608.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Done — added a TODO above the guard in mention.yaml.j2 noting that a small/fast-model pass could replace the blanket skip with content-aware filtering (only drop comments with no actionable signal).

@max-sixty
max-sixty merged commit 3db258a into main Jun 5, 2026
4 checks passed
@max-sixty
max-sixty deleted the fix/issue-606 branch June 5, 2026 07:08
tend-agent added a commit that referenced this pull request Jul 14, 2026
The verify gate's bot-comment guard (#608) only catches GitHub App /
Bot accounts via comment.user.type == "Bot". Tend's bot is a PAT-based
User account, so its own comments fall through to the engagement
heuristics and spin up a handle session that exits silently — pure
waste. This recurs on the monthly tracking-issue rollover, where
review-reviewers posts evidence-gist links on its own tracking issue.

Add a guard skipping self-authored issue_comment events, wired from
github.event.comment.user.login. Scoped to issue_comment so the
pull_request_review self-review paths keep their intentional
actionable-signal handling.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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: skip no-op sessions for undirected bot comments on bot-authored PRs

2 participants