forge_notify: record dedupe cursor inside the ok arm for clarity

This commit is contained in:
damocles 2026-06-22 16:45:24 +02:00
commit eb09ec4e28

View file

@ -847,6 +847,15 @@ async fn poll_once(
match deliver_result {
Ok(()) => {
debug!(%id, "forge_notify: delivered");
// Record the delivered version in the dedupe cursor INSTEAD
// of marking the thread read. Leaving it unread is
// deliberate: the hive-forge read-before-comment guard keys
// off forge's own unread-state, and the agent reading the
// thread via the CLI is what marks it read. Recorded only
// here in the Ok arm — a failed delivery hits the Err arm
// and `continue`s without recording, so it re-delivers next
// tick.
delivered.insert(id, updated_at);
}
Err(e) => {
warn!(%id, error = ?e, "forge_notify: deliver failed — leaving unread");
@ -854,14 +863,6 @@ async fn poll_once(
}
}
// Record the delivered version in the dedupe cursor INSTEAD of
// marking the thread read. Leaving it unread is deliberate: the
// hive-forge read-before-comment guard keys off forge's own
// unread-state, and the agent reading the thread via the CLI is
// what marks it read. A failed delivery (above) is left
// unrecorded so it re-delivers next tick.
delivered.insert(id, updated_at);
// Auto-unsubscribe from broad repo watches after delivering a
// `subscribed` notification. Gated by HIVE_FORGE_KEEP_SUBSCRIPTIONS
// for triage / firehose agents (see