Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(observability): add deduplication test for usage recording

Steven Enamakelbc48b77b9ec4
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability_projection_tests.rs b/crates/openhuman-core/src/agent/tinyagents/observability_projection_tests.rs
index 3e20fde523..cc28c3cf72 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability_projection_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability_projection_tests.rs
@@ -1,5 +1,10 @@
use super::*;
+/// W2-budget-dedupe: two `UsageRecorded` events for the *same* model call
+/// (as happens once the observe-only crate `BudgetMiddleware` re-emits usage
+/// its `after_model` folded, on top of the runtime's own emit) must be
+/// recorded into the bridge accounting **exactly once**. Without the dedupe
+/// guard the totals would double.
#[tokio::test]
async fn duplicate_usage_for_same_model_call_is_recorded_once() {
let (tx, mut rx) = tokio::sync::mpsc::channel(64);
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability_tests.rs b/crates/openhuman-core/src/agent/tinyagents/observability_tests.rs
index 16d92df42c..9d8c1dacb8 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability_tests.rs
@@ -560,11 +560,5 @@ async fn unknown_tool_call_in_a_child_run_projects_one_subagent_row() {
assert_eq!(class, Some(tinytools::status::ToolFailureClass::NotFound));
}
-/// W2-budget-dedupe: two `UsageRecorded` events for the *same* model call
-/// (as happens once the observe-only crate `BudgetMiddleware` re-emits usage
-/// its `after_model` folded, on top of the runtime's own emit) must be
-/// recorded into the bridge accounting **exactly once**. Without the dedupe
-/// guard the totals would double.
-
#[path = "observability_projection_tests.rs"]
mod projection_tests;