Skip to content

feat(notifications): freshness gate + bot-closed-PR drop - #254

Merged
max-sixty merged 1 commit into
mainfrom
notifications-split
Apr 12, 2026
Merged

max-sixty merged 1 commit into
mainfrom
notifications-split

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Empirical data (4.5-day sample across worktrunk + tend) showed two waste patterns in tend-notifications:

Races (2/6 substantive runs): tend-notifications grabbed fresh notifications while tend-mention/tend-review were concurrently handling the same event. One case produced duplicate PRs for the same issue; another posted a duplicate reply 20s before tend-mention finished.

Bot-closed-PR noise (6/13 "substantive" runs): The bot auto-subscribes to its own PRs. After merge, subscription notifications lingered and Claude spent 100-300s per run cross-checking before marking them read.

Two new pre-check layers in generate_notifications:

  • Layer C: PATCH-reads notifications on bot-authored closed PRs — permanent drop, these are pure dedup noise.
  • Layer D: Counts only "processable" notifications — cross-repo (no race possible) OR same-repo with updated_at older than 10 minutes (dedicated workflows have had time to complete). Fresh same-repo notifications are left unread for the next scheduled run.

SKILL.md step 4a gains a matching freshness gate so Claude also skips fresh same-repo notifications if invoked via workflow_dispatch. Stale-item threshold tightened from 30min to 10min to match.

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

…heck

Empirical data (4.5-day sample across worktrunk + tend) showed:
- 2/6 substantive notification runs were races — tend-notifications processed
  fresh notifications while tend-mention/tend-review were still mid-flight
- 6/13 "substantive" runs burned 100-300s dedup-ing bot-authored closed PRs

Two new pre-check layers prevent both:

Layer C: PATCH-reads notifications on bot-authored closed PRs (permanent drop).
Layer D: Counts only "processable" notifications — cross-repo OR same-repo with
updated_at older than 10 minutes. Fresh same-repo notifications are left unread
for the next scheduled run, giving dedicated workflows time to complete.

SKILL.md step 4a gains a matching freshness gate so Claude also skips fresh
same-repo notifications if invoked for another reason (e.g. workflow_dispatch).

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 28db9e6 into main Apr 12, 2026
5 checks passed
@max-sixty
max-sixty deleted the notifications-split branch April 12, 2026 00:10
tend-agent pushed a commit that referenced this pull request Apr 13, 2026
When `generator/pyproject.toml` exists (i.e. on the tend repo itself),
Step 5 of the nightly skill now regenerates workflows via the in-tree
generator instead of `uvx tend@latest`. Adopter repos without `generator/`
fall through to the existing `uvx tend@latest` path unchanged.

Motivation: PR #264 (from run 24330194038) ran `uvx tend@latest init` with
PyPI's `tend` at 0.0.11 (released 2026-04-10). `main` has 10 generator
commits landed since — #223 (drop hardcoded job timeouts), #225 (dedup
review events), #227 (workflow_extra), #228 (paginate), #231 (inline-reply
guidance), #233 (drop bot-author filter on issue_comment), #235 (prompt →
skill), #254 (notifications freshness gate + bot-closed-PR drop), etc.
Regenerating against the stale wheel reverted each of these. Maintainer
flagged the PR as regressions; diagnosis confirmed the PyPI lag.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty added a commit that referenced this pull request Apr 14, 2026
Bumps generator version to 0.0.12 and syncs lockfile.

50 commits since 0.0.11: notifications cost cut + freshness gate (#251, #254),
token-report per-run table and cost estimate (#249, #250), review-reviewers
outcome-focused Haiku analysis (#255), config workflow_extra/jobs pass-through
(#227), canonical author_association tiers across skills (#261, #263), action
token aggregation fix (#266), plus numerous review/mention/ci-runner fixes.

Co-Authored-By: Claude <[email protected]>
@max-sixty max-sixty mentioned this pull request Apr 14, 2026
max-sixty added a commit that referenced this pull request Apr 14, 2026
Bumps generator version to 0.0.12 and syncs lockfile.

50 commits since 0.0.11. Highlights:
- feat: notifications cost cut + freshness gate (#251, #254)
- feat: token-report per-run table + cost estimate (#249, #250)
- feat: review-reviewers outcome-focused Haiku analysis (#255)
- feat: config `workflow_extra` / `jobs` pass-through (#227)
- skills: canonical `author_association` tiers (#261, #263)
- fix: action token aggregation (#266), plus numerous
review/mention/ci-runner fixes

> _This was written by Claude Code on behalf of Maximilian_

Co-authored-by: Claude <[email protected]>
tend-agent pushed a commit that referenced this pull request Apr 14, 2026
Pulls in PR #268's `tend-outage` skip guard for `tend-mention`
(critical — prevents the outage self-loop) and the freshness-gate /
bot-closed-PR-drop from PR #254 for `tend-notifications`.

Observed on run 24418078692 (review-reviewers, 2026-04-14T19:13Z):
a 3-run cascade hit #267 between 19:14–19:17Z during a brief
Anthropic outage. The cascade only stopped because the API recovered;
the same pattern produced 95 runs in ~80 minutes during the earlier
2026-04-14T03:03Z outage documented in #268. Tend's own
`tend-mention.yaml` was last regenerated at cb6e919 (#236), which
predates #268, so the deployed filter still allows `issue_comment`
events on the `tend-outage` tracking issue.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty pushed a commit that referenced this pull request Apr 14, 2026
## Summary

Regenerates `tend-mention.yaml` and `tend-notifications.yaml` with tend
0.0.12 (released earlier today). The critical change is
[#268](#268 `tend-outage` skip
guard for `tend-mention`, which tend's own deployed workflow has been
missing since that fix landed.

## Evidence — outage loop reproduced today

[Run
24418078692](https://github.com/max-sixty/tend/actions/runs/24418078692)
(review-reviewers, 2026-04-14T19:13:53Z) observed a fresh cascade on
[#267](#267):

| Time (UTC) | Run | Workflow | Result |
|---|---|---|---|
| 19:14:48Z |
[24418118461](https://github.com/max-sixty/tend/actions/runs/24418118461)
| tend-mention | failure → posted to #267 |
| 19:15:49Z |
[24418164746](https://github.com/max-sixty/tend/actions/runs/24418164746)
| tend-mention | failure → posted to #267 |
| 19:16:42Z |
[24418203215](https://github.com/max-sixty/tend/actions/runs/24418203215)
| tend-mention | failure → posted to #267 |
| 19:17:43Z |
[24418247574](https://github.com/max-sixty/tend/actions/runs/24418247574)
| tend-mention | success (Anthropic recovered) |

Each failure ran `action.yaml`'s `Report failure` step
(`action.yaml:296-358`), which POSTed to the `tend-outage`-labeled #267.
That `issue_comment` event re-triggered `tend-mention`, which failed the
same way, producing the next run. The cascade stopped only when the
Anthropic API came back online — the same pattern that produced 95 runs
in ~80 minutes during the 2026-04-14T03:03Z outage documented in
[#268](#268).

## Root cause

[#268](#268) merged the fix into
`generator/src/tend/workflows.py` at 2026-04-14T13:56Z, and
[#270](#270) released 0.0.12. But
tend's own `.github/workflows/tend-mention.yaml` was last regenerated at
cb6e919 ([#236](#236)), which
predates #268. The deployed filter is still:

```yaml
(github.event_name == 'issue_comment') ||
```

which allows every comment on the `tend-outage` issue to re-trigger the
workflow. This PR applies the 0.0.12 generator, which emits the guarded
form:

```yaml
(github.event_name == 'issue_comment' &&
  !contains(github.event.issue.labels.*.name, 'tend-outage')) ||
```

## What's in this regen

- `tend-mention.yaml`:
[#268](#268) `tend-outage` skip
guard.
- `tend-notifications.yaml`:
[#254](#254) freshness gate (Layer
D) + bot-closed-PR drop (Layer C). Already released in 0.0.12;
regenerating brings tend's own workflow in line.

CLAUDE.md authorizes regenerating to the latest release ("Updating
earlier to the latest release (e.g., during a release commit) is fine");
0.0.12 was released today in
[#270](#270).

## Gate assessment

- **Classification**: Structural — same conditions reproduce every time.
An Anthropic outage lasting ≥ ~2 min triggers the cascade with
probability 1 under the current deployed filter.
- **Evidence level**: Critical. 1 occurrence this run + 1 historical
occurrence (95 runs on 2026-04-14T03:03Z, documented in
[#268](#268)). Per
`review-gates.md`, a structural failure with a clear critical outcome
passes Gate 1 at 1 occurrence.
- **Change type**: Mechanical regeneration. No generator or skill
changes — only workflow YAML regenerated from already-merged,
already-released source.
- **Gates**: Pass / Pass.

## Test plan

- [ ] CI green on this PR.
- [ ] On the next Anthropic outage lasting ≥ 2 minutes, `tend-mention`
stays quiet on #267 instead of looping — the cascade can't re-enter
because the `issue_comment` filter now excludes `tend-outage`-labeled
issues.

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[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.

2 participants