refactor(#1896): remove dead forge_notify reason plumbing + fix docs

This commit is contained in:
damocles 2026-06-23 14:44:25 +02:00 committed by mara
commit 00f682991c
2 changed files with 21 additions and 52 deletions

View file

@ -129,16 +129,16 @@ best-effort: logged at debug/warn and retried next tick.
Forgejo fires notifications for the agent's own actions (it opened a
PR, posted a comment, submitted a review). Surfacing those would
loop claude on its own writes. Two filter rules drop them silently
(mark-read without delivery):
loop claude on its own writes. The comment/review case is dropped
silently (mark-read without delivery):
- **Self-authored new items** — notifications with
`reason == "author"` AND subject state `open` (or missing). State
transitions (merge / close) on the agent's own PRs DO surface,
since those are triggered by someone else.
- **Self-authored comments / reviews** — comment payload's
`user.login` matches `own_login`.
Self-authored *new items* (an agent opening its own PR/issue) are not
filtered and do surface — the notification subject carries no author
field to match against without a per-notification fetch.
`own_login` is fetched once at startup via `GET /api/v1/user`. On
fetch failure the filter degrades open (no filtering) rather than
crashing the task — a noisy inbox beats a silently-stuck poller.
@ -181,11 +181,11 @@ Five shapes, distinguished by the notification's classification:
| Trigger | Wrapper |
| --- | --- |
| Comment on issue / PR | `[comment on PR #N owner/repo] title\nurl: ...\n\nauthor: body\nassignee: ...\nreason: mention` |
| Review submission | `[PR approved #N owner/repo] title\nurl: ...\n\nreviewer: body\nassignee: ...\nreason: review_requested` |
| New issue / PR | `[new PR #N owner/repo] title\nurl: ...\n\n<body excerpt>\nassignee: ...\nreason: subscribed` |
| Later activity (open, not creation) | `[activity on PR #N owner/repo] title\nurl: ...\n\n<body excerpt>\nassignee: ...\nreason: subscribed` |
| State change | `[PR merged #N owner/repo] title\nurl: ...\nassignee: ...\nreason: subscribed` |
| Comment on issue / PR | `[comment on PR #N owner/repo] title\nurl: ...\n\nauthor: body\nassignee: ...` |
| Review submission | `[PR approved #N owner/repo] title\nurl: ...\n\nreviewer: body\nassignee: ...` |
| New issue / PR | `[new PR #N owner/repo] title\nurl: ...\n\n<body excerpt>\nassignee: ...` |
| Later activity (open, not creation) | `[activity on PR #N owner/repo] title\nurl: ...\n\n<body excerpt>\nassignee: ...` |
| State change | `[PR merged #N owner/repo] title\nurl: ...\nassignee: ...` |
Review labels come from the Forgejo `state` field: `APPROVED`
`approved`, `REQUEST_CHANGES``changes requested`, `COMMENT`
@ -222,14 +222,6 @@ Every wrapper ends with one or more of:
the line shape is stable.
- `reviewer: <list>` — PR notifications only, present only when
`requested_reviewers` is non-empty.
- `reason: <forgejo-reason>` — always present when the notification
carries a reason; absent when the field is null/missing.
The `reason` line distinguishes otherwise-identical messages: Forgejo
emits one notification per applicable reason for the same event
(e.g. both `mention` and `subscribed` arrive for a PR comment that
tags the agent). Without the suffix, the agent would see duplicated
wrapper text with no signal which Forgejo path triggered each copy.
### Review-request override