Expand description
Windows ProcessTreeTracker implementation backed by Job Objects.
Flow:
JobObjectTracker::new(block_id)creates an anonymous job and setsKILL_ON_JOB_CLOSE, so anything in the job dies automatically if AgentMux itself crashes without callingkill_tree.- The caller gets the tracker handle and, when spawning the agent
CLI, calls
assign_process(child_pid)immediately after spawn. EveryCreateProcessdescendant of that PID inherits the job automatically — no per-process tagging. list_membersqueries the job for its current PID set and enriches each with command line + RSS viaPROCESS_QUERY_LIMITED_INFORMATIONGetModuleFileNameEx/GetProcessMemoryInfo.
kill_tree→TerminateJobObject. One call nukes everything.
The only non-trivial thing: there’s a ~1ms race window between
CreateProcess and our AssignProcessToJobObject. A child the CLI
creates in that window escapes the job. In practice the CLI doesn’t
spawn anything before it reads stdin, so this is a theoretical
concern — but worth a future move to CREATE_SUSPENDED + assign +
ResumeThread if we see escapes.
Structs§
Functions§
- query_
command_ 🔒line - Read a process’s command line via
GetCommandLineWis not an option for foreign processes — that’s the calling process’s cmdline. Instead we useQueryFullProcessImageNameWfor the executable path and treat cmdline as “unavailable” for v1. WMI can fill this in later if the user asks for full cmdline. - query_
rss 🔒