Skip to content

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

feat(jev): add configurable deadline for JEV evaluations

Steven Enamakel6028b7a14b87
diff --git a/crates/openhuman-cli/src/bin/tool_search_bench.rs b/crates/openhuman-cli/src/bin/tool_search_bench.rs
index ade9375c9e..5c38894d86 100644
--- a/crates/openhuman-cli/src/bin/tool_search_bench.rs
+++ b/crates/openhuman-cli/src/bin/tool_search_bench.rs
@@ -429,7 +429,8 @@ async fn main() -> Result<()> {
{
let ranker = openhuman_tinyhumans::jev::TinyHumansJevRanker::with_config(
jev_config(args.retrieval_k, args.family, args.embedding),
- );
+ )
+ .with_deadline(Duration::from_secs(20));
rankers.push(("jev".into(), Arc::new(ranker)));
}
#[cfg(not(feature = "jev"))]
@@ -526,7 +527,9 @@ async fn main() -> Result<()> {
};
if retrieved.iter().any(|h| h == &row.expected) {
report.recall_at_20 += 1;
- report.by_source.get_mut(source).map(|b| b.3 += 1);
+ if let Some(bucket) = report.by_source.get_mut(source) {
+ bucket.3 += 1;
+ }
}
let expected_family = row
.family
diff --git a/crates/openhuman-tinyhumans/src/jev/ranker.rs b/crates/openhuman-tinyhumans/src/jev/ranker.rs
index fa76c9e844..33c6236261 100644
--- a/crates/openhuman-tinyhumans/src/jev/ranker.rs
+++ b/crates/openhuman-tinyhumans/src/jev/ranker.rs
@@ -7,7 +7,7 @@ use std::{
sync::Mutex,
};
-use std::{future::Future, pin::Pin, sync::Arc};
+use std::{future::Future, pin::Pin, sync::Arc, time::Duration};
use openhuman_core::agent::tinyagents::discovery::EmbeddingToolRanker;
use openhuman_core::api::config::effective_backend_api_url;
@@ -31,9 +31,18 @@ pub type ConfigLoader = Arc<
pub struct TinyHumansJevRanker {
config: JevRankerConfig,
load_config: ConfigLoader,
+ /// Deadline for one evaluation. Measured through the TinyHumans proxy
+ /// (2026-09) one evaluation takes 0.7–1.9 s at p50 and the family
+ /// strategy runs its second-stage evaluations concurrently, so six
+ /// seconds bounds a slow search well above the norm while still turning
+ /// a stalled proxy into a BM25 fallback inside the turn.
+ deadline: Duration,
cached: Mutex<Option<Cached>>,
}
+/// Default per-evaluation deadline; see `TinyHumansJevRanker::deadline`.
+const DEFAULT_DEADLINE: Duration = Duration::from_secs(6);
+
struct Cached {
fingerprint: u64,
ranker: JevRanker,
@@ -72,10 +81,17 @@ impl TinyHumansJevRanker {
load_config: Arc::new(|| {
Box::pin(openhuman_core::config::ops::load_config_with_timeout())
}),
+ deadline: DEFAULT_DEADLINE,
cached: Mutex::new(None),
}
}
+ /// Sets the per-evaluation deadline.
+ pub fn with_deadline(mut self, deadline: Duration) -> Self {
+ self.deadline = deadline;
+ self
+ }
+
/// Reads the config through `loader` instead of the core's read path.
pub fn with_config_loader(mut self, loader: ConfigLoader) -> Self {
self.load_config = loader;
@@ -116,7 +132,7 @@ impl TinyHumansJevRanker {
let client = Client::new(client_config)
.map_err(|error| RankError::invalid_input(error.to_string()))?;
let evaluator: Arc<dyn tinytools_jev::JevEvaluator> =
- Arc::new(TinyJevEvaluator::new(client));
+ Arc::new(TinyJevEvaluator::new(client).with_deadline(self.deadline));
// The retriever is the process's embedding provider when it can
// embed (the same one memory recall uses), so a family larger than
// one Jev Choice is cut by meaning, not by shared words. Reused