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(session_db): remove the six read controllers with no writer
shanuf37489de7001
diff --git a/src/core/all.rs b/src/core/all.rsindex 2a39ca1860..55b5439e95 100644--- a/src/core/all.rs+++ b/src/core/all.rs@@ -963,7 +963,7 @@ fn build_registered_controllers() -> Vec<GroupedController> {DomainGroup::Security,crate::openhuman::security::devices::all_devices_registered_controllers(),);- // Durable agent session database — queryable index over transcripts, lineage, tool calls+ // Durable agent/workflow run ledger — read surface over run state, lineage, events, telemetrypush(&mut controllers,DomainGroup::Agent,diff --git a/src/core/all_tests.rs b/src/core/all_tests.rsindex 163e42b9e1..dc5de2d8c0 100644--- a/src/core/all_tests.rs+++ b/src/core/all_tests.rs@@ -2481,3 +2481,59 @@ fn memory_diff_controllers_are_gone_and_memory_survives() {"removing the git ledger must not remove the memory domain");}++// ---- session_db removal (#6082) --------------------------------------------++/// The six read-only `session_db` controllers were removed in #6082: they+/// queried a session index that nothing in `src/` ever writes (permanently+/// empty in production, no frontend consumer). The three `run_ledger`+/// controllers live in the same module and read a table that *is* written+/// (from `web_chat::progress_bridge` and `agent::progress_tracing`), so they+/// must stay fully registered.+///+/// `run_ledger` is asserted present in the same test on purpose: the removal+/// took the dead read surface, not the run-ledger domain. Splitting that into a+/// separate test would let one pass while the other silently regressed.+#[test]+fn session_db_controllers_are_gone_and_run_ledger_survives() {+ let methods: Vec<String> = all_controller_schemas()+ .iter()+ .map(rpc_method_name)+ .collect();++ for removed in [+ "openhuman.session_db_list",+ "openhuman.session_db_get",+ "openhuman.session_db_search",+ "openhuman.session_db_get_messages",+ "openhuman.session_db_get_tool_calls",+ "openhuman.session_db_get_children",+ ] {+ assert!(+ !methods.contains(&removed.to_string()),+ "removed session_db controller `{removed}` must be absent \+ (unknown-method over /rpc, omitted from /schema), got: {methods:?}"+ );+ }++ for kept in [+ "openhuman.run_ledger_list",+ "openhuman.run_ledger_get",+ "openhuman.run_ledger_events",+ ] {+ assert!(+ methods.contains(&kept.to_string()),+ "run_ledger controller `{kept}` must stay registered — removing the \+ dead session_db read surface must not touch the run ledger"+ );+ }++ let namespaces: Vec<&str> = all_controller_schemas()+ .iter()+ .map(|s| s.namespace)+ .collect();+ assert!(+ !namespaces.contains(&"session_db"),+ "the `session_db` namespace was removed and must not be registered, got: {namespaces:?}"+ );+}diff --git a/src/openhuman/agent/session_db/mod.rs b/src/openhuman/agent/session_db/mod.rsindex 772237221b..611c2bd503 100644--- a/src/openhuman/agent/session_db/mod.rs+++ b/src/openhuman/agent/session_db/mod.rs@@ -1,21 +1,25 @@-//! JSON-RPC surface for the durable agent session database.+//! JSON-RPC surface for the durable agent run ledger.//!-//! The store itself — sessions, messages, tool calls, cost metadata,-//! parent/child lineage, and the run ledger — lives in-//! [`tinyagents::session`]. Only the controller schemas and+//! The store itself — run ledger rows, child lineage, events, and telemetry —+//! lives in [`tinyagents::session::run_ledger`]. Only the controller schemas and//! their handlers stay here, because the RPC envelope, config resolution, and//! `RpcOutcome` shape are host concerns the runtime crate has no business//! knowing about.//!-//! Call the store directly (`tinyagents_session::…`) rather+//! Call the store directly (`tinyagents_session::run_ledger::…`) rather//! than through this module; it deliberately re-exports no storage API.//!//! Every store entry point takes the workspace root, so handlers pass//! `config.workspace_dir`. The database path is-//! `{workspace}/session_db/sessions.db` — unchanged by the move, so existing-//! installs keep their history.+//! `{workspace}/session_db/sessions.db` — unchanged, so existing installs keep+//! their run-ledger history.//!-//! The `session_db` and `run_ledger` RPC namespaces are unchanged.+//! The `run_ledger` RPC namespace is unchanged. The six read-only `session_db`+//! controllers were removed in #6082: they queried a session index that nothing+//! in `src/` ever writes (permanently empty in production, no frontend+//! consumer). The run ledger below is written from+//! [`crate::openhuman::web_chat::progress_bridge`] and+//! [`crate::openhuman::agent::progress_tracing`], so it stays fully functional.mod schemas;diff --git a/src/openhuman/agent/session_db/schemas.rs b/src/openhuman/agent/session_db/schemas.rsindex b944c345d0..d57933a1ef 100644--- a/src/openhuman/agent/session_db/schemas.rs+++ b/src/openhuman/agent/session_db/schemas.rs@@ -1,4 +1,4 @@-//! Controller schemas and JSON-RPC dispatchers for the session database.+//! Controller schemas and JSON-RPC dispatchers for the durable run ledger.use serde_json::{Map, Value};@@ -8,16 +8,9 @@ use crate::openhuman::config::rpc as config_rpc;use crate::rpc::RpcOutcome;use tinyagents_session::run_ledger::{AgentRunListRequest, RunEventListRequest};-use tinyagents_session::types::SessionSearchParams;pub fn all_controller_schemas() -> Vec<ControllerSchema> {vec![- schema_for("session_db_list"),- schema_for("session_db_get"),- schema_for("session_db_search"),- schema_for("session_db_get_messages"),- schema_for("session_db_get_tool_calls"),- schema_for("session_db_get_children"),schema_for("run_ledger_list"),schema_for("run_ledger_get"),schema_for("run_ledger_events"),@@ -26,30 +19,6 @@ pub fn all_controller_schemas() -> Vec<ControllerSchema> {pub fn all_registered_controllers() -> Vec<RegisteredController> {vec![- RegisteredController {- schema: schema_for("session_db_list"),- handler: handle_session_db_list,- },- RegisteredController {- schema: schema_for("session_db_get"),- handler: handle_session_db_get,- },- RegisteredController {- schema: schema_for("session_db_search"),- handler: handle_session_db_search,- },- RegisteredController {- schema: schema_for("session_db_get_messages"),- handler: handle_session_db_get_messages,- },- RegisteredController {- schema: schema_for("session_db_get_tool_calls"),- handler: handle_session_db_get_tool_calls,- },- RegisteredController {- schema: schema_for("session_db_get_children"),- handler: handle_session_db_get_children,- },RegisteredController {schema: schema_for("run_ledger_list"),handler: handle_run_ledger_list,@@ -67,86 +36,6 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {fn schema_for(function: &str) -> ControllerSchema {match function {- "session_db_list" => ControllerSchema {- namespace: "session_db",- function: "list",- description: "List agent sessions with optional filters (status, parent) \- and pagination.",- inputs: vec![- optional_u64("limit", "Max sessions to return (default 50, max 500)."),- optional_u64("offset", "Pagination offset."),- optional_str(- "status",- "Filter by status (running, completed, failed, interrupted).",- ),- optional_str("parentSessionId", "Filter by parent session ID."),- ],- outputs: vec![json_output(- "result",- "SessionSearchResult with sessions array and total count.",- )],- },- "session_db_get" => ControllerSchema {- namespace: "session_db",- function: "get",- description: "Get a single session by ID.",- inputs: vec![required_str("id", "Session ID.")],- outputs: vec![json_output("session", "Full SessionRecord.")],- },- "session_db_search" => ControllerSchema {- namespace: "session_db",- function: "search",- description: "Search sessions by full-text query, agent ID, tool name, \- source channel, thread ID, parent, and/or status.",- inputs: vec![- optional_str("query", "Full-text search query."),- optional_str("agentId", "Filter by agent definition ID."),- optional_str("toolName", "Filter to sessions that used this tool."),- optional_str("sourceChannel", "Filter by source channel."),- optional_str("threadId", "Filter by thread ID."),- optional_str("parentSessionId", "Filter by parent session ID."),- optional_str("status", "Filter by status."),- optional_u64("limit", "Max results (default 50, max 500)."),- optional_u64("offset", "Pagination offset."),- ],- outputs: vec![json_output(- "result",- "SessionSearchResult with sessions array and total count.",- )],- },- "session_db_get_messages" => ControllerSchema {- namespace: "session_db",- function: "get_messages",- description: "Get messages for a session.",- inputs: vec![- required_str("sessionId", "Session ID."),- optional_u64("limit", "Max messages (default 200, max 1000)."),- ],- outputs: vec![json_output("messages", "Array of SessionMessage objects.")],- },- "session_db_get_tool_calls" => ControllerSchema {- namespace: "session_db",- function: "get_tool_calls",- description: "Get tool calls for a session.",- inputs: vec![- required_str("sessionId", "Session ID."),- optional_u64("limit", "Max tool calls (default 200, max 1000)."),- ],- outputs: vec![json_output(- "toolCalls",- "Array of SessionToolCall objects.",- )],- },- "session_db_get_children" => ControllerSchema {- namespace: "session_db",- function: "get_children",- description: "Get child (sub-agent) sessions for a parent session.",- inputs: vec![required_str("sessionId", "Parent session ID.")],- outputs: vec![json_output(- "children",- "Array of child SessionRecord objects.",- )],- },"run_ledger_list" => ControllerSchema {namespace: "run_ledger",function: "list",@@ -187,9 +76,9 @@ fn schema_for(function: &str) -> ControllerSchema {)],},_ => ControllerSchema {- namespace: "session_db",+ namespace: "run_ledger",function: "unknown",- description: "Unknown session_db controller.",+ description: "Unknown run_ledger controller.",inputs: vec![],outputs: vec![FieldSchema {name: "error",@@ -205,192 +94,6 @@ fn new_correlation_id() -> String {uuid::Uuid::new_v4().simple().to_string()[..8].to_string()}-fn handle_session_db_list(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] list.entry");- let config = config_rpc::load_config_with_timeout().await.inspect_err(|err| {- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] list.config_failed err={err}");- })?;-- let limit = params- .get("limit")- .and_then(|v| v.as_u64())- .map(|v| v as u32);- let offset = params- .get("offset")- .and_then(|v| v.as_u64())- .map(|v| v as u32);- let status = params- .get("status")- .and_then(|v| v.as_str())- .map(String::from);- let parent_id = params- .get("parentSessionId")- .and_then(|v| v.as_str())- .map(String::from);-- let result = tinyagents_session::list_sessions(- &config.workspace_dir,- limit,- offset,- status.as_deref(),- parent_id.as_deref(),- )- .map_err(|e| {- let s = e.to_string();- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] list.error err={s}");- s- })?;-- let json = to_json(result);- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] list.exit ok={}", json.is_ok());- json- })-}--fn handle_session_db_get(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get.entry");- let config = config_rpc::load_config_with_timeout().await.inspect_err(|err| {- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get.config_failed err={err}");- })?;-- let id = params- .get("id")- .and_then(|v| v.as_str())- .ok_or_else(|| "missing required param: id".to_string())?;-- let session = tinyagents_session::get_session(&config.workspace_dir, id).map_err(|e| {- let s = e.to_string();- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get.error id={id} err={s}");- s- })?;-- let json = to_json(session);- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get.exit ok={}", json.is_ok());- json- })-}--fn handle_session_db_search(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] search.entry");- let config = config_rpc::load_config_with_timeout().await.inspect_err(|err| {- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] search.config_failed err={err}");- })?;-- let search_params: SessionSearchParams = if params.is_empty() {- SessionSearchParams::default()- } else {- serde_json::from_value(Value::Object(params)).map_err(|e| {- let s = format!("invalid search params: {e}");- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] search.bad_params err={s}");- s- })?- };-- let result = tinyagents_session::search_sessions(- &config.workspace_dir,- &search_params,- )- .map_err(|e| {- let s = e.to_string();- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] search.error err={s}");- s- })?;-- let json = to_json(result);- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] search.exit ok={}", json.is_ok());- json- })-}--fn handle_session_db_get_messages(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_messages.entry");- let config = config_rpc::load_config_with_timeout().await.inspect_err(|err| {- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_messages.config_failed err={err}");- })?;-- let session_id = params- .get("sessionId")- .and_then(|v| v.as_str())- .ok_or_else(|| "missing required param: sessionId".to_string())?;- let limit = params- .get("limit")- .and_then(|v| v.as_u64())- .map(|v| v as u32);-- let messages = tinyagents_session::list_messages(&config.workspace_dir, session_id, limit).map_err(|e| {- let s = e.to_string();- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_messages.error err={s}");- s- })?;-- let json = to_json(messages);- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_messages.exit ok={}", json.is_ok());- json- })-}--fn handle_session_db_get_tool_calls(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_tool_calls.entry");- let config = config_rpc::load_config_with_timeout().await.inspect_err(|err| {- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_tool_calls.config_failed err={err}");- })?;-- let session_id = params- .get("sessionId")- .and_then(|v| v.as_str())- .ok_or_else(|| "missing required param: sessionId".to_string())?;- let limit = params- .get("limit")- .and_then(|v| v.as_u64())- .map(|v| v as u32);-- let tool_calls = tinyagents_session::list_tool_calls(&config.workspace_dir, session_id, limit).map_err(|e| {- let s = e.to_string();- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_tool_calls.error err={s}");- s- })?;-- let json = to_json(tool_calls);- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_tool_calls.exit ok={}", json.is_ok());- json- })-}--fn handle_session_db_get_children(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let cid = new_correlation_id();- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_children.entry");- let config = config_rpc::load_config_with_timeout().await.inspect_err(|err| {- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_children.config_failed err={err}");- })?;-- let session_id = params- .get("sessionId")- .and_then(|v| v.as_str())- .ok_or_else(|| "missing required param: sessionId".to_string())?;-- let children = tinyagents_session::list_children(&config.workspace_dir, session_id).map_err(|e| {- let s = e.to_string();- log::warn!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_children.error err={s}");- s- })?;-- let json = to_json(children);- log::debug!(target: "session_db_rpc", "[session_db_rpc][{cid}] get_children.exit ok={}", json.is_ok());- json- })-}-fn handle_run_ledger_list(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {let cid = new_correlation_id();diff --git a/src/openhuman/agent/session_db/schemas_tests.rs b/src/openhuman/agent/session_db/schemas_tests.rsindex 360292c98a..addfde709a 100644--- a/src/openhuman/agent/session_db/schemas_tests.rs+++ b/src/openhuman/agent/session_db/schemas_tests.rs@@ -3,13 +3,40 @@ use super::*;#[test]fn all_controller_schemas_lists_registered_functions() {let schemas = all_controller_schemas();- assert_eq!(schemas.len(), 9);+ assert_eq!(schemas.len(), 3);+ // The six read-only `session_db` controllers were removed in #6082; only the+ // durable run-ledger read surface remains here.assert!(schemas.iter()- .any(|schema| schema.namespace == "session_db"));- assert!(schemas- .iter()- .any(|schema| schema.namespace == "run_ledger"));+ .all(|schema| schema.namespace == "run_ledger"));+}++/// The removed `session_db` surface must stay removed: none of the six read+/// controllers may reappear in this module's aggregators (#6082).+#[test]+fn session_db_controllers_are_absent() {+ let removed = [+ "list",+ "get",+ "search",+ "get_messages",+ "get_tool_calls",+ "get_children",+ ];+ let schemas = all_controller_schemas();+ assert!(+ schemas.iter().all(|schema| schema.namespace != "session_db"),+ "the removed `session_db` namespace must not be registered"+ );+ let registered = all_registered_controllers();+ for name in removed {+ assert!(+ registered+ .iter()+ .all(|rc| rc.schema.namespace != "session_db" || rc.schema.function != name),+ "removed session_db controller '{name}' must not be registered"+ );+ }}#[test]@@ -28,40 +55,6 @@ fn all_registered_controllers_match_schemas() {}}-#[test]-fn schema_for_list_has_optional_inputs() {- let s = schema_for("session_db_list");- assert_eq!(s.function, "list");- assert!(s.inputs.iter().all(|i| !i.required));-}--#[test]-fn schema_for_get_requires_id() {- let s = schema_for("session_db_get");- assert_eq!(s.function, "get");- assert_eq!(s.inputs.len(), 1);- assert!(s.inputs[0].required);- assert_eq!(s.inputs[0].name, "id");-}--#[test]-fn schema_for_search_has_query_and_filters() {- let s = schema_for("session_db_search");- assert_eq!(s.function, "search");- let names: Vec<&str> = s.inputs.iter().map(|i| i.name).collect();- assert!(names.contains(&"query"));- assert!(names.contains(&"agentId"));- assert!(names.contains(&"toolName"));- assert!(names.contains(&"sourceChannel"));- assert!(names.contains(&"threadId"));-}--#[test]-fn schema_for_unknown_returns_error_shape() {- let s = schema_for("session_db_nonexistent");- assert_eq!(s.function, "unknown");-}-#[test]fn schema_for_run_ledger_events_requires_run_id() {let s = schema_for("run_ledger_events");