A stage whose request carries a HarnessSpec runs the Kit's CLI as a subprocess in its own process group, with the mission and archie's rules as the prompt. After every invocation the runner compares HEAD, every ref and the git configuration, and the worktree against a pre-run baseline: any ref or config change, a protected-path edit, or a write in a read-only stage parks the step whatever the CLI claimed. The runner runs the gate itself and resumes the same session with the gate's output, up to the gate's failure cap. The wall clock and cancellation kill the whole process group, so the CLI's children cannot outlive the step.
16 lines
360 B
Go
16 lines
360 B
Go
//go:build unix
|
|
|
|
package agentexec
|
|
|
|
import (
|
|
"os/exec"
|
|
"syscall"
|
|
)
|
|
|
|
// setProcessGroup puts the harness in its own process group and makes
|
|
// cancellation kill the whole group.
|
|
func setProcessGroup(cmd *exec.Cmd) {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
|
cmd.Cancel = func() error { return syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) }
|
|
}
|