Skip to content

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

fix(memory): correct subsystem schema reference in memory status

Steven Enamakel057c4b851399
diff --git a/crates/openhuman-core/src/core/subsystem/schemas.rs b/crates/openhuman-core/src/core/subsystem/schemas.rs
index 3a7b78b2f7..c3510c75fd 100644
--- a/crates/openhuman-core/src/core/subsystem/schemas.rs
+++ b/crates/openhuman-core/src/core/subsystem/schemas.rs
@@ -72,7 +72,13 @@ pub fn schemas(function: &str) -> ControllerSchema {
/// Memory is the only occupant today. This is also what
/// [`crate::core::subsystems_cli`] renders as a table.
pub async fn subsystems_status() -> Vec<SubsystemStatus> {
- vec![crate::memory::rpc::memory_subsystem_status().await]
+ match crate::config::rpc::load_config_with_timeout().await {
+ Ok(config) => vec![crate::memory::status::subsystem_status(&config).await],
+ Err(error) => {
+ log::warn!("[subsystems] config unavailable for status: {error}");
+ Vec::new()
+ }
+ }
}
fn handle_status(_params: Map<String, Value>) -> ControllerFuture {
diff --git a/crates/openhuman-core/src/memory/mod.rs b/crates/openhuman-core/src/memory/mod.rs
index dc7e06e484..651a800098 100644
--- a/crates/openhuman-core/src/memory/mod.rs
+++ b/crates/openhuman-core/src/memory/mod.rs
@@ -24,6 +24,7 @@ pub mod import;
pub mod ops;
pub mod schemas;
pub mod sources;
+pub mod status;
pub mod tools;
pub mod types;
diff --git a/crates/openhuman-core/src/memory/status.rs b/crates/openhuman-core/src/memory/status.rs
new file mode 100644
index 0000000000..b8295527ea
--- /dev/null
+++ b/crates/openhuman-core/src/memory/status.rs
@@ -0,0 +1,52 @@
+//! The memory row of the kernel's subsystem table (`subsystems.status`).
+
+use crate::config::Config;
+use crate::core::subsystem::SubsystemStatus;
+
+use super::engine::{self, Binding};
+
+/// Contract version the memory slot speaks: TinyMemory's v2 engine contract.
+pub const CONTRACT_VERSION: &str = "2.0";
+
+/// The operations every v2 engine serves.
+const OPERATIONS: [&str; 5] = ["recall", "fetch", "store", "forget", "list"];
+
+/// The memory slot's status for `config`: the bound engine and its health, or
+/// a `null` row with the reason memory is off.
+pub async fn subsystem_status(config: &Config) -> SubsystemStatus {
+ match engine::resolve(config) {
+ Binding::On(bound) => {
+ let (health, reason) = match bound.engine.health().await {
+ tinymemory::EngineHealth::Ok => ("ready", None),
+ tinymemory::EngineHealth::Degraded(reason) => ("degraded", Some(reason)),
+ tinymemory::EngineHealth::Down(reason) => ("down", Some(reason)),
+ };
+ SubsystemStatus {
+ slot: "memory".to_string(),
+ driver: bound.id,
+ class: "external".to_string(),
+ health: health.to_string(),
+ health_reason: reason,
+ contract_version: CONTRACT_VERSION.to_string(),
+ capabilities: OPERATIONS.iter().map(|op| (*op).to_string()).collect(),
+ fell_back_from: None,
+ last_error: None,
+ }
+ }
+ Binding::Off { engine, reason, .. } => SubsystemStatus {
+ slot: "memory".to_string(),
+ driver: "null".to_string(),
+ class: "null".to_string(),
+ health: "down".to_string(),
+ health_reason: Some(reason),
+ contract_version: CONTRACT_VERSION.to_string(),
+ capabilities: Vec::new(),
+ fell_back_from: engine,
+ last_error: None,
+ },
+ }
+}
+
+#[cfg(test)]
+#[path = "status_tests.rs"]
+mod tests;