Module process_tracker

Module process_tracker 

Source
Expand description

Agent-spawned process tracking.

Gives the host a complete, authoritative view of what each agent CLI has forked — backgrounded shells, dev servers, Docker containers, file watchers, nested bash/python/node children, etc. The goal is end-user visibility: a user running multiple agents can see in one place what’s still running on their machine, and kill it reliably when they’re done.

The API is a platform-agnostic trait. Per-platform impls use the strongest available mechanism:

PlatformImplMechanismConfidence
WindowsJobObjectTrackerCreateJobObject + AssignProcessToJobObject + TerminateJobObjecthigh
LinuxCgroupv2Trackersystemd-run --user --scope + cgroup.procs / cgroup.killhigh
macOSProcessGroupTrackerPOSIX_SPAWN_SETPGROUP + killpgbest-effort
otherStubTrackerno-opnone

The frontend’s swarm panel surfaces the confidence level so users know when tracking may miss escaped descendants.

See agentmux-ai/AGENT_SPAWNED_PROCESSES_SPEC.md for the design.

Modules§

registry
AgentProcessRegistry — app-wide map from block_id → tracker handle.
stub
Windows fallback if JobObjectTracker::new fails (e.g. the process is not elevated enough to create a job object). The real impl lives in windows; this is only used for the init-fail recovery path.
windows
Windows ProcessTreeTracker implementation backed by Job Objects.

Structs§

TrackedProcess
A single process tracked by the host — PID + metadata enriched per-platform. The frontend renders one row per entry.

Enums§

TrackingConfidence
How reliable this platform’s tracker is.

Traits§

TrackerHandle
Opaque per-agent handle returned by the tracker when we wrap a spawn. Held inside AgentProcessRegistry for the lifetime of the pane; dropped when the pane closes or the agent exits.

Functions§

new_tracker
Factory: returns a platform-appropriate tracker handle that will accept the next-spawned process and everything it forks.