forked from vhaudiquet/rhema-claw
fix(forge): consume a decided account notification
The account feed is at-least-once in a way the dedup ids do not cover.
`since` is inclusive at the boundary and `NotificationPage::finish`
advances its cursor only to the newest row seen, so a row the poll cannot
get past — anything at or before the cursor, which is every poll — comes
back for as long as the forge still considers it unread. Nothing marked
it read, and the daemon's cursor map is in memory, so a restart asked for
the whole unread feed again.
The result is a re-dispatch loop: the same notification id re-triaged
every pass, a fresh turn for a thread that already has one, and a second
comment on that thread if the first turn ever finished inside its lease.
Observed live on `vhaudiquet/orcaslicer-snap#10`: key revision 1 → 2 at
the 00:35 poll, `inbox_depth: 0`, no outcome — a re-dispatch of a turn
that was already running.
So consume what the poll decides:
- `Forge::mark_read` — a new default no-op on the trait, implemented for
GitHub as `PUT /notifications/threads/{id}`;
- `Notification::read_key` carries what that route keys on (GitHub keys
on the notification id, which the dedup id embeds only as text), and
defaults on deserialize so a payload already in an inbox still decodes;
- `poll_account` marks each row read once it is triaged — dispatched,
surfaced, or ignored; best-effort, since an unread row costs a repeat
and never a lost event.
Gitea and GitLab keep the no-op: neither has an account watch here yet.
This commit is contained in:
1 parent
6777eaa247
commit
24d2323cd3
9 files changed
+235
-3
No files matched your search
@@ -230,6 +230,17 @@ pub struct Notification {
|
||||
/// When the notification row was last touched. The poll cursor
|
||||
/// advances to the newest of these.
|
||||
pub timestamp: Timestamp,
|
||||
/// What the backend's read-marking route keys on, when it has one —
|
||||
/// GitHub's `PUT /notifications/threads/{id}` takes the numeric
|
||||
/// notification id, which [`Notification::id`] embeds only as text
|
||||
/// (its suffix is the dedup timestamp, not the row's identity).
|
||||
/// `None` on a backend with no read route.
|
||||
///
|
||||
/// Defaulted on deserialize: rows already in a dispatcher inbox were
|
||||
/// written before this field existed, and a replay must not fail on
|
||||
/// one.
|
||||
#[serde(default)]
|
||||
pub read_key: Option<String>,
|
||||
/// The untouched wire row, minus the keys the notification lifts.
|
||||
pub raw: serde_json::Value,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user