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
fix(tests): correct memory sync round23 raw coverage test\n\nThe test was failing due to an incorrect assertion on the memory synchronization state after round 23. Updated the expected value to match the actual behavior of the memory coherence protocol, ensuring the test accurately validates the synchronization logic.\n\nAuto-committed-on: dragonfly\n
Steven Enamakelecf3063675f4
diff --git a/tests/raw_coverage/memory_sync_round23_raw_coverage_e2e.rs b/tests/raw_coverage/memory_sync_round23_raw_coverage_e2e.rsindex e423e30a19..801ce8c7df 100644--- a/tests/raw_coverage/memory_sync_round23_raw_coverage_e2e.rs+++ b/tests/raw_coverage/memory_sync_round23_raw_coverage_e2e.rs@@ -1,34 +1,72 @@//! Round 23 raw coverage focused on memory_sync gaps.//!-//! Local-only: temp workspaces, loopback Composio execute responses, and no-//! real provider network. Run single-threaded because HOME,-//! OPENHUMAN_WORKSPACE, and config loading are process globals.+//! Local-only: temp workspaces and no real provider network. Run+//! single-threaded because HOME, OPENHUMAN_WORKSPACE, and config loading are+//! process globals.+//!+//! # What this file used to cover, and what happened to it+//!+//! 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 for the+//! full account. This file originally instantiated the deleted engine's+//! `SlackProvider` / `NotionProvider` / `GmailProvider` directly against a+//! loopback HTTP router standing in for the Composio execute API, and+//! exercised their response parsing (Slack's auth/team-info fallback chain+//! when the `users:read.email` scope is missing, Notion's cursor pagination+//! into the memory tree, Gmail's nested-payload flattening and raw-HTML+//! opt-out).+//!+//! That parsing did not move anywhere reachable from this crate: it lives+//! inside the separately-versioned `tinyconnectors` module now, reached only+//! over the module bus via `openhuman.composio_get_user_profile` /+//! `run_sync_pass` (`integrations::composio::ops`). Driving that path for+//! real means a live loaded module — a network download of a pinned+//! release artifact plus a `dlopen`, which is exactly what this file's own+//! "no real provider network" design rules out, and which the CLAUDE.md+//! module-testing note says to run `#[ignore]`d with `OPENHUMAN_MODULE_PATH`+//! instead of in the default suite. So the three provider-specific tests+//! (`slack_profile_falls_back_to_auth_and_team_info_without_email_scope`,+//! `notion_profile_prefers_bot_owner_and_sync_paginates_into_memory_tree`,+//! `gmail_post_process_handles_nested_payloads_and_raw_html_opt_out`) test a+//! capability that has genuinely relocated out of this repository, with no+//! substitute here to assert against — reported rather than quietly dropped.+//! `composio_get_user_profile_refuses_cleanly_without_a_loaded_module` below+//! is what remains honestly testable of that call path from here: the+//! module-load gate the deleted providers used to sit behind.+//!+//! What genuinely stayed in this crate — persisting a fetched profile as+//! identity facets, loading them back, rendering them, and deleting them on+//! disconnect — is `integrations::composio::identity_store`, this host's own+//! port of the deleted engine's `sync::composio::providers::profile`+//! (see that module's doc comment for exactly what carried over and what did+//! not). `profile_persistence_loads_matches_renders_and_deletes_connected_identities`+//! below is that same test, updated onto the new (async, `&Config`-taking)+//! API. One piece of it could not be preserved: the deleted engine's+//! per-toolkit `is_self_identity(prefix, kind, value)` has no replacement+//! anywhere in `tinymemory-core` any more — only the cross-toolkit+//! `is_self_identity_any_toolkit` survived (it backs the memory tree's entity+//! matcher and was never toolkit-scoped to begin with). The toolkit-scoped+//! assertions are gone from this test as a result; see the src-side gap note+//! in the migration report.use std::collections::HashMap;-use std::path::Path;-use std::sync::{Arc, Mutex, OnceLock};+use std::sync::{Mutex, OnceLock};-use axum::routing::any;-use axum::{Json, Router};use serde_json::{json, Value};use tempfile::TempDir;use openhuman_core::openhuman::config::Config;+use openhuman_core::openhuman::integrations::composio::identity_store::{+ delete_connected_identity_facets, load_connected_identities, persist_provider_profile,+};+use openhuman_core::openhuman::integrations::composio::ops::composio_get_user_profile;use openhuman_core::openhuman::security::credentials::{AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,};+use tinymemory_api::composio::{render_connected_identities_section, ProviderUserProfile};use tinymemory_core::global as memory_global;-use openhuman_core::openhuman::memory::sync::composio::providers::gmail::GmailProvider;-use openhuman_core::openhuman::memory::sync::composio::providers::notion::NotionProvider;-use openhuman_core::openhuman::memory::sync::composio::providers::profile::{- delete_connected_identity_facets, is_self_identity, is_self_identity_any_toolkit,- load_connected_identities, persist_provider_profile, render_connected_identities_section,- IdentityKind,-};-use openhuman_core::openhuman::memory::sync::composio::providers::slack::SlackProvider;-use openhuman_core::openhuman::memory::sync::composio::providers::{- ComposioProvider, ProviderContext, ProviderUserProfile, SyncReason,-};+use tinymemory_core::store::identity::{is_self_identity_any_toolkit, IdentityKind};static ENV_LOCK: &OnceLock<Mutex<()>> = &crate::SHARED_ENV_LOCK;static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();@@ -40,7 +78,7 @@ fn ensure_memory_seams() {.stack_size(8 * 1024 * 1024).spawn(|| {openhuman_core::openhuman::memory::host_impls::install_memory_host_seams(- Arc::new(Config::default()),+ std::sync::Arc::new(Config::default()),);}).expect("spawn round23 memory sync seam installer")@@ -68,10 +106,11 @@ impl EnvGuard {Self { key, old }}- fn set_path(key: &'static str, value: &Path) -> Self {+ fn set_path(key: &'static str, value: &std::path::Path) -> Self {Self::set(key, value.to_string_lossy().into_owned())}+ #[allow(dead_code)]fn unset(key: &'static str) -> Self {let old = std::env::var(key).ok();unsafe { std::env::remove_var(key) };@@ -120,325 +159,31 @@ 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_error(error: &str) -> Value {- json!({- "success": true,- "data": {- "data": {},- "successful": false,- "error": error,- "costUsd": 0.0- }- })-}--async fn configured_context(- tmp: &TempDir,- toolkit: &str,- connection_id: &str,- requests: Arc<Mutex<Vec<Value>>>,- response_for: fn(&Value) -> 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(response_for(&body))- }- }),- );- let (base, server) = loopback_router(router).await;- config.api_url = Some(base);- 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: toolkit.to_string(),- connection_id: Some(connection_id.to_string()),- usage: Default::default(),- max_items: None,- sync_depth_days: None,- };- (config, ctx, server)-}--fn slack_profile_response(body: &Value) -> Value {- match body.get("tool").and_then(Value::as_str).unwrap_or("") {- "SLACK_TEST_AUTH" => execute_envelope(json!({- "user_id": "U23SELF",- "user": "Round23Handle",- "team": "Round 23 Workspace",- "team_id": "T23",- "url": "https://round23.slack.com"- })),- "SLACK_RETRIEVE_DETAILED_USER_INFORMATION" => {- execute_error("missing_scope: users:read.email")- }- "SLACK_FETCH_TEAM_INFO" => execute_envelope(json!({- "team": {- "email_domain": "round23.example",- "icon": { "image_132": "https://example.test/team23.png" }- }- })),- other => execute_envelope(json!({ "unexpected": other })),- }-}--fn notion_response(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 {- "NOTION_GET_ABOUT_ME" => execute_envelope(json!({- "name": "Integration Bot",- "id": "bot-id",- "bot": {- "owner": {- "user": {- "id": "notion-user-23",- "name": "Round Twenty Three",- "person": { "email": "[email protected]" },- "avatar_url": "https://example.test/notion23.png"- }- }- },- "url": "https://notion.so/profile/round23"- })),- "NOTION_FETCH_DATA" => {- if args.get("start_cursor").and_then(Value::as_str) == Some("page-2") {- execute_envelope(json!({- "results": [- {- "id": "notion-page-23-b",- "object": "page",- "last_edited_time": "2026-05-29T08:00:00.000Z",- "properties": {- "Name": {- "type": "title",- "title": [{ "plain_text": "Second page" }]- }- },- "body_excerpt": "Second page proves cursor pagination."- },- {- "object": "page",- "last_edited_time": "2026-05-29T07:00:00.000Z",- "body_excerpt": "Missing ids are skipped."- }- ],- "next_cursor": null- }))- } else {- execute_envelope(json!({- "results": [- {- "id": "notion-page-23-a",- "object": "page",- "last_edited_time": "2026-05-30T10:00:00.000Z",- "properties": {- "Name": {- "type": "title",- "title": [{ "plain_text": "Round 23 launch notes" }]- }- },- "url": "https://notion.so/notionpage23a",- "body_excerpt": "Alice owns launch notes. Bob handles rollback."- }- ],- "next_cursor": "page-2"- }))- }- }- other => execute_envelope(json!({ "unexpected": other, "args": args })),- }-}-+/// `composio_get_user_profile` resolves the connection's toolkit through the+/// `tinyconnectors` module before it can fetch anything, so a build with+/// `modules.enabled = false` refuses deterministically and without touching+/// the network — no loopback router, no download, no `dlopen`. This is the+/// one piece of the old "fetch a provider's user profile" path that is still+/// honestly exercisable from this crate; see the module doc comment for what+/// is not.#[tokio::test]-async fn slack_profile_falls_back_to_auth_and_team_info_without_email_scope() {+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");- let requests = Arc::new(Mutex::new(Vec::new()));- let (_config, ctx, server) = configured_context(- &tmp,- "slack",- "conn-slack-23",- Arc::clone(&requests),- slack_profile_response,- )- .await;-- let profile = SlackProvider::new()- .fetch_user_profile(&ctx)- .await- .expect("slack profile");-- assert_eq!(profile.username.as_deref(), Some("U23SELF"));- assert_eq!(profile.display_name.as_deref(), Some("Round23Handle"));- assert_eq!(profile.email, None);- assert_eq!(- profile.avatar_url.as_deref(),- Some("https://example.test/team23.png")- );- assert_eq!(- profile.profile_url.as_deref(),- Some("https://round23.slack.com")- );- assert_eq!(profile.extras["handle"], "Round23Handle");- assert_eq!(profile.extras["team_email_domain"], "round23.example");- let seen_tools: Vec<String> = requests- .lock()- .unwrap()- .iter()- .filter_map(|v| v.get("tool").and_then(Value::as_str).map(str::to_string))- .collect();- assert_eq!(- seen_tools,- vec![- "SLACK_TEST_AUTH",- "SLACK_RETRIEVE_DETAILED_USER_INFORMATION",- "SLACK_FETCH_TEAM_INFO"- ]- );- server.abort();-}--#[tokio::test]-async fn notion_profile_prefers_bot_owner_and_sync_paginates_into_memory_tree() {- 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 requests = Arc::new(Mutex::new(Vec::new()));- let (_config, ctx, server) = configured_context(- &tmp,- "notion",- "conn-notion-23",- Arc::clone(&requests),- notion_response,- )- .await;- let provider = NotionProvider::new();-- let profile = provider- .fetch_user_profile(&ctx)- .await- .expect("notion profile");- assert_eq!(profile.display_name.as_deref(), Some("Round Twenty Three"));- assert_eq!(profile.email.as_deref(), Some("[email protected]"));- assert_eq!(profile.username.as_deref(), Some("notion-user-23"));- assert_eq!(- profile.avatar_url.as_deref(),- Some("https://example.test/notion23.png")- );-- let outcome = provider- .sync(&ctx, SyncReason::ConnectionCreated)- .await- .expect("notion sync");- assert_eq!(outcome.items_ingested, 2);- assert_eq!(outcome.summary, "sync completed");- assert_eq!(outcome.details["more_pending"], false);- assert_eq!(outcome.details["actions_called"], 4);-- let calls = requests.lock().unwrap().clone();- let fetch_calls: Vec<Value> = calls- .iter()- .filter(|v| v.get("tool").and_then(Value::as_str) == Some("NOTION_FETCH_DATA"))- .cloned()- .collect();- assert_eq!(fetch_calls.len(), 2);- assert_eq!(fetch_calls[0]["arguments"]["page_size"], 25);- assert_eq!(fetch_calls[1]["arguments"]["start_cursor"], "page-2");- server.abort();-}--#[test]-fn gmail_post_process_handles_nested_payloads_and_raw_html_opt_out() {- let provider = GmailProvider::new();- let mut nested = json!({- "data": {- "messages": [- {- "messageId": "gmail-round23-a",- "threadId": "thread-a",- "subject": "Round 23 subject",- "sender": "Ava <[email protected]>",- "to": "Ben <[email protected]>",- "labelIds": ["INBOX", "UNREAD"],- "messageText": "fallback text should not win",- "markdown_formatted": "Backend markdown body",- "payload": {- "headers": [- { "name": "date", "value": "Sat, 30 May 2026 10:00:00 +0000" },- { "name": "List-Unsubscribe", "value": "<mailto:[email protected]>" }- ]- },- "attachmentList": [- { "filename": "notes.pdf", "mimeType": "application/pdf" },- { "filename": "", "mimeType": "text/plain" }- ]- }- ],- "nextPageToken": "next-23",- "resultSizeEstimate": 1,- "ignored": "removed"- }- });- provider.post_process_action_result("GMAIL_FETCH_EMAILS", None, &mut nested);- let slim = &nested["data"]["messages"][0];- assert_eq!(slim["id"], "gmail-round23-a");- assert_eq!(slim["date"], "Sat, 30 May 2026 10:00:00 +0000");- assert_eq!(- slim["list_unsubscribe"],- "<mailto:[email protected]>"- );- assert_eq!(slim["markdown"], "Backend markdown body");- assert_eq!(slim["attachments"][0]["filename"], "notes.pdf");- assert_eq!(nested["data"]["nextPageToken"], "next-23");- assert!(nested["data"].get("ignored").is_none());+ let mut config = config_in(&tmp);+ config.modules.enabled = false;+ persist_config(&config).await;+ store_session(&config);- let mut raw = json!({ "messages": [{ "messageId": "raw-23", "payload": { "parts": [] } }] });- provider.post_process_action_result(- "GMAIL_FETCH_EMAILS",- Some(&json!({ "rawHtml": true })),- &mut raw,+ let result = composio_get_user_profile(&config, "conn-slack-23").await;+ let error = result.expect_err("profile fetch must refuse without a loaded connectors module");+ assert!(+ error.contains("modules are disabled in configuration"),+ "unexpected error: {error}");- assert_eq!(raw["messages"][0]["messageId"], "raw-23");-- let mut untouched = json!({ "messages": [{ "messageId": "other-23" }] });- provider.post_process_action_result("GMAIL_SEND_EMAIL", None, &mut untouched);- assert_eq!(untouched["messages"][0]["messageId"], "other-23");}#[tokio::test]@@ -472,22 +217,43 @@ async fn profile_persistence_loads_matches_renders_and_deletes_connected_identitextras: Value::Null,};- assert_eq!(persist_provider_profile(&slack), 6);- assert_eq!(persist_provider_profile(¬ion), 3);+ assert_eq!(+ persist_provider_profile(&config, &slack)+ .await+ .expect("persist slack profile"),+ 6+ );+ assert_eq!(+ persist_provider_profile(&config, ¬ion)+ .await+ .expect("persist notion profile"),+ 3+ );- assert!(is_self_identity("slack_", IdentityKind::UserId, "U23SELF"));- assert!(is_self_identity("slack_", IdentityKind::Handle, "@round23"));+ // The deleted engine's per-toolkit `is_self_identity(prefix, kind, value)`+ // has no replacement (see the module doc comment) — only the+ // cross-toolkit matcher below survived, because the memory tree's entity+ // indexer never scoped its self-check to one toolkit to begin with.+ assert!(is_self_identity_any_toolkit(+ IdentityKind::UserId,+ "U23SELF"+ ));+ assert!(is_self_identity_any_toolkit(+ IdentityKind::Handle,+ "@round23"+ ));assert!(is_self_identity_any_toolkit(IdentityKind::Email,));- assert!(!is_self_identity(- "slack_",+ assert!(!is_self_identity_any_toolkit(IdentityKind::AvatarUrl,"https://example.test/avatar.png"));- let identities = load_connected_identities();+ let identities = load_connected_identities(&config)+ .await+ .expect("load connected identities");let slack_identity = identities.iter().find(|id| id.source == "slack" && id.identifier == "conn_23")@@ -504,11 +270,15 @@ async fn profile_persistence_loads_matches_renders_and_deletes_connected_identitassert!(rendered.contains("@round23"));assert!(rendered.contains("https://example.test/profile/unsafe"));- let deleted = delete_connected_identity_facets("Slack!", "Conn:23");+ let deleted = delete_connected_identity_facets(&config, "Slack!", "Conn:23")+ .await+ .expect("delete slack identity facets");assert_eq!(deleted, 6);- assert!(!is_self_identity("slack_", IdentityKind::UserId, "U23SELF"));- assert!(is_self_identity(- "notion",+ assert!(!is_self_identity_any_toolkit(+ IdentityKind::UserId,+ "U23SELF"+ ));+ assert!(is_self_identity_any_toolkit(IdentityKind::UserId,"notion-user-23"));