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/channels/controllers/ops/connect/memory_tests.rs,crat

Steven Enamakel15bb99281725
diff --git a/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs b/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs
index f99a945611..75d5c4fd23 100644
--- a/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs
+++ b/crates/openhuman-core/src/channels/controllers/ops/connect/memory_tests.rs
@@ -105,6 +105,7 @@ async fn clears_stamped_and_legacy_channel_conversations_without_mutating_legacy
let tmp = tempfile::TempDir::new().unwrap();
let mut config = Config::default();
config.workspace_dir = tmp.path().to_path_buf();
+ use_linked_channel_module(&mut config).await;
let engine = Arc::new(ReferenceEngine::new());
crate::memory::engine::install_test_engine(&config.workspace_dir, engine.clone());
let discord_thread = store_channel_thread(
@@ -197,6 +198,7 @@ async fn stamped_channel_forget_isolated_to_the_configured_account() {
let mut current = Config::default();
current.workspace_dir = current_tmp.path().to_path_buf();
current.memory.engine.clear();
+ use_linked_channel_module(&mut current).await;
let mut other = Config::default();
other.workspace_dir = other_tmp.path().to_path_buf();
other.memory.engine.clear();
@@ -240,6 +242,7 @@ async fn missing_or_corrupt_legacy_map_does_not_block_stamped_forget() {
let tmp = tempfile::TempDir::new().unwrap();
let mut config = Config::default();
config.workspace_dir = tmp.path().to_path_buf();
+ use_linked_channel_module(&mut config).await;
let engine = Arc::new(ReferenceEngine::new());
crate::memory::engine::install_test_engine(&config.workspace_dir, engine.clone());
let thread_id = store_channel_thread(
@@ -280,6 +283,7 @@ async fn memory_off_queues_channel_threads_from_the_canonical_thread_store() {
let mut config = Config::default();
config.workspace_dir = tmp.path().to_path_buf();
config.memory.engine.clear();
+ use_linked_channel_module(&mut config).await;
let thread_id = store_channel_thread(
DispatchCtx::ambient(),
&config.workspace_dir,
@@ -301,6 +305,7 @@ async fn reserved_channel_thread_id_survives_metadata_edit_without_prefix_collis
let mut config = Config::default();
config.workspace_dir = tmp.path().to_path_buf();
config.memory.engine.clear();
+ use_linked_channel_module(&mut config).await;
let ctx = DispatchCtx::ambient();
let target = store_channel_thread(
ctx.clone(),
@@ -354,6 +359,7 @@ async fn offline_snapshot_scans_every_thread_and_message_page() {
let mut config = Config::default();
config.workspace_dir = tmp.path().to_path_buf();
config.memory.engine.clear();
+ use_linked_channel_module(&mut config).await;
let workspace = config.workspace_dir.clone();
let ctx = DispatchCtx::ambient();
let params = crate::channels::providers::relay::RelayInboundParams::new(
@@ -492,6 +498,7 @@ async fn filter_failure_is_visible_and_queued_snapshot_does_not_catch_reconnecte
let tmp = tempfile::TempDir::new().unwrap();
let mut config = Config::default();
config.workspace_dir = tmp.path().to_path_buf();
+ use_linked_channel_module(&mut config).await;
let old_thread = store_channel_thread(
DispatchCtx::ambient(),
&config.workspace_dir,
diff --git a/crates/openhuman-core/src/memory/ops_tests.rs b/crates/openhuman-core/src/memory/ops_tests.rs
index 81d216efc2..f179f3e03f 100644
--- a/crates/openhuman-core/src/memory/ops_tests.rs
+++ b/crates/openhuman-core/src/memory/ops_tests.rs
@@ -15,6 +15,79 @@ fn learn_params(text: &str) -> LearnParams {
}
}
+#[cfg(feature = "channels")]
+#[tokio::test]
+async fn reserved_thread_matching_uses_module_identity_boundaries() {
+ use tinychannels_bus::module_inbound::PrepareChannelIdentityRequest;
+
+ let client = crate::channels::module_fixture::client().await;
+ let base_for = |channel: &'static str| {
+ let client = client.clone();
+ async move {
+ crate::modules::channel_controller::prepare_identity(
+ &client,
+ PrepareChannelIdentityRequest {
+ channel: channel.into(),
+ sender: None,
+ reply_target: None,
+ thread_ts: None,
+ },
+ )
+ .await
+ .expect("linked TinyChannels module prepares its canonical base")
+ .thread_id
+ }
+ };
+ let base = base_for("discord").await;
+ let neighboring_channel = base_for("discordish").await;
+
+ assert!(is_channel_thread_id(&base, &base));
+ assert!(is_channel_thread_id(&format!("{base}/thread-1"), &base));
+ assert!(is_channel_thread_id(&format!("{base}#thread:1700.001"), &base));
+ assert!(!is_channel_thread_id(&format!("{base}suffix"), &base));
+ assert!(!is_channel_thread_id(&neighboring_channel, &base));
+ assert!(!is_channel_thread_id(&format!("prefix-{base}"), &base));
+}
+
+#[cfg(feature = "channels")]
+#[tokio::test]
+async fn unavailable_channel_module_reports_error_and_queues_known_legacy_threads() {
+ use tinychannels_bus::module_inbound::PrepareChannelIdentityRequest;
+
+ let tmp = tempfile::tempdir().unwrap();
+ let mut config = config_in(&tmp);
+ config.modules.enabled = false;
+ let legacy_thread = "legacy-discord-thread";
+ let legacy_file = config.workspace_dir.join("memory/channel_threads.json");
+ std::fs::create_dir_all(legacy_file.parent().unwrap()).unwrap();
+ std::fs::write(&legacy_file, br#"{"discord":["legacy-discord-thread"]}"#).unwrap();
+
+ let unavailable = crate::modules::channel_controller::prepare_identity(
+ &crate::modules::client(config.clone()),
+ PrepareChannelIdentityRequest {
+ channel: "discord".into(),
+ sender: None,
+ reply_target: None,
+ thread_ts: None,
+ },
+ )
+ .await
+ .expect_err("explicitly disabled module must stay unavailable");
+ assert_eq!(unavailable, tinybus::module::ModuleCallError::Unavailable);
+
+ let error = forget_channel(&config, "discord")
+ .await
+ .expect_err("an unavailable identity module must be visible to the caller");
+ assert_eq!(error.code(), "ENGINE");
+ assert!(error.to_string().contains("channel identity preparation"));
+ assert_eq!(
+ crate::memory::deletion::pending(&config.workspace_dir),
+ vec![crate::memory::deletion::PendingDeletion::Thread {
+ thread_id: legacy_thread.into()
+ }]
+ );
+}
+
#[tokio::test]
async fn every_engine_operation_reports_memory_off_without_an_engine() {
let tmp = tempfile::tempdir().unwrap();