Skip to content

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

chore: reorder imports and reformat test assertions

Steven Enamakelfdbda2b79d10
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
index 7429122829..dab2c81b19 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/repeated_failure.rs
@@ -23,11 +23,11 @@ use super::loop_guards::{
is_repeat_call_exempt, RECOVERABLE_NO_PROGRESS_FAILURE_THRESHOLD,
RECOVERABLE_REPEAT_FAILURE_THRESHOLD,
};
+pub(crate) use crate::inference::failure_copy::user_actionable_escalation;
use crate::inference::failure_copy::{
recoverable_identical_halt_summary, recoverable_no_progress_halt_summary,
terminal_inference_failure_kind, terminal_inference_halt_summary,
};
-pub(crate) use crate::inference::failure_copy::user_actionable_escalation;
use tinyinference_llm::failure::is_recoverable_failure_text as is_recoverable_tool_failure;
/// `after_tool`: stop (or nudge) the run when tool calls keep failing with no
diff --git a/crates/openhuman-core/src/agent/triage/evaluator/arm.rs b/crates/openhuman-core/src/agent/triage/evaluator/arm.rs
index 7acfb5db64..500b9fd72e 100644
--- a/crates/openhuman-core/src/agent/triage/evaluator/arm.rs
+++ b/crates/openhuman-core/src/agent/triage/evaluator/arm.rs
@@ -16,6 +16,7 @@ use crate::inference::provider::error_classify::{
is_rate_limited, is_upstream_unhealthy, parse_retry_after_ms,
};
use tinybus::NativeRequestError;
+use tinyinference_providers::{is_budget_message, BudgetMatch};
use super::super::decision::parse_triage_decision;
use super::super::envelope::TriggerEnvelope;
diff --git a/crates/openhuman-core/src/inference/failure_copy/halt.rs b/crates/openhuman-core/src/inference/failure_copy/halt.rs
index 70d7e15c77..6b3bbf9539 100644
--- a/crates/openhuman-core/src/inference/failure_copy/halt.rs
+++ b/crates/openhuman-core/src/inference/failure_copy/halt.rs
@@ -4,7 +4,9 @@
//! summaries. Thresholds and the repeat-call exemption stay with the guards in
//! `agent::tinyagents::middleware::loop_guards`.
-use tinyinference_providers::{BudgetMatch, is_budget_message, is_provider_config_rejection_message};
+use tinyinference_providers::{
+ is_budget_message, is_provider_config_rejection_message, BudgetMatch,
+};
/// Clamp the last-error text embedded in a circuit-breaker halt summary so a huge
/// tool error (already capped at 1MB upstream) can't blow up the agent's result.
@@ -128,7 +130,6 @@ pub(crate) fn recoverable_no_progress_halt_summary(
)
}
-
/// Recognise a **user-actionable** blocker in a failing tool result — one only
/// the user can clear — and phrase the halt as a direct ask instead of the
/// crate's generic "the goal looks unreachable in this environment, report this
@@ -169,4 +170,3 @@ pub(crate) fn user_actionable_escalation(tool: &str, error: &str) -> Option<Stri
crate::util::truncate_with_ellipsis(error, 400),
))
}
-
diff --git a/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs b/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs
index efdb27402f..be107c8b50 100644
--- a/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs
+++ b/crates/openhuman-core/src/web_chat/web_errors/backend_error_code.rs
@@ -48,8 +48,8 @@ pub(super) fn classify_by_backend_error_code(
provider,
);
- use crate::inference::failure_copy::{failure_copy, FailureClass as C};
use super::classify::{classified, classified_plain};
+ use crate::inference::failure_copy::{failure_copy, FailureClass as C};
let classified = match code {
BackendErrorCode::RateLimited => {
diff --git a/crates/openhuman-core/src/web_chat/web_errors/classify.rs b/crates/openhuman-core/src/web_chat/web_errors/classify.rs
index 917fbc312e..f7bb5796b8 100644
--- a/crates/openhuman-core/src/web_chat/web_errors/classify.rs
+++ b/crates/openhuman-core/src/web_chat/web_errors/classify.rs
@@ -5,6 +5,7 @@
use super::backend_error_code::classify_by_backend_error_code;
use super::budget::{is_action_budget_exhausted, is_inference_budget_exceeded_error};
use super::retry::{is_non_retryable_rate_limit_text, retry_after_hint};
+use super::timeout::is_turn_timeout_error;
use crate::inference::failure_copy::{failure_copy, FailureClass};
use tinyinference_llm::failure::{
extract_provider_name, is_auth_error_text, is_codex_token_expired_text,
@@ -14,7 +15,6 @@ use tinyinference_llm::failure::{
is_server_error_text, is_timeout_text, is_transient_unavailability_text,
is_vision_unsupported_text, parse_retry_after_secs, with_provider_detail,
};
-use super::timeout::is_turn_timeout_error;
/// Structured chat-error envelope produced by [`classify_inference_error`].
///
@@ -155,7 +155,11 @@ pub(crate) fn classify_inference_error(err: &str) -> ClassifiedError {
// "authentication token is expired", which the broader "session
// expired" test would also match. Requires "codex" so a generic
// provider `token_expired` is not misread as a Codex failure.
- classified_plain(C::CodexSessionExpired, Some("openai_codex".to_string()), None)
+ classified_plain(
+ C::CodexSessionExpired,
+ Some("openai_codex".to_string()),
+ None,
+ )
} else if crate::core::observability::is_session_expired_message(err) {
// The OpenHuman app-session JWT expired. There is NO client-side
// refresh — recovery is an interactive re-auth — so non-retryable, and
@@ -204,7 +208,10 @@ pub(crate) fn classify_inference_error(err: &str) -> ClassifiedError {
// non-retryable so the FE can hide "Retry" and route to billing.
let non_retryable = is_non_retryable_rate_limit_text(&lower);
let (class, summary) = if non_retryable {
- (C::RateLimitedBilling, failure_copy(C::RateLimitedBilling).copy.to_string())
+ (
+ C::RateLimitedBilling,
+ failure_copy(C::RateLimitedBilling).copy.to_string(),
+ )
} else {
(
C::RateLimited,
diff --git a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
index 2adce38a76..15675d18fa 100644
--- a/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
+++ b/crates/openhuman-core/src/web_chat/web_tests_error_copy_fixture_tests.rs
@@ -74,9 +74,15 @@ fn every_failure_class_keeps_its_exact_copy_and_wire_values() {
assert_eq!(got.error_type, *error_type, "{case}: error_type");
assert_eq!(got.source, *source, "{case}: source");
assert_eq!(got.retryable, *retryable, "{case}: retryable");
- assert_eq!(got.retry_after_ms, *retry_after_ms, "{case}: retry_after_ms");
+ assert_eq!(
+ got.retry_after_ms, *retry_after_ms,
+ "{case}: retry_after_ms"
+ );
assert_eq!(got.provider.as_deref(), *provider, "{case}: provider");
- assert_eq!(got.fallback_available, *fallback, "{case}: fallback_available");
+ assert_eq!(
+ got.fallback_available, *fallback,
+ "{case}: fallback_available"
+ );
assert_eq!(got.message, *message, "{case}: message");
}
}
@@ -99,10 +105,22 @@ fn standalone_copy_accessors_are_unchanged() {
super::super::web_errors::retry_after_hint(Some(0)),
" You can retry immediately."
);
- assert_eq!(super::super::web_errors::retry_after_hint(Some(1)), " Try again in 1 second.");
- assert_eq!(super::super::web_errors::retry_after_hint(Some(45)), " Try again in 45 seconds.");
- assert_eq!(super::super::web_errors::retry_after_hint(Some(90)), " Try again in about 2 minutes.");
- assert_eq!(super::super::web_errors::retry_after_hint(Some(60 * 60)), " Try again in about 60 minutes.");
+ assert_eq!(
+ super::super::web_errors::retry_after_hint(Some(1)),
+ " Try again in 1 second."
+ );
+ assert_eq!(
+ super::super::web_errors::retry_after_hint(Some(45)),
+ " Try again in 45 seconds."
+ );
+ assert_eq!(
+ super::super::web_errors::retry_after_hint(Some(90)),
+ " Try again in about 2 minutes."
+ );
+ assert_eq!(
+ super::super::web_errors::retry_after_hint(Some(60 * 60)),
+ " Try again in about 60 minutes."
+ );
assert_eq!(super::super::web_errors::retry_after_hint(None), "");
}
@@ -276,8 +294,12 @@ fn loop_guard_halt_summaries_are_byte_identical() {
user_actionable_escalation("gmail", "Gmail is not connected").as_deref(),
Some("I can't continue without your input: the `gmail` action needs a service that isn't connected. Gmail is not connected\n\nConnect it (Connections), then tell me to retry \u{2014} or tell me how you'd like to proceed instead.")
);
- assert_eq!(user_actionable_escalation("gmail", "insufficient scope"), None);
+ assert_eq!(
+ user_actionable_escalation("gmail", "insufficient scope"),
+ None
+ );
let long = "x".repeat(700);
- let summary = terminal_inference_halt_summary(TerminalInferenceFailure::BudgetExhausted, "t", &long);
+ let summary =
+ terminal_inference_halt_summary(TerminalInferenceFailure::BudgetExhausted, "t", &long);
assert!(summary.ends_with(&format!("{}\n\u{2026} [truncated]", "x".repeat(600))));
}