An open-source, faster Devin alternative
TypeScript
make sure supervisord cleanly survives reboot
Brian Reardonf7f57a7664c7
diff --git a/cmd/agent/main.go b/cmd/agent/main.goindex 929f5598..6365d1c5 100644--- a/cmd/agent/main.go+++ b/cmd/agent/main.go@@ -8,6 +8,7 @@ package mainimport ("log""os"+ "os/exec""os/signal""syscall"@@ -51,6 +52,24 @@ func main() {// running. Drain on each SIGCHLD; signals coalesce so we loop.startReaper()+ // Best-effort: start supervisord if installed and configured. Run as a+ // daemon (default mode, not -n) so it returns immediately and we don't+ // block agent startup. Supervisord becomes a regular child of PID 1; its+ // own children (configured programs) are reparented to it, not to us, so+ // our SIGCHLD reaper doesn't conflict with supervisord's own wait4 calls.+ // Without this, "supervisord baked into rootfs" only works while the user+ // manually starts it — programs don't auto-start at boot the way they do+ // on a systemd-managed VM.+ if _, err := os.Stat("/usr/bin/supervisord"); err == nil {+ if _, err := os.Stat("/etc/supervisor/supervisord.conf"); err == nil {+ if err := exec.Command("/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf").Start(); err != nil {+ log.Printf("agent: supervisord start failed: %v (continuing)", err)+ } else {+ log.Printf("agent: supervisord started (config=/etc/supervisor/supervisord.conf)")+ }+ }+ }+// Signal handling:// SIGTERM/SIGINT: clean shutdown (exit)// SIGUSR1: hibernate prep — reset virtio-serial listener so Accept