fix: replace bash_tasks.rs with generic mcp_loose_ends scanner

- hive-ag3nt: remove bash_tasks.rs entirely; add mcp_loose_ends.rs that
  scans harness/mcp-loose-ends/*.json generically (no bash knowledge)
- hive-bash-mcp: daemon writes mcp-loose-ends/bash.json on every task
  state transition (pending/running/done/interrupted/timed_out)
- get_loose_ends: reads mcp_loose_ends::collect() instead of bash-specific code
- implements the generic mechanism from #1162
This commit is contained in:
damocles 2026-06-03 17:23:40 +02:00 committed by mara
commit 8731474104
6 changed files with 119 additions and 93 deletions

View file

@ -684,8 +684,8 @@ impl AgentServer {
description = "List loose ends pending against this agent: unanswered questions \
where you are the asker (waiting on someone) or the target (someone's waiting on \
you), pending reminders you scheduled, plus for the manager only pending \
approvals you submitted that the operator hasn't acted on yet. Also lists any \
local bash tasks still in pending or running state. Cheap sweep, no args. Useful \
approvals you submitted that the operator hasn't acted on yet. Also lists active \
local tasks published by external MCP daemons (e.g. running bash tasks). Cheap sweep, no args. Useful \
at turn start to remember what you owe / what's owed to you without scrolling \
inbox history. Output is a short bulleted list with ids, ages in seconds, and \
the relevant context. Each `question` or `reminder` row can be cancelled by \
@ -737,19 +737,15 @@ impl AgentServer {
}
}
let mut out = annotate_retries(render_loose_ends(&loose_ends), retries);
// Append any local bash tasks still in pending/running state so
// the agent sees all outstanding work in one call.
let active = crate::bash_tasks::active_tasks();
if !active.is_empty() {
// 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::mcp_loose_ends::collect();
if !mcp_items.is_empty() {
use std::fmt::Write as _;
let _ = write!(out, "\n\n{} active bash task(s):", active.len());
for task in &active {
let age = crate::serve_common::now_unix() - task.created_at;
let _ = write!(
out,
"\n- `{}` status={:?}, cmd: `{}`, age {}s",
task.id, task.status, task.cmd, age
);
let _ = write!(out, "\n\nlocal task(s):");
for item in &mcp_items {
let _ = write!(out, "\n- {item}");
}
}
out