Skip to content

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

feat(config): add env overlay loading and model ID types

Steven Enamakel3d5521efbeb8
diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rs
index be3f4d6d6b..7cbe2cf372 100644
--- a/crates/openhuman-core/src/config/schema/load/dirs.rs
+++ b/crates/openhuman-core/src/config/schema/load/dirs.rs
@@ -33,10 +33,6 @@ pub const PROJECTS_DIR_ENV_VAR: &str = "OPENHUMAN_PROJECTS_DIR";
/// Environment override for the agent action sandbox directory.
pub const ACTION_DIR_ENV_VAR: &str = "OPENHUMAN_ACTION_DIR";
-/// Environment override for the global memory-sync cadence (seconds).
-/// `0` means "Manual only". See issue #3302 and
-/// [`Config::memory_sync_interval_secs`].
-pub const MEMORY_SYNC_INTERVAL_SECS_ENV_VAR: &str = "OPENHUMAN_MEMORY_SYNC_INTERVAL_SECS";
fn default_root_dir_name() -> &'static str {
if crate::config::app_env::is_staging_app_env(
diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay.rs b/crates/openhuman-core/src/config/schema/load/env_overlay.rs
index 8e021430e7..b4263badd1 100644
--- a/crates/openhuman-core/src/config/schema/load/env_overlay.rs
+++ b/crates/openhuman-core/src/config/schema/load/env_overlay.rs
@@ -12,7 +12,6 @@ mod search;
use super::super::proxy::{set_runtime_proxy_config, ProxyScope};
use super::super::Config;
-use super::dirs::MEMORY_SYNC_INTERVAL_SECS_ENV_VAR;
use std::path::PathBuf;
/// Classification of an `OPENHUMAN_SHELL_HIDE_WINDOW` env value. Split out from
@@ -175,20 +174,6 @@ impl Config {
}
}
- if let Some(raw) = env.get(MEMORY_SYNC_INTERVAL_SECS_ENV_VAR) {
- let trimmed = raw.trim();
- if !trimmed.is_empty() {
- match trimmed.parse::<u64>() {
- Ok(secs) => self.memory_sync_interval_secs = Some(secs),
- Err(_) => tracing::warn!(
- env = %MEMORY_SYNC_INTERVAL_SECS_ENV_VAR,
- value = %raw,
- "invalid memory-sync interval ignored; expected an unsigned integer (0 = manual)"
- ),
- }
- }
- }
-
if let Some(language) = env.get("OPENHUMAN_OUTPUT_LANGUAGE") {
let language = language.trim();
if !language.is_empty() {
diff --git a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
index 77b65fc29f..aee1580993 100644
--- a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs
@@ -94,69 +94,6 @@ fn env_overlay_autonomy_max_actions_per_hour_accepts_valid_u32() {
);
}
-#[test]
-fn env_overlay_memory_sync_interval_parses_and_honours_zero() {
- let mut cfg = Config::default();
- assert!(cfg.memory_sync_interval_secs.is_none());
-
- // A positive value is stored verbatim.
- cfg.apply_env_overlay_with(&HashMapEnv::new().with(MEMORY_SYNC_INTERVAL_SECS_ENV_VAR, "14400"));
- assert_eq!(cfg.memory_sync_interval_secs, Some(14_400));
-
- // `0` is honoured as the "Manual only" sentinel (unlike the per-provider
- // override which rejects it).
- cfg.apply_env_overlay_with(&HashMapEnv::new().with(MEMORY_SYNC_INTERVAL_SECS_ENV_VAR, "0"));
- assert_eq!(cfg.memory_sync_interval_secs, Some(0));
-
- // A non-numeric value is ignored, leaving the previous value intact.
- cfg.apply_env_overlay_with(&HashMapEnv::new().with(MEMORY_SYNC_INTERVAL_SECS_ENV_VAR, "nope"));
- assert_eq!(cfg.memory_sync_interval_secs, Some(0));
-
- // A blank value is ignored too.
- cfg.apply_env_overlay_with(&HashMapEnv::new().with(MEMORY_SYNC_INTERVAL_SECS_ENV_VAR, " "));
- assert_eq!(cfg.memory_sync_interval_secs, Some(0));
-}
-
-#[test]
-fn env_overlay_subsystems_memory_driver_and_hooks_apply() {
- let mut cfg = Config::default();
- // The shared schema retains the persisted legacy id; binding normalizes it
- // to the built-in `tinymemory` module id.
- assert_eq!(cfg.subsystems.memory.driver, "tinycortex");
- assert!(cfg.subsystems.memory.hooks.auto_recall);
- assert!(cfg.subsystems.memory.hooks.auto_capture);
- assert_eq!(cfg.subsystems.memory.hooks.max_context_tokens, 2000);
- assert_eq!(cfg.subsystems.memory.hooks.recall_max_chars, 1000);
- assert_eq!(cfg.subsystems.memory.hooks.capture_max_chars, 500);
-
- cfg.apply_env_overlay_with(
- &HashMapEnv::new()
- .with("OPENHUMAN_MEMORY_DRIVER", "supermemory")
- .with("OPENHUMAN_MEMORY_HOOKS_AUTO_RECALL", "off")
- .with("OPENHUMAN_MEMORY_HOOKS_AUTO_CAPTURE", "false")
- .with("OPENHUMAN_MEMORY_HOOKS_MAX_CONTEXT_TOKENS", "4000")
- .with("OPENHUMAN_MEMORY_HOOKS_RECALL_MAX_CHARS", "2000")
- .with("OPENHUMAN_MEMORY_HOOKS_CAPTURE_MAX_CHARS", "900"),
- );
-
- assert_eq!(cfg.subsystems.memory.driver, "supermemory");
- assert!(!cfg.subsystems.memory.hooks.auto_recall);
- assert!(!cfg.subsystems.memory.hooks.auto_capture);
- assert_eq!(cfg.subsystems.memory.hooks.max_context_tokens, 4000);
- assert_eq!(cfg.subsystems.memory.hooks.recall_max_chars, 2000);
- assert_eq!(cfg.subsystems.memory.hooks.capture_max_chars, 900);
-
- // A blank driver value is ignored, leaving the previous override intact.
- cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_MEMORY_DRIVER", " "));
- assert_eq!(cfg.subsystems.memory.driver, "supermemory");
-
- // A non-numeric budget value is ignored, leaving the previous value intact.
- cfg.apply_env_overlay_with(
- &HashMapEnv::new().with("OPENHUMAN_MEMORY_HOOKS_MAX_CONTEXT_TOKENS", "nope"),
- );
- assert_eq!(cfg.subsystems.memory.hooks.max_context_tokens, 4000);
-}
-
#[test]
fn env_overlay_output_language_accepts_non_empty_value() {
let mut cfg = Config::default();
diff --git a/crates/openhuman-core/src/config/schema/types.rs b/crates/openhuman-core/src/config/schema/types.rs
index 3b0039e5c3..17943ff4c1 100644
--- a/crates/openhuman-core/src/config/schema/types.rs
+++ b/crates/openhuman-core/src/config/schema/types.rs
@@ -11,8 +11,8 @@ mod resolvers;
pub use config::{Config, CustomEmbeddingsConfig, ModelRegistryEntry};
pub use model_ids::{
- is_legacy_tier_model, legacy_tier_role, DEFAULT_MEMORY_SYNC_INTERVAL_SECS, DEFAULT_MODEL,
- LEGACY_TIER_MODELS, MANAGED_MULTIMODAL_MODELS, MEMORY_SYNC_INTERVAL_PRESETS_SECS,
+ is_legacy_tier_model, legacy_tier_role, DEFAULT_MODEL, LEGACY_TIER_MODELS,
+ MANAGED_MULTIMODAL_MODELS,
MODEL_IMAGE_GENERATION_AGENT, MODEL_MANAGED_DEFAULT, MODEL_MEDIA_UNDERSTANDING,
MODEL_VIDEO_GENERATION_AGENT, WORKLOAD_ROLES,
};
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index bbcff6b359..f8e4f9be4f 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -56,7 +56,6 @@ impl Default for Config {
reliability: ReliabilityConfig::default(),
scheduler: SchedulerConfig::default(),
scheduler_gate: SchedulerGateConfig::default(),
- memory_sync_interval_secs: None,
agent: AgentConfig::default(),
orchestrator: OrchestratorModelConfig::default(),
teams: HashMap::new(),
@@ -67,9 +66,6 @@ impl Default for Config {
task_sources: TaskSourcesConfig::default(),
channels_config: ChannelsConfig::default(),
memory: MemoryConfig::default(),
- memory_tree: MemoryTreeConfig::default(),
- storage: StorageConfig::default(),
- subsystems: SubsystemsConfig::default(),
composio: ComposioConfig::default(),
secrets: SecretsConfig::default(),
browser: BrowserConfig::default(),
@@ -87,7 +83,7 @@ impl Default for Config {
search: SearchConfig::default(),
proxy: ProxyConfig::default(),
cost: CostConfig::default(),
- memory_sources: Vec::new(),
+ legacy_memory_sources: Vec::new(),
agent_registry: crate::agent::registry::types::AgentRegistryConfig::default(),
agents: HashMap::new(),
local_ai: LocalAiConfig::default(),
@@ -113,13 +109,11 @@ impl Default for Config {
stt_provider: None,
tts_provider: None,
integrations: IntegrationsConfig::default(),
- learning: LearningConfig::default(),
update: UpdateConfig::default(),
dictation: DictationConfig::default(),
onboarding_completed: false,
chat_onboarding_completed: false,
model_registry: Vec::new(),
- composio_source_caps_migration_version: 0,
}
}
}
diff --git a/crates/openhuman-core/src/config/schema/types/model_ids.rs b/crates/openhuman-core/src/config/schema/types/model_ids.rs
index 1af7aee034..2354d0b36a 100644
--- a/crates/openhuman-core/src/config/schema/types/model_ids.rs
+++ b/crates/openhuman-core/src/config/schema/types/model_ids.rs
@@ -99,17 +99,3 @@ pub const MANAGED_MULTIMODAL_MODELS: [&str; 3] = [
MODEL_IMAGE_GENERATION_AGENT,
MODEL_VIDEO_GENERATION_AGENT,
];
-
-/// Effective default global memory-sync cadence (seconds) used when
-/// [`Config::memory_sync_interval_secs`] is `None` — i.e. the user has not
-/// explicitly picked a schedule. 24h, matching the "Sync every 24h" preset
-/// surfaced in the Memory Sources UI. See issue #3302.
-///
-/// Defined in `tinymemory_api::host` and re-exported here: the extracted memory
-/// subsystem applies this fallback too, and two `86_400`s that must agree is a
-/// drift waiting to happen.
-pub use tinymemory_api::host::DEFAULT_MEMORY_SYNC_INTERVAL_SECS;
-
-/// Preset memory-sync cadences (seconds) offered in the UI: 4h / 12h / 24h.
-/// "Manual only" is represented separately by `Some(0)`. See issue #3302.
-pub const MEMORY_SYNC_INTERVAL_PRESETS_SECS: [u64; 3] = [14_400, 43_200, 86_400];
diff --git a/crates/openhuman-core/src/integrations/composio/contract/runs.rs b/crates/openhuman-core/src/integrations/composio/contract/runs.rs
index d4eb967fb6..284c39fd23 100644
--- a/crates/openhuman-core/src/integrations/composio/contract/runs.rs
+++ b/crates/openhuman-core/src/integrations/composio/contract/runs.rs
@@ -37,8 +37,7 @@ impl SyncReason {
}
}
-/// Result of a provider sync run. Read by the sync status panel and written to
-/// the sync audit log.
+/// The `openhuman.composio_sync` reply.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SyncOutcome {
/// Composio toolkit slug the run covered.
@@ -61,7 +60,6 @@ pub struct SyncOutcome {
pub details: serde_json::Value,
}
-
#[cfg(test)]
#[path = "runs_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/integrations/composio/contract/runs_tests.rs b/crates/openhuman-core/src/integrations/composio/contract/runs_tests.rs
index 748a0dd26b..b582843fc3 100644
--- a/crates/openhuman-core/src/integrations/composio/contract/runs_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/contract/runs_tests.rs
@@ -1,12 +1,11 @@
//! Tests for the sync-run report vocabulary — the pure-data half.
//!
//! What is pinned here is what two separately compiled processes have to agree
-//! on: the `snake_case` reason tags that end up in audit rows, and the
-//! arithmetic on a report that a status panel renders without re-deriving.
+//! on: the `snake_case` reason tags and the reply shape.
#![allow(clippy::expect_used, clippy::unwrap_used, clippy::panic)]
-use super::{ComposioUsage, ComposioUsageHandle, SyncOutcome, SyncReason};
+use super::{SyncOutcome, SyncReason};
#[test]
fn every_sync_reason_tag_matches_its_serde_form() {
@@ -33,28 +32,6 @@ fn sync_reason_tags_are_the_stable_strings() {
assert_eq!(SyncReason::Manual.as_str(), "manual");
}
-#[test]
-fn elapsed_is_the_difference_between_the_two_stamps() {
- let outcome = SyncOutcome {
- started_at_ms: 1_000,
- finished_at_ms: 1_750,
- ..SyncOutcome::default()
- };
- assert_eq!(outcome.elapsed_ms(), 750);
-}
-
-#[test]
-fn elapsed_saturates_when_the_clock_went_backwards() {
- // Two separate clock reads; an NTP step between them must not panic a
- // status panel over a cosmetic number.
- let outcome = SyncOutcome {
- started_at_ms: 2_000,
- finished_at_ms: 1_000,
- ..SyncOutcome::default()
- };
- assert_eq!(outcome.elapsed_ms(), 0);
-}
-
#[test]
fn an_outcome_round_trips_with_its_open_details_object() {
let outcome = SyncOutcome {
@@ -74,7 +51,6 @@ fn an_outcome_round_trips_with_its_open_details_object() {
assert_eq!(back.connection_id.as_deref(), Some("conn-1"));
assert_eq!(back.reason, "periodic");
assert_eq!(back.items_ingested, 12);
- assert_eq!(back.elapsed_ms(), 4);
assert_eq!(back.summary, "12 messages");
assert_eq!(back.details["pages"], 3);
}
@@ -90,24 +66,3 @@ fn an_outcome_decodes_when_details_is_absent() {
.expect("deserialize without details");
assert!(back.details.is_null());
}
-
-#[test]
-fn cloning_a_usage_handle_shares_one_tally() {
- let handle = ComposioUsageHandle::default();
- let clone = handle.clone();
- {
- let mut usage = clone.lock().expect("usage lock");
- usage.actions_called += 2;
- usage.cost_usd += 0.5;
- }
- let usage = handle.lock().expect("usage lock");
- assert_eq!(usage.actions_called, 2);
- assert_eq!(usage.cost_usd, 0.5);
-}
-
-#[test]
-fn a_usage_tally_starts_at_zero() {
- let usage = ComposioUsage::default();
- assert_eq!(usage.actions_called, 0);
- assert_eq!(usage.cost_usd, 0.0);
-}