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(core): handle shutdown and credential edge cases
Steven Enamakelddd71e49aa55
diff --git a/crates/openhuman-app/src/imessage_scanner/tick.rs b/crates/openhuman-app/src/imessage_scanner/tick.rsindex 17b87ffeeb..debafc5d10 100644--- a/crates/openhuman-app/src/imessage_scanner/tick.rs+++ b/crates/openhuman-app/src/imessage_scanner/tick.rs@@ -154,11 +154,6 @@ impl TickDeps for HttpDeps {}}-#[allow(dead_code)]-pub(crate) fn chat_db_exists(path: &Path) -> bool {- path.exists()-}-#[cfg(test)]#[path = "tick_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/attachments/mod.rs b/crates/openhuman-core/src/agent/attachments/mod.rsindex 2d6d2eadad..8ff5861567 100644--- a/crates/openhuman-core/src/agent/attachments/mod.rs+++ b/crates/openhuman-core/src/agent/attachments/mod.rs@@ -585,19 +585,6 @@ pub(crate) async fn stage_turn(stage(message, thread.unwrap_or("direct"), &config, &scope).await}-/// The session prelude's typed enrichment hook. Both image forwarding and-/// source blocks are derived before adding contextual prose.-pub(crate) fn enrich_request_input(- input: &mut tinyinference_llm::message::Message,- context: &mut crate::agent::tinyagents::host::OpenHumanRunContext,- original_text: &str,- enriched: &str,-) {- context.attachment_placeholders =- std::sync::Arc::new(image_references(input, &context.attachment_placeholders));- *input = enrich_input(input.clone(), original_text, enriched);-}-#[cfg(test)]#[path = "mod_tests.rs"]mod tests;diff --git a/crates/openhuman-core/src/agent/goals/runtime.rs b/crates/openhuman-core/src/agent/goals/runtime.rsindex 311d6865cd..78a70f241e 100644--- a/crates/openhuman-core/src/agent/goals/runtime.rs+++ b/crates/openhuman-core/src/agent/goals/runtime.rs@@ -68,29 +68,6 @@ pub async fn resume_for_thread(}}-/// Pause the active goal for an explicit thread (interrupt/abort semantics).-/// Best-effort; safe to call when there is no goal or thread id.-pub async fn pause_for_thread(workspace_dir: &Path, thread_id: Option<&str>) {- let Some(thread_id) = normalized_thread(thread_id) else {- return;- };- match store::pause(workspace_dir, &thread_id).await {- Ok(goal) => {- if matches!(goal.status, ThreadGoalStatus::Paused) {- BUS.publish(DomainEvent::ThreadGoalUpdated {- thread_id: goal.thread_id.clone(),- goal_id: goal.goal_id.clone(),- status: goal.status.as_str().to_string(),- goal: Some(super::goal_to_value(&goal)),- });- }- }- Err(e) => {- tracing::debug!(thread_id = %thread_id, error = %e, "[thread_goals] pause_for_thread failed");- }- }-}-/// Mark the active goal for an explicit thread `Complete` (the originating/// task settled successfully). Best-effort; safe to call when there is no goal/// or no thread id. Emits `ThreadGoalUpdated` so the UI chip refreshes.diff --git a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rsindex ff7df5351a..ad3c937e49 100644--- a/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs+++ b/crates/openhuman-core/src/agent/session_host/builder/host_tools.rs@@ -362,27 +362,6 @@ impl OpenHumanSessionHost {}}-/// Compose the host belt before adding the remaining product configuration.-pub(super) fn tool_builder(- host: Option<&HostTools>,- agent_id: &str,- session_id: Option<&str>,- mut tools: Vec<Box<dyn Tool>>,- mut visible: HashSet<String>,-) -> Result<super::super::SessionHostBuilder> {- let merged = merge_for_turn(host, agent_id, session_id, &mut tools, &mut visible)?;- let mut builder = OpenHumanSessionHost::builder()- .tools(tools)- .visible_tool_names(visible)- .withheld_tool_names(merged.withheld)- .permanent_tool_names(merged.permanent);- // A supplied gate retains the existing replacement semantics.- if let Some(policy) = merged.policy {- builder = builder.tool_policy(policy);- }- Ok(builder)-}-/// Binds the embedder's per-turn root as the default cwd, when it exists.pub(super) fn derive_turn_workspace_descriptor() -> Option<tinytools::WorkspaceDescriptor> {let root = crate::agent::turn_workspace::current()?;diff --git a/crates/openhuman-core/src/core/shutdown.rs b/crates/openhuman-core/src/core/shutdown.rsindex c3a68aaff2..8890b15427 100644--- a/crates/openhuman-core/src/core/shutdown.rs+++ b/crates/openhuman-core/src/core/shutdown.rs@@ -72,20 +72,6 @@ async fn run_hooks() {}}-/// Run `hooks` side by side.-///-/// For the embedded server's exit, whose graceful path is a cancellation token-/// rather than SIGTERM: [`signal`] never resolves there, so the hooks it would-/// have run — the memory engine releasing its queue leases, above all — never-/// ran on a normal quit. Concurrent, unlike the signal path, because the caller-/// runs this under a deadline, and in sequence one hook that never answers-/// would keep every hook after it — the lease release among them — from so-/// much as starting before the deadline dropped the lot. Run together, a-/// hanging hook costs only itself.-pub async fn run_hook_list(hooks: Vec<ShutdownHook>) {- futures::future::join_all(hooks.iter().map(|hook| hook())).await;-}-/// Returns a future that resolves when the process receives a termination/// signal (SIGINT on all platforms, plus SIGTERM on Unix), then runs all/// registered shutdown hooks.diff --git a/crates/openhuman-core/src/integrations/composio/client/credential.rs b/crates/openhuman-core/src/integrations/composio/client/credential.rsindex ecad25f059..6b1978622e 100644--- a/crates/openhuman-core/src/integrations/composio/client/credential.rs+++ b/crates/openhuman-core/src/integrations/composio/client/credential.rs@@ -12,15 +12,6 @@ use tinyconnectors_bus::ComposioDirectCredential;/// URL, so a credential on it sends no override.const COMPOSIO_API_BASE_V3: &str = "https://backend.composio.dev/api/v3";-pub(super) fn ensure_https(url: &str) -> anyhow::Result<()> {- if !url.starts_with("https://") {- anyhow::bail!(- "Refusing to transmit sensitive data over non-HTTPS URL: URL scheme must be https"- );- }- Ok(())-}-pub(super) fn is_loopback_http_url(url: &str) -> bool {// Parse rather than prefix-match: a raw `starts_with("http://127.0.0.1:")`// is fooled by userinfo smuggling likediff --git a/crates/openhuman-core/src/security/encryption/core.rs b/crates/openhuman-core/src/security/encryption/core.rsindex 350c648e8d..4c2312bb77 100644--- a/crates/openhuman-core/src/security/encryption/core.rs+++ b/crates/openhuman-core/src/security/encryption/core.rs@@ -86,30 +86,6 @@ impl EncryptionKey {}}-/// Get the path to the OpenHuman data directory.-/// If an active user is set, returns the user-scoped directory under the-/// env-aware root returned by `default_root_openhuman_dir()`-/// (for example `~/.openhuman/users/{user_id}` in production or-/// `~/.openhuman-staging/users/{user_id}` when `OPENHUMAN_APP_ENV=staging`);-/// otherwise it falls back to that root directory itself.-pub fn get_data_dir() -> Result<PathBuf, String> {- let root_dir = crate::config::default_root_openhuman_dir()- .map_err(|e| format!("Cannot determine app data directory: {e}"))?;- std::fs::create_dir_all(&root_dir)- .map_err(|e| format!("Failed to create data directory: {e}"))?;-- let data_dir = if let Some(user_id) = crate::config::read_active_user_id(&root_dir) {- let user_dir = crate::config::user_openhuman_dir(&root_dir, &user_id);- std::fs::create_dir_all(&user_dir)- .map_err(|e| format!("Failed to create user data directory: {e}"))?;- user_dir- } else {- root_dir- };-- Ok(data_dir)-}-#[cfg(test)]#[path = "core_tests.rs"]mod tests;