fix(#1896): remove dead forge_notify reason drop-list + auto-unsubscribe

This commit is contained in:
damocles 2026-06-24 23:07:48 +02:00
commit 9f40bd13f9
4 changed files with 20 additions and 182 deletions

View file

@ -104,19 +104,17 @@ the cursor to the threads still in the unread set. A failed wake
delivery is left unread **and** out of the cursor, so it resurfaces
next tick.
Two paths still mark-read directly (no read-before-comment value):
self-echo notifications (the agent's own writes, see below) and
`HIVE_FORGE_NOTIFY_SKIP_REASONS` drop-listed reasons.
Self-echo notifications (the agent's own writes, see below) are the
one path still marked-read directly (no read-before-comment value).
> Note: the unread list grows for threads the agent never reads via
> the CLI, since nothing else trims it. This does not affect guard
> correctness (the guard does a per-thread, repo-scoped query) nor
> wake delivery (Forgejo orders unread newest-first, so new activity
> always lands in the polled window). Bounding the unread list via a
> reason-independent firehose-reduction is a separate follow-up — the
> existing auto-unsubscribe below is gated on a `reason` field that
> this Forgejo's notification API does not actually emit, so it never
> fires today.
> always lands in the polled window). Bounding the unread list is a
> separate follow-up — explicit subscription management via a
> hive-forge CLI verb, rather than the poller second-guessing which
> repo watches to drop.
### Activation gates (graceful no-ops)
@ -240,36 +238,11 @@ fallback checks the subject payload directly. Detection is gated on
`is_new` so the label only fires once on PR creation, not on every
subsequent comment.
### Reason drop-list
### Subscription management
`HIVE_FORGE_NOTIFY_SKIP_REASONS` (comma-separated) suppresses
notifications whose Forgejo `reason` matches an entry. Marked-read
silently, no delivery. Drop-list is intentionally chosen over an
allow-list:
- Allow-list would silently miss any directed signal Forgejo adds
later (`review_requested`, `mention`, future kinds).
- Drop-list explicitly identifies the noisy paths
(`subscribed`, `participating`) and lets unknown / null reasons
pass through.
Configured per-agent via `hyperhive.forge.skipNotifyReasons` in
`agent.nix`. Default is empty (deliver everything).
### Auto-unsubscribe on broad watches
Default behavior: after delivering a `reason == "subscribed"`
notification, `DELETE /api/v1/repos/<owner>/<repo>/subscription` is
called to drop the agent's broad-watch on that repo. The agent
remains subscribed to specific issues/PRs it interacts with, but
stops receiving the firehose of every commit / new issue.
`HIVE_FORGE_KEEP_SUBSCRIPTIONS=1` disables this — triage agents and
other firehose consumers need to keep watching every repo activity.
Set via `hyperhive.forge.keepSubscriptions = true` in `agent.nix`.
The auto-unsub set is process-local (a `HashSet<String>` keyed by
`owner/repo`), so a single repo only gets one DELETE per harness
boot. After harness restart the agent might re-watch the repo via
some other path; the next `subscribed` notification re-triggers the
unsubscribe.
The poller does **not** auto-unsubscribe from repo watches — it
delivers every unread notification it's handed. Bounding the
firehose (dropping broad repo watches an agent doesn't need) is done
explicitly via a hive-forge CLI subscription verb, not by the poller
guessing which watches to drop. See the `subscription` verb in
[`docs/tools/forge.md`](tools/forge.md).