interplane.Get Omega
Read in your language

spark-supervisor

Process supervisor and health monitor for sovereign daemons

Brought by drakestapleton

Unfinished: not checked yet

There is no published receipt of a rebuild from its source yet. What a receipt is

Get this repository
Git over HTTPS
git clone --no-checkout https://interplane.io/projects/spark-supervisor/repo.git spark-supervisor && git -C spark-supervisor checkout --detach 60c0c046b629f76b0bb736480a4fb44babf82230
Source archive of 60c0c046b629f76b0bb736480a4fb44babf82230
Download ZIP · tar.gz

README.md

spark-supervisor: aien-supervise

AIEN's process supervisor, written in seeded Omega. It runs AIEN services from line-format declaration files: services have no .service, .timer or .path files and no systemd-run. One systemd user unit, tools/aien-supervise.service, starts the daemon itself at boot (see below).

This repository used to hold a Rust daemon. The Rust sources were removed when the Omega supervisor came to Radicle main; they stay in this repository's git history. Nothing in this repository's documents keeps them as an oracle.

What still depends on systemd on this machine

The Spark runs DGX OS (Ubuntu). PID 1 is the distribution's systemd and stays so. aien-supervise calls no systemd program, but two things it relies on come from systemd today:

  1. cgroup delegation. An unprivileged process may only create cgroups and move processes inside a cgroup v2 subtree its user owns. On this machine that subtree is /sys/fs/cgroup/user.slice/user-UID.slice/user@UID.service, created and chowned to the user by systemd's user manager at login (controllers cpu memory pids delegated). A process started from an ssh login sits in session-N.scope, outside that subtree, and cannot move itself in (the common ancestor user-UID.slice is root-owned). So the supervisor must be started from a process that already lives inside the delegated subtree; run-limited callers from anywhere then reach it over its local socket.
  2. Boot start. One systemd user unit, tools/aien-supervise.service, starts the daemon at boot and hands it its delegated cgroup (Delegate=cpu memory pids). The route needs no cron line and no other unit: every service is a file in ~/.config/aien-supervise/services. cgroupfs is rebuilt at every boot, so some boot-time root actor has to create or delegate the subtree; on this machine that actor is systemd. Install: cp tools/aien-supervise.service ~/.config/systemd/user/ && systemctl --user enable --now aien-supervise. Moving a service off its own systemd unit: stop the old unit, add NAME.svc, aien-supervise reload, and once it has run healthy, systemctl --user disable the old unit (keep the file for the undo). Until that disable, the old unit still starts at boot as well, and both copies compete for the same port. Once the unit is installed it is the only start route: start and stop the daemon with systemctl --user start|stop aien-supervise, not ensure or shutdown (a daemon started by ensure from a login shell sits outside the delegated cgroup, and the unit then refuses to start a second one). Right after a start, requests such as aien-supervise start NAME are refused with daemon not running until the daemon has written its pid; wait until aien-supervise status says daemon running.

What removes the dependency: a root-owned, one-time setup that creates /sys/fs/cgroup/aien-supervise.slice with cpu memory pids enabled in its parent and chowns it (and its cgroup.procs, cgroup.subtree_control) to the operator account; then AIEN_SUPERVISE_CGROUP points there and systemd's user manager is no longer involved. Replacing PID 1 itself is a separate, larger change (aienux).

Parts

ProgramSourceRuns asRole
aien-superviseom/contract.om, om/supervise.om, om/limits.om, om/limited.om, om/services.omthe operator accountdaemon (run), ensure, status, start/stop/restart, check, reload, shutdown, run-limited
aien-supervise-rootom/root.omroot, via one sudoers rulebuilds one service's sandbox and execs it; stop/kill its cgroup; check (dry run)
aien-watchom/watch.omthe service user, inside the sandboxpath trigger for a service's watch key

om/lib.om is shared. om/syscalls.om is generated by tools/gen-syscalls.sh from systemd-analyze syscall-filter and <asm/unistd.h>; systemd-analyze is used there only as a read-only oracle for group membership, and tools/gen-syscalls.sh --check fails on any difference.

Build

OMC=/path/to/omega-mv/seed/out/omc nice -n 19 sh tools/build.sh

The script refuses (exit 2) an omc other than the pin: omega-mv 15760b5009f00485ce51669c84d0126ed19fa479, seed/out/omc sha256 a5613368f427aacd73ebeee16d46f8b3203405711d4de5b860d0cbee11ce4533. Take that compiler from Radicle storage: git -C <omega-mv storage> cat-file blob 15760b50:seed/out/omc.

Service files

Two directories, one line per directive (key value...), no quoting:

  • ~/.config/aien-supervise/services/NAME.svc: user services, run as the operator account.
  • /etc/aien-supervise/services/NAME.svc: sandboxed services, root-owned, not group/other-writable.

NAME is 1..32 bytes of a-z 0-9 -. The daemon reads the directories when it starts and on aien-supervise reload (adds new files, stops services whose file is gone).

KeyMeaning (systemd equivalent)
exec PATH ARG...program and arguments; PATH absolute (ExecStart)
type simple\|oneshotdefault simple (Type)
restart always\|on-failure\|neverdefault on-failure; oneshot never; no is accepted as never (Restart)
backoff MIN MAXrestart delay MINĀ·2^k seconds, never above MAX, reset after 60 s of uptime (RestartSec)
after NAME...user services: start only after each named service is running and healthy; stop in reverse order (After, Requires)
health-http PORT PATHuser services: healthy only when GET PATH on 127.0.0.1:PORT answers HTTP/1.x 2..; without it, healthy = the process is alive
every S / delay Soneshot period and first-run delay (OnCalendar, OnBootSec, Persistent)
timeout Soneshot run limit: SIGTERM, then SIGKILL after stoptime (TimeoutStartSec)
stoptime Sgrace between SIGTERM and SIGKILL of the whole process group, default 10 (TimeoutStopSec, KillMode=control-group)
autostart yes\|nostart with the daemon, default yes
log-max BYTES / log-keep Nstdout and stderr of the service go to state/log/NAME.log, rotated to NAME.log.1..N so that no file is ever larger than log-max; default 10 MiB, 3
env K=V...user services: the environment is cleared and holds only these (Environment)
dir PATH, umask OCTAL, nice NWorkingDirectory, UMask, Nice (0..19, set in Omega)
memory-max BYTES, tasks-max N, cpu-weight 1..10000user services: cgroup v2 memory.max (with memory.swap.max 0 and memory.oom.group 1), pids.max, cpu.weight (MemoryMax, TasksMax, CPUWeight)
watch DIR SUFFIX PERIOD TIMEOUTrun exec through aien-watch when DIR holds a matching entry

Limits fail closed. A user service that declares a limit runs in its own leaf $AIEN_SUPERVISE_CGROUP/svc-NAME. The daemon creates the leaf, writes each value and reads it back; the child moves itself into the leaf and reports back before it execs. If any step fails the service is not started, its state is error and its status line carries reason=LIMIT_NOT_APPLIED errno=-N. A service killed by its memory ceiling shows LIMIT_OOM_KILLED.

Change trigger: MISSING_IMPLEMENTATION. Restarting a service when its declaration file changes needs inotify, and the pinned compiler has no inotify host words. Every status line says change-trigger=MISSING_IMPLEMENTATION. The daemon does not poll the files and runs no timer in its place; tests/contract.py missing_trigger checks that an edited file restarts nothing. The compiler change (host words for inotify_init1, inotify_add_watch, event reads) is a separate omega-mv landing, then a repin here.

Sandboxed services (/etc/aien-supervise/services) keep the root helper's keys and mechanisms, documented with their per-directive table and probes in docs/MIGRATION.md: user, group, groups, ro, rw, hide, envfile, secret, net, allow, deny, net-default, listen, memory-max, memory-swap-max, tasks-max, cpu-quota, nofile, namespaces, syscalls, syscalls-deny, syscall-error, families, mdwe. Their cgroup is /sys/fs/cgroup/aien-supervise/NAME, created by the root helper.

run-limited

aien-supervise run-limited --memory BYTES [--pids N] -- /absolute/CMD ARG...

Runs one command under a kernel-enforced memory ceiling (swap 0) and optional process ceiling. The caller connects to the running daemon's socket state/limited.sock (mode 0600, peer uid checked with SO_PEERCRED). The daemon makes a leaf job-PID under its cgroup root, applies and reads back the limits, and runs the command in it with the caller's working directory and the caller's standard input, output and error (opened from the caller's /proc/PID/fd/0..2). The command's environment is empty. The leaf is killed and removed afterwards. If the caller goes away, the command's process group is killed.

ExitMeaning
the command's statusthe command ran and exited (128+N when it died from signal N)
137 and LIMIT_OOM_KILLED on stderrthe memory ceiling killed it (memory.events oom_kill > 0)
125 and LIMIT_NOT_APPLIED errno=-N on stderrno daemon, socket refused, or a limit could not be applied: the command did not run
2usage

Privilege model

The daemon runs as the operator account and holds no privilege. For a sandboxed service it runs sudo -n /usr/local/libexec/aien-supervise/aien-supervise-root run NAME. The helper refuses unless real and effective uid are 0 and the arguments are run|stop|kill|check NAME; it checks that every path it relies on is root-owned and not group/other-writable; it runs nothing as root except nft -f (the service's own table) and prlimit --pid (on itself).

Defaults!/usr/local/libexec/aien-supervise/aien-supervise-root !use_pty
<operator> ALL=(root) NOPASSWD: /usr/local/libexec/aien-supervise/aien-supervise-root run *, /usr/local/libexec/aien-supervise/aien-supervise-root stop *, /usr/local/libexec/aien-supervise/aien-supervise-root kill *, /usr/local/libexec/aien-supervise/aien-supervise-root check *

Install

sudo install -d -o root -g root -m 0755 /usr/local/libexec/aien-supervise /etc/aien-supervise /etc/aien-supervise/services
sudo install -o root -g root -m 0755 out/aien-supervise-root out/aien-watch /usr/local/libexec/aien-supervise/
install -m 0755 out/aien-supervise ~/.local/bin/aien-supervise

Start the daemon from a process inside the delegated subtree (see above), with AIEN_SUPERVISE_CGROUP naming a private directory under it, for example .../user@UID.service/aien-supervise. State lives in ~/.local/state/aien-supervise/ (daemon.log, log/NAME.log*, st/NAME, ctl/, limited.sock). aien-supervise status prints a daemon line, then one line per service.

Tests

  • sh tests/user.sh: daemon behaviour without root (restart/backoff, timers, timeout, requests, TERM-to-KILL, environment, rotation, refusals, shutdown). 15 cases.
  • python3 tests/contract.py: cleared environment plus declared variables; always / on-failure / never with bounded backoff; HTTP-health-gated start order, one status line per service and reverse stop; bounded stdout+stderr rotation, grace then process-group kill with no surviving child; the honest missing change trigger; a fake cgroup root that refuses writes (service and run-limited both refused, command never run). 6 cases. The test waits on inotify events.
  • OMC=... sh tests/limits.sh: real cgroup v2 under the user's delegated subtree: a child at half the ceiling succeeds, one past it is killed and reported, a fork bomb is held by pids.max, pipes and exit status pass through, service limits read back, a service OOM is reported, restart and rotation under a running daemon. Exits 3 (NOT_RUN) when no delegated subtree or delegated tmux server is available.
  • OMC=... python3 tests/mutants.py: 20 source mutants (environment, each restart policy, backoff bound, start order, HTTP health, reverse stop, status line, rotation bound, grace, group kill, missing-trigger marker, explicit reload, fail-closed, memory, pids and cpu writes, OOM marker, exit status); each must make its test fail.
  • sudo -n sh tests/sandbox.sh (root; qualifies the installed helper) and sh tools/gen-syscalls.sh --check.

Host helpers (recorded dependencies)

The user-service path uses only Omega host words (execenv, setprio, cgroup files). The root helper still uses these host programs:

HelperUsed forOmega successor
/usr/bin/setprivuid/gid/groups, no_new_privs, capability dropsetids, nonewpriv, capdrop host words
/usr/bin/prlimitRLIMIT_NOFILE, RLIMIT_RTPRIO on the helperprlimit host word (exists at the pin; not yet used by om/root.om)
/usr/bin/bwrapnamespaces, binds, seccomp loadunshare, mount, pivotroot, seccomp host words
/usr/sbin/nftper-uid network tablenfnetlink in Omega
/usr/bin/sudothe single privilege crossingnone planned: the narrow rule is the design

License

Apache-2.0 WITH LLVM-exception. See LICENSE and NOTICE.

For developers: proof and records

The full record of this project. Words that are used only here are explained once:

ID
The project's permanent id on Interplane: the SHA-256 of its first signed record. This one is git:c7d3d5c355d6708a8d8e9a1c2642257aa307ec0e2b2bde1884d07debab0d2ddf. Its old id, kept only so that old links still work: z3HQENMJfT9o14N3oDQtY4YPFak73.
Owner
The key that signs every record of the project. This forge lists the project under drakestapleton; its key is SHA256:qg3vxoE9ul3Cgk5heosQvPmO9pqIJNsdcsGJ2cHghTs.
Refs and HEAD
Refs are the names that point at versions: branches and tags. HEAD is the version a fresh copy starts from, the newest commit of the default branch.
Patch
A proposed change, reviewed before it is merged. This forge does not show proposed changes from its own store yet. The list is under Proposed changes.
Receipt
A public record that someone checked a claim, with the fingerprint of its evidence file. The state at the top of this page is read from the list at interplane.io/receipts. This project has no receipt in that list yet.

Clones and fetches over HTTPS: 0 by visitors (git smart-HTTP info/refs requests answered 200 in the front-door download log; our own addresses and bots left out; since 2026-11-08) · not measured git-upload-pack requests from all clients (the source of this count is retired)

Downloads: 2 by visitors (2 source archives, 0 release assets; forged access log; our own addresses left out; since 2026-11-07)

commit 60c0c046b629f76b0bb736480a4fb44babf82230 Branches Tags History
60c0c04 README: the boot route needs no other unit (old units are disabled one by one) Drake Stapleton committed 2026-11-15
.github/
assets/
docs/
om/
services/
tests/
tools/
.gitignore44
AGENTS.md4281
AGENT_CODE_OF_CONDUCT.md5650
CONSTITUTION.md9632
CONTRIBUTING.md1848
LICENSE12278
NOTICE354
README.md13272
SECURITY.md1328
agent.json863
llms.txt1734

Every record: History (commits) · Branches · Tags · Releases, with the SHA-256 of each download · Patches · Issues · This project as JSON