Skip to content

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

fix(doctor): the live probe identity includes auth style, headers and CA

M3gA-Mind15592a9d434c
diff --git a/crates/openhuman-core/src/doctor/checks/inference_live_identity_tests.rs b/crates/openhuman-core/src/doctor/checks/inference_live_identity_tests.rs
new file mode 100644
index 0000000000..a3c1dc11ab
--- /dev/null
+++ b/crates/openhuman-core/src/doctor/checks/inference_live_identity_tests.rs
@@ -0,0 +1,49 @@
+use super::*;
+
+// The live probe sends one completion per effective request identity. Two
+// aliases that share endpoint, key and model but authenticate differently are
+// two different requests: deduplicating them reported the second alias as
+// passing on the first one's answer.
+
+#[tokio::test]
+async fn same_endpoint_credential_and_model_with_another_auth_style_get_distinct_completions() {
+ let server = MockServer::start().await;
+ Mock::given(method("POST"))
+ .respond_with(
+ ResponseTemplate::new(200)
+ .set_body_json(completion_response("provider/answered-model", "OK")),
+ )
+ .mount(&server)
+ .await;
+ let mut fixture = cloud_route_fixture(
+ &server,
+ &[
+ (
+ "alias-one",
+ "shared",
+ "provider/shared-model",
+ "dummy-same-key",
+ ),
+ (
+ "alias-two",
+ "shared",
+ "provider/shared-model",
+ "dummy-same-key",
+ ),
+ ],
+ "alias-one",
+ "alias-two",
+ );
+ fixture.config.cloud_providers[1].auth_style = AuthStyle::Anthropic;
+
+ let _report = run_live(fixture, vec![CHECK_CHAT, "inference/live/reasoning"]).await;
+ assert_eq!(
+ server
+ .received_requests()
+ .await
+ .expect("mock records calls")
+ .len(),
+ 2,
+ "the auth style is part of the effective request identity"
+ );
+}
diff --git a/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs b/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs
index 3547a40824..1791fa1e42 100644
--- a/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs
+++ b/crates/openhuman-core/src/doctor/checks/inference_live_tests.rs
@@ -737,3 +737,6 @@ fn configured_role_ids_are_registered_as_live_checks_for_that_config() {
}
assert!(!by_id.contains_key("inference/live/embeddings"));
}
+
+#[path = "inference_live_identity_tests.rs"]
+mod identity_tests;
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
index e29d4a46e0..2572bb323d 100644
--- a/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_slug.rs
@@ -682,8 +682,17 @@ fn try_create_cloud_slug_chat_model_from_string_with_native_tools_and_access(
key.clone()
};
let output_budget = inspection_output_budget_capability(&codex);
+ // Doctor's live probe deduplicates on this identity, so it carries
+ // everything else that shapes the request: two aliases with the same
+ // endpoint, key and model but another auth style, header or CA bundle
+ // are two different requests.
+ let transport = format!(
+ "{:?}\u{1f}{extra_headers:?}\u{1f}{extra_query_params:?}\u{1f}{user_agent:?}\u{1f}{:?}",
+ entry.auth_style,
+ config.cloud_provider_ca_certs.get(&slug),
+ );
*identity = Some((
- codex.endpoint.clone(),
+ format!("{}\u{1f}{transport}", codex.endpoint),
credential,
effective_model.clone(),
output_budget,