Expand description
Agent process helpers.
All agents run in non-interactive mode (claude -p, codex exec) under a
detached monitor that owns the process and its capture files (see
crate::monitor). The old synchronous launch/capture path
(launch_agent + capture_agent_output) was removed in 14b — the monitor
is now the single way an agent process is spawned.
Functions§
- agent_
running - Check whether a process with the given PID is still running.
- is_
same_ process - Whether
pidis the same process instance that recordedexpected_start. - looks_
like_ devflow_ process - Best-effort, Linux-only identity check for
devflow stop’s signalling fallback (T-23-52, PID reuse in a stale lock file): does/proc/<pid>/cmdlinename a devflow process? Reads the NUL-separated argv and reports whether any argument’s file-name component starts withdevflow. Returnsfalsewhen the file cannot be read (process exited between the liveness check and this call, non-Linux, permission denied) — the fail-closed direction. Afalsereturn means “identity could not be confirmed,” and callers must treat that as “do not signal,” never as “signal anyway.” - process_
start_ time - A process’s start time — field 22 of
/proc/<pid>/stat, in clock ticks since boot. - terminate
- Send SIGTERM to
pid— the crate’s one process-termination call, used bydevflow stop’s signalling fallback (23c). Applies exactly the same guardsagent_runningapplies, for reasons that are catastrophic here rather than merely wrong: signalling pid0would target the caller’s own process group (kill(0, sig)reaches every process in the group, including this one), and a value abovei32::MAXwould wrap negative through theas libc::pid_tcast —kill(-1, sig)sends the signal to every process the caller may signal. Returns whether the signal was delivered.