From a1352376d88d6236a46cef7ccc5d646f9282487c Mon Sep 17 00:00:00 2001 From: damocles Date: Tue, 21 Jul 2026 23:52:47 +0200 Subject: [PATCH] refactor(#2626): retire the file-based mcp-loose-ends scanner (todos own it now) --- hive-agent-mcp/src/loose_ends.rs | 42 -------------------------------- hive-agent-mcp/src/main.rs | 1 - hive-agent-mcp/src/mcp/mod.rs | 15 +----------- hive-sh4re/src/paths.rs | 7 ------ 4 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 hive-agent-mcp/src/loose_ends.rs diff --git a/hive-agent-mcp/src/loose_ends.rs b/hive-agent-mcp/src/loose_ends.rs deleted file mode 100644 index 7b6f4aad..00000000 --- a/hive-agent-mcp/src/loose_ends.rs +++ /dev/null @@ -1,42 +0,0 @@ -//! Generic scanner for MCP loose-end summary files. -//! -//! External MCP daemons (hive-bash-mcp, hive-matrix-mcp, etc.) write -//! JSON files to `$HYPERHIVE_HARNESS_DIR/mcp-loose-ends/.json`. -//! Each file contains a JSON array of plain-text summary strings. -//! -//! The harness reads all files in this directory in `get_loose_ends` to -//! surface active background work from any MCP without hardcoding -//! per-MCP knowledge here. - -use std::path::PathBuf; - -/// Resolution lives in `hive_sh4re::paths` so the harness + every MCP -/// daemon agree on where loose-end summary files are written. -fn loose_ends_dir() -> PathBuf { - hive_sh4re::paths::mcp_loose_ends_dir() -} - -/// Collect all loose-end summary strings published by external MCP daemons. -/// Each string is a single line suitable for inclusion in `get_loose_ends` -/// output. Returns an empty vec if the directory doesn't exist or is empty. -#[must_use] -pub fn collect() -> Vec { - let Ok(rd) = std::fs::read_dir(loose_ends_dir()) else { - return Vec::new(); - }; - let mut out = Vec::new(); - for entry in rd.flatten() { - let path = entry.path(); - if path.extension().and_then(|e| e.to_str()) != Some("json") { - continue; - } - let Ok(content) = std::fs::read_to_string(&path) else { - continue; - }; - let Ok(items) = serde_json::from_str::>(&content) else { - continue; - }; - out.extend(items); - } - out -} diff --git a/hive-agent-mcp/src/main.rs b/hive-agent-mcp/src/main.rs index cc3c3c0d..2fbe4791 100644 --- a/hive-agent-mcp/src/main.rs +++ b/hive-agent-mcp/src/main.rs @@ -18,7 +18,6 @@ use anyhow::Result; use clap::Parser; mod client; -mod loose_ends; mod mcp; mod paths; mod send_allow; diff --git a/hive-agent-mcp/src/mcp/mod.rs b/hive-agent-mcp/src/mcp/mod.rs index 8acc2c6e..73e30954 100644 --- a/hive-agent-mcp/src/mcp/mod.rs +++ b/hive-agent-mcp/src/mcp/mod.rs @@ -339,20 +339,7 @@ impl AgentServer { if is_self_query && let Some(todos) = local_todos().await { loose_ends.extend(todos); } - let mut out = annotate_retries(render_loose_ends(&loose_ends), retries); - // Append loose-end items published by external MCP daemons - // (e.g. active bash tasks from hive-bash-mcp). Generic — no - // per-MCP knowledge needed here. - let mcp_items = crate::loose_ends::collect(); - if !mcp_items.is_empty() { - use std::fmt::Write as _; - let n = mcp_items.len(); - let _ = write!(out, "\n\n{n} local task(s):"); - for item in &mcp_items { - let _ = write!(out, "\n- {item}"); - } - } - out + annotate_retries(render_loose_ends(&loose_ends), retries) }) .await } diff --git a/hive-sh4re/src/paths.rs b/hive-sh4re/src/paths.rs index 9a3609e7..1a390d73 100644 --- a/hive-sh4re/src/paths.rs +++ b/hive-sh4re/src/paths.rs @@ -28,10 +28,3 @@ pub fn harness_dir() -> PathBuf { let label = std::env::var("HIVE_LABEL").unwrap_or_default(); PathBuf::from(format!("/agents/{label}/harness")) } - -/// Directory where out-of-process MCP daemons write loose-end summary -/// files (`.json`) for the harness to scan in `get_loose_ends`. -#[must_use] -pub fn mcp_loose_ends_dir() -> PathBuf { - harness_dir().join("mcp-loose-ends") -}