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(memory): serve the scheduler gate to the module; manual override RPC
Shanu21ba08003ed9
diff --git a/src/core/cli.rs b/src/core/cli.rsindex f807c4ceb6..f0a2ea9393 100644--- a/src/core/cli.rs+++ b/src/core/cli.rs@@ -500,7 +500,20 @@ fn run_call_command(args: &[String]) -> Result<()> {.max_blocking_threads(crate::core::runtime::MAX_BLOCKING_THREADS).build()?;let value = rt- .block_on(async { invoke_method(default_state(), &method, params).await })+ .block_on(async {+ // A raw call is its own process: the server publishes the module+ // host policy during boot, and a method that crosses the memory+ // module binding (since the round-2 migration, most of them)+ // fails with "the module host policy was never published"+ // without this — the same per-process publish the memory and+ // tree-summarizer subcommand families already do.+ #[cfg(feature = "modules")]+ if let Ok(config) = crate::openhuman::config::Config::load_or_init().await {+ crate::openhuman::memory::host::install_memory_event_sink();+ crate::openhuman::modules::memory::set_modules_policy(std::sync::Arc::new(config));+ }+ invoke_method(default_state(), &method, params).await+ }).map_err(anyhow::Error::msg)?;// Output the result as pretty-printed JSON to stdout.diff --git a/src/openhuman/integrations/composio/ops/mod.rs b/src/openhuman/integrations/composio/ops/mod.rsindex 05dd667961..c5aa5a4a21 100644--- a/src/openhuman/integrations/composio/ops/mod.rs+++ b/src/openhuman/integrations/composio/ops/mod.rs@@ -40,6 +40,7 @@ pub use connections::{composio_authorize, composio_delete_connection, composio_lpub use direct_mode::{composio_clear_api_key, composio_get_mode, composio_set_api_key};pub(crate) use error_utils::{report_composio_op_error, should_forward_tags};pub use execute::composio_execute;+#[cfg(test)]pub(crate) use providers_ops::completed_sync_detail;pub use providers_ops::{composio_get_user_profile, composio_refresh_all_identities, composio_sync,diff --git a/src/openhuman/memory/ops/mod.rs b/src/openhuman/memory/ops/mod.rsindex faafa03f26..0e66b1dfdd 100644--- a/src/openhuman/memory/ops/mod.rs+++ b/src/openhuman/memory/ops/mod.rs@@ -54,8 +54,9 @@ pub use kv_graph::{pub use learn::{memory_learn_all, LearnAllParams, LearnAllResult, NamespaceLearnResult};pub use provider::{memory_provider_status, memory_subsystem_status};pub use sync::{- memory_ingestion_status, memory_sync_all, memory_sync_channel, IngestionStatusResult,- SyncAllResult, SyncChannelParams, SyncChannelResult,+ memory_ingestion_status, memory_scheduler_override, memory_sync_all, memory_sync_channel,+ IngestionStatusResult, SchedulerOverrideResult, SyncAllResult, SyncChannelParams,+ SyncChannelResult,};pub use tool_memory::{tool_rule_delete, tool_rule_get, tool_rule_list, tool_rule_put, tool_rules_for_prompt,diff --git a/src/openhuman/memory/ops/sync.rs b/src/openhuman/memory/ops/sync.rsindex a8097b7710..036b482c58 100644--- a/src/openhuman/memory/ops/sync.rs+++ b/src/openhuman/memory/ops/sync.rs@@ -360,3 +360,49 @@ async fn ingestion_status_for_config(config: &Config) -> Result<IngestionStatusR#[cfg(test)]#[path = "sync_tests.rs"]mod tests;++/// `openhuman.memory_scheduler_override` result.+#[derive(Debug, serde::Serialize)]+pub struct SchedulerOverrideResult {+ pub overridden: bool,+ pub seconds: u64,+}++/// `openhuman.memory_scheduler_override` — open a bounded manual-override+/// window on the module's scheduler gate.+///+/// The gate's pauses (`mode = off`, signed-out, battery) protect the user+/// from background cost they did not ask for; this RPC is the sanctioned+/// exception for work they explicitly did — "process my memory now" while+/// the gate is off (openhuman#5935). The window is clamped module-side to an+/// hour; the default asks for ten minutes.+pub async fn memory_scheduler_override(+ seconds: Option<u64>,+) -> Result<RpcOutcome<SchedulerOverrideResult>, String> {+ let seconds = seconds.unwrap_or(600).min(3600);+ #[cfg(feature = "modules")]+ {+ crate::openhuman::modules::memory::ModuleMemoryProvider::from_boot_policy()+ .override_scheduler_gate(seconds)+ .await+ .map_err(|error| format!("scheduler override: {error}"))?;+ Ok(RpcOutcome::new(+ SchedulerOverrideResult {+ overridden: true,+ seconds,+ },+ vec![format!(+ "memory: scheduler gate overridden for {seconds}s — background maintenance runs \+ now regardless of the gate's pause"+ )],+ ))+ }+ #[cfg(not(feature = "modules"))]+ {+ Err(+ "scheduler override needs the modules feature: the gate lives in the loaded memory \+ module"+ .to_string(),+ )+ }+}diff --git a/src/openhuman/memory/schemas/sync.rs b/src/openhuman/memory/schemas/sync.rsindex d6b4a28291..dc4ee2cbca 100644--- a/src/openhuman/memory/schemas/sync.rs+++ b/src/openhuman/memory/schemas/sync.rs@@ -8,7 +8,12 @@ use crate::openhuman::memory::rpc::{self, SyncChannelParams};use super::{parse_params, to_json};-pub(super) const FUNCTIONS: &[&str] = &["sync_channel", "sync_all", "ingestion_status"];+pub(super) const FUNCTIONS: &[&str] = &[+ "sync_channel",+ "sync_all",+ "ingestion_status",+ "scheduler_override",+];pub(super) fn controllers() -> Vec<RegisteredController> {vec![@@ -24,6 +29,10 @@ pub(super) fn controllers() -> Vec<RegisteredController> {schema: schema("ingestion_status").unwrap(),handler: handle_ingestion_status,},+ RegisteredController {+ schema: schema("scheduler_override").unwrap(),+ handler: handle_scheduler_override,+ },]}@@ -67,6 +76,23 @@ pub(super) fn schema(function: &str) -> Option<ControllerSchema> {FieldSchema { name: "last_success", ty: TypeSchema::Option(Box::new(TypeSchema::Bool)), comment: "Whether the most recent job succeeded.", required: false },],},+ "scheduler_override" => ControllerSchema {+ namespace: "memory",+ function: "scheduler_override",+ description: "Open a bounded manual-override window on the memory module's background \+ scheduler gate, so user-requested maintenance runs even while the gate \+ is paused (mode=off, signed out, on battery). Clamped to one hour.",+ inputs: vec![FieldSchema {+ name: "seconds",+ ty: TypeSchema::Option(Box::new(TypeSchema::U64)),+ comment: "Window length in seconds; default 600, clamped to 3600.",+ required: false,+ }],+ outputs: vec![+ FieldSchema { name: "overridden", ty: TypeSchema::Bool, comment: "True when the module accepted the window.", required: true },+ FieldSchema { name: "seconds", ty: TypeSchema::U64, comment: "The clamped window actually opened.", required: true },+ ],+ },_ => return None,})}@@ -86,6 +112,13 @@ fn handle_ingestion_status(_params: Map<String, Value>) -> ControllerFuture {Box::pin(async move { to_json(rpc::memory_ingestion_status().await?) })}+fn handle_scheduler_override(params: Map<String, Value>) -> ControllerFuture {+ Box::pin(async move {+ let seconds = params.get("seconds").and_then(Value::as_u64);+ to_json(rpc::memory_scheduler_override(seconds).await?)+ })+}+#[cfg(test)]#[path = "sync_tests.rs"]mod tests;diff --git a/src/openhuman/modules/memory_host.rs b/src/openhuman/modules/memory_host.rsindex 0d8c7f3585..7470fa3b0c 100644--- a/src/openhuman/modules/memory_host.rs+++ b/src/openhuman/modules/memory_host.rs@@ -392,6 +392,40 @@ impl RuntimeCallbacks {Ok(())}+ /// The host's background-AI policy, as wire strings.+ ///+ /// Answered from `cron::scheduler_gate` — the same process-global the+ /// in-process `OpenHumanSchedulerGate` seam reads — so mode+ /// (`auto`/`always_on`/`off`), battery, CPU pressure and signed-out state+ /// all reach a loaded module. The module polls this and caches it; see+ /// `BusSchedulerGate` in tinymemory-module. The tier crosses as a string+ /// pair rather than the `Policy` enum so the wire stays additive: a tier+ /// this host grows later degrades to `normal` on an older module instead+ /// of failing decode.+ async fn scheduler_policy(&self) -> tinybus::Result<(String, Option<String>)> {+ use tinymemory_api::host::{PauseReason, Policy};+ Ok(+ match crate::openhuman::cron::scheduler_gate::gate::current_policy() {+ Policy::Aggressive => ("aggressive".to_string(), None),+ Policy::Normal => ("normal".to_string(), None),+ Policy::Throttled => ("throttled".to_string(), None),+ Policy::Paused { reason } => (+ "paused".to_string(),+ Some(+ match reason {+ PauseReason::UserDisabled => "user_disabled",+ PauseReason::OnBattery => "on_battery",+ PauseReason::CpuPressure => "cpu_pressure",+ PauseReason::SignedOut => "signed_out",+ PauseReason::Unknown => "unknown",+ }+ .to_string(),+ ),+ ),+ },+ )+ }+async fn extract_spacy(&self, text: String) -> tinybus::Result<SpacyResponse> {let response = crate::openhuman::runtime::python_server::extract_spacy(&self.0, &text).awaitdiff --git a/src/openhuman/modules/memory_part_02.rs b/src/openhuman/modules/memory_part_02.rsindex 47394510b3..2c0f33373a 100644--- a/src/openhuman/modules/memory_part_02.rs+++ b/src/openhuman/modules/memory_part_02.rs@@ -695,3 +695,21 @@ impl MemorySourceSync for ModuleMemoryProvider {)}}++impl ModuleMemoryProvider {+ /// Open a bounded manual-override window on the module's scheduler gate.+ ///+ /// Not part of the `MemoryProvider` contract traits: the override is a+ /// host-initiated maintenance action, not a memory capability, and adding+ /// it to `tinymemory-api` would put a consent-bypass lever into every+ /// embedding's vocabulary. The module serves it as a plain member+ /// (`OverrideSchedulerGate`), and only this host client names it.+ pub(crate) async fn override_scheduler_gate(&self, seconds: u64) -> Result<(), MemoryError> {+ module_call!(+ self,+ "override_scheduler_gate",+ methods::OVERRIDE_SCHEDULER_GATE,+ (seconds,)+ )+ }+}