docs: W6 spec and runbook follow the final review fixes
Spec §3, §4.2, §5.2, §5.3 and §9: absolute deadlines (step 2 by 100 s, report final by 140 s), the route bound at 150 s and the drain unit's TimeoutStopSec=170; tenant starts closed from step 1 (wakes on the draining box get 503 Retry-After, hibernate stops wait); the 3-minute exit goes through SIGTERM; the verbs dry-check the guard before asking; the update unit's extra 300 s. The runbook says the same, and notes that "not healthy at start" can follow failed first reads (W6 final review F1, F3, F4, F5, F6, F7, F8).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+26
−17
docs/region-ha-runbook.md+13 −6docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md+13 −11
CI failed — run details
Intent
Attributed to this commit: 35.3 g CO₂e (4,527,525 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on w6-ingress-drain, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/region-ha-runbook.md b/docs/region-ha-runbook.md| index 17fd9c5aa..c48189c20 100644 |
| --- a/docs/region-ha-runbook.md |
| +++ b/docs/region-ha-runbook.md |
| @@ -173,9 +173,9 @@ A fixed box that is a target of a region's load balancer takes itself out of the |
| ### What the drain does |
| -1. The box fails its load balancer health check on purpose, and keeps serving every request normally. |
| -2. Every 2 seconds it reads its target groups until each one reports it `unhealthy` (or `unhealthy.draining`) and at least one other target `healthy`. That must hold for another 10 seconds. It waits at most 90 seconds. |
| -3. It closes its public listeners gracefully: it stops accepting connections, lets requests already under way finish for up to 30 seconds, and then cuts anything still open. |
| +1. The box fails its load balancer health check on purpose, and keeps serving requests to apps that are already running. From here until the agent exits it starts no app on this box: a request that would wake one gets 503 with `Retry-After: 10`. |
| +2. Every 2 seconds it reads its target groups until each one reports it `unhealthy` (or `unhealthy.draining`) and at least one other target `healthy`. That must hold for another 10 seconds. A confirmation must start within 90 seconds and this step ends by 100 seconds whatever the reads do. |
| +3. It closes its public listeners gracefully: it stops accepting connections, lets requests already under way finish for up to 30 seconds, and then cuts anything still open. The whole drain has finished within 140 seconds of the request. |
| 4. systemd then stops the tenants and the edge as before. |
| ### You do not need to do anything |
| @@ -185,7 +185,7 @@ Every planned stop of the edge drains on its own: |
| - `carlos system apply` and `carlos system rollback` ask for the drain after their own checks pass and before they change anything. An apply of the release already installed, or a refusal, restarts nothing and asks for no drain. |
| - `systemctl restart carlos-edge`, `systemctl stop carlos-edge`, a reboot and a poweroff run the drain through `carlos-edge-drain.service`. That unit is started with the edge, and its stop runs the drain before any tenant or the edge stops. |
| -Expect a planned stop to take 30 to 60 seconds longer than before, and up to about 2 minutes at worst. The box's own hosts (fixed, non-HA hosts it serves) are unreachable for that extra time. After the restart, the load balancer sends the box new traffic only after two passing health checks, about 20 seconds after tenant admission opens. The other targets carry the traffic in the meantime. |
| +Expect a planned stop to take 30 to 60 seconds longer than before, and up to about 2 minutes 20 seconds at worst. The box's own hosts (fixed, non-HA hosts it serves) are unreachable for that extra time. After the restart, the load balancer sends the box new traffic only after two passing health checks, about 20 seconds after tenant admission opens. The other targets carry the traffic in the meantime. |
| These stops are **not** drained, and behave as before: |
| @@ -193,6 +193,11 @@ These stops are **not** drained, and behave as before: |
| - Recovery of an interrupted or failed self-update (`carlos-system-recover.service`). The recovery verb itself does not ask for the drain, because the edge has usually already stopped by then. It restarts the edge with systemctl, so if the edge is still running and `carlos-edge-drain.service` is active, that unit's stop runs the drain as for any restart, using the binary then on disk. If that binary has no drain, nothing is drained. |
| - Crashes, `systemctl kill`, and an instance that dies. The load balancer notices only after two failed health checks, about 20 seconds. |
| +While the drain runs, the box itself also behaves differently: |
| + |
| +- Requests that need an app woken on this box get 503 with `Retry-After: 10`, and the client retries through the load balancer. |
| +- An app on this box that is due to hibernate stops only after the drain has finished. |
| + |
| ### Reading the result |
| The drain unit writes two lines to the journal. Read them with: |
| @@ -239,7 +244,9 @@ Other summary lines, with no report, mean nothing was drained: |
| - `target group retention: ...`: the drain could not confirm that the target groups keep open connections long enough. Two different causes share this prefix, so read the rest of the line before changing any infrastructure: |
| - `target group retention: target group <arn>: unhealthy connection termination is on` or `... draining interval ... is below 3m0s`: the attributes are not applied. Apply them (next section). |
| - `target group retention: target health reader: ...` or another error after the prefix: the box could not build its reader or read the attributes, for example missing read rights or an AWS error. The attributes may be fine; fix what the error names. |
| -- `not healthy at start: target group <arn> reports <state>`: the box was already not healthy when the drain began, so the drain cannot tell how long it has been that way. |
| +- `not healthy at start: target group <arn> reports <state>`: the box was already not healthy when the drain began, so the drain cannot tell how long it has been that way. It is judged on the first read that succeeds, so it can also appear when the first reads failed for more than about 20 seconds: by then the drain's own failing health check has made the box unhealthy. Either way the drain errs toward `unverified`. |
| +- `ingress drain: no public listener is registered ...`: the edge runs in dev mode with plain HTTP, which the drain does not close. Only seen on a dev box run by hand. |
| +- `the settle did not end within 1m40s of the request`: the target groups had marked the box unhealthy, but the 10-second check was not finished 100 seconds after the drain began, usually because reads were slow. |
| - `target group <arn> reports healthy` (or `initial`): after 90 seconds the target group still had not marked the box unhealthy. |
| - `no other healthy target: target group <arn>`: the box was the last healthy target. When every target is unhealthy the load balancer fails open and keeps sending traffic to all of them, so draining this box protected nobody. Bring another target into service before you restart this one. |
| - `read failed: ...`: the box could not read its target groups (for example, the role lacks the read rights). The error is in the line. |
| @@ -247,7 +254,7 @@ Other summary lines, with no report, mean nothing was drained: |
| ### If the edge does not stop |
| -After the listeners close, the box serves nothing on its public ports. If the agent is still running 3 minutes later (someone stopped only `carlos-edge-drain`, or a verb failed after the drain and never restarted the edge), it logs `ingress drain ended without a stop; exiting` and exits. systemd restarts it, and the box comes back into the load balancer after tenant admission opens and two health checks pass. You do not need to step in. |
| +After the listeners close, the box serves nothing on its public ports. If the agent is still running 3 minutes later (someone stopped only `carlos-edge-drain`, or a verb failed after the drain and never restarted the edge), it logs `ingress drain ended without a stop; exiting` and shuts itself down as for a normal stop, so a fixed HA box still releases its hosts cleanly. If it is still running 90 seconds after that, it exits at once. systemd restarts it, and the box comes back into the load balancer after tenant admission opens and two health checks pass. You do not need to step in. |
| ### Setting it up on a deployment |
diff --git a/docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md b/docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md| index 3e491d73d..18a3f615b 100644 |
| --- a/docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md |
| +++ b/docs/superpowers/specs/2026-11-10-fixed-edge-ingress-drain-design.md |
| @@ -30,10 +30,12 @@ Within that, **no errors are expected** for requests that reach the region throu |
| - the request's host is not held by the restarting box; |
| - the box has started serving the request (read its headers and dispatched it) before step 3, and it completes within the connection wait (30 s). A connection the box accepted before step 3 whose request headers have not all arrived when step 3 starts is closed by Go's `Shutdown` without an answer (`net/http/server.go:2009`); this is refused up front, not handled. In practice it needs a client that opened a connection through the NLB before withdrawal and sent nothing for the settle and more. Longer requests (slow uploads or downloads) and long-lived streams (SSE, WebSockets) still open at the end of the wait are closed, as at today's shutdown; streams reconnect through the NLB to another box, as in §25.4 step 4. |
| -**Not covered, unchanged from today:** |
| +**Not covered** (the first three unchanged from today): |
| - Requests for hosts held by the restarting box. A fixed (non-HA) host is down for the restart, and from the end of step 2 rather than from the stop: once the listeners close, peers' hops to it are refused and answered with today's 503 `Retry-After: 10`. An HA host held by a fixed HA box (adi; leo when it serves a pool) is released with a clean marker at shutdown (§9.9), and peers answer 503 `Retry-After: 10` until they read it (§25.1 item 3). Moving those hosts first is §25's job, and §25 drains group members only (§6). |
| - Unplanned stops (§7). |
| - Group members (§4.1). |
| +- Wakes on the draining box. From step 1 until the agent exits, the box starts no tenant unit, platform and unit routes included: every such unit is bound to the edge and ordered before the drain unit, so its start job would wait behind the drain unit's stop job and, in replace mode, could cancel the edge's pending stop. A request that needs a wake on this box gets today's 503 `Retry-After: 10`; requests to instances already running are served. |
| +- Hibernate stops on the box wait until the drain ends: their stop jobs are ordered behind the drain unit's. |
| ## 4. The drain |
| @@ -50,16 +52,16 @@ The core treats "is this box still a target that receives new flows" as an adapt |
| The agent runs these when asked (§5). One drain per agent process; a second request joins it and gets the same report. |
| -1. **Fail the health check, keep serving.** `lbhealth.State` gains one condition, `ingress-drain`, listed by `Failing` after the six it has (`internal/lbhealth/lbhealth.go:154-178`). The health answer becomes 503 `unavailable: ingress-drain`. Nothing else changes: tenant admission stays open, the edges file keeps the box's role and admission, placement and forwarding are unchanged, and peers keep forwarding to it as a holder. Every response now says `Connection: close` (the switch §25's connection drain uses, §4.3), so each HTTP/1 client connection carries at most one more request and the client's next connection goes through the NLB again. There is **no barrier**: a request that arrives during the drain is served normally. |
| +1. **Fail the health check, keep serving.** (Tenant starts close here, §3.) `lbhealth.State` gains one condition, `ingress-drain`, listed by `Failing` after the six it has (`internal/lbhealth/lbhealth.go:154-178`). The health answer becomes 503 `unavailable: ingress-drain`. Nothing else changes: tenant admission stays open, the edges file keeps the box's role and admission, placement and forwarding are unchanged, and peers keep forwarding to it as a holder. Every response now says `Connection: close` (the switch §25's connection drain uses, §4.3), so each HTTP/1 client connection carries at most one more request and the client's next connection goes through the NLB again. There is **no barrier**: a request that arrives during the drain is served normally, unless it needs a tenant unit started on this box (§3). |
| 2. **Wait for the target groups.** Every 2 s the agent calls `DescribeTargetHealth` on each named target group with **no target filter**, so one response carries every target: it finds its own entries by instance id and the ports it is registered on (80 and 443), and counts the other targets reported `healthy`. Before the first poll it reads `DescribeTargetGroupAttributes` once per target group; if unhealthy connection termination is on, or the draining interval is below 180 s (§8), the verdict is `unverified: target group retention` and the drain goes on to the cap's behaviour below. If the box's state at the first poll is already anything but `healthy`, its age is unknown and the verdict is `unverified: not healthy at start`. |
| It goes on when every target group reports the box `unhealthy` or `unhealthy.draining`, and at least one other target `healthy`, and then waits a **settle** of 10 s, polling on. The verdict is `withdrawn` only if the states held through the settle. `draining` and `unused` (deregistration) do not count: AWS notes that a deregistering target may still receive new connections while the change propagates, and the ingress drain never deregisters. The settle is a margin, not a documented bound (§3). |
| - The cap is 90 s from the request. If a read fails, or any target group still reports the box `healthy` or `initial` at the cap, the agent goes on anyway and records `unverified`, naming the target group, its last state or the read error. The drain cannot refuse the stop: a reboot or a `systemctl stop` is already under way, and stalling it longer helps nobody. Fail-open (§8) shows up here as the healthy-peer count: with none, the verdict is `unverified: no other healthy target`. |
| -3. **Close the public listeners gracefully.** The agent calls `Shutdown` on the edge's `:443` and `:80` servers with a 30 s context (the **connection wait**). Go's `Shutdown` stops accepting, closes idle connections, sends HTTP/2 GOAWAY to every HTTP/2 connection, and waits for the requests it has already dispatched on both protocols. A connection whose request headers are still incomplete is closed without an answer (§3). Before the wait it closes the edge-held SSE streams still open through it at an event boundary (`closeAllHeld`, which the edge already tracks). Other long-lived responses (proxied SSE, WebSockets) are not picked out early: they run until the 30 s bound, so a drain with one open takes the whole wait. At 30 s, whatever is still running is cancelled and its connection closed, as in `DrainConnections` (`internal/edge/hadrainconns.go:193-232`), and counted. The serve loops already treat `http.ErrServerClosed` as a normal exit (`internal/edge/edge.go:4956-4966`), and the shutdown at SIGTERM finds the servers already shut and returns at once. |
| -4. **Answer** with the report: the verdict (`withdrawn` or `unverified` and why), the target groups' states over time, the time each step ended, requests finished during the wait, and streams and connections closed. The caller logs it to the journal and returns. systemd then stops tenant units and the edge, which closes admission and shuts down as today (`internal/edge/shutdown.go:9-14`, §9.9). |
| + The cap is 90 s from the request, and step 2 ends by 100 s (the cap plus the settle) whatever the reads do: no settle starts at or after the cap, each read is bounded by what is left of the 100 s, and a read still out at 100 s is abandoned (`unverified: the settle did not end within 1m40s of the request` if a settle was under way). If a read fails, or any target group still reports the box `healthy` or `initial` at the cap, the agent goes on anyway and records `unverified`, naming the target group, its last state or the read error. The drain cannot refuse the stop: a reboot or a `systemctl stop` is already under way, and stalling it longer helps nobody. Fail-open (§8) shows up here as the healthy-peer count: with none, the verdict is `unverified: no other healthy target`. |
| +3. **Close the public listeners gracefully.** The agent calls `Shutdown` on the edge's `:443` and `:80` servers with a 30 s context (the **connection wait**). Go's `Shutdown` stops accepting, closes idle connections, sends HTTP/2 GOAWAY to every HTTP/2 connection, and waits for the requests it has already dispatched on both protocols. A connection whose request headers are still incomplete is closed without an answer (§3). Before the wait it closes the edge-held SSE streams still open through it at an event boundary (`closeAllHeld`, which the edge already tracks). Other long-lived responses (proxied SSE, WebSockets) are not picked out early: they run until the 30 s bound, so a drain with one open takes the whole wait. At 30 s, whatever is still running is cancelled and its connection closed, as in `DrainConnections` (`internal/edge/hadrainconns.go:193-232`), and counted. Step 3 runs under one context that ends 140 s after the request: the connection wait, the cut and the join of what was cut (10 s) all end inside it. An edge with no public server registered (dev mode's plain HTTP) closes nothing and the verdict becomes `unverified` with that reason. The serve loops already treat `http.ErrServerClosed` as a normal exit (`internal/edge/edge.go:4956-4966`), and the shutdown at SIGTERM finds the servers already shut and returns at once. |
| +4. **Answer** with the report, final by 140 s from the request: the verdict (`withdrawn` or `unverified` and why), the target groups' states over time, the time each step ended, requests finished during the wait, and streams and connections closed. The caller logs it to the journal and returns. systemd then stops tenant units and the edge, which closes admission and shuts down as today (`internal/edge/shutdown.go:9-14`, §9.9). |
| -After step 3 the box serves nothing on its public ports. If the agent is still running 3 minutes after step 3 ended (someone stopped only the drain unit, or a verb failed after draining), it logs `ingress drain ended without a stop; exiting` and exits non-zero. systemd restarts it (`Restart=always`), and it comes back through admission and two passing health checks like any start. Before step 3 an abandoned caller changes nothing: the agent finishes the drain on its own, because the stop it was asked for is coming. |
| +After step 3 the box serves nothing on its public ports. If the agent is still running 3 minutes after step 3 ended (someone stopped only the drain unit, or a verb failed after draining), it logs `ingress drain ended without a stop; exiting` and sends SIGTERM to its own process, so its normal shutdown runs (on a fixed HA box that writes the clean marker and releases the lease); if it is still running `agentShutdownBudget` (90 s) later, or the signal cannot be sent, it exits non-zero. systemd restarts it (`Restart=always`), and it comes back through admission and two passing health checks like any start. Before step 3 an abandoned caller changes nothing: the agent finishes the drain on its own, because the stop it was asked for is coming. |
| ### 4.3 Sharing the connection drain with §25 |
| @@ -89,7 +91,7 @@ Type=oneshot |
| RemainAfterExit=yes |
| ExecStart=/bin/true |
| ExecStop=-/opt/carlos/carlos __ingress-drain |
| -TimeoutStopSec=150 |
| +TimeoutStopSec=170 |
| User=carlos |
| Group=carlos |
| (the edge's hardening, with an empty capability bounding set) |
| @@ -97,14 +99,14 @@ Group=carlos |
| - **Started with the edge.** `carlos-edge.service` gains `Upholds=carlos-edge-drain.service` (systemd 249 or later), so the drain unit is active whenever the edge is: after a boot, a `systemctl restart` and an automatic restart alike. The plan checks the boxes' systemd version; the root-runner test (§9) decides between `Upholds=` and `Wants=`. |
| - **Finished first.** Every tenant unit, that is every unit other than the drain unit that has `BindsTo=carlos-edge.service`, gains `Before=carlos-edge-drain.service`. systemd stops units in reverse order and starts a unit's stop only after the stop jobs ordered before it have finished, so in a stop of the edge the drain unit's `ExecStop` **completes** before any tenant unit's stop begins, and before the edge's own stop. A unit test fails if a tenant unit misses the line. |
| -- **Never blocks a stop.** The `-` prefix ignores the exit status, and `__ingress-drain` exits 0 in every case. If the agent's socket does not answer (the edge already crashed, or an older agent without the route), it exits at once. `TimeoutStopSec=150` covers the 90 s cap, the 10 s settle, the 30 s connection wait and slack. The edge's own `TimeoutStopSec=120` is separate and unchanged. |
| -- **How it reaches the agent.** It runs as the agent's user and dials the agent's existing drain socket, `/run/carlos/.ha-drain/drain.sock` (`internal/host/hadrain_socket.go:30-34`), which serves only that user (SO_PEERCRED, `hadrain_socket_linux.go:23-31`). New routes: `POST /v1/ingress/drain` (start or join, wait, answer the report; bounded at 140 s) and `GET /v1/ingress/status`. Today the socket is served on group members only (`internal/host/agent.go:1236-1243`); it is now served whenever the ingress drain is armed too, and the group-only `/v1/drain/*` routes answer 404 on a fixed box. Instances never see the socket: their namespaces replace `/run/carlos` (`hadrain_socket.go:8-9`). |
| +- **Never blocks a stop.** The `-` prefix ignores the exit status, and `__ingress-drain` exits 0 in every case. If the agent's socket does not answer (the edge already crashed, or an older agent without the route), it exits at once. `TimeoutStopSec=170` outlasts the whole budget: the report is final by 140 s (the 90 s cap, the 10 s settle, the 30 s connection wait, the 10 s join), the route answers by 150 s and the helper gives up at 155 s. The edge's own `TimeoutStopSec=120` is separate and unchanged. |
| +- **How it reaches the agent.** It runs as the agent's user and dials the agent's existing drain socket, `/run/carlos/.ha-drain/drain.sock` (`internal/host/hadrain_socket.go:30-34`), which serves only that user (SO_PEERCRED, `hadrain_socket_linux.go:23-31`). New routes: `POST /v1/ingress/drain` (start or join, wait, answer the report; bounded at 150 s) and `GET /v1/ingress/status`. Today the socket is served on group members only (`internal/host/agent.go:1236-1243`); it is now served whenever the ingress drain is armed too, and the group-only `/v1/drain/*` routes answer 404 on a fixed box. Instances never see the socket: their namespaces replace `/run/carlos` (`hadrain_socket.go:8-9`). |
| ### 5.3 The root verbs, and rollback across W6 |
| Rollback restores `carlos.prev` over `/opt/carlos/carlos` and then installs the older unit set, which lacks the drain unit, before it restarts the edge (`internal/host/systemapply.go:2063-2098`). By the time the drain unit stopped, its `ExecStop` would run the old binary, which has no `__ingress-drain`. So `apply` and `rollback` ask for the drain themselves, **before** they quiesce and swap anything, through the drain-call child they already use for group maintenance (`internal/host/hadrain_call.go`): root re-executes its own pinned `/proc/self/exe` (the binary running the verb, not the file on disk), which drops to the agent's user and dials the socket. The verb waits for the report and prints it. If the verb then fails before it restarts the edge, the agent's 3-minute exit (§4.2) restores service. |
| -A verb that will not restart the edge (a refusal, a no-op apply of the same release) asks for no drain. The verb asks only after its own refusals and preflight checks have passed. |
| +A verb that will not restart the edge (a refusal, a no-op apply of the same release) asks for no drain. The verb asks only after its own refusals and preflight checks have passed, including a dry run of the activation guard's checks (the root protocol check on the binary, the moves floor and hold rule) and the quiesce's group maintenance permit, so a refusal never follows a drain. `carlos-system-update.service`'s `TimeoutStartSec` gains 300 s: an apply whose gate fails asks twice (install, then rollback). |
| **Not drained: anything a pre-W6 binary runs.** That is the first roll onto W6, and also an automatic rollback or recovery that the pre-W6 verb process runs during that first roll if the new agent fails its gate (`internal/host/systemapply.go:675`, `:730`): the old process cannot ask, and the binary it restores has no helper. |
| @@ -160,7 +162,7 @@ Cost: no money; target group attributes are free and health checks are not bille |
| - **Edge, step 1 and step 3:** a request during step 1 is served (200) with `Connection: close`; across step 3, an HTTP/1 request already in flight and an HTTP/2 stream already open both complete; an HTTP/2 client gets GOAWAY and its next request opens a new connection; a connection accepted before step 3 with partial headers is closed without an answer (the refusal in §3, pinned so a Go upgrade that changes it is noticed); a request still running at the 30 s bound is cancelled and counted; edge-held SSE streams are closed at the start of the wait, and a proxied SSE response or WebSocket runs until the bound and is then cut and counted; the serve loops exit without `log.Fatal`; the later SIGTERM shutdown returns at once. |
| - **Guard:** the ingress drain refuses to start during a §25 connection drain, and the reverse. |
| - **Healthy only once admitted:** a box restarted with admission closed answers 503 on `/.carlos/lb-health` until admission opens, with every lbhealth condition otherwise passing (pins `internal/edge/lbhealth.go:34-49`). |
| -- **Units:** every tenant unit in `internal/host/units` (`BindsTo=carlos-edge.service`, the drain unit excluded) has `Before=carlos-edge-drain.service`; the edge has `Upholds=carlos-edge-drain.service`; the drain unit's `ExecStop` has the `-` prefix and `TimeoutStopSec=150`. |
| +- **Units:** every tenant unit in `internal/host/units` (`BindsTo=carlos-edge.service`, the drain unit excluded) has `Before=carlos-edge-drain.service`; the edge has `Upholds=carlos-edge-drain.service`; the drain unit's `ExecStop` has the `-` prefix and `TimeoutStopSec=170`. |
| - **`__ingress-drain`:** exits 0 when the socket is absent, refuses, answers 404 (old agent) or times out; prints the report on success. |
| - **The verbs:** `apply` and `rollback` ask for the drain after their preflight and before the quiesce and the binary swap; not on a refusal or a same-release no-op; a 404 is logged and the verb goes on. Fakes as in `systemapply`'s tests. |
| - **Root runner, real systemd** (the `TestRootHATerminateRelease` harness, §9.9), with a fake target-health adapter that turns `unhealthy` 10 s after the drain starts: on a box with one awake tenant serving a request loop through the edge, `systemctl restart carlos-edge` shows, from journal timestamps, the drain's `ExecStop` **ending** before the tenant unit's first stop command and before the edge's SIGTERM, with the request loop at 0 failures until step 3; the drain unit active again after the restart; the same after an automatic restart following `systemctl kill -s KILL` of the agent, where the drain exits within 1 s; a reboot runs the drain first; `carlos system rollback` from a W6 build to a pre-W6 build drains before the swap; a pre-W6 to W6 apply with a forced gate failure rolls back undrained, as §5.3 states, and leaves the box serving. |