Skip to content

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

fix(doctor): the Claude Agent SDK probe reads the model as the runtime does

M3gA-Mind73a732d47e0b
diff --git a/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs b/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs
index 91c4c98585..d92c7ecc9e 100644
--- a/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/subprocess_providers.rs
@@ -14,6 +14,9 @@ pub(super) fn try_create_claude_agent_sdk_chat_model_for_inspection(
let model = claude_agent_sdk_model_from_string(provider, config)?;
Some((|| {
enforce_local_only_inference(role, provider)?;
+ if model.is_empty() {
+ anyhow::bail!("Claude Agent SDK route has an empty model");
+ }
let api_key = std::env::var("ANTHROPIC_API_KEY")
.ok()
.filter(|value| !value.is_empty());
@@ -57,12 +60,10 @@ fn claude_agent_sdk_model_from_string(provider: &str, config: &Config) -> Option
if provider == CLAUDE_AGENT_SDK_PROVIDER {
Some(config.claude_agent_sdk.default_model.clone())
} else {
- Some(
- provider
- .strip_prefix(CLAUDE_AGENT_SDK_PREFIX)?
- .trim()
- .to_owned(),
- )
+ // The model as the runtime route reads it: an `@<temperature>`
+ // suffix is not part of the model id.
+ let model = provider.strip_prefix(CLAUDE_AGENT_SDK_PREFIX)?.trim();
+ Some(split_model_and_temperature(model).0.trim().to_owned())
}
}
diff --git a/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs b/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs
index a115e4cb49..97625a09b8 100644
--- a/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_route_resolution_tests.rs
@@ -579,3 +579,33 @@ fn standard_mode_permits_external() {
"Sensitive mode has no egress enforcement in S1"
);
}
+
+#[test]
+fn claude_agent_sdk_inspection_reads_the_model_as_the_runtime_does() {
+ let _guard = crate::inference::inference_test_guard();
+ let _env = crate::config::test_env::EnvVarGuard::locked()
+ .with("ANTHROPIC_API_KEY", "dummy-inspection-key")
+ .without("ANTHROPIC_AUTH_TOKEN")
+ .without("ANTHROPIC_BASE_URL");
+ let inspect = |provider: &str| {
+ let mut config = Config::default();
+ config.chat_provider = Some(provider.to_string());
+ crate::inference::provider::factory::create_chat_model_with_model_id_in_for_inspection(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ "chat",
+ &config,
+ 0.0,
+ )
+ };
+
+ let (_, model) = inspect("claude_agent_sdk:[email protected]").expect("an SDK route builds");
+ assert_eq!(
+ model, "sonnet",
+ "the temperature suffix is not part of the model"
+ );
+ let error = match inspect("claude_agent_sdk:") {
+ Ok(_) => panic!("an empty SDK model must not be probed"),
+ Err(error) => error.to_string(),
+ };
+ assert!(error.contains("empty model"), "{error}");
+}