Skip to content

skills(notifications): dedup bot-authored PRs cross-referencing the issue - #279

Merged
max-sixty merged 1 commit into
mainfrom
daily/review-runs-24443948807
Apr 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
daily/review-runs-24443948807

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

The notifications skill's dedup check only looks at issue comments and PR reviews. When tend-mention handles an @-mention by opening a PR with Refs #N in the body (and no issue comment), the next tend-notifications run misses that signal and opens a duplicate PR.

Evidence

Observed today in issue max-sixty/tend#276:

Time (UTC) Event
04:54:15 @max-sixty commented on #276 with @tend-agent mention asking for a PR
04:54:19 tend-mention run 24437112906 fires
04:58:58 tend-mention opens PR #277 with Refs #276 in body — no issue comment
05:40:46 tend-notifications run 24438413763 starts — past the 10-min freshness gate
05:40:xx Dedup check: gh api repos/.../issues/276/comments --jq '[.[] | select(bot login and created_at > 04:54:37)] | length' returns 0
05:46:11 Opens duplicate PR #278 on the same branch name docs/workflow-override-example
05:59:16 Closes #278 as duplicate after discovering #277 merged at 05:43:22

Direct cost: ~$4 of wasted API tokens on the second run, a confused issue timeline, and a correction comment the maintainer had to read.

Classification: structural — the failure is deterministic. For any @tend-agent mention that tend-mention handles by opening a PR with Refs #N (no issue comment), the notifications skill will always miss the dedup and produce a duplicate.

Fix

Add a third dedup check for issue notifications: search the issue timeline for cross-referenced events from bot-authored PRs created after NOTIF_UPDATED_AT. GitHub emits these events when a PR body references the issue (via Refs #N, #N, etc.), so this reliably catches the tend-mention→PR path.

Verified against the real timeline for issue #276:

$ gh api "repos/max-sixty/tend/issues/276/timeline" --jq '[.[] | select(.event == "cross-referenced") | {pr: .source.issue.number, author: .source.issue.user.login, created_at}]'
[{"pr":277,"author":"tend-agent","created_at":"2026-04-15T04:58:59Z"}, ...]

A dedup run at 05:40 with NOTIF_UPDATED_AT=2026-04-15T04:54:37Z would have returned length > 0 and correctly skipped.

Gate assessment

  • Gate 1 (confidence): 1 occurrence today, classified structural — one occurrence is sufficient per review-gates.md.
  • Gate 2 (magnitude): Targeted fix (one extra dedup query) — normal evidence bar, met.

Test plan

  • Next tend-notifications run that processes an issue already handled by tend-mention (via Refs #N PR) should skip and mark read instead of opening a duplicate PR.
  • Existing dedup on bot comments and PR reviews still works — the new check is additive.

…ssue

The dedup check only looked at issue comments, so when tend-mention
handled an @-mention by opening a PR with `Refs #N` in the body (no
issue comment), the next tend-notifications run saw no bot response on
the issue and opened a duplicate PR.

Observed in run 24438580801 — `tend-notifications` opened PR #278 ~45min
after tend-mention had already opened PR #277 for the same request.
Both branches collided on `docs/workflow-override-example` and #278 was
closed as a duplicate after ~$4 of wasted work.

Add a third dedup check: for issue notifications, look at the timeline
for `cross-referenced` events from bot-authored PRs created after the
notification's `updated_at`.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@tend-agent tend-agent added the review-runs Findings from review-runs skill label Apr 15, 2026
@max-sixty
max-sixty merged commit d241bd6 into main Apr 15, 2026
3 checks passed
@max-sixty
max-sixty deleted the daily/review-runs-24443948807 branch April 15, 2026 20:39
max-sixty added a commit that referenced this pull request Apr 18, 2026
Bumps generator version to 0.0.16 and syncs lockfile.

7 commits since 0.0.15: nightly bot PAT scope audit (#294), review-reviewers gist-backed evidence storage with single-fetch optimization (#291, #292), nightly closes bot-opened tracking issues when resolved (#290), drops GITHUB_STEP_SUMMARY writes that fail under Claude sandbox (#289), release docs clarification (#288), and notifications dedup of bot-authored PRs (#279).

Co-Authored-By: Claude <[email protected]>
@max-sixty max-sixty mentioned this pull request Apr 18, 2026
max-sixty added a commit that referenced this pull request Apr 18, 2026
Bumps generator to 0.0.16.

## Changes since 0.0.15

- #294 — nightly: audit bot PAT scopes via script
- #292 — review-reviewers: fetch current-month gist once per run
- #291 — review-reviewers: pilot gist-backed evidence storage
- #290 — nightly: close bot-opened tracking issues when resolved
- #289 — skills: drop `GITHUB_STEP_SUMMARY` writes that fail under
Claude sandbox
- #288 — docs(release): commit on the current branch, don't create a new
one
- #279 — notifications: dedup bot-authored PRs cross-referencing the
issue

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

Labels

review-runs Findings from review-runs skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants