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

@ -126,7 +126,7 @@ pub enum UiMessage {
ContextInfoUpdate(ContextInfo),
/// Agent cycle state update — refreshes the F2 agents screen.
AgentUpdate(Vec<crate::subconscious::hook::AgentInfo>),
AgentUpdate(Vec<crate::subconscious::hook::AgentSnapshot>),
}
/// Sender that fans out to both the TUI (mpsc) and observers (broadcast).