Skip to content

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

fix(web_chat): improve error type handling in turn events

Steven Enamakel34aa049b8534
diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
index 52de1bac9f..e51a5a0cd0 100644
--- a/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
+++ b/crates/openhuman-core/src/channels/runtime/dispatch/native_runner.rs
@@ -428,7 +428,7 @@ impl EventSink<QueuedPayload> for NativeEvents {
None
};
let localized =
- render_classified_native_failure(None, &fallback, &classification);
+ render_classified_native_failure(config.as_ref(), &fallback, &classification);
#[cfg(test)]
self.shared.with(&request.request_id, |slot| {
slot.failure_message = Some(localized.clone());
diff --git a/crates/openhuman-core/src/web_chat/turn_events.rs b/crates/openhuman-core/src/web_chat/turn_events.rs
index 17c3d1bda5..450e9b9fa8 100644
--- a/crates/openhuman-core/src/web_chat/turn_events.rs
+++ b/crates/openhuman-core/src/web_chat/turn_events.rs
@@ -420,7 +420,12 @@ fn chat_error_event(
.map(|failure| failure.message.clone())
.unwrap_or(classified.message),
),
- error_type: Some(classified.error_type.to_owned()),
+ error_type: Some(
+ structured
+ .map(|failure| failure.class.as_str())
+ .unwrap_or(classified.error_type)
+ .to_owned(),
+ ),
error_source: Some(classified.source.to_owned()),
error_retryable: Some(classified.retryable),
error_retry_after_ms: classified.retry_after_ms,