Skip to content

feat(notifications): drop cross-repo CheckSuite notifications in pre-check - #392

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

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

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

Adds a pre-check layer to tend-notifications that drops cross-repo CheckSuite notifications (reason: ci_activity from forks) before counting unread items. Without this filter, a forked repo whose own tend-* workflows fail keeps generating ci_activity notifications to the canonical bot, each of which forces a Claude invocation that loads the notifications skill, classifies the item as "cross-repo, not actionable", and marks it read — work that can be done in YAML for cents-on-the-dollar.

The notifications skill is the sole handler for: fork PR inline comments, cross-repo @-mentions, and stale same-repo items. Cross-repo CheckSuite items aren't in any of those categories — the bundled skill explicitly tells Claude to mark them read without action. Filtering at the pre-check makes the YAML do what Claude was already doing.

Evidence

In one hour on max-sixty/worktrunk (runs 25461250978, 25462624978, 25463750952), three consecutive scheduled tend-notifications runs each:

  1. Saw exactly 1 unread notification — a ci_activity CheckSuite from lucaspimentel/worktrunk reporting that fork's own tend-notifications failed on its main.
  2. Passed the YAML pre-check (Layer A's count > 0; Layers B/C/D don't filter cross-repo CheckSuite).
  3. Invoked Claude (~26–33 KB session log per run).
  4. Loaded running-in-ci and running-tend, classified the item as cross-repo CI activity, marked it read, exited.

Cumulative occurrences of the same shape across the bot's evidence gists (this month + last): 80+. Pattern is structural: same input → same paid-but-no-op outcome every time.

Linked evidence gist: https://gist.github.com/9675d1510da32c68a68c1d45137b21e0

Gate assessment

  • Gate 1 (Confidence): High — structural failure, 80+ historical occurrences.
  • Gate 2 (Magnitude): Targeted fix — one new pre-check layer. Normal threshold; passes.
  • Structural vs. stochastic: Structural — Layer A only checks count > 0, so any cross-repo CheckSuite always reaches Claude.

Why filter subject.type == "CheckSuite" rather than reason == "ci_activity"

CheckSuite is the typed subject GitHub assigns to all CI-related notifications and matches the same set in practice. Filtering by subject type keeps the predicate close in spirit to existing Layer C (subject.type == "PullRequest") and avoids depending on the reason enum.

Why drop only cross-repo, not same-repo

Same-repo CI failures are handled by tend-ci-fix on the workflow_run event (immediate, deterministic). The notifications-skill "stale unanswered items" path explicitly carries the case where a dedicated workflow failed or was skipped. Same-repo ci_activity therefore stays in scope; only cross-repo (which has no dedicated handler and is out-of-scope per the skill's scope rules) is filtered.

Test plan

  • uv run pytest — 188 passed
  • Regtest snapshots regenerated and the diff is constrained to the three notifications-related fixtures
  • Forked-repo tend-notifications runs no longer trigger Claude on lucaspimentel-style fork CI failures (verifiable next hour after this lands and a release ships)

…check

Cross-repo `ci_activity` notifications (typically forks whose own tend-*
workflows fail and notify the canonical bot) are categorically unactionable
per the notifications skill's scope rules — Claude reads them, classifies
them as cross-repo, and marks them read. Layer A's `count > 0` early-exit
gate doesn't catch this, so each one forces a paid Claude invocation for a
no-op mark-read.

Adds a Layer C that drops cross-repo `subject.type == "CheckSuite"`
notifications by marking them read in YAML, mirroring the shape of the
existing same-repo PullRequest filter (now Layer D). Same-repo CheckSuite
notifications stay in scope: tend-ci-fix is the event-driven handler, and
the notifications skill's "stale unanswered items" path covers the case
where a dedicated handler failed.

Observed pattern: three consecutive `tend-notifications` runs on
max-sixty/worktrunk in one hour each invoked Claude solely to silent-mark
the same `lucaspimentel/worktrunk` CI-failure notification.
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label May 6, 2026
@max-sixty

Copy link
Copy Markdown
Owner

Closing — superseded by the upstream fix in 0.0.17 (#375 fork guard). Once consumer repos run their nightly regen, their canonical workflows gate scheduled jobs on github.repository_owner, and forks that sync from upstream pick up the same guard and no-op on the cron. The abandoned-fork case (forks that never sync) was the residual gap this PR addressed, but the cost of that residual is small enough not to justify a permanent pre-check layer.

This was written by Claude Code on behalf of @max-sixty

@max-sixty max-sixty closed this May 8, 2026
tend-agent added a commit that referenced this pull request May 10, 2026
Remove links to specific past PRs (#154, #212, #263, #203, #268, #392, #375, #305, #318) from review-reviewers and running-in-ci, restating each as a structural rule (what shape is accepted, what shape is not). Extend "Authoring skills" in the root CLAUDE.md with a parallel "No specific past-case references" bullet so future skill edits don't re-introduce them.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
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