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
fix(tinyhumans): keep host tool ranker over the Jev ranker
Steven Enamakelca23643db71a
diff --git a/crates/openhuman-tinyhumans/src/runtime.rs b/crates/openhuman-tinyhumans/src/runtime.rsindex 5605e7c3af..7fbe569cc6 100644--- a/crates/openhuman-tinyhumans/src/runtime.rs+++ b/crates/openhuman-tinyhumans/src/runtime.rs@@ -115,7 +115,8 @@ impl RuntimeBuilder {/// Whether the Jev `tool_search` ranker is installed (default `true`;/// needs the `jev` feature). Off, the harness ranks with BM25 alone- /// unless [`tool_ranker`](Self::tool_ranker) supplies another.+ /// unless [`tool_ranker`](Self::tool_ranker) supplies another. A host+ /// ranker, however it was set, always wins over the Jev one.pub fn jev_ranker(mut self, enabled: bool) -> Self {self.install.tool_ranker = enabled;self@@ -263,7 +264,14 @@ impl RuntimeBuilder {inner = inner.controller_extension(extension);}if let Some(ranker) = wiring.ranker {- inner = inner.tool_ranker(ranker);+ // A ranker already on the embed builder (from `from_embed`, or+ // `tool_ranker` followed by `jev_ranker(true)`) is the host's+ // choice; the Jev ranker never replaces it.+ if inner.summary().tool_ranker.is_some() {+ log::debug!("[tinyhumans] host tool ranker kept; Jev ranker skipped");+ } else {+ inner = inner.tool_ranker(ranker);+ }}Ok(inner)}diff --git a/crates/openhuman-tinyhumans/src/runtime_tests.rs b/crates/openhuman-tinyhumans/src/runtime_tests.rsindex a8ca4d5124..011ca1a668 100644--- a/crates/openhuman-tinyhumans/src/runtime_tests.rs+++ b/crates/openhuman-tinyhumans/src/runtime_tests.rs@@ -142,3 +142,38 @@ fn knobs_and_seams_forward_unchanged() {assert_eq!(summary.tool_ranker.as_deref(), Some("test-ranker"));assert_eq!(summary.controller_extensions, vec![DomainGroup::Hosted]);}++struct HostRanker;++#[async_trait::async_trait]+impl ToolRanker for HostRanker {+ fn kind(&self) -> &'static str {+ "host-ranker"+ }+ async fn rank(+ &self,+ _intent: &str,+ _context: &tinytools::RankContext,+ _candidates: &[tinytools::RankCandidate],+ _limit: usize,+ ) -> Result<Vec<tinytools::RankHit>, tinytools::RankError> {+ Ok(Vec::new())+ }+}++#[test]+fn a_ranker_on_a_wrapped_embed_builder_is_kept() {+ let embed = openhuman_embed::RuntimeBuilder::new().tool_ranker(Arc::new(HostRanker));+ let summary = connected(RuntimeBuilder::from_embed(embed));+ assert_eq!(summary.tool_ranker.as_deref(), Some("host-ranker"));+}++#[test]+fn turning_jev_back_on_does_not_replace_a_host_ranker() {+ let summary = connected(+ RuntimeBuilder::new()+ .tool_ranker(Arc::new(HostRanker))+ .jev_ranker(true),+ );+ assert_eq!(summary.tool_ranker.as_deref(), Some("host-ranker"));+}