Skip to content

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

feat(progress-tracing): export non-zero command exits at warning level

Steven Enamakelf6cf8a80f6c5
diff --git a/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs b/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
index 8ed2ce2768..1aa5f5ea63 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
+++ b/crates/openhuman-core/src/agent/progress_tracing/collector/events.rs
@@ -514,6 +514,7 @@ impl SpanCollector {
/// `InvalidArguments`, `NotFound`, …). Content-free, so not gated: it is
/// what separates a program that exited non-zero from a harness failure
/// on an error-level observation.
+ /// * `observation.level = WARNING` — for `CommandFailed` only.
/// * `error.message` — the classified plain-language cause, truncated,
/// which Langfuse renders as the statusMessage. Gated on content capture
/// (it can quote user data / paths).
@@ -531,6 +532,15 @@ impl SpanCollector {
serde_json::Value::String(class),
);
}
+ // A program that ran and exited non-zero is an expected outcome, not a
+ // harness failure: export it at WARNING so error rates count only the
+ // latter.
+ if failure.class == crate::tools::status::ToolFailureClass::CommandFailed {
+ extra.insert(
+ super::finish::LEVEL_ATTR.to_string(),
+ serde_json::Value::String("WARNING".to_string()),
+ );
+ }
if self.ctx.capture_content {
extra.insert(
"error.message".to_string(),
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 b96133971b..faec59ae1e 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
@@ -25,7 +25,7 @@ fn failed_tool_completed(call_id: &str, tool: &str, output: &str) -> AgentProgre
/// A plain non-zero command exit and a harness failure both close as an error
/// span, so the class rides the span (content-free, so not gated on capture):
/// it is what separates "the program exited 1" from "the harness failed" in
-/// Langfuse until the exporter can set a WARNING level.
+/// Langfuse, and a plain exit is exported at WARNING instead of ERROR.
#[test]
fn failed_tool_span_carries_its_failure_class() {
let mut c = collect(&[
@@ -68,6 +68,17 @@ fn failed_tool_span_carries_its_failure_class() {
assert_eq!(class_of("c1"), Some(serde_json::json!("CommandFailed")));
assert_eq!(class_of("c2"), Some(serde_json::json!("InvalidArguments")));
assert_eq!(class_of("c3"), None, "a successful call carries no class");
+ let level_of = |call: &str| {
+ c.spans()
+ .iter()
+ .find(|s| s.attributes.get("tool.call_id") == Some(&serde_json::json!(call)))
+ .and_then(|s| s.attributes.get("observation.level").cloned())
+ };
+ // A program that exited non-zero exports at WARNING (Langfuse showed 27%
+ // of `shell` calls as errors, ~70% of them ordinary non-zero exits); a
+ // harness failure stays ERROR.
+ assert_eq!(level_of("c1"), Some(serde_json::json!("WARNING")));
+ assert_eq!(level_of("c2"), None);
}
/// Tool observations name the model whose call requested them, so tool errors