Skip to content

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

test(progress_tracing): add attribution tests for progress tracing

Steven Enamakel1eea2b472039
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_attribution_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_attribution_tests.rs
index 07384c9e3c..efe86f2897 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_attribution_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_attribution_tests.rs
@@ -237,9 +237,15 @@ fn model_call_completed_emits_generation_span_with_usage_cost_and_pricing() {
serde_json::json!(0.0886)
);
assert!(a.contains_key("gen_ai.pricing.output_per_mtok_usd"));
- // Zero reasoning / cache-write tokens are omitted on the generation.
+ // Zero reasoning tokens are omitted; cache writes always flow (even 0)
+ // so every route reports the same usage dimensions.
assert!(!a.contains_key("gen_ai.usage.reasoning_tokens"));
- assert!(!a.contains_key("gen_ai.usage.cache_creation_tokens"));
+ assert_eq!(
+ a["gen_ai.usage.cache_creation_tokens"],
+ serde_json::json!(0)
+ );
+ assert_eq!(a["gen_ai.usage.total_tokens"], serde_json::json!(1_200));
+ assert_eq!(a["gen_ai.cost.source"], serde_json::json!("priced"));
}
#[test]