delete ProcessTracker — replaced by ActiveToolCall + KillOnDrop

All process management now goes through active_tools:
- TUI reads metadata (name, elapsed time)
- Ctrl+K aborts handles (KillOnDrop sends SIGTERM)
- Running count from active_tools.len()

No more separate PID tracking, register/unregister, or
ProcessInfo. One data structure for everything.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
ProofOfConcept 2026-04-03 23:56:56 -04:00 committed by Kent Overstreet
parent 310bbe9fce
commit 021eafe6da
5 changed files with 37 additions and 109 deletions

View file

@ -12,7 +12,7 @@ use serde_json::json;
use std::process::Stdio;
use tokio::io::AsyncReadExt;
use super::{ToolDef, ProcessTracker, default_timeout};
use super::{ToolDef, default_timeout};
/// RAII guard that SIGTERMs the process group on drop.
/// Ensures child processes are cleaned up when a task is aborted.
@ -55,7 +55,7 @@ pub fn definition() -> ToolDef {
)
}
pub async fn run_bash(args: &serde_json::Value, tracker: &ProcessTracker) -> Result<String> {
pub async fn run_bash(args: &serde_json::Value) -> Result<String> {
let a: Args = serde_json::from_value(args.clone())
.context("invalid bash arguments")?;
let command = &a.command;
@ -73,7 +73,6 @@ pub async fn run_bash(args: &serde_json::Value, tracker: &ProcessTracker) -> Res
let pid = child.id().unwrap_or(0);
let kill_guard = KillOnDrop(pid);
tracker.register(pid, command).await;
// Take ownership of stdout/stderr handles before waiting,
// so we can still kill the child on timeout.
@ -139,14 +138,12 @@ pub async fn run_bash(args: &serde_json::Value, tracker: &ProcessTracker) -> Res
Err(anyhow::anyhow!("Command failed: {}", e))
}
Err(_) => {
// Timeout — kill the process group
tracker.kill(pid).await;
// Timeout — KillOnDrop will SIGTERM the process group
Err(anyhow::anyhow!("Command timed out after {}s: {}", timeout_secs, command))
}
};
// Process completed normally — defuse the kill guard
std::mem::forget(kill_guard);
tracker.unregister(pid).await;
result
}