Skip to content

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

test(triage): add builds tracking to triage test model

Steven Enamakel5e60d88de9b4
diff --git a/crates/openhuman-core/src/triage/escalation_tests.rs b/crates/openhuman-core/src/triage/escalation_tests.rs
index e3b1591020..d2a6c5fc29 100644
--- a/crates/openhuman-core/src/triage/escalation_tests.rs
+++ b/crates/openhuman-core/src/triage/escalation_tests.rs
@@ -3,10 +3,10 @@ use crate::agent_registry::host_definition::AgentDefinitionRegistry;
use crate::core::events::DomainEvent;
use serde_json::json;
use std::sync::{Arc, Mutex};
-use tokio::time::{sleep, timeout, Duration};
use tinyinference_llm::model::{
ChatModel, ModelProfile, ModelRequest, ModelResponse, ModelStream, ModelStreamItem,
};
+use tokio::time::{sleep, timeout, Duration};
struct TriageReplyModel {
requests: Arc<Mutex<Vec<ModelRequest>>>,
@@ -44,17 +44,27 @@ impl ChatModel<()> for TriageReplyModel {
let response = ModelResponse::assistant("handled inline");
Ok(ModelStream::new(Box::pin(futures::stream::iter([
ModelStreamItem::Started,
- ModelStreamItem::MessageDelta(
- tinyinference_llm::message::MessageDelta::text("handled inline"),
- ),
+ ModelStreamItem::MessageDelta(tinyinference_llm::message::MessageDelta::text(
+ "handled inline",
+ )),
ModelStreamItem::Completed(response),
]))))
}
}
-fn triage_test_model(requests: Arc<Mutex<Vec<ModelRequest>>>) -> crate::inference::registry::ChatModelEntry {
+fn triage_test_model(
+ requests: Arc<Mutex<Vec<ModelRequest>>>,
+ builds: Arc<Mutex<Vec<String>>>,
+) -> crate::inference::registry::ChatModelEntry {
crate::inference::registry::ChatModelEntry {
- build: Arc::new(move |_| {
+ build: Arc::new(move |request| {
+ builds.lock().unwrap().push(format!(
+ "role={} model_override={:?} default_model={:?} native_tool_calling={}",
+ request.role,
+ request.model_override,
+ request.default_model,
+ request.native_tool_calling
+ ));
Ok((
Arc::new(TriageReplyModel {
requests: Arc::clone(&requests),
@@ -80,11 +90,12 @@ async fn react_dispatch_keeps_routing_without_creating_child_lifecycle_records()
config.default_model = Some(crate::config::MODEL_MANAGED_DEFAULT.to_string());
let requests = Arc::new(Mutex::new(Vec::new()));
+ let builds = Arc::new(Mutex::new(Vec::new()));
let extensions = crate::core::slots::Extensions::new();
crate::inference::registry::register_chat_model_in(
&extensions,
crate::inference::provider::factory::PROVIDER_OPENHUMAN,
- triage_test_model(Arc::clone(&requests)),
+ triage_test_model(Arc::clone(&requests), Arc::clone(&builds)),
);
let runtime = crate::core::runtime::CoreBuilder::new(crate::core::types::HostKind::Library)
.services(crate::core::runtime::ServiceSet::none())
@@ -117,6 +128,25 @@ async fn react_dispatch_keeps_routing_without_creating_child_lifecycle_records()
// Prove that the requested route reached the model before checking the
// lifecycle boundary below, so a skipped dispatch cannot satisfy it.
let requests = requests.lock().unwrap();
+ let build_summaries = builds.lock().unwrap();
+ eprintln!(
+ "triage diagnostic: model_requests={} provider_builds={:?}",
+ requests.len(),
+ *build_summaries
+ );
+ eprintln!(
+ "triage diagnostic: request_summaries={:?}",
+ requests
+ .iter()
+ .map(|request| (
+ request.messages.len(),
+ request
+ .messages
+ .iter()
+ .any(|message| message.text().contains("handle this trigger inline")),
+ ))
+ .collect::<Vec<_>>()
+ );
assert_eq!(requests.len(), 1, "triage should make one model request");
assert!(
requests[0]