Skip to content

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

chore(tests): update raw coverage snapshot for memory sync tree round 21

Steven Enamakelba7b538ac388
diff --git a/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs b/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs
index 5cfe7cb681..bead759743 100644
--- a/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs
+++ b/tests/raw_coverage/memory_sync_tree_round21_raw_coverage_e2e.rs
@@ -1,43 +1,85 @@
//! Round 21 focused raw coverage for memory_sync + memory_tree gaps.
//!
-//! Hermetic: temp workspaces, loopback Composio backend, and no real network.
-//! Run with `--test-threads=1` because config/HOME/workspace env vars and the
-//! global memory client are process-global.
+//! Hermetic: temp workspaces, loopback Composio backend where still
+//! applicable, and no real network. Run with `--test-threads=1` because
+//! config/HOME/workspace env vars and the global memory client are
+//! process-global.
+//!
+//! # What changed here
+//!
+//! tinymemory v1.13.4 deleted the ENTIRE in-process Composio provider
+//! registry (`ComposioProvider` trait, `ProviderContext`, the concrete
+//! per-toolkit provider structs including `GmailProvider` and
+//! `LinearProvider`, `register_provider`/`init_default_providers`) — see
+//! `crate::openhuman::integrations::composio::providers`'s module docs for
+//! the full account. None of it has a replacement in this crate: it now
+//! lives in the separately-versioned `tinyconnectors` module, reachable only
+//! via a live loaded module over the bus (a real network download plus a
+//! `dlopen`), which this file's own "no real network" design rules out.
+//!
+//! `gmail_post_process_slims_wrapped_messages_and_honours_raw_flag` and the
+//! provider-internals half of
+//! `linear_provider_profile_tasks_sync_and_periodic_bookkeeping_use_loopback`
+//! (constructing a `GmailProvider`/`LinearProvider` directly and driving it
+//! against a loopback Composio execute API) tested exactly that deleted,
+//! relocated capability — Gmail's nested-payload post-processing, Linear's
+//! profile fetch, task normalization, and cursor-paginated sync. There is
+//! nothing left in this crate to assert that behaviour against; it is
+//! reported as a coverage gap rather than silently dropped. What replaces
+//! them below is the current, real, network-free entry point that stands in
+//! its place: `integrations::composio::ops::{composio_get_user_profile,
+//! composio_sync}`, which — with `modules.enabled = false` — refuse cleanly
+//! and deterministically instead of reaching a provider.
+//! `integrations::composio::periodic::record_sync_success` (moved from
+//! `memory::sync::composio::periodic`, which no longer exists) is still real
+//! and is still exercised directly.
+//!
+//! `slack_sync_status_rpc_reads_mock_connections_and_persisted_state` is
+//! rewritten rather than deleted, onto a genuinely different current
+//! behaviour: `providers::slack::rpc::sync_status_rpc`'s own doc comment
+//! (`src/openhuman/memory/sync/composio/providers/slack/rpc.rs`) explains
+//! that it is now a **deliberately degraded read** — the connector module
+//! keeps its cursor and daily-request budget internally and exposes neither
+//! outside of an actual `Sync` call, so every per-connection detail field
+//! (`per_channel_cursors`, `synced_ids_count`, `requests_used_today`,
+//! `daily_request_limit`) is hardcoded to its zero value rather than read
+//! back from anywhere. Persisting a `SyncState` before calling it (the old
+//! test's approach) no longer has any effect on the response, because
+//! nothing reads it — so this test now asserts the zero-value degraded shape
+//! and the log line that explains it, matching the RPC's own documented
+//! contract instead of a behaviour it no longer has.
use std::collections::HashMap;
use std::ffi::OsString;
use std::path::Path;
use std::sync::{Arc, Mutex, OnceLock};
-use axum::routing::{any, get};
+use axum::routing::get;
use axum::{Json, Router};
use chrono::{TimeZone, Utc};
-use serde_json::{json, Value};
+use serde_json::json;
use tempfile::TempDir;
use openhuman_core::openhuman::config::Config;
+use openhuman_core::openhuman::integrations::composio::ops::{
+ composio_get_user_profile, composio_sync,
+};
+use openhuman_core::openhuman::integrations::composio::periodic::record_sync_success;
+use openhuman_core::openhuman::memory::sync::composio::providers::slack::rpc::{
+ sync_status_rpc, SyncStatusRequest,
+};
+use openhuman_core::openhuman::memory::tree::retrieval::source::query_source;
+use openhuman_core::openhuman::memory::tree::tree::store as tree_store;
+use openhuman_core::openhuman::memory::tree::tree::TreeStatus;
use openhuman_core::openhuman::security::credentials::{
AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,
};
+use tinycortex::memory::score::embed::{pack_embedding, EMBEDDING_DIM};
use tinymemory_core::global as memory_global;
use tinymemory_core::store::chunks::store::with_connection;
use tinymemory_core::store::content::atomic::stage_summary;
use tinymemory_core::store::content::{SummaryComposeInput, SummaryTreeKind};
use tinymemory_core::store::trees::types::{SummaryNode, Tree, TreeKind};
-use openhuman_core::openhuman::memory::sync::composio::periodic::record_sync_success;
-use openhuman_core::openhuman::memory::sync::composio::providers::gmail::GmailProvider;
-use openhuman_core::openhuman::memory::sync::composio::providers::linear::LinearProvider;
-use openhuman_core::openhuman::memory::sync::composio::providers::slack::rpc::{
- sync_status_rpc, SyncStatusRequest,
-};
-use openhuman_core::openhuman::memory::sync::composio::providers::sync_state::{PersistedSyncState, SyncState};
-use openhuman_core::openhuman::memory::sync::composio::providers::{
- ComposioProvider, ProviderContext, SyncReason, TaskFetchFilter,
-};
-use openhuman_core::openhuman::memory::tree::retrieval::source::query_source;
-use tinycortex::memory::score::embed::{pack_embedding, EMBEDDING_DIM};
-use openhuman_core::openhuman::memory::tree::tree::store as tree_store;
-use openhuman_core::openhuman::memory::tree::tree::TreeStatus;
static ENV_LOCK: &OnceLock<Mutex<()>> = &crate::SHARED_ENV_LOCK;
static MEMORY_SEAMS_INIT: OnceLock<()> = OnceLock::new();
@@ -138,278 +180,60 @@ async fn loopback_router(router: Router) -> (String, tokio::task::JoinHandle<()>
(format!("http://{addr}"), handle)
}
-fn execute_envelope(data: Value) -> Value {
- json!({
- "success": true,
- "data": {
- "data": data,
- "successful": true,
- "error": null,
- "costUsd": 0.0
- }
- })
-}
-
-fn linear_execute_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 {
- "LINEAR_LIST_LINEAR_USERS" => execute_envelope(json!({
- "data": {
- "nodes": [{
- "id": "usr-round21",
- "name": "Round Twenty One",
- "email": "[email protected]",
- "avatarUrl": "https://example.test/linear.png",
- "url": "https://linear.app/openhuman/profiles/round21"
- }]
- }
- })),
- "LINEAR_LIST_LINEAR_ISSUES" => {
- let after = args.get("after").and_then(Value::as_str);
- let state = args.get("state").and_then(Value::as_str).unwrap_or("open");
- let nodes = if after == Some("cursor-page-2") {
- vec![
- json!({
- "id": "lin-round21-older",
- "identifier": "OH-20",
- "title": "Older issue past cursor",
- "description": "This page proves cursor pagination is followed.",
- "updatedAt": "2026-05-29T08:00:00.000Z",
- "url": "https://linear.app/openhuman/issue/OH-20",
- "state": { "name": state },
- "assignee": { "name": "Round Twenty One" },
- "labels": { "nodes": [{ "name": "coverage" }] },
- "priorityLabel": "Medium"
- }),
- json!({
- "identifier": "OH-MISSING-ID",
- "title": "Missing id is skipped",
- "updatedAt": "2026-05-29T07:00:00.000Z"
- }),
- ]
- } else {
- vec![
- json!({
- "id": "lin-round21-new",
- "identifier": "OH-21",
- "title": "Cover Linear provider branches",
- "description": "Exercise profile, task normalization, sync persistence.",
- "updatedAt": "2026-05-30T10:00:00.000Z",
- "url": "https://linear.app/openhuman/issue/OH-21",
- "state": { "name": state },
- "assignee": { "name": "Round Twenty One" },
- "dueDate": "2026-06-01",
- "labels": { "nodes": [{ "name": "coverage" }, { "name": "round21" }] },
- "priorityLabel": "High"
- }),
- json!({
- "data": {
- "id": "lin-round21-wrapped",
- "title": "Wrapped Linear issue",
- "description": "Wrapped shape exercises data.* fallbacks.",
- "updated_at": "2026-05-30T09:00:00.000Z",
- "state": { "name": state },
- "assignee": { "name": "Round Twenty One" },
- "priorityLabel": "Low"
- }
- }),
- ]
- };
- execute_envelope(json!({
- "data": {
- "nodes": nodes,
- "pageInfo": {
- "hasNextPage": after.is_none(),
- "endCursor": if after.is_none() { "cursor-page-2" } else { "" }
- }
- }
- }))
- }
- _ => execute_envelope(json!({ "unknown_tool": tool, "arguments": args })),
- }
-}
-
-async fn configured_loopback_context(
- tmp: &TempDir,
- toolkit: &str,
- connection_id: &str,
- 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(linear_execute_response(&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)
-}
-
-#[test]
-fn gmail_post_process_slims_wrapped_messages_and_honours_raw_flag() {
- let provider = GmailProvider::new();
- let mut wrapped = json!({
- "data": {
- "messages": [
- {
- "messageId": "gmail-round21-a",
- "threadId": "thread-a",
- "subject": "Round 21 A",
- "sender": "Ava <[email protected]>",
- "to": "Ben <[email protected]>",
- "labelIds": ["INBOX", "IMPORTANT"],
- "markdownFormatted": "## Round 21 A\nUseful body from backend markdown.",
- "messageText": "fallback body",
- "payload": {
- "headers": [
- { "name": "Date", "value": "Sat, 30 May 2026 10:00:00 +0000" },
- { "name": "List-Unsubscribe", "value": "<mailto:[email protected]>" }
- ]
- },
- "attachmentList": [
- { "filename": "brief.pdf", "mimeType": "application/pdf" },
- { "filename": "", "mimeType": "text/plain" }
- ]
- },
- "non-object-passthrough"
- ],
- "nextPageToken": "next-round21",
- "resultSizeEstimate": 2,
- "verboseNoise": { "dropped": true }
- }
- });
-
- provider.post_process_action_result("GMAIL_FETCH_EMAILS", None, &mut wrapped);
- let messages = wrapped["data"]["messages"]
- .as_array()
- .expect("slim messages");
- assert_eq!(messages.len(), 2);
- assert_eq!(messages[0]["id"], "gmail-round21-a");
- assert_eq!(messages[0]["date"], "Sat, 30 May 2026 10:00:00 +0000");
- assert_eq!(
- messages[0]["list_unsubscribe"],
- "<mailto:[email protected]>"
- );
- assert_eq!(messages[0]["attachments"][0]["filename"], "brief.pdf");
- assert_eq!(
- messages[0]["markdown"],
- "## Round 21 A\nUseful body from backend markdown."
- );
- assert_eq!(wrapped["data"]["nextPageToken"], "next-round21");
- assert!(wrapped["data"].get("verboseNoise").is_none());
-
- let mut raw = json!({
- "messages": [{ "messageId": "gmail-raw", "messageText": "<b>raw html stays</b>" }]
- });
- provider.post_process_action_result(
- "GMAIL_FETCH_EMAILS",
- Some(&json!({ "rawHtml": true })),
- &mut raw,
- );
- assert_eq!(raw["messages"][0]["messageId"], "gmail-raw");
-
- let mut unknown = json!({ "messages": [{ "messageId": "gmail-unknown" }] });
- provider.post_process_action_result("GMAIL_SEND_EMAIL", None, &mut unknown);
- assert_eq!(unknown["messages"][0]["messageId"], "gmail-unknown");
-}
-
+/// What `gmail_post_process_slims_wrapped_messages_and_honours_raw_flag` and
+/// the profile/tasks half of
+/// `linear_provider_profile_tasks_sync_and_periodic_bookkeeping_use_loopback`
+/// used to cover — see the module doc comment for why that coverage cannot
+/// be expressed here any more. `composio_get_user_profile` is the real,
+/// current entry point standing in its place for "fetch a provider's
+/// profile", and it refuses cleanly and deterministically — no network, no
+/// provider — when no connectors module is loaded.
#[tokio::test]
-async fn linear_provider_profile_tasks_sync_and_periodic_bookkeeping_use_loopback() {
+async fn composio_get_user_profile_refuses_cleanly_for_gmail_and_linear_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<Mutex<Vec<Value>>> = Arc::new(Mutex::new(Vec::new()));
- let (_config, ctx, server) =
- configured_loopback_context(&tmp, "linear", "conn-linear-round21", Arc::clone(&requests))
- .await;
- let provider = LinearProvider::new();
- let profile = provider.fetch_user_profile(&ctx).await.expect("profile");
- assert_eq!(profile.username.as_deref(), Some("usr-round21"));
- assert_eq!(profile.display_name.as_deref(), Some("Round Twenty One"));
- assert_eq!(profile.email.as_deref(), Some("[email protected]"));
-
- let tasks = provider
- .fetch_tasks(
- &ctx,
- &TaskFetchFilter {
- assignee_is_me: true,
- state: Some("open".to_string()),
- max: 5,
- extra: json!({ "includeArchived": false }),
- ..TaskFetchFilter::default()
- },
- )
- .await
- .expect("tasks");
- assert_eq!(tasks.len(), 2);
- assert_eq!(tasks[0].external_id, "lin-round21-new");
- assert_eq!(
- tasks[0].labels,
- vec!["coverage".to_string(), "round21".to_string()]
- );
- assert_eq!(tasks[0].priority.as_deref(), Some("High"));
- assert_eq!(tasks[1].external_id, "lin-round21-wrapped");
+ let mut config = config_in(&tmp);
+ config.modules.enabled = false;
+ persist_config(&config).await;
+ store_session(&config);
- let sync = provider
- .sync(&ctx, SyncReason::ConnectionCreated)
- .await
- .expect("linear sync");
- assert_eq!(sync.items_ingested, 4);
- assert_eq!(sync.details["more_pending"], false);
- assert_eq!(sync.details["actions_called"], 3);
+ for connection_id in ["conn-gmail-round21", "conn-linear-round21"] {
+ let error = composio_get_user_profile(&config, connection_id)
+ .await
+ .expect_err("profile fetch must refuse without a loaded connectors module");
+ assert!(
+ error.contains("modules are disabled in configuration"),
+ "unexpected error for {connection_id}: {error}"
+ );
+ }
- let second = provider
- .sync(&ctx, SyncReason::Manual)
+ // `composio_sync` — the entry point standing in for the deleted
+ // `LinearProvider::sync` / periodic bookkeeping loop — refuses the same
+ // way: the toolkit resolution it needs is itself module-mediated.
+ let sync_error = composio_sync(&config, "conn-linear-round21", Some("manual".to_string()))
.await
- .expect("second sync");
- assert_eq!(second.items_ingested, 0);
- assert_eq!(second.details["more_pending"], false);
- assert_eq!(second.details["actions_called"], 3);
+ .expect_err("sync must refuse without a loaded connectors module");
+ assert!(
+ sync_error.contains("modules are disabled in configuration"),
+ "unexpected sync error: {sync_error}"
+ );
+ // `record_sync_success` (moved from the deleted `memory::sync::composio::
+ // periodic` to `integrations::composio::periodic`) is untouched by the
+ // deletion — it is a pure process-local bookkeeping call the periodic
+ // scheduler uses to avoid immediately re-firing a sync it just ran. It
+ // exposes no public reader, so this — like the original test — only
+ // proves it is callable and does not panic.
record_sync_success("linear", "conn-linear-round21");
record_sync_success("linear", "conn-linear-round21");
-
- let called_tools: Vec<String> = requests
- .lock()
- .unwrap()
- .iter()
- .filter_map(|b| b.get("tool").and_then(Value::as_str).map(str::to_string))
- .collect();
- assert!(called_tools.contains(&"LINEAR_LIST_LINEAR_USERS".to_string()));
- assert!(called_tools.contains(&"LINEAR_LIST_LINEAR_ISSUES".to_string()));
- assert!(requests.lock().unwrap().iter().any(|body| {
- body.get("arguments")
- .and_then(|args| args.get("after"))
- .and_then(Value::as_str)
- == Some("cursor-page-2")
- }));
-
- server.abort();
}
#[tokio::test]
-async fn slack_sync_status_rpc_reads_mock_connections_and_persisted_state() {
+async fn slack_sync_status_rpc_reports_the_degraded_zero_value_shape() {
let _guard = env_lock();
let tmp = TempDir::new().expect("tempdir");
let _workspace = EnvGuard::set_path("OPENHUMAN_WORKSPACE", tmp.path());
@@ -435,43 +259,34 @@ async fn slack_sync_status_rpc_reads_mock_connections_and_persisted_state() {
config.api_url = Some(base);
persist_config(&config).await;
store_session(&config);
- let memory = memory_global::init(config.workspace_dir.clone()).expect("memory global");
- let mut state = SyncState::new("slack", "conn-slack-round21");
- state.advance_cursor(r#"{"C21":"1714003200.000100"}"#);
- state.mark_synced("C21:1714003200.000100");
- state.record_requests(7);
- let state_adapter =
- tinymemory_core::tinycortex::HostSyncAdapter::new(memory.clone());
- state
- .save(&state_adapter)
- .await
- .expect("save slack sync state");
-
- // `sync_status_rpc` reads each connection's sync state through the bound
- // memory driver, which under the `modules` gate is the loaded tinymemory
- // artifact and resolves its config from the process-wide boot policy. A
- // row whose state read fails is skipped, so without a policy the response
- // was honestly empty and this asserted 0 == 1. Publish it from THIS
- // test's `config`: the policy is first-call-wins and the module captures
- // its workspace at load, so the state saved in-process above and the
- // state the module reads must name one store. This is the only
- // driver-routed case in this aggregated module, so nothing contends.
- #[cfg(feature = "modules")]
- openhuman_core::openhuman::modules::memory::set_modules_policy(Arc::new(config.clone()));
-
+ memory_global::init(config.workspace_dir.clone()).expect("memory global");
+
+ // `list_slack_connections` (what `sync_status_rpc` calls first) still
+ // goes through the old backend HTTP client factory, untouched by the
+ // tinyconnectors migration — so the loopback connections router above
+ // still drives it. What changed is everything after: there is no more
+ // per-connection detail to read back (see module doc comment), so this
+ // no longer seeds a `SyncState` before calling the RPC — nothing would
+ // read it.
let outcome = sync_status_rpc(&config, SyncStatusRequest::default())
.await
.expect("status rpc");
- assert_eq!(outcome.value.connections.len(), 1);
+ assert_eq!(outcome.value.connections.len(), 1, "only the active slack connection qualifies");
let row = &outcome.value.connections[0];
assert_eq!(row.connection_id, "conn-slack-round21");
- assert_eq!(row.synced_ids_count, 1);
- assert_eq!(row.requests_used_today, 7);
- assert!(row.per_channel_cursors.contains("C21"));
- assert!(outcome
- .logs
- .iter()
- .any(|line| line.contains("connections=1")));
+ assert_eq!(row.per_channel_cursors, "{}");
+ assert_eq!(row.synced_ids_count, 0);
+ assert_eq!(row.requests_used_today, 0);
+ assert_eq!(row.daily_request_limit, 0);
+ assert!(
+ outcome
+ .logs
+ .iter()
+ .any(|line| line.contains("connections=1")
+ && line.contains("no longer available")),
+ "status log should explain the degraded read: {:?}",
+ outcome.logs
+ );
server.abort();
}