Skip to content

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

chore: files changed src/core/jsonrpc_tests.rs,src/openhuman/agent/tinyagents/model.rs,src/openhuman

Steven Enamakel8ac57288dd39
diff --git a/src/core/jsonrpc_tests.rs b/src/core/jsonrpc_tests.rs
index f8270b93cb..2da2f7544e 100644
--- a/src/core/jsonrpc_tests.rs
+++ b/src/core/jsonrpc_tests.rs
@@ -178,21 +178,6 @@ fn learning_subscriber_registration_is_idempotent_after_success() {
assert!(!learning_first_time_when_bus_ready(&completed, true));
}
-/// The wrapper reads readiness off the process-wide `BUS` singleton. Unit
-/// tests never stand that bus up (see `core::bus::init` on runtime affinity),
-/// so the observable contract here is the deferred case: with no bus the
-/// token is *not* consumed, and a later call can still claim it. The
-/// consumed/not-consumed transitions are pinned above through
-/// `group_first_time_when_bus_ready`.
-#[test]
-fn domain_subscriber_registration_wrapper_defers_without_a_global_bus() {
- use crate::core::all::DomainGroup;
-
- assert!(crate::core::bus::BUS.get().is_none());
- assert!(!group_first_time(DomainGroup::Media));
- assert!(!group_first_time(DomainGroup::Media));
-}
-
/// #5027 — the tool-execution timeout must be seeded on the always-on core boot
/// path (`register_domain_subscribers`), NOT inside
/// `channels::runtime::startup::start_channels`, which is skipped for
diff --git a/src/openhuman/agent/tinyagents/model.rs b/src/openhuman/agent/tinyagents/model.rs
index 5c4c747c14..9a594ff036 100644
--- a/src/openhuman/agent/tinyagents/model.rs
+++ b/src/openhuman/agent/tinyagents/model.rs
@@ -441,7 +441,10 @@ impl ChatModel<()> for RouteRecordingModel {
}
fn cache_identity(&self) -> Option<String> {
- self.inner.cache_identity()
+ self.inner.cache_identity().map(|identity| match &self.request_model {
+ Some(model) => format!("{identity}:request-model={model}"),
+ None => identity,
+ })
}
async fn invoke(
diff --git a/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs b/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs
index 9712eea118..cb17a331e4 100644
--- a/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs
+++ b/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs
@@ -114,3 +114,14 @@ fn every_turn_wrapper_forwards_the_inner_cache_identity() {
);
assert_eq!(stacked.cache_identity(), expected);
}
+
+#[test]
+fn profile_override_cache_identity_includes_request_model() {
+ let inner: Arc<dyn ChatModel<()>> = Arc::new(IdentifiedModel);
+ let first = ProfileOverrideModel::new(inner.clone(), ModelProfile::default())
+ .with_request_model("model-a");
+ let second = ProfileOverrideModel::new(inner, ModelProfile::default())
+ .with_request_model("model-b");
+
+ assert_ne!(first.cache_identity(), second.cache_identity());
+}
diff --git a/src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs b/src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs
index 8315a586dc..a4777fd793 100644
--- a/src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs
+++ b/src/openhuman/inference/provider/claude_agent_sdk/subprocess.rs
@@ -254,12 +254,13 @@ impl ChatModel<()> for ClaudeAgentSdkProvider {
Some(&self.profile)
}
- /// Identity for harness response-cache scoping: the SDK binary and its
- /// default model. No credential is involved on this path.
+ /// Identity for harness response-cache scoping: the SDK binary and the
+ /// selected model. No credential is involved on this path.
fn cache_identity(&self) -> Option<String> {
Some(format!(
"claude_agent_sdk:{}:{}",
- self.config.binary, self.config.default_model
+ self.config.binary,
+ self.profile.model.as_deref().unwrap_or(&self.config.default_model)
))
}
diff --git a/src/openhuman/inference/provider/claude_agent_sdk/subprocess_tests.rs b/src/openhuman/inference/provider/claude_agent_sdk/subprocess_tests.rs
index ec920180aa..d8687ca097 100644
--- a/src/openhuman/inference/provider/claude_agent_sdk/subprocess_tests.rs
+++ b/src/openhuman/inference/provider/claude_agent_sdk/subprocess_tests.rs
@@ -213,6 +213,15 @@ printf '%s\n' '{"type":"result","result":"Calling.<tool_call>{\"name\":\"lookup\
);
}
+#[test]
+fn cache_identity_includes_selected_model() {
+ let config = ClaudeAgentSdkConfig::default();
+ let first = ClaudeAgentSdkProvider::for_model(config.clone(), "model-a");
+ let second = ClaudeAgentSdkProvider::for_model(config, "model-b");
+
+ assert_ne!(first.cache_identity(), second.cache_identity());
+}
+
/// The CLI takes one `--system-prompt`, so every system message has to be
/// folded into it. Taking only the first dropped the artifact contents list and
/// the turn-cap wrap-up, which are appended as system messages exactly so the
diff --git a/src/openhuman/inference/provider/crate_openai.rs b/src/openhuman/inference/provider/crate_openai.rs
index 36cfae890c..4de4798c37 100644
--- a/src/openhuman/inference/provider/crate_openai.rs
+++ b/src/openhuman/inference/provider/crate_openai.rs
@@ -101,12 +101,10 @@ pub(crate) struct CrateOpenAiConfig<'a> {
/// Whether `endpoint` is OpenRouter, the one relay in the catalog that
/// documents forwarding `cache_control` markers to its upstream providers.
pub(crate) fn endpoint_is_openrouter(endpoint: &str) -> bool {
- endpoint
- .trim()
- .to_ascii_lowercase()
- .split("://")
- .last()
- .is_some_and(|rest| rest.starts_with("openrouter.ai/"))
+ url::Url::parse(endpoint.trim())
+ .ok()
+ .and_then(|url| url.host_str().map(|host| host.eq_ignore_ascii_case("openrouter.ai")))
+ .unwrap_or(false)
}
/// Build a crate-native `OpenAiModel` (`ChatModel`) for the given OpenAI-compatible
diff --git a/src/openhuman/inference/provider/crate_openai_tests.rs b/src/openhuman/inference/provider/crate_openai_tests.rs
index ccfad10044..a9e8f73ebf 100644
--- a/src/openhuman/inference/provider/crate_openai_tests.rs
+++ b/src/openhuman/inference/provider/crate_openai_tests.rs
@@ -114,6 +114,7 @@ fn local_runtime_builder_disables_native_tools_and_vision() {
fn openrouter_endpoints_are_recognised_for_explicit_cache_control() {
assert!(endpoint_is_openrouter("https://openrouter.ai/api/v1"));
assert!(endpoint_is_openrouter("HTTPS://OpenRouter.ai/api/v1/"));
+ assert!(endpoint_is_openrouter("https://openrouter.ai:443/api/v1"));
assert!(!endpoint_is_openrouter("https://api.openai.com/v1"));
assert!(!endpoint_is_openrouter("https://notopenrouter.ai/api/v1"));
assert!(!endpoint_is_openrouter(