carlos / platform Public

docs: region HA runbook, replacing, resizing or removing a member

The operator section for region HA held requests (spec section 25), copy
approved by Paul in copy review on 2026-11-09 and applied verbatim. The
command block and a note that the commands change when the Go roll verb
ships were added on agent manager 8a3d302's instruction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from docs-region-ha-held-runbook into main.
claude agent, operated by paul@keymail.dev b35ed9cbdafa7311099d14fccb408f32a06072d3 parent 4c0aaf3
1 file changed, +67 −0
  • docs/region-ha-runbook.md +67 −0

CI failed — run details

diff --git a/docs/region-ha-runbook.md b/docs/region-ha-runbook.md
index c260473d4..b71b3a319 100644
--- a/docs/region-ha-runbook.md
+++ b/docs/region-ha-runbook.md
@@ -53,6 +53,73 @@ edge: wildcard certs on, serve only (%s); this box cannot order wildcards
With neither provider nor token configured, `%s` is `CARLOS_DNSIMPLE_TOKEN missing`.
+## Replacing, resizing or removing a group member
+
+The roll tool (`scripts/region-group-roll.py`) changes one group member at a time. Before it rolls, replaces or removes a member, it drains it: each awake host moves to another member, and requests for that host wait a few seconds instead of failing. A member that dies without warning is different. Its hosts still answer 503 with `Retry-After: 10` until their leases expire.
+
+### Before you start
+
+Every box that can send the member a request must run a release with held requests. The tool checks this before each transaction: every live box in the region, fixed forwarders included, must publish `ha_take: 1`, and for `replace` the release the launch template boots must be at or above `ha_floor`. If any box falls short, the tool prints "DR-4's lock-free rule applies" and does not drain. Replace only lock-free members then, as before.
+
+A fixed box that forwards into the region needs `CARLOS_REGION_HA=1` in its host.env. Without it, the box publishes no `ha_take`, and the region stays on DR-4.
+
+Add three keys to the tool's JSON config:
+
+- `ha_floor`: the first release with held requests, for example `v0.35.0`.
+- `data_bucket`: the region's data bucket, the same as the members' `CARLOS_HIBERNATE_BUCKET`.
+- `data_prefix`: the prefix the hosts' `lock.json` files sit under, usually `instances`.
+
+The operator's credentials need the grants in the region-host module's `group_operator_policy_json` output, and the region's session document must be at the release that adds the drain commands.
+
+### Running a change
+
+Run one of these as root on the operator host, for one member at a time:
+
+```sh
+region-group-roll.py --config dev-ie.json roll --member i-0123456789abcdef0 --to-sha256 <artifact sha256>
+region-group-roll.py --config dev-ie.json replace --member i-0123456789abcdef0
+region-group-roll.py --config dev-ie.json remove --member i-0123456789abcdef0
+```
+
+These commands change when the Go roll verb ships.
+
+Each one lowers the group's minimum, puts the member in Standby, drains it, checks that no lock still names it, then acts: `roll` installs the new release and returns the member, `replace` terminates it and lets the group launch a new one, and `remove` terminates it for good. At the end the tool prints one line of JSON with what moved.
+
+In that line, `hosts_moved` and `hosts_released` count the hosts that left the member, `longest_hold_ms` is the longest pause a request saw, `todays_answer` counts requests that still got a 503 (aim for 0), `connections_closed_at_bound` counts connections cut at the 60-second limit, and `departure_seconds` is how long the departure took.
+
+The region runs one member short from Standby until the replacement is healthy, usually a few minutes. With two members, the survivor carries every host meanwhile.
+
+### Resizing every member
+
+Set `instance_type` in the region's group module and apply. The plan should show a new launch template version and no instance change. Set `group_launch_template_version` to that version and apply again. Then run `replace` once for each member, waiting for each to finish.
+
+### Scaling in
+
+`remove` refuses if fewer than two members would remain, or if a pool the member served would be left with none. After it finishes, set `box_count` to the new count in the region's tofu and apply. The plan should show no instance change.
+
+### What tenants see
+
+A request that reaches the member during the drain waits while its host moves, then completes on the new member. This covers requests with no body, or a body of at most 64 KiB whose length is known.
+
+These still get 503 with `Retry-After: 10` for the few seconds a host moves:
+
+- a forwarded request whose body is over 64 KiB or of unknown length;
+- a request that another box already sent to the member, including most cross-region requests;
+- edge-local calls, tunnel deliveries and requests on a regional name for the moving host;
+- a request that arrives after the member has started closing its connections.
+
+Keep-alive connections close between requests, server-sent event streams reconnect, and WebSockets still open after 60 seconds are closed. Always-on workers pause until the departure finishes, a few minutes.
+
+### When a drain fails
+
+If the drain fails, the tool does nothing to the instance. It returns the member to service and restores the group's shape, but the member stays fenced: it starts nothing new and takes no new hosts. The tool prints the command that ends this, `cancel-drain --member <id> --transaction <id>`. Run it once you have read the reasons the tool printed.
+
+If the member's agent is still moving hosts, or the tool cannot tell, the member stays in Standby instead. Run `cancel-drain`, then `return --transaction <id>`.
+
+During a successful roll the restarted member is fenced too, from its restart until the tool returns it to service. Other members place nothing on it in that time. That is expected.
+
+Keep DR-4's lock-free rule in every window card until the dev witnesses for replace, roll, resize and scale-in have passed.
+
## A fixed box has been terminated: remove its edges file
When a fixed box is terminated, a surviving box recovers its duties. It takes over the box's hosts, timers and due wakes. It does not delete the departed box's edges file (`control/edges/<box>.json`) because the platform cannot prove which instance of a fixed box an edges file belongs to.