ADR-0310: The gate never signals itself, its ancestors or their groups
Status: Accepted Date: 2026-11-20
Context
The gate stops processes by id: ProcessTable freezes a process and every
process a listing finds under it, kills them, and kills the group of a
process that led its session (ADR-0158). The gate also signals single
processes it forked: the progress reporter (ADR-0157), the plan's warm-up,
a split stream's late children (ADR-0117) and the serve daemon's child.
Each of these takes its target from data: a listing, a fork's result, a stored id. A fault in that data, or a mutant of the code that reads it when the gate's own tests judge the gate, can name the wrong process. Before this decision only the ids under 2 were refused: 1 (the system's first process), 0 (the caller's own group) and -1 (every process the caller may signal).
On GitHub's hosted runners the job's processes share the runner agent's
process group and session: in run 44770323518 the gate (pid 5818), its step
shell and the job's other steps were in pgid and sid 2006, the group of
hosted-compute-agent, which also holds provjobd, Runner.Listener and
Runner.Worker. A group kill of the gate's own group, or a stop of any of
the gate's ancestors, takes the runner down: GitHub then waits about 45
minutes and reports that it lost communication with the server.
Decision
SparedProcessesnames what one process never signals: every id under 2, the process itself, each process above it (its parent, its parent's parent, up to the system's first process), and as groups those ids, its own process group and its own session. It is read from one listing of the processes (ADR-0312) andposix_getsid()where PHP has it.- Every signal the gate sends goes through it.
ProcessTableleaves a spared id out of every freeze and kill, stops nothing where the process it is asked to stop is spared, and kills no spared group.SparedProcesses::signalandsignalGroupare the one way the gate signals another process or group: a stop's freezes and kills (ADR-0312), the progress reporter's end, the warm-up's drop, a stream's late children and the serve daemon's children. Once they let a signal through, it is sent by the processes running (RunningProcesses::signalledUnspared, ADR-0312), which nothing else calls: rule S3 holds that list. Every other place that callsposix_killsignals its own process, sends signal 0, or wakes a warm worker, each named in PHPStan's list of whereposix_killmay be called. - The gate's own process lists once. Once its settings are read it
tells itself what it spares (
MUTATION_GATE_SPARED), so letting go of each process it started costs no listing. Any other process, such as a stream or a test's process, lists at each stop. The variable is withheld from every process the gate starts, as everyMUTATION_GATE_*is, and a value told to another process is never taken. - A warm worker's wake is not guarded. It sends
SIGURG, whose default action is to ignore it, so a wake that reaches the wrong process changes nothing. - A cgroup is killed whole only inside the gate's own.
CgroupFilewritescgroup.killonly where the cgroup's real path lies strictly inside the cgroup this process was told is the gate's (MUTATION_GATE_CGROUP). In CI,CgroupDelegationrunssudoonly for a cgroup one level under the mount and the gate's own one level under that, so no fault in a path hands the gate's user the mount, or a cgroup beside its own, to create, own or write (ADR-0158). - The gate does not leave the runner's group itself. A gate that led a
session of its own would no longer get the
SIGINTa terminal sends its foreground group, so Ctrl-C would stop reaching a local run, and a CI runner that cancels a step by its group would leave the gate running. Refusing the group is enough: no signal of the gate's reaches it.
Consequences
- Unmutated, the gate signals exactly what it signalled before: no process it starts is ever its own ancestor, nor is its group or session one it started.
- A mutant of the gate's own signalling code that names an ancestor, the gate's group or session, 1, 0 or -1 now leaves the target alone. The test that needed the signal fails, so the mutant is killed; before, it could stop the runner and leave its shard without a verdict.
- Stopping a process costs one more listing in a process other than the gate's own.
- A process beside the caller that is not its ancestor, such as another stream, is not spared: a signal sent to it by a fault still reaches it. Containing those signals is a separate decision.