Skip to content

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

fix(tests): update memory sync slack bus raw coverage test\n\nUpdate the raw coverage end-to-end test for memory sync slack bus to reflect changes in the underlying implementation, ensuring the test continues to validate correct behavior after recent modifications to the memory synchronization logic.\n\nAuto-committed-on: dragonfly\n

Steven Enamakel515dfe279353
diff --git a/tests/raw_coverage/memory_sync_slack_bus_raw_coverage_e2e.rs b/tests/raw_coverage/memory_sync_slack_bus_raw_coverage_e2e.rs
index 1d30f2f7c5..ebd8bb53f6 100644
--- a/tests/raw_coverage/memory_sync_slack_bus_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_sync_slack_bus_raw_coverage_e2e.rs
@@ -1,32 +1,59 @@
//! Round19 raw coverage for Slack memory sync, Composio bus subscribers,
//! and Gmail post-processing.
//!
-//! Everything stays local: temp workspaces plus a loopback backend that
-//! returns Composio execute envelopes. Run single-threaded because HOME,
-//! OPENHUMAN_WORKSPACE, and config loading are process globals.
+//! Everything stays local: temp workspaces, no real provider network. Run
+//! single-threaded because HOME, OPENHUMAN_WORKSPACE, and config loading are
+//! process globals.
+//!
+//! # What changed here
+//!
+//! tinymemory v1.13.4 deleted the in-process Composio pipeline outright (72
+//! files, ~18.3k lines) — see
+//! `crate::openhuman::integrations::composio::providers`'s module docs. This
+//! file used to instantiate the deleted engine's `SlackProvider` /
+//! `GmailProvider` directly against a loopback HTTP router standing in for
+//! the Composio execute API, exercising Slack's full sync (profile, users,
+//! conversations, history) plus `run_backfill_via_search`, and Gmail's
+//! nested-payload post-processing.
+//!
+//! None of that parsing moved anywhere reachable from this crate — it now
+//! lives inside the separately-versioned `tinyconnectors` module, reached
+//! only over the module bus. Exercising it for real means a live loaded
+//! module (a network download of a pinned release plus a `dlopen`), which
+//! this file's own "no real provider network" design rules out and which
+//! the CLAUDE.md module-testing note says belongs in an `#[ignore]`d test
+//! with `OPENHUMAN_MODULE_PATH`, not the default suite. So
+//! `slack_full_sync_search_backfill_and_bus_use_loopback_composio` and
+//! `gmail_post_process_reshapes_nested_messages_and_honors_raw_html_flag`
+//! test a capability that has genuinely relocated with nothing here to
+//! assert against — reported as a gap rather than silently dropped.
+//!
+//! The bus subscribers themselves (`ComposioTriggerSubscriber`,
+//! `ComposioConnectionCreatedSubscriber`, `ComposioConfigChangedSubscriber`)
+//! are untouched by the deletion — they still live in
+//! `memory::sync::composio::bus` — and their `handle()` bodies now route
+//! through `run_sync_pass` / `composio_get_user_profile` (module-mediated)
+//! instead of the deleted engine's `MemorySourceSync`. Both fail closed and
+//! log rather than panic when the module cannot load, which is exactly the
+//! `modules.enabled = false` state these tests run in, so they still
+//! exercise real, current code — name/domain wiring, event matching, and the
+//! auto-register-into-`memory_sources` side effect on connection creation —
+//! without needing the module or the network. That coverage is preserved
+//! below, retargeted onto the honest network-free path.
use std::collections::HashMap;
use std::path::Path;
use std::sync::{Arc, Mutex, OnceLock};
-use axum::routing::any;
-use axum::{Json, Router};
-use serde_json::{json, Value};
+use serde_json::json;
use tempfile::TempDir;
use openhuman_core::core::events::DomainEvent;
use openhuman_core::openhuman::config::Config;
-use tinymemory_core::global as memory_global;
+use openhuman_core::openhuman::integrations::composio::ops::composio_get_user_profile;
use openhuman_core::openhuman::memory::sync::composio::bus::{
ComposioConfigChangedSubscriber, ComposioConnectionCreatedSubscriber, ComposioTriggerSubscriber,
};
-use openhuman_core::openhuman::memory::sync::composio::providers::gmail::GmailProvider;
-use openhuman_core::openhuman::memory::sync::composio::providers::slack::{
- run_backfill_via_search, SlackProvider,
-};
-use openhuman_core::openhuman::memory::sync::composio::providers::{
- ComposioProvider, ProviderContext, SyncReason,
-};
use openhuman_core::openhuman::security::credentials::{
AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
};
@@ -100,6 +127,11 @@ fn config_in(tmp: &TempDir) -> Config {
..Config::default()
};
config.secrets.encrypt = false;
+ // Deterministic, network-free: no loopback router stands in for the
+ // Composio execute API any more (see module doc comment), so every
+ // module-mediated call in this file resolves to a clean "modules
+ // disabled" refusal instead of attempting a real download.
+ config.modules.enabled = false;
ensure_memory_seams(Arc::new(config.clone()));
config
}
@@ -121,222 +153,54 @@ fn store_session(config: &Config) {
.expect("store app session token");
}
-async fn loopback_router(router: Router) -> (String, tokio::task::JoinHandle<()>) {
- let listener = tokio::net::TcpListener::bind("127.0.0.1:0")
- .await
- .expect("bind loopback");
- let addr = listener.local_addr().expect("loopback addr");
- let handle = tokio::spawn(async move {
- axum::serve(listener, router).await.expect("serve loopback");
- });
- (format!("http://{addr}"), handle)
-}
-
-fn execute_envelope(data: Value) -> Value {
- json!({
- "success": true,
- "data": {
- "data": data,
- "successful": true,
- "error": null,
- "costUsd": 0.0
- }
- })
-}
-
-fn execute_response_for(body: &Value) -> Value {
- let tool = body.get("tool").and_then(Value::as_str).unwrap_or("");
- let args = body.get("arguments").cloned().unwrap_or_else(|| json!({}));
- match tool {
- "SLACK_TEST_AUTH" => execute_envelope(json!({
- "user_id": "U19A",
- "user": "round19",
- "team": "Round19 Workspace",
- "team_id": "T19",
- "url": "https://round19.slack.com"
- })),
- "SLACK_RETRIEVE_DETAILED_USER_INFORMATION" => execute_envelope(json!({
- "user": {
- "real_name": "Round Nineteen",
- "profile": {
- "email": "[email protected]",
- "image_192": "https://example.test/r19.png"
- }
- }
- })),
- "SLACK_FETCH_TEAM_INFO" => execute_envelope(json!({
- "team": {
- "email_domain": "example.test",
- "icon": { "image_132": "https://example.test/team19.png" }
- }
- })),
- "SLACK_LIST_ALL_USERS" => {
- let has_cursor = args.get("cursor").is_some();
- execute_envelope(json!({
- "members": [
- {
- "id": if has_cursor { "U19B" } else { "U19A" },
- "profile": {
- "display_name": if has_cursor { "" } else { "Ava Round19" },
- "real_name": if has_cursor { "Ben Round19" } else { "" }
- },
- "name": if has_cursor { "ben19" } else { "ava19" }
- },
- { "id": "", "name": "dropped" }
- ],
- "response_metadata": {
- "next_cursor": if has_cursor { "" } else { "users-page-2" }
- }
- }))
- }
- "SLACK_LIST_CONVERSATIONS" => {
- let has_cursor = args.get("cursor").is_some();
- execute_envelope(json!({
- "channels": if has_cursor {
- json!([
- { "id": "G19", "name": "private-coverage", "is_private": true }
- ])
- } else {
- json!([
- { "id": "C19", "name": "coverage", "is_private": false },
- { "id": "", "name": "dropped" }
- ])
- },
- "response_metadata": {
- "next_cursor": if has_cursor { "" } else { "channels-page-2" }
- }
- }))
- }
- "SLACK_FETCH_CONVERSATION_HISTORY" => {
- let channel = args.get("channel").and_then(Value::as_str).unwrap_or("");
- execute_envelope(json!({
- "messages": [
- {
- "ts": if channel == "G19" { "1714004200.000300" } else { "1714003200.000100" },
- "user": "U19A",
- "text": if channel == "G19" {
- "private sync note for <@U19B>"
- } else {
- "shipping Slack sync coverage with <@U19B>"
- },
- "thread_ts": "1714003200.000100",
- "permalink": "https://round19.slack.com/archives/C19/p1714003200000100"
- },
- {
- "ts": "1714003300.000200",
- "bot_id": "B19",
- "text": "bot authored update"
- },
- { "ts": "1714003400.000300", "user": "U19B", "text": " " }
- ],
- "response_metadata": { "next_cursor": "" }
- }))
- }
- "SLACK_SEARCH_MESSAGES" => execute_envelope(json!({
- "messages": {
- "matches": [
- {
- "ts": "1714005200.000400",
- "user": "U19B",
- "text": "search backfill hit for <@U19A>",
- "channel": { "id": "C19" },
- "permalink": "https://round19.slack.com/archives/C19/p1714005200000400"
- },
- {
- "ts": "1714005300.000500",
- "user": "U19B",
- "text": "orphan match should be dropped",
- "channel": { "name": "missing-id" }
- }
- ],
- "paging": { "pages": 1 }
- }
- })),
- _ => execute_envelope(json!({ "unknown_tool": tool, "arguments": args })),
- }
-}
+/// What `slack_full_sync_search_backfill_and_bus_use_loopback_composio` used
+/// to cover for the fetch-and-sync half: `composio_get_user_profile` is the
+/// current entry point a Slack connection's profile fetch goes through
+/// (`integrations::composio::ops`), and it refuses cleanly, deterministically
+/// and without touching the network when no connectors module is loaded —
+/// see the module doc comment for what this cannot cover in place of the
+/// deleted `SlackProvider`.
+#[tokio::test]
+async fn composio_get_user_profile_refuses_cleanly_without_a_loaded_module() {
+ let _guard = env_lock();
+ let tmp = TempDir::new().expect("tempdir");
+ let _workspace = EnvGuard::set_path("OPENHUMAN_WORKSPACE", tmp.path());
+ let _home = EnvGuard::set_path("HOME", tmp.path());
+ let _backend = EnvGuard::unset("BACKEND_URL");
-async fn configured_loopback_context(
- tmp: &TempDir,
- requests: Arc<Mutex<Vec<Value>>>,
-) -> (Config, ProviderContext, tokio::task::JoinHandle<()>) {
- let mut config = config_in(tmp);
- let router = Router::new().route(
- "/agent-integrations/composio/execute",
- any(move |Json(body): Json<Value>| {
- let requests = Arc::clone(&requests);
- async move {
- requests.lock().unwrap().push(body.clone());
- Json(execute_response_for(&body))
- }
- }),
- );
- let (base, server) = loopback_router(router).await;
- config.api_url = Some(base);
+ let config = config_in(&tmp);
persist_config(&config).await;
store_session(&config);
- memory_global::init(config.workspace_dir.clone()).expect("init global memory client");
- let ctx = ProviderContext {
- config: Arc::new(config.clone()),
- toolkit: "slack".to_string(),
- connection_id: Some("conn-slack-round19".to_string()),
- usage: Default::default(),
- max_items: None,
- sync_depth_days: None,
- };
- (config, ctx, server)
+
+ let error = composio_get_user_profile(&config, "conn-slack-round19")
+ .await
+ .expect_err("profile fetch must refuse without a loaded connectors module");
+ assert!(
+ error.contains("modules are disabled in configuration"),
+ "unexpected error: {error}"
+ );
}
+/// The Composio bus subscribers are untouched by the tinymemory v1.13.4
+/// deletion — only what their handlers call underneath changed (see module
+/// doc comment). This drives all three with `modules.enabled = false` so the
+/// module-mediated calls inside them fail closed and log rather than reach
+/// the network, and asserts the wiring (name/domains) plus the one
+/// observable side effect that does not depend on the module at all: a
+/// created connection is still auto-registered into the `memory_sources`
+/// registry even though its initial profile fetch and sync both refuse.
#[tokio::test]
-async fn slack_full_sync_search_backfill_and_bus_use_loopback_composio() {
+async fn composio_bus_subscribers_wire_up_and_auto_register_despite_no_loaded_module() {
let _guard = env_lock();
let tmp = TempDir::new().expect("tempdir");
let _workspace = EnvGuard::set_path("OPENHUMAN_WORKSPACE", tmp.path());
let _home = EnvGuard::set_path("HOME", tmp.path());
let _backend = EnvGuard::unset("BACKEND_URL");
let _triage_off = EnvGuard::set("OPENHUMAN_TRIGGER_TRIAGE_DISABLED", "1");
- let _pacing = EnvGuard::set("OPENHUMAN_SLACK_INTER_CALL_PACING_MS", "0");
- let _backfill = EnvGuard::set("OPENHUMAN_SLACK_BACKFILL_DAYS", "1");
-
- let requests: Arc<Mutex<Vec<Value>>> = Arc::new(Mutex::new(Vec::new()));
- let (_config, ctx, server) = configured_loopback_context(&tmp, Arc::clone(&requests)).await;
-
- let provider = SlackProvider::new();
- let profile = provider
- .fetch_user_profile(&ctx)
- .await
- .expect("slack profile");
- assert_eq!(profile.username.as_deref(), Some("U19A"));
- assert_eq!(profile.display_name.as_deref(), Some("Round Nineteen"));
- assert_eq!(profile.email.as_deref(), Some("[email protected]"));
- assert_eq!(profile.extras["team_name"], "Round19 Workspace");
- let outcome = provider
- .sync(&ctx, SyncReason::Manual)
- .await
- .expect("slack full sync");
- assert_eq!(outcome.toolkit, "slack");
- assert_eq!(outcome.connection_id.as_deref(), Some("conn-slack-round19"));
- assert_eq!(outcome.items_ingested, 3);
- assert_eq!(outcome.details["more_pending"], false);
- assert_eq!(outcome.details["actions_called"], 6);
-
- let search = run_backfill_via_search(&ctx, 2)
- .await
- .expect("slack search backfill");
- assert_eq!(search.items_ingested, 1);
- assert_eq!(search.details["more_pending"], false);
- assert_eq!(search.details["actions_called"], 5);
-
- let documents = openhuman_core::openhuman::memory::ops::doc_list(Some(
- openhuman_core::openhuman::memory::ops::NamespaceOnlyParams {
- namespace: "skill-slack".into(),
- },
- ))
- .await
- .expect("list synchronized Slack documents")
- .value;
- assert_eq!(documents["documents"].as_array().unwrap().len(), 4);
+ let config = config_in(&tmp);
+ persist_config(&config).await;
+ store_session(&config);
let trigger_sub = ComposioTriggerSubscriber::new();
assert_eq!(trigger_sub.name(), "composio::trigger");
@@ -351,16 +215,6 @@ async fn slack_full_sync_search_backfill_and_bus_use_loopback_composio() {
})
.await;
- let connection_sub = ComposioConnectionCreatedSubscriber::new();
- assert_eq!(connection_sub.name(), "composio::connection_created");
- assert_eq!(connection_sub.domains().unwrap(), &["composio"]);
- connection_sub
- .handle(&DomainEvent::ComposioConfigChanged {
- mode: "backend".to_string(),
- api_key_set: false,
- })
- .await;
-
let config_sub = ComposioConfigChangedSubscriber::new();
assert_eq!(config_sub.name(), "composio::config_changed");
assert_eq!(config_sub.domains().unwrap(), &["composio"]);
@@ -371,90 +225,31 @@ async fn slack_full_sync_search_backfill_and_bus_use_loopback_composio() {
})
.await;
- let calls = requests.lock().unwrap().clone();
- let called_tools: Vec<String> = calls
- .iter()
- .filter_map(|b| b.get("tool").and_then(Value::as_str).map(str::to_string))
- .collect();
- assert!(called_tools.contains(&"SLACK_LIST_ALL_USERS".to_string()));
- assert!(called_tools.contains(&"SLACK_LIST_CONVERSATIONS".to_string()));
- assert!(called_tools.contains(&"SLACK_FETCH_CONVERSATION_HISTORY".to_string()));
- assert!(called_tools.contains(&"SLACK_SEARCH_MESSAGES".to_string()));
-
- let history_args: Vec<Value> = calls
- .iter()
- .filter(|b| {
- b.get("tool").and_then(Value::as_str) == Some("SLACK_FETCH_CONVERSATION_HISTORY")
+ let connection_sub = ComposioConnectionCreatedSubscriber::new();
+ assert_eq!(connection_sub.name(), "composio::connection_created");
+ assert_eq!(connection_sub.domains().unwrap(), &["composio"]);
+ connection_sub
+ .handle(&DomainEvent::ComposioConnectionCreated {
+ toolkit: "slack".to_string(),
+ connection_id: "conn-slack-round19".to_string(),
})
- .filter_map(|b| b.get("arguments").cloned())
- .collect();
- assert!(history_args
- .iter()
- .any(|args| args.get("channel").and_then(Value::as_str) == Some("C19")));
- assert!(history_args
- .iter()
- .any(|args| args.get("channel").and_then(Value::as_str) == Some("G19")));
- assert!(history_args.iter().all(|args| {
- args.get("inclusive").and_then(Value::as_bool) == Some(false)
- && args.get("oldest").and_then(Value::as_str).is_some()
- }));
-
- server.abort();
-}
-
-#[tokio::test]
-async fn gmail_post_process_reshapes_nested_messages_and_honors_raw_html_flag() {
- let _guard = env_lock();
- let provider = GmailProvider::new();
-
- let mut data = json!({
- "data": {
- "messages": [
- {
- "messageId": "gmail-round19-a",
- "threadId": "thread-a",
- "subject": "Round19 A",
- "sender": "Ava <[email protected]>",
- "to": ["Ben <[email protected]>"],
- "messageText": "Plain fallback body",
- "labelIds": ["INBOX", "UNREAD"],
- "attachmentList": [
- { "filename": "notes.pdf", "mimeType": "application/pdf" },
- { "filename": "", "mimeType": "text/plain" }
- ],
- "payload": {
- "headers": [
- { "name": "Date", "value": "Fri, 29 May 2026 10:00:00 GMT" },
- { "name": "List-Unsubscribe", "value": "<mailto:[email protected]>" }
- ]
- }
- }
- ],
- "nextPageToken": "next-round19",
- "resultSizeEstimate": 7
- }
- });
- provider.post_process_action_result("GMAIL_FETCH_EMAILS", None, &mut data);
- let msg = &data["data"]["messages"][0];
- assert_eq!(msg["id"], "gmail-round19-a");
- assert_eq!(msg["threadId"], "thread-a");
- assert_eq!(msg["markdown"], "Plain fallback body");
- assert_eq!(msg["labels"][0], "INBOX");
- assert_eq!(msg["attachments"][0]["filename"], "notes.pdf");
- assert_eq!(msg["list_unsubscribe"], "<mailto:[email protected]>");
- assert_eq!(data["data"]["nextPageToken"], "next-round19");
- assert_eq!(data["data"]["resultSizeEstimate"], 7);
+ .await;
- let mut raw_passthrough = json!({
- "messages": [
- { "messageId": "raw-round19", "messageText": "<b>keep raw</b>" }
- ]
- });
- provider.post_process_action_result(
- "GMAIL_FETCH_EMAILS",
- Some(&json!({ "rawHtml": true })),
- &mut raw_passthrough,
+ // The profile fetch and the sync pass both refused (no loaded module),
+ // but the auto-register step reads no module — it is a local
+ // `memory_sources` upsert gated only on `has_native_provider`, which
+ // slack satisfies. That side effect survives the refusal, same as it did
+ // before the deletion.
+ let sources = openhuman_core::openhuman::memory::sources::registry::list_enabled_by_kind(
+ openhuman_core::openhuman::memory::sources::SourceKind::Composio,
+ )
+ .await
+ .expect("list composio memory sources");
+ assert!(
+ sources
+ .iter()
+ .any(|s| s.toolkit.as_deref() == Some("slack")
+ && s.connection_id.as_deref() == Some("conn-slack-round19")),
+ "connection-created should still auto-register into memory_sources: {sources:?}"
);
- assert_eq!(raw_passthrough["messages"][0]["messageId"], "raw-round19");
- assert!(raw_passthrough["messages"][0].get("markdown").is_none());
}