Skip to content

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

refactor(core): update vision support checks to use registry

Steven Enamakelac5ff1d12113
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
index 4124c84cbc..8efef7cc4e 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/subagent_dispatch_host.rs
@@ -218,7 +218,10 @@ pub(crate) async fn dispatch_subagent_with_live_parent(
if crate::attachments::should_forward_parent_images(prompt)
&& !images.is_empty()
&& (agent_id == "vision_agent"
- || crate::inference::provider::factory::oh_tier_supports_vision(&subagent_model))
+ || crate::inference::registry::provider_model_supports_vision(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ &subagent_model,
+ ))
{
log::info!(
"[agent] forwarding {} image placeholder(s) to vision sub-agent '{}'",
diff --git a/crates/openhuman-core/src/attachments/provider.rs b/crates/openhuman-core/src/attachments/provider.rs
index 4d82feb40f..0c57b30c77 100644
--- a/crates/openhuman-core/src/attachments/provider.rs
+++ b/crates/openhuman-core/src/attachments/provider.rs
@@ -34,8 +34,10 @@ pub(crate) fn wrap(
.map(|p| p.modalities)
.unwrap_or_default();
if provider == "openhuman" || provider == "managed" {
- profile.modalities.image_in =
- crate::inference::provider::factory::oh_tier_supports_vision(model);
+ profile.modalities.image_in = crate::inference::registry::provider_model_supports_vision(
+ crate::inference::provider::factory::PROVIDER_OPENHUMAN,
+ model,
+ );
}
let route = if matches!(provider, "openhuman" | "managed") {
"openhuman".to_string()
diff --git a/crates/openhuman-core/src/core/observability.rs b/crates/openhuman-core/src/core/observability.rs
index 573d298d8f..d56fddb2ca 100644
--- a/crates/openhuman-core/src/core/observability.rs
+++ b/crates/openhuman-core/src/core/observability.rs
@@ -2318,7 +2318,7 @@ fn report_expected_message(kind: ExpectedErrorKind, message: &str, domain: &str,
// The FE surfaces actionable copy via `classify_inference_error`;
// Sentry must not double-report (F2/F4). Demote at `warn!` so the
// breadcrumb retains the code for triage without spawning an event.
- let code = backend_error
+ let code = crate::inference::registry::classify_backend_error(message)
.as_ref()
.and_then(|classification| classification.token.as_deref())
.unwrap_or_default();
diff --git a/tests/cost_cap_removed.rs b/tests/cost_cap_removed.rs
index ee864f7c7f..b159881fa7 100644
--- a/tests/cost_cap_removed.rs
+++ b/tests/cost_cap_removed.rs
@@ -24,7 +24,7 @@
use std::sync::Arc;
use openhuman_core::agent::tinyagents::host::OpenHumanBudgetGate;
-use openhuman_core::config::{Config, DEFAULT_MODEL};
+use openhuman_core::config::Config;
use openhuman_core::platform::cost::{self, TokenUsage};
use tinyagents_harness::host::budget_gate::{BudgetGate, CallEstimate};
@@ -49,7 +49,7 @@ async fn a_spend_state_that_used_to_refuse_now_grants_and_is_still_recorded() {
// Managed route — only managed spend was ever counted against the cap
// (#5016), so a BYOK model here would have been ignored even before the
// removal and would prove nothing.
- let mut usage = TokenUsage::new(DEFAULT_MODEL, 10_000, 5_000, 1.0, 2.0);
+ let mut usage = TokenUsage::new("test-model", 10_000, 5_000, 1.0, 2.0);
usage.cost_usd = RUNAWAY_SPEND_USD;
tracker.record_usage(usage).expect("recording the spend");
@@ -58,7 +58,7 @@ async fn a_spend_state_that_used_to_refuse_now_grants_and_is_still_recorded() {
// "[tinyagents][budget] refusing model call" message. Before the
// removal this returned `Err(LimitExceeded)` for exactly this state.
let gate = OpenHumanBudgetGate::new(Arc::new(config));
- let estimate = CallEstimate::new(DEFAULT_MODEL, 1_000, 1_000).with_agent("lead");
+ let estimate = CallEstimate::new("test-model", 1_000, 1_000).with_agent("lead");
match gate.acquire(&estimate).await {
Ok(permit) => drop(permit),
Err(err) => panic!(
diff --git a/tests/in_process/agent_builder_public.rs b/tests/in_process/agent_builder_public.rs
index 5929e2af8a..165b9d3711 100644
--- a/tests/in_process/agent_builder_public.rs
+++ b/tests/in_process/agent_builder_public.rs
@@ -90,7 +90,7 @@ fn builder_applies_defaults_and_exposes_public_accessors() {
assert_eq!(agent.tools().len(), 2);
assert_eq!(agent.tool_specs().len(), 2);
- assert_eq!(agent.model_name(), openhuman_core::config::DEFAULT_MODEL);
+ assert_eq!(agent.model_name(), "openrouter/deepseek/deepseek-v4-flash");
assert_eq!(agent.temperature(), 0.7);
assert_eq!(agent.workspace_dir(), std::path::Path::new("."));
assert!(agent.workflows().is_empty());