Skip to content

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

chore: files changed crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs

Steven Enamakel99d8072d739e
diff --git a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs
index 336882cdcc..a8920d1a5f 100644
--- a/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/hooks_tests.rs
@@ -1,10 +1,8 @@
use super::*;
use tinymemory_api::{
- Error as MemoryApiError, ItemKind, LearningKind, MemoryEngine, MemoryMeta, MetaFilter, Role,
- StoreItem, Turn,
+ ItemKind, LearningKind, MemoryEngine, MemoryMeta, MetaFilter, Role, StoreItem, Turn,
};
-use tinymemory_tools::recall::SkipReason;
#[path = "adapter_tests.rs"]
mod adapter_tests;
@@ -72,7 +70,18 @@ async fn run_post_turn(
identity: &tinymemory_tools::layout::identity::ResolvedIdentity,
(thread, index, text, calls, at): PostTurnArgs,
) {
- post_turn(config, identity, thread, index, text, calls, at, None).await;
+ post_turn(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ config,
+ identity,
+ thread,
+ index,
+ text,
+ calls,
+ at,
+ None,
+ )
+ .await;
}
#[test]
@@ -81,33 +90,6 @@ fn turn_indices_follow_the_committed_transcript() {
assert_eq!(user_turn_index(3), 6);
}
-#[test]
-fn typed_skip_reasons_expose_only_account_wide_errors() {
- let account_wide = [
- MemoryApiError::Off("disabled".into()),
- MemoryApiError::Unauthorized("bad key".into()),
- MemoryApiError::InsufficientCredits("top up".into()),
- MemoryApiError::Unavailable("connection refused".into()),
- ];
- for error in &account_wide {
- assert_eq!(
- account_wide_skip_reason(&SkipReason::Engine(error.clone())),
- Some(error)
- );
- }
-
- let local = [
- MemoryApiError::InvalidRequest("bad scope".into()),
- MemoryApiError::NotFound("item".into()),
- MemoryApiError::Conflict("duplicate".into()),
- MemoryApiError::Engine("corrupt index".into()),
- ];
- for error in local {
- assert_eq!(account_wide_skip_reason(&SkipReason::Engine(error)), None);
- }
- assert_eq!(account_wide_skip_reason(&SkipReason::Empty), None);
-}
-
#[path = "hooks_channel_tests.rs"]
mod channel_tests;
@@ -321,11 +303,24 @@ async fn compaction_recalls_from_the_dropped_turns() {
Turn::new(Role::User, "the project codename is Heron"),
Turn::new(Role::Assistant, "Noted: Heron."),
];
- let pack = compaction_work(&config, &identity, "t", dropped).await;
+ let pack = compaction_work(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &identity,
+ "t",
+ dropped,
+ )
+ .await;
assert!(pack.expect("a pack").markdown.contains("Heron"));
- assert!(compaction_work(&config, &identity, "t", Vec::new())
- .await
- .is_none());
+ assert!(compaction_work(
+ &crate::core::runtime::DispatchCtx::ambient(),
+ &config,
+ &identity,
+ "t",
+ Vec::new()
+ )
+ .await
+ .is_none());
}
#[tokio::test]
@@ -405,41 +400,6 @@ async fn an_engine_fault_that_is_not_account_wide_injects_nothing() {
.is_none());
}
-#[test]
-fn a_refusal_is_read_back_from_a_skipped_section() {
- let outcomes = vec![Ok(ContextPack {
- markdown: String::new(),
- tokens: 0,
- refs: Vec::new(),
- sections: Vec::new(),
- skipped: vec![
- tinymemory_tools::recall::SkippedSection {
- heading: "Learnings".into(),
- reason: SkipReason::Empty,
- },
- tinymemory_tools::recall::SkippedSection {
- heading: "History".into(),
- reason: SkipReason::Engine(MemoryApiError::Unauthorized(
- "memory API fetch (HTTP 401)".into(),
- )),
- },
- ],
- engine: "tinyhumans".into(),
- })];
- let refusal = refusal_of(&outcomes).expect("refusal");
- assert_eq!(refusal.code(), "UNAUTHORIZED");
-
- let quiet = vec![Ok(ContextPack {
- markdown: String::new(),
- tokens: 0,
- refs: Vec::new(),
- sections: Vec::new(),
- skipped: Vec::new(),
- engine: "tinyhumans".into(),
- })];
- assert!(refusal_of(&quiet).is_none());
-}
-
// ── the pack's token budget against a large store (#6718, #7023) ────────────
async fn fill_with_learnings(engine: &tinymemory_api::conformance::ReferenceEngine, count: usize) {