Skip to content

Reason Network: your team's coding agents, talking to each other. The engine behind `reason network`.

fix: count held approvals in detailed network usage (#175)

reason-machines-staging[bot]fea09c57bd44
diff --git a/Cargo.lock b/Cargo.lock
index ad461f9..5bce9a5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2757,7 +2757,7 @@ dependencies = [
[[package]]
name = "reason-network"
-version = "0.12.14"
+version = "0.12.15"
dependencies = [
"anyhow",
"blake3",
diff --git a/Cargo.toml b/Cargo.toml
index 7fe9ae6..9f16b75 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "reason-network"
-version = "0.12.14"
+version = "0.12.15"
edition = "2024"
description = "Reason Network: the team directory and message bus behind reason network, for coding agents across machines"
license = "MIT OR Apache-2.0"
diff --git a/src/daemon/mail.rs b/src/daemon/mail.rs
index b3ab0c5..18629b6 100644
--- a/src/daemon/mail.rs
+++ b/src/daemon/mail.rs
@@ -712,13 +712,7 @@ impl Daemon {
let kept = held && g.store.session_by_name(name)?.is_some_and(|r| r.kept());
// Counted once, when it is new here; a held one once approved.
if g.store.insert(&mut msg, held)? && !held {
- let dims = crate::usage::Dimensions {
- source: msg.from_agent.as_deref().map(crate::usage::family).unwrap_or_else(|| "unknown".into()),
- locality: "remote".into(),
- ..Default::default()
- };
- self.usage.start(&msg.id, dims.clone(), msg.reply_to.as_deref(), true);
- self.usage.count("received", dims, 1);
+ self.record_remote_received(&msg);
let _ = g.store.count(util::now_ms(), Counted::Received);
}
let (state, note) = match key {
@@ -795,6 +789,18 @@ impl Daemon {
}
}
+ // Both immediate receipt and an approved hold enter the eligible inbox once.
+ // Keep their observation together; neither telemetry failure can hold up delivery.
+ fn record_remote_received(&self, msg: &Message) {
+ let dims = crate::usage::Dimensions {
+ source: msg.from_agent.as_deref().map(crate::usage::family).unwrap_or_else(|| "unknown".into()),
+ locality: "remote".into(),
+ ..Default::default()
+ };
+ self.usage.start(&msg.id, dims.clone(), msg.reply_to.as_deref(), true);
+ self.usage.count("received", dims, 1);
+ }
+
/// Approves or drops held messages. Approved ones go to their session now.
pub(super) fn settle(self: &Arc<Self>, ids: &[String], release: bool) -> Result<usize> {
let mut g = self.inner.lock().unwrap();
@@ -804,6 +810,7 @@ impl Daemon {
}
if release {
for m in &msgs {
+ self.record_remote_received(m);
let name = m.to.split_once('/').map_or("", |(_, n)| n);
if let Some(key) = g.live.iter().find(|(_, l)| l.name == name).map(|(k, _)| k.clone()) {
self.deliver(&mut g, &key, vec![m.clone()], m.wake);