Skip to content

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

test(tracing): preserve accuracy coverage with optional charged costs

Steven Enamakel65febaed2b63
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs
index fed11cb7d7..834c7022f8 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_accuracy_tests.rs
@@ -22,7 +22,7 @@ fn call(
output: u64,
cache_read: u64,
cache_write: u64,
- cost: f64,
+ cost: impl Into<Option<f64>>,
) -> AgentProgress {
AgentProgress::ModelCallCompleted {
model: model.to_string(),
@@ -36,7 +36,7 @@ fn call(
cached_input_tokens: cache_read,
cache_creation_tokens: cache_write,
reasoning_tokens: 0,
- cost_usd: cost,
+ cost_usd: cost.into(),
}
}
@@ -445,7 +445,7 @@ fn empty_provider_and_model_do_not_produce_dot_labels() {
// ── 7. unpriced / free models ───────────────────────────────────────────────
#[test]
-fn unpriced_model_placeholder_cost_is_not_recorded() {
+fn unpriced_model_unknown_cost_is_not_recorded() {
let model = "acme/never-heard-of-it";
let placeholder = crate::agent::cost::estimate_call_cost_usd(
model,
@@ -460,10 +460,7 @@ fn unpriced_model_placeholder_cost_is_not_recorded() {
),
]);
let g = generations(c.spans())[0];
- assert_eq!(
- g.attributes["gen_ai.usage.cost_usd"],
- serde_json::json!(0.0)
- );
+ assert!(!g.attributes.contains_key("gen_ai.usage.cost_usd"));
assert_eq!(
g.attributes["gen_ai.cost.source"],
serde_json::json!("unpriced")
diff --git a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tool_span_tests.rs b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tool_span_tests.rs
index faec59ae1e..24e2dc3a27 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tool_span_tests.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/progress_tracing_tool_span_tests.rs
@@ -126,7 +126,7 @@ fn tool_spans_carry_the_model_that_requested_them() {
cached_input_tokens: 0,
cache_creation_tokens: 0,
reasoning_tokens: 0,
- cost_usd: 0.0,
+ cost_usd: Some(0.0),
},
9,
),