Track agent child processes, reap on completion

spawn_agent returns Child handle + log_path. AgentCycleState stores
the Child, polls with try_wait() on each trigger to detect completion.
No more filesystem scanning to track agent lifecycle.

AgentSnapshot (Clone) sent to TUI for display. AgentInfo holds the
Child handle and stays in the state.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-02 01:20:03 -04:00
parent 54ea7824d8
commit 9ac50bd999
5 changed files with 71 additions and 32 deletions

View file

@ -243,7 +243,7 @@ impl Agent {
} else {
self.push_message(Message::user(user_input));
}
let _ = ui_tx.send(UiMessage::AgentUpdate(self.agent_cycles.agents.clone()));
let _ = ui_tx.send(UiMessage::AgentUpdate(self.agent_cycles.snapshots()));
let mut overflow_retries: u32 = 0;
let mut empty_retries: u32 = 0;