The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs
Steven Enamakelefd9b27b0a51
diff --git a/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs b/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rsindex f6e593867f..9712eea118 100644--- a/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs+++ b/src/openhuman/agent/tinyagents/model_route_recording_tests_tests.rs@@ -65,3 +65,52 @@ async fn streamed_model_records_concrete_route_before_stream_consumption() {}));}++/// A model that identifies itself for response-cache scoping.+struct IdentifiedModel;++#[async_trait]+impl ChatModel<()> for IdentifiedModel {+ fn cache_identity(&self) -> Option<String> {+ Some("test-provider:https://example/v1:model-x".to_string())+ }++ async fn invoke(+ &self,+ _state: &(),+ _request: ModelRequest,+ ) -> tinyinference::Result<ModelResponse> {+ Ok(ModelResponse::assistant("ok"))+ }+}++/// The harness scopes its response cache on `ChatModel::cache_identity`, and+/// the trait default declines identity. Every host wrapper therefore has to+/// forward it, or every wrapped model collapses into the crate's+/// "anonymous-model" key space and a shared cache can cross-serve answers+/// between a hosted and a local model.+#[test]+fn every_turn_wrapper_forwards_the_inner_cache_identity() {+ let expected = Some("test-provider:https://example/v1:model-x".to_string());+ let inner: Arc<dyn ChatModel<()>> = Arc::new(IdentifiedModel);++ let route = RouteRecordingModel::new(inner.clone(), "p", "m");+ assert_eq!(route.cache_identity(), expected);++ let profile = ProfileOverrideModel::new(inner.clone(), ModelProfile::default());+ assert_eq!(profile.cache_identity(), expected);++ let capped = MaxTokensModel::new(inner.clone(), 1024);+ assert_eq!(capped.cache_identity(), expected);++ // Nested the way the turn builder stacks them.+ let stacked = RouteRecordingModel::new(+ Arc::new(MaxTokensModel::new(+ Arc::new(ProfileOverrideModel::new(inner, ModelProfile::default())),+ 1024,+ )),+ "p",+ "m",+ );+ assert_eq!(stacked.cache_identity(), expected);+}