Skip to content

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

fix(services): correct memory adapter test to use proper assertion

Steven Enamakeld22ac3222f3a
diff --git a/crates/openhuman-core/src/core/runtime/services.rs b/crates/openhuman-core/src/core/runtime/services.rs
index 820bbf2175..36ec2f720b 100644
--- a/crates/openhuman-core/src/core/runtime/services.rs
+++ b/crates/openhuman-core/src/core/runtime/services.rs
@@ -296,27 +296,8 @@ pub fn start_bootstrap_jobs(services: ServiceSet, config: &Config) {
log::debug!("[runtime.bootstrap] memory queue workers disabled by ServiceSet");
}
- // Integrations — Composio source reconcile. No-ops without active
- // connections.
- //
- // ── The periodic loops are NOT started here any more ────────────────────
- //
- // They were, and deleting them was blocked on upstream rather than on
- // taste: `start_periodic_sync` is not host code, it re-exported through
- // `integrations::composio` to `memory::sync::composio::periodic`, which was
- // `pub use tinymemory_core::sync::composio::*` — engine code running in
- // this process against the engine this host used to boot.
- //
- // tinymemory v1.6.0 moves both loops into the module and closes the three
- // things that stopped them working there: the cadence, the Composio mode,
- // and the module's client not being in the engine's global slot. The host
- // now passes the first two in `ModuleConfig` (see `modules::ops`).
- //
- // Restoring either call would be worse than a duplicate. The cdylib carries
- // its OWN copy of `tinymemory-core`, so each loop's `OnceLock` is a
- // different static from this process's: a host that starts them while
- // loading the module gets TWO pairs of loops over one store, and neither
- // can see the other.
+ // Integrations — no bootstrap job. Composio → memory syncs run on memory
+ // v2 source schedules (`memory::sources`), not a host loop here.
if plan.composio_integration_sync {
log::debug!(
"[runtime.bootstrap] composio integrations enabled; memory syncs run on memory source schedules"
diff --git a/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs b/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
index acfe977304..44d35eb887 100644
--- a/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/memory_adapter_tests.rs
@@ -9,11 +9,9 @@ fn security(autonomy: AutonomyLevel) -> Arc<SecurityPolicy> {
})
}
-/// A `Config` rooted at a fresh tempdir — `lookup_flavour` (via
-/// `flavour`) touches disk under `workspace_dir`, so every test needs its
-/// own isolated root rather than sharing whatever `Config::default()`'s
-/// workspace_dir happens to resolve to. The `TempDir` guard must outlive
-/// the adapter, so callers keep it alive for the test's duration.
+/// A `Config` rooted at a fresh tempdir with an in-memory reference engine
+/// bound to it. The `TempDir` guard must outlive the adapter, so callers keep
+/// it alive for the test's duration.
fn test_config() -> (TempDir, Arc<Config>) {
let tmp = TempDir::new().unwrap();
let mut cfg = Config::default();
@@ -23,12 +21,10 @@ fn test_config() -> (TempDir, Arc<Config>) {
fn adapter(autonomy: AutonomyLevel) -> (TempDir, OpenHumanMemory) {
let (tmp, config) = test_config();
- // `flavour` reads through `MemoryTree::flavour_profile` since #5560, so the
- // workspace needs a driver serving the Tree family — the null driver a test
- // workspace otherwise resolves to answers `Unsupported`, which the node
- // reports as a capability error rather than as an absent profile. This is
- // the driver the loaded module wraps.
- crate::memory::test_support::install_memory_driver_for_test(&config);
+ crate::memory::engine::install_test_engine(
+ &config.workspace_dir,
+ Arc::new(tinymemory::conformance::ReferenceEngine::new()),
+ );
(
tmp,
OpenHumanMemory {
@@ -112,7 +108,7 @@ async fn remember_flow_scope_without_trusted_origin_errs() {
///
/// This is asserted indirectly but unambiguously: with NO trusted
/// `TrustedAutomation { Workflow }` origin scoped, `remember`'s later steps
-/// (the tier-gate write summary is fine, but `flow_memory_namespace` —
+/// (the tier-gate write summary is fine, but the trusted flow id —
/// reached only AFTER the tier gate — requires one and errors
/// `"trusted Workflow-scoped origin"` if missing, see
/// `remember_flow_scope_without_trusted_origin_errs` above). If the secret
@@ -197,33 +193,96 @@ async fn forget_blocked_in_readonly_autonomy() {
assert!(err.to_string().contains(POLICY_BLOCKED_MARKER));
}
-// ── flavour / people delegate cleanly with no trusted origin required ──
+// ── flavour / people: unsupported in memory v2 ──────────────────────────
#[tokio::test]
-async fn flavour_unknown_slug_errs() {
+async fn flavour_reports_every_slug_unknown() {
let (_tmp, adapter) = adapter(AutonomyLevel::Full);
- let err = adapter.flavour("not-a-real-flavour").await.unwrap_err();
- assert!(err.to_string().contains("Unknown flavour"));
+ let err = adapter.flavour("coding_style").await.unwrap_err();
+ assert!(err.to_string().contains("unknown flavour"));
+}
+
+#[tokio::test]
+async fn people_returns_an_empty_unsupported_listing() {
+ let (_tmp, adapter) = adapter(AutonomyLevel::ReadOnly);
+ let result = adapter.people(Some("ada")).await.unwrap();
+ assert_eq!(result["people"], json!([]));
+ assert_eq!(result["supported"], json!(false));
+}
+
+// ── round trip inside a trusted workflow run ──────────────────────────
+
+fn workflow_origin(flow_id: &str) -> AgentTurnOrigin {
+ AgentTurnOrigin::TrustedAutomation {
+ job_id: flow_id.to_string(),
+ source: TrustedAutomationSource::Workflow {
+ require_approval: false,
+ },
+ }
}
#[tokio::test]
-async fn flavour_valid_slug_with_no_tree_yet_reports_not_found() {
+async fn remember_search_and_forget_round_trip_in_the_flows_own_scope() {
let (_tmp, adapter) = adapter(AutonomyLevel::Full);
- let result = adapter.flavour("coding_style").await.unwrap();
- assert_eq!(result["found"], json!(false));
- assert_eq!(result["profile"], Value::Null);
+ turn_origin::with_origin(workflow_origin("f1"), async {
+ adapter
+ .remember("flow", "sent", json!("newsletter item 42"))
+ .await
+ .unwrap();
+ adapter
+ .remember("flow", "sent", json!("newsletter item 43"))
+ .await
+ .unwrap();
+ let found = adapter
+ .recall("flow", "newsletter item", json!({"operation": "search"}))
+ .await
+ .unwrap();
+ let results = found["results"].as_array().unwrap();
+ assert_eq!(results.len(), 1, "a key rewrite replaces the old value");
+ assert_eq!(results[0]["key"], json!("sent"));
+ let text = results[0]["text"].as_str().unwrap();
+ assert!(text.contains("item 43"));
+ assert!(text.contains("untrusted-source"), "flow output is marked as data");
+
+ let recalled = adapter
+ .recall("flows", "newsletter item", json!({"operation": "recall"}))
+ .await
+ .unwrap();
+ assert!(recalled["answer"].is_string());
+ assert_eq!(recalled["results"].as_array().unwrap().len(), 1);
+
+ adapter.forget("flow", "sent").await.unwrap();
+ adapter.forget("flow", "never-written").await.unwrap();
+ let after = adapter
+ .recall("flow", "newsletter item", json!({"operation": "search"}))
+ .await
+ .unwrap();
+ assert!(after["results"].as_array().unwrap().is_empty());
+ })
+ .await;
}
#[tokio::test]
-async fn flavour_blocked_in_readonly_autonomy_still_reaches_lookup() {
- // Read is Allow at every tier, so ReadOnly must behave identically
- // to Full for a read-only operation like `flavour`.
- let (_tmp, adapter) = adapter(AutonomyLevel::ReadOnly);
- let result = adapter.flavour("coding_style").await.unwrap();
- assert_eq!(result["found"], json!(false));
+async fn flow_scope_never_sees_another_flows_items() {
+ let (_tmp, adapter) = adapter(AutonomyLevel::Full);
+ turn_origin::with_origin(workflow_origin("f-other"), async {
+ adapter
+ .remember("flow", "k", json!("other flow note"))
+ .await
+ .unwrap();
+ })
+ .await;
+ turn_origin::with_origin(workflow_origin("f-mine"), async {
+ let found = adapter
+ .recall("flow", "other flow note", json!({"operation": "search"}))
+ .await
+ .unwrap();
+ assert!(found["results"].as_array().unwrap().is_empty());
+ })
+ .await;
}
-// ── value_to_content / filter_people_by_query (pure helpers) ──────────
+// ── pure helpers ───────────────────────────────────────────────────────
#[test]
fn value_to_content_keeps_strings_verbatim() {
@@ -241,42 +300,15 @@ fn value_to_content_serializes_non_strings() {
}
#[test]
-fn filter_people_by_query_matches_display_name_case_insensitively() {
- let listing = json!({
- "people": [
- {"display_name": "Ada Lovelace", "primary_email": null, "primary_phone": null, "handles": []},
- {"display_name": "Grace Hopper", "primary_email": null, "primary_phone": null, "handles": []},
- ]
- });
- let filtered = filter_people_by_query(listing, "ada");
- let people = filtered["people"].as_array().unwrap();
- assert_eq!(people.len(), 1);
- assert_eq!(people[0]["display_name"], json!("Ada Lovelace"));
-}
-
-#[test]
-fn filter_people_by_query_matches_handle_values() {
- let listing = json!({
- "people": [
- {
- "display_name": "Someone",
- "primary_email": null,
- "primary_phone": null,
- "handles": [{"kind": "email", "value": "[email protected]"}]
- },
- ]
- });
- let filtered = filter_people_by_query(listing, "example.com");
- assert_eq!(filtered["people"].as_array().unwrap().len(), 1);
+fn min_score_keeps_unscored_rows() {
+ assert!(passes_min_score(None, Some(0.9)));
+ assert!(passes_min_score(Some(0.5), None));
+ assert!(!passes_min_score(Some(0.1), Some(0.5)));
}
#[test]
-fn filter_people_by_query_no_match_returns_empty() {
- let listing = json!({
- "people": [
- {"display_name": "Ada Lovelace", "primary_email": null, "primary_phone": null, "handles": []},
- ]
- });
- let filtered = filter_people_by_query(listing, "zzz-no-match");
- assert!(filtered["people"].as_array().unwrap().is_empty());
+fn plain_agent_learnings_are_trusted_and_everything_else_is_not() {
+ assert!(!is_untrusted(&MemoryMeta::default()));
+ assert!(is_untrusted(&crate::flows::flow_meta("f", &[])));
+ assert!(is_untrusted(&MemoryMeta::from_source(SourceKind::Composio, None)));
}
diff --git a/crates/openhuman-core/src/integrations/composio/providers/mod.rs b/crates/openhuman-core/src/integrations/composio/providers/mod.rs
index 051bef7111..51c6325fde 100644
--- a/crates/openhuman-core/src/integrations/composio/providers/mod.rs
+++ b/crates/openhuman-core/src/integrations/composio/providers/mod.rs
@@ -1,32 +1,9 @@
-//! The Composio provider surface, sourced by what each half actually is.
-//!
-//! This was one line — `pub use crate::memory::sync::composio::providers::*;`
-//! — a compatibility shim over the engine crate's provider module. The glob
-//! hid the fact that two very different things were coming through it, and
-//! that most of what this host reads is not provider behaviour at all
-//! (OpenHuman#5560).
-//!
-//! - **The curated catalogs, the scope verdicts and the identity vocabulary**
-//! come from the contract crate (`tinymemory-bus`/`tinymemory-api`). They
-//! are `&'static str` tables, pure functions over them, and inert payload
-//! types; nothing about answering "is this action curated, and at what
-//! scope" needs a provider, an HTTP client or a store. Every host read
-//! here — the agent's visible tool list, the `gated_tools` unlock hints,
-//! the agent-ready badge — is one of these.
-//! - **The provider registry, the `ComposioProvider` trait, `ProviderContext`
-//! and the run types are gone.** tinymemory v1.13.4 deleted the in-process
-//! Composio pipeline outright (72 files, ~18.3k lines) rather than moving
-//! it behind `MemorySourceSync` — reaching a connected account needs a
-//! credential this crate must not hold. There is no registry to glob-import
-//! any more. Every former `get_provider(toolkit)` call site now either:
-//!
-//! - answers from `catalog_for_toolkit`/`has_native_provider` directly
-//! (curated-tool lookups — a native provider's `curated_tools()` was
-//! always verified identical to its catalog entry, so the registry hop
-//! was pure indirection), or
-//! - calls the `tinyconnectors` module directly through
-//! [`super::module_client`] (profile fetch, action execution, sync —
-//! see `ops::sync::run_sync_pass` and `ops::execute`).
+//! The Composio provider surface: curated catalogs, scope verdicts, the
+//! identity vocabulary and the run types, all from
+//! [`crate::integrations::composio::contract`]. They are `&'static str`
+//! tables, pure functions and inert payload types. Reading a connected
+//! account goes through the connector module ([`super::module_client`]):
+//! profile fetch, action execution and sync (`ops::sync::run_sync_pass`).
// ── The contract half ───────────────────────────────────────────────────────
pub use crate::integrations::composio::contract::catalogs::{