From 76bd27905f2c98b9b516ff0ce2fa13542fcc4507 Mon Sep 17 00:00:00 2001 From: autonomic-bot Date: Wed, 8 Jul 2026 16:23:47 +0000 Subject: [PATCH] feat(host): reboot-persistent lichen-orchestrator systemd service Mirrors cc-ci-loops.service for the SEPARATE p-lichen-orchestrator (lichen.page testing). On boot, resumes its Remote Control session + watchdog + pipeline via engine/agents.py up. Added after the 2026-07-08 reboot (Hetzner rollback of a bad staging nixos-rebuild) left this orchestrator down while cc-ci-loops auto-recovered. Points at the /home path for now; re-point to /srv at that migration. Verified: diff-closures shows only this unit added; sshd/dhcpcd/tailscaled/network unchanged. --- .../configuration.nix | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/nix/hosts/cc-ci-orchestrator-hetzner/configuration.nix b/nix/hosts/cc-ci-orchestrator-hetzner/configuration.nix index 855d5d1..a088758 100644 --- a/nix/hosts/cc-ci-orchestrator-hetzner/configuration.nix +++ b/nix/hosts/cc-ci-orchestrator-hetzner/configuration.nix @@ -186,6 +186,33 @@ SSHCFG ''; }; + # p-lichen-orchestrator supervisor — the SEPARATE lichen.page testing/hardening orchestrator + # (distinct from cc-ci-loops above). Reboot-resilience: on boot, resume the orchestrator's Remote + # Control session + watchdog + pipeline via `engine/agents.py up`. Added 2026-07-08 after a reboot + # (Hetzner rollback) left this orchestrator down while cc-ci-loops auto-recovered. + # NOTE: still points at the /home path — will be re-pointed to /srv when that migration happens. + systemd.services.lichen-orchestrator = { + description = "p-lichen-orchestrator (lichen.page testing) — orchestrator + watchdog + pipeline"; + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" "tailscaled.service" "claude-install.service" ]; + wants = [ "network-online.target" ]; + serviceConfig = { + Type = "oneshot"; RemainAfterExit = true; + User = "loops"; Group = "users"; + WorkingDirectory = "/home/loops/project-orchestrator/projects/p-lichen-orchestrator"; + }; + environment = { HOME = "/home/loops"; CLAUDE_BIN = "/home/loops/.local/bin/claude"; }; + path = [ pkgs.bash pkgs.tmux pkgs.git pkgs.python3 pkgs.openssh pkgs.nettools ]; + script = '' + export PATH="/home/loops/.local/bin:$PATH" + proj="/home/loops/project-orchestrator/projects/p-lichen-orchestrator" + # boot marker (best-effort; boot_id-gated logging can be added later) + echo "$(cat /proc/sys/kernel/random/boot_id) boot $(date -u +%FT%TZ) — lichen-orchestrator up" \ + >> "$proj/.ao-state/boot.log" 2>/dev/null || true + cd "$proj" && python3 engine/agents.py up || echo "p-lichen agents.py up failed" + ''; + }; + # Weekly recipe upgrade — runs /upgrade-all over every enrolled recipe (opens recipe PRs # verified by !testme, never merges). Replaces the boot-fragile busybox-crond-in-tmux from # phase 5 §4 with a reboot-safe systemd timer. The service is timer-triggered only (NOT