carlos / platform Public

region HA: held witnesses run in CI; r2 text fixes

Branch review r2 P3s. The roll tool's planned-handover and operator
document witnesses run in the provision guard tests (Fable B2.2). Stale
text: the cancel comments in the roll tool, the drainClient.call census
basis (re-proposed; the unit runs only in the agent-user child), and
§25.10's roll mutation count (Fable B2.4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ac42f4c89a2f0f005969ebe89dfe3e421f586b23 parent 0ec8f11
6 files changed, +24 −7
  • docs/superpowers/notes/census-proposal-region-ha-held-build.md +1 −1
  • docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md +1 −1
  • internal/provision/region_group_guards_test.go +15 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv +2 −2
  • scripts/region-group-roll.py +4 −2

CI failed — run details

Intent

Human

<task-notification> <task-id>adf1e06c315d476b2</task-id> <tool-use-id>toolu_01HMfTHhq6gu2nnzJQQHWPvW</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a99cbe46-f458-4f72-8b8a-294aae9cdf21/tasks/adf1e06c315d476b2.output</output-file> <status>completed</status> <summary>Agent "Fable branch review round 2" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Nothing further is needed: the review file is written, the scratch directory `/tmp/g.CjaI` was removed, no servers or background processes were started, and the repo is untouched. **Verdict: READY AFTER FIXES** Findings: 0 P1, 1 P2 (B2.1, already closed by post-head commit 0ec8f111), 4 P3 (B2.2 to B2.5).</result> <usage><subagent_tokens>261626</subagent_tokens><tool_uses>56</tool_uses><duration_ms>1008352</duration_ms></usage> </task-notification>

Attributed to this commit: 24.3 g CO₂e (2,954,997 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-held-build, 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/superpowers/notes/census-proposal-region-ha-held-build.md b/docs/superpowers/notes/census-proposal-region-ha-held-build.md
index 066e3dc1a..162a56123 100644
--- a/docs/superpowers/notes/census-proposal-region-ha-held-build.md
+++ b/docs/superpowers/notes/census-proposal-region-ha-held-build.md
@@ -96,6 +96,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- reads `internal/edge/edge.go:Edge.ServeHTTP`: +registry:HA ×2, +registry:Host, +whole:Route ×4; keeps legacy, task accepted-legacy
- reads `internal/edge/forwardha.go:Edge.forwardHAAndNote`: -registry:Host ×3, +whole:Route; keeps legacy, task accepted-legacy
-Seal: `7ac2bde8301c37c7546e9aa19d375f1468fc8061876a618fa8f93dd4543c5652` → `d4b7894257c676f02520635e62ad04daaab0ae6557597857e3c6e1c3f1abc8fc`.
+Seal: `7ac2bde8301c37c7546e9aa19d375f1468fc8061876a618fa8f93dd4543c5652` → `318d254cf1f1bd33b50bed810332a2d95e89c43b558c5d305d3e64e3d8d9ff9e`.
Overlay: `internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md
index 550e974cc..b0cf8d1b0 100644
--- a/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md
+++ b/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md
@@ -1208,7 +1208,7 @@ A drain is only safe when every box that may send A a request understands the ne
**Request budget (§18).**
- **Steady state:** unchanged. Nothing polls. `ha_take` rides the existing edges publication.
- **Per drain:**
- - two edges mutations (the drain state, then `drained`), each with its change-index update and §18's reader amplification;
+ - two edges mutations (the drain state, then `drained`), each with its change-index update and §18's reader amplification; a roll adds a third when fence-clear makes the restarted member placeable again;
- two acknowledgement rounds, each costing one fold read per live box (one LIST plus one GET per edges file, as at any fold). A failed fold read is retried at the 5 s cadence, so the worst case is 24 fold reads per box per round. The change-index fold that the publication triggers anyway is separate;
- the tool's lock check (the sweep): one delimited LIST of the lock prefix (one page per 1,000 hosts), then for each host under it, HA or not, one exact-key LIST and one GET when its `lock.json` exists. A replace or remove sweeps twice, before the action check and again after the edge stops; a resumed or retried stop sweeps again. Per transaction only, never on a timer.
- **Per host moved:** the marker PUT, as at any sleep, plus the successor's acquire (1 GET + 1 PUT) and restore, which the host's next wake would have cost anyway.
diff --git a/internal/provision/region_group_guards_test.go b/internal/provision/region_group_guards_test.go
index 7b43b92da..491a9317e 100644
--- a/internal/provision/region_group_guards_test.go
+++ b/internal/provision/region_group_guards_test.go
@@ -210,3 +210,18 @@ func TestRegionGroupPythonGuards(t *testing.T) {
}
t.Logf("%s", output)
}
+
+// TestRegionGroupHeldPythonGuards runs the planned-handover witnesses of
+// the roll tool (region HA §25: drain, replace, remove, return refusal,
+// cancel-drain) and the operator document's, a few minutes in all
+// (branch review r2, Fable B2.2).
+func TestRegionGroupHeldPythonGuards(t *testing.T) {
+ python := groupGuardBinary(t, "python3")
+ cmd := exec.Command(python, "-B", "-m", "unittest", "scripts.region_group_held_test", "scripts.region_group_document_test")
+ cmd.Dir = "../.."
+ output, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("region group held Python guards: %v\n%s", err, output)
+ }
+ t.Logf("%s", output)
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 9694c2864..e1115e31d 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -136,4 +136,4 @@ plan14-root-reads-edge-page-cache-1.tsv 2774b43ac5970e4340339b859204bce5eb9f83d4
plan14-root-reads-cli-default-console-carloku.tsv 2774b43ac5970e4340339b859204bce5eb9f83d4c2551f0984e919a2853d0216
plan14-root-reads-gvisor-demos.tsv f05716181a82721b38cba9b2d89c47925dc2ca426e5c4876ebf1df7b45895ee3
plan14-root-reads-dns-fresh-lookup-724.tsv 7ac2bde8301c37c7546e9aa19d375f1468fc8061876a618fa8f93dd4543c5652
-plan14-root-reads-region-ha-held-build.tsv d4b7894257c676f02520635e62ad04daaab0ae6557597857e3c6e1c3f1abc8fc
+plan14-root-reads-region-ha-held-build.tsv 318d254cf1f1bd33b50bed810332a2d95e89c43b558c5d305d3e64e3d8d9ff9e
diff --git a/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv b/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv
index 4d68d3f00..45103fb4f 100644
--- a/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv
+++ b/internal/provision/testdata/plan14-root-reads-region-ha-held-build.tsv
@@ -48,7 +48,7 @@
@legacy acd0edb08e913a3081fee9c34c1eebb082919af819b7736490abb99b34260e0b internal/host/hadrain.go drainDriver.take legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: successor choice (ChooseRoomiest over the in-memory drain snapshot among peers that answer takes and are not draining), the signed take, and on a timeout one DrainTakeOwner lock read; reads route Host/App in memory Branch review r1 (Astra B1.1): the single DrainTakeOwner lock read also runs on a receiver wake timeout (ErrTakeWakeTimeout), as on the driver's own deadline; no read added. registry:App@571,registry:Host@545,registry:Host@711,whole:Route@1148,whole:Route@125,whole:Route@158 4454396f3c36378742b07609afb9d9aa016f59b27d84b085662cf025860d0a95
@legacy 6186adafae20db50adfdf289c023799fc414dd76c1e6c7bd89b79db9a4619510 internal/host/hadrain.go newIncarnation legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: 16 random bytes from crypto/rand for the agent's incarnation; not a file read file:Read@61 32ca897808b96ae347289759b271cc59c099010b32792d9718739dde08f44835
@legacy 39dadc8c7a42e85c098a3df493dbd89cd3ebf04167931ce5509b1654270c9155 internal/host/hadrain_call_linux.go drainCallExec legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new (branch review r1, Astra B1.3): builds the __drain-call child command: the pinned executable /proc/self/fd/3 (registryExecutable, as the registry child), fixed arguments (op from a fixed set, the validated transaction), empty environment, Dir "/", no stdin; the child drops to the agent user before it dials the agent socket; root reads only its bounded stdout (drainCallMax) file:Command@142 b9add51d0ece2b6f51b9fb54e7b9c5336f6189405052f2bacf1745ce3a9083c1
-@legacy e5b59e41c54b84f68f8f85d7656e848ec3cf47849125b88ef8907f874260bd64 internal/host/hadrain_socket.go drainClient.call legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: root verb client: reads the agent drain socket's HTTP response body, bounded to 4 MiB; not a file read file:ReadAll@552 fdf043168e644ec9118aca5ee92b04957a77dfda91d815d18e941d4b3036f63d
+@legacy f14834af3b6cdd77a800f1f4c97abbb3f378318fb0c9ec78554b0924ad98d1e2 internal/host/hadrain_socket.go drainClient.call legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: drain call client, run only in the __drain-call child after it drops to the agent user (branch review r1; formerly the root verb client): reads the agent drain socket's HTTP response body, bounded to 4 MiB; not a file read file:ReadAll@552 fdf043168e644ec9118aca5ee92b04957a77dfda91d815d18e941d4b3036f63d
@legacy 65d4e49a758fd6592af4020c4d5158f6cd1a7ab0cce2e4295b74078a61bb39fd internal/host/hadrain_socket.go drainDriver.handler legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: agent drain socket handler: reads the request body bounded to 4 KiB, strict JSON with one transaction field; served only to a peer SO_PEERCRED reports as root; not a file read file:ReadAll@722 642e5314cdd3cc05f789b91b44fe981c874eb0fedc099f08a9ccd4d6fd2e9e37
@legacy 0839e28f113acda04839f0e9f581c961270841cf6370f0a37c26debb7cd08055 internal/host/hadrain_socket_linux.go serveHADrain legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: agent-side: Lstat and open of its own 0700 socket directory under /run/carlos for a flock, as serveReplicaHealth does; no tenant or root file read file:Lstat@181,file:Open@433 a9e2bda502b2845a65824570d9afe4d2bdd18f4bda7c76e9db8e52a1861c2627
@legacy e6bb200428a5904ba23eb85c836a4c117a34cc2fb2ed1609b2dbc3f70d4380d3 internal/host/hadrainfence_linux.go fenceLocation.install legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: root verb: writes fence.json (0644) by O_EXCL temp file, fsync and RENAME_NOREPLACE in the fence directory; reads the existing fence first and refuses another transaction's file:Openat2@703,file:Read@568 001cace56ac0d4129f8101729f0a5b80896a549db216a79cabd4728147dc85bb
@@ -110,7 +110,7 @@ internal/host/hadrain.go drainDriver.releaseOne legacy accepted-legacy accepted-
internal/host/hadrain.go drainDriver.take legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: successor choice (ChooseRoomiest over the in-memory drain snapshot among peers that answer takes and are not draining), the signed take, and on a timeout one DrainTakeOwner lock read; reads route Host/App in memory Branch review r1 (Astra B1.1): the single DrainTakeOwner lock read also runs on a receiver wake timeout (ErrTakeWakeTimeout), as on the driver's own deadline; no read added. registry:App@571,registry:Host@545,registry:Host@711,whole:Route@1148,whole:Route@125,whole:Route@158 4454396f3c36378742b07609afb9d9aa016f59b27d84b085662cf025860d0a95
internal/host/hadrain.go newIncarnation legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: 16 random bytes from crypto/rand for the agent's incarnation; not a file read file:Read@61 32ca897808b96ae347289759b271cc59c099010b32792d9718739dde08f44835
internal/host/hadrain_call_linux.go drainCallExec legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new (branch review r1, Astra B1.3): builds the __drain-call child command: the pinned executable /proc/self/fd/3 (registryExecutable, as the registry child), fixed arguments (op from a fixed set, the validated transaction), empty environment, Dir "/", no stdin; the child drops to the agent user before it dials the agent socket; root reads only its bounded stdout (drainCallMax) file:Command@142 b9add51d0ece2b6f51b9fb54e7b9c5336f6189405052f2bacf1745ce3a9083c1
-internal/host/hadrain_socket.go drainClient.call legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: root verb client: reads the agent drain socket's HTTP response body, bounded to 4 MiB; not a file read file:ReadAll@552 fdf043168e644ec9118aca5ee92b04957a77dfda91d815d18e941d4b3036f63d
+internal/host/hadrain_socket.go drainClient.call legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: drain call client, run only in the __drain-call child after it drops to the agent user (branch review r1; formerly the root verb client): reads the agent drain socket's HTTP response body, bounded to 4 MiB; not a file read file:ReadAll@552 fdf043168e644ec9118aca5ee92b04957a77dfda91d815d18e941d4b3036f63d
internal/host/hadrain_socket.go drainDriver.handler legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: agent drain socket handler: reads the request body bounded to 4 KiB, strict JSON with one transaction field; served only to a peer SO_PEERCRED reports as root; not a file read file:ReadAll@722 642e5314cdd3cc05f789b91b44fe981c874eb0fedc099f08a9ccd4d6fd2e9e37
internal/host/hadrain_socket_linux.go serveHADrain legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: agent-side: Lstat and open of its own 0700 socket directory under /run/carlos for a flock, as serveReplicaHealth does; no tenant or root file read file:Lstat@181,file:Open@433 a9e2bda502b2845a65824570d9afe4d2bdd18f4bda7c76e9db8e52a1861c2627
internal/host/hadrainfence_linux.go fenceLocation.install legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-held-build;basis=new: root verb: writes fence.json (0644) by O_EXCL temp file, fsync and RENAME_NOREPLACE in the fence directory; reads the existing fence first and refuses another transaction's file:Openat2@703,file:Read@568 001cace56ac0d4129f8101729f0a5b80896a549db216a79cabd4728147dc85bb
diff --git a/scripts/region-group-roll.py b/scripts/region-group-roll.py
index 00b4b52ae..b680e51bf 100755
--- a/scripts/region-group-roll.py
+++ b/scripts/region-group-roll.py
@@ -834,7 +834,8 @@ class AWS:
require(isinstance(tx, str) and TX.fullmatch(tx) and not tx.startswith("-"), "record")
command += " " + tx
if verb == "drain-cancel":
- # The root verb removes the fence only on a confirmed stop
+ # The root verb removes the fence whatever the agent says and
+ # fails unless the agent confirmed or the edge is stopped
# (internal/host/group_maintenance_drain.go); status shows it.
command = ("/usr/bin/timeout --signal=TERM --kill-after=30s %ds %s system group-maintenance "
"drain --cancel %s && %s system group-maintenance status" % (CANCEL_BOUND, binary, tx, binary))
@@ -2296,7 +2297,8 @@ class Operator:
def cancel_drain(self, iid, transaction):
"""drain --cancel for a transaction closed after a failed drain. The
- root verb removes the fence only on a confirmed stop; status proves it."""
+ root verb removes the fence and fails unless the agent or systemd
+ confirmed the stop; status proves it."""
require(self.state.held and isinstance(transaction, str) and TX.fullmatch(transaction) and
not transaction.startswith("-"), "record")
self.j = self.state.load(transaction)