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
feat(config): add memory schema migration
Steven Enamakel9ab70a25dc6d
diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rsindex b6c58abc12..8b2dce9d48 100644--- a/crates/openhuman-core/src/config/schema/load/migrate.rs+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs@@ -215,7 +215,7 @@ pub(crate) fn migrate_search_settings(config: &mut Config) {/// Migrates legacy v1 `[[memory_sources]]` into `[[memory.sources]]`, once:/// only when no v2 source exists yet. Kinds without a v2 equivalent-/// (`twitter_query`, `conversation`) and disabled entries are dropped. The+/// (`twitter_query`, `conversation`, and the removed `composio`) and disabled entries are dropped. The/// legacy list is cleared either way, so it is never written back.pub(crate) fn migrate_legacy_memory_sources(config: &mut Config) {let legacy = std::mem::take(&mut config.legacy_memory_sources);diff --git a/crates/openhuman-core/src/config/schema/memory.rs b/crates/openhuman-core/src/config/schema/memory.rsindex d6382eb0c5..9e126253c7 100644--- a/crates/openhuman-core/src/config/schema/memory.rs+++ b/crates/openhuman-core/src/config/schema/memory.rs@@ -328,7 +328,8 @@ impl Default for MemoryRecallConfig {}}-/// What a document source reads.+/// What a document source reads. The `composio` kind was removed: a saved+/// entry of that kind is dropped at load.#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]#[serde(rename_all = "snake_case")]pub enum MemorySourceKind {@@ -342,19 +343,16 @@ pub enum MemorySourceKind {Github,/// An RSS or Atom feed.Rss,- /// A connected Composio toolkit.- Composio,}impl MemorySourceKind {/// Every kind, in display order.- pub const ALL: [Self; 6] = [+ pub const ALL: [Self; 5] = [Self::Folder,Self::File,Self::Link,Self::Github,Self::Rss,- Self::Composio,];/// Wire name.@@ -366,7 +364,6 @@ impl MemorySourceKind {Self::Link => "link",Self::Github => "github",Self::Rss => "rss",- Self::Composio => "composio",}}@@ -388,7 +385,7 @@ pub struct MemorySourceConfig {pub id: String,/// What the source reads.pub kind: MemorySourceKind,- /// Path, URL, `owner/repo`, feed URL or Composio toolkit.+ /// Path, URL, `owner/repo` or feed URL.pub target: String,/// Display label.#[serde(default)]@@ -414,7 +411,9 @@ where}/// Decodes source entries leniently: an entry that does not parse is dropped-/// with a warning naming only its index and reason (never its contents).+/// with a warning naming only its index and reason (never its contents). This+/// is also how a saved `composio` source (a removed kind) disappears: its+/// `kind` no longer parses.pub(crate) fn decode_sources_lenient(raw: Vec<serde_json::Value>) -> Vec<MemorySourceConfig> {raw.into_iter().enumerate()@@ -425,7 +424,7 @@ pub(crate) fn decode_sources_lenient(raw: Vec<serde_json::Value>) -> Vec<MemoryStracing::warn!(index,error = %error,- "[memory:config] dropping unreadable memory source entry"+ "[memory:config] dropping unreadable or removed-kind memory source entry");None}@@ -437,7 +436,7 @@ pub(crate) fn decode_sources_lenient(raw: Vec<serde_json::Value>) -> Vec<MemoryS/// Maps one legacy v1 `[[memory_sources]]` entry onto a v2 source.////// v1 kinds map as `folder`→`folder`, `file`→`file`, `web_page`→`link`,-/// `github_repo`→`github`, `rss_feed`→`rss`, `composio`→`composio`. The v1+/// `github_repo`→`github`, `rss_feed`→`rss`. The v1 `composio`,/// `twitter_query` and `conversation` kinds have no v2 equivalent and are/// dropped, as is anything else unrecognised or missing its target.#[must_use]@@ -457,13 +456,15 @@ pub fn migrate_legacy_source(value: &serde_json::Value) -> Option<MemorySourceCo"web_page" => MemorySourceKind::Link,"github_repo" => MemorySourceKind::Github,"rss_feed" => MemorySourceKind::Rss,- "composio" => MemorySourceKind::Composio,+ "composio" => {+ tracing::warn!("[memory:config] dropping legacy composio memory source (removed kind)");+ return None;+ }_ => return None,};let target = match kind {MemorySourceKind::Folder | MemorySourceKind::File => text("path")?,MemorySourceKind::Link | MemorySourceKind::Github | MemorySourceKind::Rss => text("url")?,- MemorySourceKind::Composio => text("toolkit")?,};if object.get("enabled").and_then(serde_json::Value::as_bool) == Some(false) {return None;diff --git a/crates/openhuman-core/src/config/schema/memory_tests.rs b/crates/openhuman-core/src/config/schema/memory_tests.rsindex 63b8fc7add..589bcff715 100644--- a/crates/openhuman-core/src/config/schema/memory_tests.rs+++ b/crates/openhuman-core/src/config/schema/memory_tests.rs@@ -150,6 +150,50 @@ target = "https://example.com/feed.xml"assert_eq!(config.sources[0].label, "", "label defaults to empty");}+#[test]+fn drops_a_stale_composio_source_and_keeps_every_other_kind() {+ let config: MemoryConfig = toml::from_str(+ r#"+[[sources]]+id = "src-composio"+kind = "composio"+target = "gmail"++[[sources]]+id = "src-link"+kind = "link"+target = "https://example.com"++[[sources]]+id = "src-github"+kind = "github"+target = "o/r"++[[sources]]+id = "src-rss"+kind = "rss"+target = "https://example.com/feed.xml"++[[sources]]+id = "src-folder"+kind = "folder"+target = "/notes"++[[sources]]+id = "src-file"+kind = "file"+target = "/notes/a.md"+"#,+ )+ .expect("a removed kind must not fail the section");+ let ids: Vec<&str> = config.sources.iter().map(|s| s.id.as_str()).collect();+ assert_eq!(+ ids,+ ["src-link", "src-github", "src-rss", "src-folder", "src-file"]+ );+ assert_eq!(MemorySourceKind::parse("composio"), None);+}+#[test]fn endpoint_for_ignores_blank_and_missing_endpoints() {let mut config = MemoryConfig::default();@@ -217,11 +261,6 @@ fn migrates_every_mappable_legacy_kind() {MemorySourceKind::Rss,"https://f",),- (- json!({"id":"f","kind":"composio","toolkit":"gmail"}),- MemorySourceKind::Composio,- "gmail",- ),];for (legacy, kind, target) in cases {let migrated = migrate_legacy_source(&legacy).expect("mappable kind migrates");@@ -246,6 +285,7 @@ fn migration_drops_unmappable_disabled_and_incomplete_entries() {for legacy in [json!({"id":"t","kind":"twitter_query","query":"rust"}),json!({"id":"c","kind":"conversation"}),+ json!({"id":"k","kind":"composio","toolkit":"gmail"}),json!({"id":"x","kind":"folder","path":"/p","enabled":false}),json!({"id":"y","kind":"folder"}),json!({"kind":"folder","path":"/p"}),