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 crates/openhuman-core/src/memory/tool_budget_tests.rs,crates/openhuman-core/src
Steven Enamakele1d4c3690d9d
diff --git a/crates/openhuman-core/src/memory/tool_budget_tests.rs b/crates/openhuman-core/src/memory/tool_budget_tests.rsindex 790c3ba8f9..5164ff583a 100644--- a/crates/openhuman-core/src/memory/tool_budget_tests.rs+++ b/crates/openhuman-core/src/memory/tool_budget_tests.rs@@ -13,6 +13,12 @@ async fn a_slow_memory_call_returns_and_disables_memory_only_for_its_turn() {.await;assert!(result.is_error);assert!(result.text().contains("Continue answering"));+ assert!(!is_budget_refusal(&result), "a timeout is an ordinary tool error");+ assert_ne!(+ result.metadata.as_ref().and_then(|metadata| metadata.get("openhuman.memory_budget")),+ Some(&serde_json::json!("refused")),+ "timeouts must not carry the budget-refusal marker"+ );let calls = AtomicUsize::new(0);let result = budget.run(Some("turn-one".into()), async {diff --git a/crates/openhuman-core/src/memory/tools_budget_tests.rs b/crates/openhuman-core/src/memory/tools_budget_tests.rsindex 187a46cdc0..b6aad478f5 100644--- a/crates/openhuman-core/src/memory/tools_budget_tests.rs+++ b/crates/openhuman-core/src/memory/tools_budget_tests.rs@@ -45,6 +45,12 @@ async fn learn_is_not_capped_but_reads_are_and_recover_on_the_next_chat_turn() {.unwrap();assert_eq!(result.is_error, i == 8, "fetch {i}: {}", result.text());assert_eq!(is_budget_refusal(&result), i == 8);+ if i == 8 {+ assert_eq!(+ result.metadata,+ Some(json!({"openhuman.memory_budget": "refused"}))+ );+ }}let context = ToolExecutionContext::from_run_context(&next, CallId::new("next-call"));let result = tooldiff --git a/crates/openhuman-core/src/memory/tools_schema_tests.rs b/crates/openhuman-core/src/memory/tools_schema_tests.rsindex 26305e3565..7c62459e15 100644--- a/crates/openhuman-core/src/memory/tools_schema_tests.rs+++ b/crates/openhuman-core/src/memory/tools_schema_tests.rs@@ -37,5 +37,7 @@ fn expected_memory() -> serde_json::Value {#[test]fn memory_static_schema_matches_json_literal() {let tool = MemoryTool::new(std::sync::Arc::new(crate::config::Config::default()));+ assert_eq!(MEMORY_TOOL_NAME, "memory");+ assert_eq!(tinytools::Tool::name(&tool), "memory");assert_eq!(tinytools::Tool::parameters_schema(&tool), expected_memory());}diff --git a/crates/openhuman-core/src/memory/tools_tests.rs b/crates/openhuman-core/src/memory/tools_tests.rsindex 46f9cd7d12..e3e61d27f2 100644--- a/crates/openhuman-core/src/memory/tools_tests.rs+++ b/crates/openhuman-core/src/memory/tools_tests.rs@@ -194,7 +194,8 @@ async fn recall_fetch_and_forget_round_trip_and_recall_records_citations() {.await;assert!(!recalled.is_error, "{}", text(&recalled));let cites = crate::web_chat::citations::take_turn_citations(&ambient(), "thread-citations");- assert!(cites.iter().any(|c| c.id == id), "{cites:?}");+ assert_eq!(cites.len(), 1, "{cites:?}");+ assert_eq!(cites[0].id, id, "citation ids stay available to the host");assert!(crate::web_chat::citations::take_turn_citations(&ambient(), "thread-citations").is_empty(),"draining empties the thread's citations"@@ -681,6 +682,15 @@ async fn memory_activity_carries_the_calling_turns_chat() {let _engine = bind_reference(&config);let tool = MemoryTool::new(Arc::new(config.clone()));+ for memory_text in ["routed marker question", "unrouted marker question"] {+ let learned = tool+ .execute(json!({"action": "learn", "text": memory_text}))+ .await+ .unwrap();+ assert!(!learned.is_error, "{}", text(&learned));+ }+ super::super::tool_writes::drain(&config).await;+let context = crate::agent::tinyagents::host::run_context::tool_context_with_approval(crate::security::approval::ApprovalTurnContext::chat(crate::security::approval::ApprovalChatContext {@@ -704,6 +714,14 @@ async fn memory_activity_carries_the_calling_turns_chat() {.await.unwrap();assert!(!unrouted.is_error, "{}", text(&unrouted));+ let expected_routed_hits = serde_json::from_str::<Value>(&text(&routed)).unwrap()["items"]+ .as_u64()+ .unwrap();+ let expected_unrouted_hits = serde_json::from_str::<Value>(&text(&unrouted)).unwrap()["items"]+ .as_u64()+ .unwrap();+ assert!(expected_routed_hits > 0, "the seeded memory must be recalled");+ assert!(expected_unrouted_hits > 0, "the seeded memory must be recalled");// The bus is process-wide: match our own events by the question text.let mut seen = std::collections::HashMap::new();@@ -713,9 +731,9 @@ async fn memory_activity_carries_the_calling_turns_chat() {query,thread_id,client_id,- ..+ hit_count,})) if query.contains("marker question") => {- seen.insert(query, (thread_id, client_id));+ seen.insert(query, (thread_id, client_id, hit_count));}Ok(Some(_)) => continue,other => panic!("expected both MemoryRecalled events, got {other:?}"),@@ -725,8 +743,12 @@ async fn memory_activity_carries_the_calling_turns_chat() {seen["routed marker question"],(Some("thread-activity".into()),- Some("client-activity".into())+ Some("client-activity".into()),+ expected_routed_hits as usize,));- assert_eq!(seen["unrouted marker question"], (None, None));+ assert_eq!(+ seen["unrouted marker question"],+ (None, None, expected_unrouted_hits as usize)+ );}