Approve 0057-0059, with four corrections from review

Not approved as drafted -- four things came out of checking them against each
other, and one was a bug that would have broken every upgrade.

The bug: 0059 specified Restart=on-failure while 0057 has the host restart onto
a new binary by exiting CLEANLY. on-failure does not restart a process that
exited zero, so every upgraded node would have been left stopped, having
successfully upgraded. Found by reading the two records against each other
rather than by either alone. Now Restart=always in all three places that
mention it.

The host cannot run in a container, and the reason is decisive rather than
stylistic: step 0 of the substrate bootstrap installs the container runtime, so
a host inside a container would need the thing it exists to install. It would
also break 0041 -- copy it onto a machine and run it stops being true when the
machine must already have a runtime. Everything above tier 0 is a container;
the host is not. That split is the tier boundary, not an inconsistency.

systemd is named rather than abstracted. An init is not a dependency in 0041's
sense: 0041 is about what must be installed before the host works, and an init
is not installed, it is what the machine already is. The unit file is the only
systemd-specific artefact and it belongs to the package, so a machine with a
different supervisor ships a different package.

The mesh is a watchdog, and my first draft was half an answer. Recovery must be
local -- nothing dials a node, and a host that cannot start cannot report. But
detection is the mesh's, and a local supervisor structurally cannot do it: it
sees one process failing and cannot tell a broken machine from a broken
release. Only something watching every node can, and that distinction decides
whether the response is "fix this machine" or "stop shipping this version". So
a host rollout is staged -- a few nodes, wait for heartbeats, continue or stop
on silence. Local rollback still needed, because the canary nodes break and
because a node offline during the rollout gets the declaration later with no
batch around it.

The first declaration is the overlay and nothing else. Forced, because a node's
address and peers are assigned rather than chosen. But also the way back in: a
node reachable over the overlay can be fixed by hand if a later declaration
breaks it, and a large first declaration risks a node that is broken and
unreachable at once.

Also stated plainly, because it reads as a contradiction: nodes reach each
other over the overlay and every node consumes from the broker; what 0039
forbids is an inbound CONTROL surface, not reachability.

And in 06: no node holds a credential to any control-plane store, for reads or
writes. Four ADRs already say this separately and none of them said it in one
place. Nodes state over the broker; the owning context writes. With a note that
most high-frequency writes are observability's, not the registry's -- routing
logs into the registry would be the shared-schema mistake arriving through a
door marked performance.
This commit is contained in:
2026-08-27 22:12:12 +02:00
parent 605c9fd441
commit 19997d56c3
6 changed files with 218 additions and 22 deletions
@@ -1,5 +1,5 @@
---
status: proposed
status: accepted
date: 2026-08-27
deciders: jochen
reconstructed: false
@@ -40,6 +40,42 @@ could apply almost nothing, and the almost is where the confusion would live.
reboot to hold it. The command-line entry points remain — they are how a person inspects and
rescues a machine — but the ordinary case is a unit that is always up.
### It cannot run in a container, and the reason is the bootstrap
Worth stating because everything else the mesh runs *is* a container, which makes the host look
like an exception somebody forgot to fix.
**Step 0 of the substrate bootstrap is installing the container runtime**
([`07-the-substrate.md`](../03-DESIGN/01-to-be/07-the-substrate.md)). A host that ran inside a
container could not perform it — it would need the thing it is there to install. On a machine
with no runtime, nothing would ever start.
That is not the only reason, but it is the sufficient one:
- **It would break [ADR 0041](0041-the-host-depends-on-nothing.md).** *Copy it onto a machine and
run it* stops being true when the machine must already have a container runtime.
- **The isolation would be fiction.** To write `/etc`, install packages, manage units and run
containers, it would need the host's mount, PID and network namespaces plus the runtime's own
socket. A container with all of those is a process with extra steps.
**So the host is a plain process on the machine, and everything above tier 0 is a container.**
That split is the tier boundary made concrete rather than an inconsistency.
### What it needs from an init, and why that is not a dependency
The host needs four things from whatever supervises it: start at boot, restart when it exits,
give up after repeated failures, and run something else when it gives up.
**Every machine the mesh targets already has systemd**, and the host already treats the service
manager as a detected capability rather than an assumption. This is not a dependency in
[ADR 0041](0041-the-host-depends-on-nothing.md)'s sense — 0041 is about what must be *installed
before the host works*, and an init is not installed, it is what the machine already is.
**Abstracting over init systems is not done**, because there is no second one to abstract over.
The unit file is the only systemd-specific artefact, it belongs to the package rather than the
binary, and a machine with a different supervisor would ship a different package — which is
where that difference belongs.
### It never manages its own unit
**The host's own service file is not a resource the host applies.** The temptation is obvious —
@@ -1,5 +1,5 @@
---
status: proposed
status: accepted
date: 2026-08-27
deciders: jochen
reconstructed: false
@@ -1,12 +1,12 @@
---
status: proposed
status: accepted
date: 2026-08-27
deciders: jochen
reconstructed: false
extends: 0057-the-host-is-a-root-service-installed-as-a-package.md
---
# 59. A host that cannot start is rolled back by the supervisor
# 59. Two watchdogs: the mesh stages the rollout, the supervisor recovers the node
## Context
@@ -18,21 +18,31 @@ It was left because automatic recovery looked like *the host judging its own hea
the self-reference the rest of that document avoids.
**That objection does not survive being asked properly.** A keepalive is not the host judging
itself — it is something else judging the host. The question is only *what*, and that has one
answer.
itself — it is something else judging the host.
### Why the watchdog must be local
### There are two watchdogs, and they cannot do each other's job
The obvious candidate is the control plane, and it cannot be:
A first draft of this record concluded the watchdog must be local, and stopped there. That was
half an answer: it is true that recovery must be local, and false that the mesh has no part.
| | can see | can act |
|---|---|---|
| **the service manager**, on the node | that *this* process keeps dying | **yes** — restart it, replace it |
| **the mesh** | that *eleven of twelve nodes* went quiet after one declaration | **no** — nothing dials a node |
**Recovery must be local**, and that half stands:
- **Nothing dials a node.** [ADR 0039](0039-the-link-is-the-security-boundary.md) makes the link
outbound and node-initiated, and a node has no listening control surface. The mesh has no way
to reach in and act.
outbound and node-initiated, with no listening control surface. The mesh has no way to reach
in and act.
- **The failure removes the reporting path.** A host that cannot start cannot link, so the mesh
learns nothing to act on.
learns nothing *from that node* to act on.
So the watchdog is local, and the only local thing that is always present, already depended on,
and is not the host is the **service manager**.
**But detection is the mesh's**, and it is the half a local watchdog structurally cannot do. A
node's supervisor sees one process failing and has no idea whether that is a broken machine or a
broken release. **Only something watching every node can tell those apart** — and telling them
apart is what decides whether the right response is *fix this machine* or *stop shipping this
version immediately*.
### The failure this actually prevents
@@ -51,7 +61,35 @@ nothing else.
## Decision
**The service manager rolls the host back to the last version that started.**
**The mesh stages the rollout and stops when nodes go quiet. The service manager recovers the
node it is on.** Prevention and recovery, and neither substitutes for the other.
### The mesh stages a host rollout
A host version does not reach every node at once. The delivery context updates a few nodes'
declarations, **waits for those nodes to heartbeat on the new version**, and only then continues.
```
update 2 nodes ─► heard from both, running the new version ─► continue
└► silence past the window ─► STOP. Report.
```
**Silence is the signal, and it is available because of the heartbeat**
([ADR 0057](0057-the-host-is-a-root-service-installed-as-a-package.md)). A node that upgraded
and cannot start stops reporting; that is indistinguishable from a switched-off machine *for one
node*, and completely distinguishable across a batch that was all told the same thing at the
same time.
**This is what keeps a bad release from becoming a fleet outage.** Local rollback repairs a node
after the fact; staging means most nodes never receive the bad version at all. A stopped rollout
is two broken nodes and a report, rather than every node quiet at once.
**It does not replace local recovery**, for two reasons. The canary nodes still break, and
somebody has to be able to fix them. And a node that was offline during the staged rollout gets
the declaration when it reconnects, with no batch around it and nothing watching — so it must be
able to recover alone.
### On the node: the service manager rolls back
Four parts, and each one is chosen so it works when the host does not:
@@ -78,7 +116,7 @@ import it.
```ini
[Service]
Restart=on-failure
Restart=always
StartLimitBurst=3
StartLimitIntervalSec=120
@@ -86,10 +124,27 @@ StartLimitIntervalSec=120
OnFailure=nox-mesh-host-rollback.service
```
Three failures in two minutes is a binary that does not work, not a transient. The supervisor
stops trying and runs the rollback unit, which downgrades and starts the host again.
**`Restart=always`, not `on-failure`**, and the difference is load-bearing rather than a
preference. [ADR 0057](0057-the-host-is-a-root-service-installed-as-a-package.md) has the host
restart onto a new binary by **exiting cleanly** — and `on-failure` does not restart a process
that exited zero. An earlier draft of this record specified `on-failure` and would have left
every upgraded node stopped, having successfully upgraded. Caught by reading the two records
against each other rather than by either alone.
### 4 — It rolls back once
Three failures in two minutes is a binary that does not work, not a transient. The supervisor
stops trying, the unit enters a failed state, and `OnFailure` runs the rollback unit — which
downgrades and starts the host again.
### 4 — With nothing to roll back to, it does not try
A machine whose host has *never* completed a reconcile has no `known-good`. The rollback unit
finds nothing, does nothing, and says so.
That is the right outcome: there is no previous version, so the node was never working, and the
failure belongs to the installation rather than to an upgrade. Attempting a rollback here would
mean guessing at a version, which is how a recovery mechanism becomes a second fault.
### 5 — It rolls back once
The rollback unit records that it fired. If the rolled-back version *also* fails to start, it
does **not** fire again — the node stops, loudly, in a failed state.