Skip to content

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

test(tinyagents): cover unbounded timeout error conversion

Steven Enamakel093c06a373d2
diff --git a/crates/openhuman-core/src/agent/tinyagents/budget.rs b/crates/openhuman-core/src/agent/tinyagents/budget.rs
index 3f18cc603c..7e29c8362e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/budget.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/budget.rs
@@ -31,8 +31,7 @@ impl ModelBudget {
/// Wrap the model with TinyAgents' shared physical-call budget engine.
pub(crate) fn wrap(&self, model: Arc<dyn ChatModel<()>>) -> Arc<dyn ChatModel<()>> {
- tinyagents_harness::cost::ModelBudget::new(self.ledger.clone(), self.call)
- .wrap_model(model)
+ tinyagents_harness::cost::ModelBudget::new(self.ledger.clone(), self.call).wrap_model(model)
}
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs b/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs
index 7290608dbc..2d61cd0c5e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/hosted_error_tests.rs
@@ -33,6 +33,20 @@ fn a_run_budget_timeout_names_the_run_bound() {
);
}
+#[test]
+fn an_unbounded_timeout_keeps_the_owner_conversion() {
+ let error = hosted(HostedErrorKind::Timeout, None);
+ let owner = TinyAgentsError::from(error.clone());
+ let projected = run_error_from_hosted(error);
+
+ assert_eq!(projected.to_string(), owner.to_string());
+ assert_eq!(
+ TurnTimeoutBound::from_message(&projected.to_string()),
+ None,
+ "the host must not invent a run-remaining bound when the owner supplied none"
+ );
+}
+
#[test]
fn a_non_timeout_failure_is_converted_as_before() {
let err = run_error_from_hosted(hosted(HostedErrorKind::Provider, None));
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
index 59946b66c5..9c09d36470 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_middleware.rs
@@ -207,9 +207,7 @@ pub(super) fn install_turn_middleware(
// selected) instead of failing at the provider.
if let Some(required) = required_capabilities {
harness.push_model_middleware(Arc::new(
- tinyagents_harness::middleware::library::RequiredCapabilitiesMiddleware::new(
- required,
- ),
+ tinyagents_harness::middleware::library::RequiredCapabilitiesMiddleware::new(required),
));
}