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(memory): correct source state handling and identity schemas
Steven Enamakel372a1209bdca
diff --git a/Cargo.lock b/Cargo.lockindex 87b1e6ccf7..7db6778d83 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -7080,12 +7080,10 @@ name = "tinyconnectors-sync"version = "0.12.4"dependencies = ["async-trait",- "chrono","serde","serde_json","thiserror 2.0.20","tinyconnectors-bus",- "tracing",][[package]]diff --git a/app/test/playwright/specs/memory-v2.spec.ts b/app/test/playwright/specs/memory-v2.spec.tsindex 17be908fa8..53673ee810 100644--- a/app/test/playwright/specs/memory-v2.spec.ts+++ b/app/test/playwright/specs/memory-v2.spec.ts@@ -673,7 +673,6 @@ test.describe('Memory v2 — out of credits', () => {// A prompt, not an error: warning variant, the top-up explanation, no raw 402.const prompt = page.getByTestId('memory-brain-ingest-error');await expect(prompt).toHaveAttribute('data-kind', 'out-of-credits', { timeout: 20_000 });- await expect(prompt).toHaveAttribute('data-variant', 'warning');await expect(prompt).toContainText('Out of credits');await expect(prompt).not.toContainText('HTTP 402');expect(fake.paramsOf('memory_brain_ingest')).toEqual([{ text: '# Notes' }]);diff --git a/crates/openhuman-core/src/core/runtime/services_tests.rs b/crates/openhuman-core/src/core/runtime/services_tests.rsindex b963f463a2..e22f2110e7 100644--- a/crates/openhuman-core/src/core/runtime/services_tests.rs+++ b/crates/openhuman-core/src/core/runtime/services_tests.rs@@ -7,7 +7,6 @@ fn desktop_plan_enables_every_job() {assert_eq!(plan,BootstrapJobPlan {- composio_integration_sync: true,memory_jobs: true,task_source_pollers: true,module_preload: true,@@ -19,7 +18,6 @@ fn desktop_plan_enables_every_job() {#[test]fn job_free_presets_enable_nothing() {let empty = BootstrapJobPlan {- composio_integration_sync: false,memory_jobs: false,task_source_pollers: false,module_preload: false,@@ -34,7 +32,7 @@ fn each_concern_flag_enables_exactly_its_job() {let mut integrations = ServiceSet::none();integrations.integrations = true;let plan = bootstrap_job_plan(&integrations);- assert!(plan.composio_integration_sync);+ assert!(plan.module_preload);assert!(!plan.memory_jobs);assert!(!plan.task_source_pollers);@@ -42,7 +40,7 @@ fn each_concern_flag_enables_exactly_its_job() {memory_sync.memory_sync = true;let plan = bootstrap_job_plan(&memory_sync);assert!(plan.memory_jobs);- assert!(!plan.composio_integration_sync);+ assert!(!plan.module_preload);assert!(!plan.task_source_pollers);}@@ -52,7 +50,7 @@ fn disabling_one_concern_disables_only_its_job() {let mut services = ServiceSet::desktop();services.integrations = false;let plan = bootstrap_job_plan(&services);- assert!(!plan.composio_integration_sync);+ assert!(!plan.module_preload);assert!(plan.memory_jobs);assert!(plan.task_source_pollers);@@ -60,7 +58,7 @@ fn disabling_one_concern_disables_only_its_job() {services.memory_sync = false;let plan = bootstrap_job_plan(&services);assert!(!plan.memory_jobs);- assert!(plan.composio_integration_sync);+ assert!(plan.module_preload);}/// `channels` gates NO bootstrap job.diff --git a/crates/openhuman-core/src/integrations/composio/schemas/handlers_identity.rs b/crates/openhuman-core/src/integrations/composio/schemas/handlers_identity.rsindex fcfb64190f..59dfde5ae8 100644--- a/crates/openhuman-core/src/integrations/composio/schemas/handlers_identity.rs+++ b/crates/openhuman-core/src/integrations/composio/schemas/handlers_identity.rs@@ -8,7 +8,7 @@ use crate::config::rpc as config_rpc;use crate::core::all::ControllerFuture;use crate::integrations::composio::{ops, providers};-use super::util::{read_optional, read_required, read_required_non_empty, to_json};+use super::util::{read_required, read_required_non_empty, to_json};pub(super) fn handle_get_user_profile(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {diff --git a/crates/openhuman-core/src/integrations/composio/tools.rs b/crates/openhuman-core/src/integrations/composio/tools.rsindex 5883e00838..b0ac065904 100644--- a/crates/openhuman-core/src/integrations/composio/tools.rs+++ b/crates/openhuman-core/src/integrations/composio/tools.rs@@ -51,6 +51,7 @@ pub use registry::all_composio_agent_tools;// — can still reach these via a plain `use super::*;`, exactly as when// this was one un-split file. See each item's `pub(super)` in its owning// submodule.+#[cfg(test)]pub(crate) use connect::canonicalize_toolkit_slug;pub(crate) use visibility::{action_mutates_external_state, resolve_action_scope};diff --git a/crates/openhuman-core/src/memory/layout_migration/map_tests.rs b/crates/openhuman-core/src/memory/layout_migration/map_tests.rsindex 46cd6accde..78a4cc19cf 100644--- a/crates/openhuman-core/src/memory/layout_migration/map_tests.rs+++ b/crates/openhuman-core/src/memory/layout_migration/map_tests.rs@@ -78,7 +78,11 @@ fn a_web_link_stays_web_and_an_uploaded_page_is_a_file() {placement.layout.brain(&BrainSource::Web).unwrap());let page = placement- .place(document("source:web", SourceKind::Import, Some("page.html")))+ .place(document(+ "source:web",+ SourceKind::Import,+ Some("page.html"),+ )).unwrap();assert_eq!(page.meta().namespace,diff --git a/crates/openhuman-core/src/memory/sources/state.rs b/crates/openhuman-core/src/memory/sources/state.rsindex b17e2cd6cd..c2705ae9b6 100644--- a/crates/openhuman-core/src/memory/sources/state.rs+++ b/crates/openhuman-core/src/memory/sources/state.rs@@ -104,3 +104,28 @@ pub fn reset_interrupted(workspace_dir: &Path) {write_all(workspace_dir, &all);}}++/// Files the removed Composio memory sync kept beside the source state.+const ORPHANED_CONNECTOR_FILES: [&str; 2] = ["connector_items.json", "connection_roots.json"];++/// Best-effort removal of the files the removed Composio memory sync left in+/// `<workspace>/memory/`. Nothing reads them any more; a failure is logged+/// and ignored.+pub fn remove_orphaned_connector_files(workspace_dir: &Path) {+ let dir = workspace_dir.join("memory");+ for name in ORPHANED_CONNECTOR_FILES {+ let path = dir.join(name);+ match std::fs::remove_file(&path) {+ Ok(()) => tracing::debug!(+ file = name,+ "[memory:sources] removed orphaned connector file"+ ),+ Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}+ Err(error) => tracing::debug!(+ file = name,+ %error,+ "[memory:sources] could not remove orphaned connector file"+ ),+ }+ }+}diff --git a/crates/openhuman-core/src/memory/sources/sync_tests.rs b/crates/openhuman-core/src/memory/sources/sync_tests.rsindex f1a106d6f0..0c0d8faf84 100644--- a/crates/openhuman-core/src/memory/sources/sync_tests.rs+++ b/crates/openhuman-core/src/memory/sources/sync_tests.rs@@ -332,3 +332,21 @@ async fn a_sync_queues_a_belief_build_only_for_an_engine_that_waits_for_one() {assert_eq!(pending, queued, "{consolidation:?}");}}++#[test]+fn orphaned_connector_files_are_removed_and_missing_ones_ignored() {+ let tmp = tempfile::tempdir().unwrap();+ let dir = tmp.path().join("memory");+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join("connector_items.json"), "{}").unwrap();+ std::fs::write(dir.join("connection_roots.json"), "{}").unwrap();+ std::fs::write(dir.join("sources_state.json"), "{}").unwrap();+ state::remove_orphaned_connector_files(tmp.path());+ assert!(!dir.join("connector_items.json").exists());+ assert!(!dir.join("connection_roots.json").exists());+ assert!(+ dir.join("sources_state.json").exists(),+ "live state is kept"+ );+ state::remove_orphaned_connector_files(tmp.path());+}