Expand description
Spawning child processes without putting a window on the operator’s screen.
Every external program magi runs - the agent CLIs, git, gh, the
configured verification commands - is a console application. What happens
when one is spawned depends on whether the parent has a console, and
magi has two relevant kinds of parent:
- Terminal commands: ordinary console helpers inherit the console, while redirected pipes keep their output out of the operator’s screen.
- Detached web, scheduler and execution workers: these have no console. On Windows an ordinary console child would allocate and display a new one unless its launcher suppresses the window. An implement wave can otherwise open several black windows over the operator’s browser.
CREATE_NO_WINDOW is the answer to exactly that: the child still gets a
console for its standard handles, and that console is never shown. It is
not the same as DETACHED_PROCESS, which gives the child no console and
would make a grandchild pop a window of its own for the same reason.
Nothing here is conditional on how magi was started. A hidden console is correct in a terminal too: the pipes are redirected either way, so there was never anything to look at.
Structs§
- Proc
Probe - A per-request memo over
pid_statusandprocess_started_at.
Traits§
- Quiet
- Spawn without a visible console window.
Functions§
- is_
identity_ marker - Whether the identity marker format is the current one: a plain integer
(epoch seconds). Runs recorded before this format carried the locale
dependent
ps -o lstart=text, which can never be compared reliably. - pid_
alive - Best-effort liveness check for a process id, read through
sysinfo’s process table - read-only, and no helper process is spawned. - pid_
status - A three-valued liveness read, for a caller that displays whether a
process is running rather than deciding whether it is safe to reclaim a
lock.
pid_alive’s Err-means-alive policy exists to protect a lock a live process still holds — the wrong bias for a report that must never tell an operator a process is confirmed dead just because this build could not ask the platform.Nonehere is the honest “could not tell”, left for the caller to render as its own “unknown” rather than folded into eitherSomeanswer. - process_
started_ at - An opaque marker identifying which process currently holds
pid, not merely whether the number is in use — the OS-reported moment it started. A plain integer string (epoch seconds fromsysinfo), so it does not depend on the locale of the process asking - anlstartstring recorded under one locale never matched the same process read under another. Compared only for equality by the caller; seeis_identity_marker.