From f87a52f28f3bf17060b4e219888458fa01ed2b46 Mon Sep 17 00:00:00 2001 From: damocles Date: Wed, 3 Jun 2026 18:05:32 +0200 Subject: [PATCH] fix: address argus review yellows on #1158 - restore count in get_loose_ends: 'N local task(s):' instead of bare 'local task(s):' - add cross-crate coupling comment to both mcp_loose_ends_dir() copies - add comment in hive-bash-daemon service env explaining HYPERHIVE_HARNESS_DIR is already injected via systemd.globalEnvironment by the meta flake --- hive-ag3nt/src/mcp.rs | 3 ++- hive-ag3nt/src/mcp_loose_ends.rs | 3 +++ hive-bash-mcp/src/paths.rs | 4 ++++ nix/templates/harness-base.nix | 8 ++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hive-ag3nt/src/mcp.rs b/hive-ag3nt/src/mcp.rs index 2ff5c7d9..540c37b9 100644 --- a/hive-ag3nt/src/mcp.rs +++ b/hive-ag3nt/src/mcp.rs @@ -743,7 +743,8 @@ impl AgentServer { let mcp_items = crate::mcp_loose_ends::collect(); if !mcp_items.is_empty() { use std::fmt::Write as _; - let _ = write!(out, "\n\nlocal task(s):"); + let n = mcp_items.len(); + let _ = write!(out, "\n\n{n} local task(s):"); for item in &mcp_items { let _ = write!(out, "\n- {item}"); } diff --git a/hive-ag3nt/src/mcp_loose_ends.rs b/hive-ag3nt/src/mcp_loose_ends.rs index e7e537e0..222a6392 100644 --- a/hive-ag3nt/src/mcp_loose_ends.rs +++ b/hive-ag3nt/src/mcp_loose_ends.rs @@ -10,6 +10,9 @@ use std::path::PathBuf; +/// NOTE: the base-dir resolution logic here is intentionally mirrored in +/// `hive-bash-mcp/src/paths.rs::mcp_loose_ends_dir()`. They can't share +/// code across crates — keep them in sync if the fallback logic changes. fn loose_ends_dir() -> PathBuf { let base = if let Some(p) = std::env::var_os("HYPERHIVE_HARNESS_DIR") { PathBuf::from(p) diff --git a/hive-bash-mcp/src/paths.rs b/hive-bash-mcp/src/paths.rs index 854bcc9c..dd4c5a70 100644 --- a/hive-bash-mcp/src/paths.rs +++ b/hive-bash-mcp/src/paths.rs @@ -51,6 +51,10 @@ pub fn hyperhive_socket() -> PathBuf { /// Directory where MCP daemons write loose-end summary files for the harness. /// Each daemon writes `.json` here; the harness scans the dir in /// `get_loose_ends` to surface active work from all MCPs generically. +/// +/// NOTE: the base-dir resolution logic here is intentionally mirrored in +/// `hive-ag3nt/src/mcp_loose_ends.rs::loose_ends_dir()`. They can't share +/// code across crates — keep them in sync if the fallback logic changes. #[must_use] pub fn mcp_loose_ends_dir() -> PathBuf { let base = if let Some(p) = std::env::var_os("HYPERHIVE_HARNESS_DIR") { diff --git a/nix/templates/harness-base.nix b/nix/templates/harness-base.nix index 20abfb36..7315e5cc 100644 --- a/nix/templates/harness-base.nix +++ b/nix/templates/harness-base.nix @@ -1130,6 +1130,14 @@ in HIVE_BASH_SOCKET = "/run/hive-bash/socket"; HIVE_CONTROL_SOCKET = "/run/hive/mcp.sock"; RUST_LOG = "info"; + # HYPERHIVE_HARNESS_DIR and HYPERHIVE_STATE_DIR are already + # injected via systemd.globalEnvironment by the meta flake + # (set to /agents//harness and /agents//state + # respectively). Listed here for explicitness — the daemon + # uses these to derive its task + loose-ends dir paths. + # Without them the daemon falls back to deriving harness/ as a + # sibling of state/, which produces the same value but is + # less robust if the two vars ever diverge. }; serviceConfig = { ExecStart = "${pkgs.hyperhive}/bin/hive-bash-daemon";