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
test(core): cover context binding for attachments and remix sessions
Steven Enamakel9fd5659a2946
diff --git a/crates/openhuman-core/src/agent/attachments/provider_tests.rs b/crates/openhuman-core/src/agent/attachments/provider_tests.rsindex 45230378fe..8d8c6740cc 100644--- a/crates/openhuman-core/src/agent/attachments/provider_tests.rs+++ b/crates/openhuman-core/src/agent/attachments/provider_tests.rs@@ -682,3 +682,20 @@ async fn pdf_attachment_degrades_to_a_note_when_documents_component_is_off() {assert!(text.contains("brief.pdf"));assert!(!cacheable);}++#[tokio::test]+async fn the_wrapped_model_keeps_its_turns_context_while_another_is_active() {+ use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};+ let turn = CoreContext::for_test(DomainSet::full(), None);+ let other = CoreContext::for_test(DomainSet::full(), None);+ let concrete = AttachmentModel {+ inner: Arc::new(Probe::default()),+ config: Arc::new(Config::default()),+ core: DispatchCtx::new(Arc::clone(&turn)).downgrade(),+ profile: ModelProfile::default(),+ fallback_cache: Mutex::new(Default::default()),+ };+ let seen = CoreContext::scope(Arc::clone(&other), async { concrete.dispatch_ctx() }).await;+ assert!(Arc::ptr_eq(seen.core().expect("bound"), &turn));+ assert!(!Arc::ptr_eq(seen.core().expect("bound"), &other));+}diff --git a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs b/crates/openhuman-core/src/tinymemes/callbacks_tests.rsindex f6d3d04432..80005fd136 100644--- a/crates/openhuman-core/src/tinymemes/callbacks_tests.rs+++ b/crates/openhuman-core/src/tinymemes/callbacks_tests.rs@@ -158,3 +158,15 @@ fn the_correlation_id_is_read_from_the_first_argument_only() {assert_eq!(correlation_of(&bad), None, "{bad}");}}++#[tokio::test]+async fn a_remix_session_answers_under_the_context_that_registered_it() {+ use crate::core::runtime::{CoreContext, DispatchCtx, DomainSet};+ let dir = tempfile::tempdir().unwrap();+ let caller = CoreContext::for_test(DomainSet::full(), None);+ let other = CoreContext::for_test(DomainSet::full(), None);+ let session = Session::new(&DispatchCtx::new(Arc::clone(&caller)), &config_in(dir.path()));+ // A callback arrives on the module bus while some other context is active.+ let seen = CoreContext::scope(Arc::clone(&other), async { session.dispatch_ctx() }).await;+ assert!(Arc::ptr_eq(seen.core().expect("bound"), &caller));+}