carlos / platform Public

spec: PPv2 rev 4, one-way PROXY protocol (option A)

Rollback ends at S1 and PPv2 never goes off, so no allowed move can
reach S3. Adds the trust-violation metric and alarm, close-trusted
containment, and the cost: no build below vN on an NLB target after A80,
with a box-side activation guard and release/roll card checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b06da7a081ac3e881300e438d0d91ecdda715bc4 parent 9869fab
2 files changed, +84 −43
  • docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md +63 −34
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-ppv2.md +21 −9

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md b/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md
index 5d7365faf..46653a36d 100644
--- a/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md
+++ b/docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md
@@ -1,6 +1,6 @@
# PROXY protocol v2 on the region HA load balancers
-Design, 2026-11-12, **rev 3** (Astra rounds 1 and 2 applied, §12 and §13; **stopped under stopping rule 2**: round 2 repeated fault family F1, so the decision in §14 goes to Paul before any third round). Agent manager 8a3d302 asked for it on 2026-11-12 with Paul's approval: client IP preservation off and PROXY protocol v2 on, on both target groups of each region NLB, before G6 opens the NLBs to customers. Design only; the build is a separate GO. Review budget: at most three Astra rounds (AGENTS.md stopping rules); rounds 1 and 2 each found one P1 in fault family F1, so two rounds are spent and the third waits on §14.
+Design, 2026-11-12, **rev 4** (Astra rounds 1 and 2 applied, §12 and §13; round 2 repeated fault family F1, so under stopping rule 2 the choice went to Paul: **option A, one-way PROXY protocol, decided 2026-11-12** by agent manager 8a3d302 on Paul's standing acceptance of recommendations, Paul informed and free to override; §14). Rev 4 writes A in, with the alarm and the close-all action; Astra round 3 is the last. Agent manager 8a3d302 asked for it on 2026-11-12 with Paul's approval: client IP preservation off and PROXY protocol v2 on, on both target groups of each region NLB, before G6 opens the NLBs to customers. Design only; the build is a separate GO. Review budget: at most three Astra rounds (AGENTS.md stopping rules); rounds 1 and 2 each found one P1 in fault family F1, so two rounds are spent and the third waits on §14.
Line citations are to `origin/main` at ae1b8cca. AWS facts quote "Edit target group attributes for your Network Load Balancer" (docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html, read 2026-11-12) unless another page is named.
@@ -24,11 +24,11 @@ Today on both NLBs (read 2026-11-12, `~/.cache/ppv2/aws/`):
## 2. What changes, in one paragraph
-Each target group stops preserving the client address and sends a PROXY protocol v2 header instead. The target then sees every NLB connection coming from one of the NLB's own private addresses, on a source port the NLB chose, so two client connections can never share a 4-tuple at the target. The edge learns the client address from the header. It reads a header as identity only on connections whose socket peer is one of its region NLB's private addresses, listed in a new host-env key; it rewrites the connection's remote address to the header's source before net/http sees it, so every reader of `r.RemoteAddr` downstream (rate limits, protection, geo, records, analytics, `X-Forwarded-For`) sees the client exactly as today. A header from any other peer is consumed and ignored. A trusted connection without a client address may only answer the health check. The cutover flips one attribute on one target group per step, through states where every target handles every new connection correctly, each step proven converged on every NLB node before the next, and the one unsafe state (preservation off with PROXY protocol off) is refused by the step tooling and detected by a forgery probe if it happens anyway.
+Each target group stops preserving the client address and sends a PROXY protocol v2 header instead. The target then sees every NLB connection coming from one of the NLB's own private addresses, on a source port the NLB chose, so two client connections can never share a 4-tuple at the target. The edge learns the client address from the header. It reads a header as identity only on connections whose socket peer is one of its region NLB's private addresses, listed in a new host-env key; it rewrites the connection's remote address to the header's source before net/http sees it, so every reader of `r.RemoteAddr` downstream (rate limits, protection, geo, records, analytics, `X-Forwarded-For`) sees the client exactly as today. A header from any other peer is consumed and ignored. A trusted connection without a client address may only answer the health check. The cutover flips one attribute on one target group per step, through states where every target handles every new connection correctly, each forward step proven converged on every NLB node before the next. PROXY protocol is one-way: once on, it never goes off, so the one unsafe state (preservation off with PROXY protocol off) is never a step. The tooling refuses it, an alarm detects it for the whole armed lifetime, and one root action closes every connection it could have touched. The price is stated in §7.3: once a target group has PROXY protocol on, no edge older than this release can run behind it again.
## 3. Guarantee and invariant
-**The trust invariant.** A node address grants trust to the first header on a connection only because the NLB writes that header. That holds only while the target group has PROXY protocol on. With preservation off and PROXY protocol off (S3, §6.2) the node address still arrives as the peer, the NLB writes nothing, and a client's own header would be read as the NLB's: any client could choose its address, and that address reaches limits and the signed `X-Forwarded-For` (`homemap.go:1684-1718`, `forwardproof.go:44-51`). So **S3 is a security state, not a degraded one**: the cutover never enters it (§6.2), the step tooling refuses any change that could (§6.3), and the forgery probe (§6.4) detects it within seconds if anything else causes it, with an incident procedure (§6.5).
+**The trust invariant.** A node address grants trust to the first header on a connection only because the NLB writes that header. That holds only while the target group has PROXY protocol on. With preservation off and PROXY protocol off (S3, §6.2) the node address still arrives as the peer, the NLB writes nothing, and a client's own header would be read as the NLB's: any client could choose its address, and that address reaches limits and the signed `X-Forwarded-For` (`homemap.go:1684-1718`, `forwardproof.go:44-51`). So **S3 is a security state, not a degraded one**. It is kept out by making PROXY protocol one-way: the only moves are S0 to S1, S1 to S2 and S2 to S1 (§6.2), none of which can pass through S3 however the NLB nodes disagree mid-change, and the step tooling refuses every other move (§6.3). S3 then needs someone to turn PROXY protocol off outside the tooling. That is detected for the whole armed lifetime, not only in a window, by the edge's trust-violation metric and its alarm (§4.5): in S3 every client that sends no header of its own is refused, so the metric is loud. The incident (§6.5) restores preservation and closes every trusted connection at once with a root action (§4.7).
**Fixed:** with preservation off, two client connections through the NLB never share a 4-tuple at a target: the NLB allocates the source address and port toward each target, so the documented collision cannot happen. Hairpin connections through the NLB work too (AWS: "you can also prevent this type of connection error by disabling client IP preservation"), which removes the A21 limit (region HA spec 2026-10-26 §12.4).
@@ -37,7 +37,7 @@ Each target group stops preserving the client address and sends a PROXY protocol
**Zero downtime is the target and is measured** (§10), as in W6. AWS states that preservation changes "take effect only for new TCP connections" and states nothing for PROXY protocol. The design assumes both apply only to new connections, because a header can only be the first bytes of a connection; the dev witness tests the assumption with connections held open across every step (§10 row 3) before the flagship relies on it.
**Not covered:**
-- A target running an edge older than the release that carries this (vN) while its TG has PROXY protocol on. It answers the header with 400 or a TLS error, fails its health checks and leaves the target group: one lost target, not an outage, unless every target is old, when the NLB fails open to all of them. Refused by procedure: §7.3.
+- A target running an edge older than the release that carries this (vN) while its TG has PROXY protocol on. It answers the header with 400 or a TLS error, fails its health checks and leaves the target group: one lost target, not an outage, unless every target is old, when the NLB fails open to all of them. Refused up front by a box-side guard and by the release and roll checks: §7.3.
- Real client addresses inside the NLB's own TCP layer (NLB logs, flow logs): unchanged, off.
## 4. Edge parsing
@@ -92,7 +92,9 @@ The header's destination address and port are not used.
### 4.5 Counters
-Per listener and, for trusted connections, per node address, since start: `proxied`, `no_client`, `no_client_refused` (§4.6), `ignored` (untrusted header consumed), `ignored_private` (untrusted header from a private address: almost certainly an NLB node missing from the key), `marker_trusted` (§6.4), `malformed`, `timeout`. One journal line at start (`edge: proxy protocol: armed on :80 and :443, trusting 172.31.29.110,172.31.11.189`), and one throttled line every minute while armed, naming every counter. `no_client_refused` and `ignored_private` above zero also log once a minute at warning level with the peer address. The cutover reads these lines over SSM (§6.4); no new metric or alarm in the edge.
+Per listener and, for trusted connections, per node address, since start: `proxied`, `no_client`, `no_client_refused` (§4.6), `ignored` (untrusted header consumed), `ignored_private` (untrusted header from a private address: almost certainly an NLB node missing from the key), `marker_trusted` (§6.4), `malformed`, `timeout`. One journal line at start (`edge: proxy protocol: armed on :80 and :443, trusting 172.31.29.110,172.31.11.189`), and one throttled line every minute while armed, naming every counter. `no_client_refused` and `ignored_private` above zero also log once a minute at warning level with the peer address. The cutover reads these lines over SSM (§6.4).
+
+**The trust-violation metric, for the whole armed lifetime.** `no_client_refused` plus `marker_trusted` is the S3 signal: in S3 every client that sends no header of its own lands in `no_client_refused` (§4.6), which on a serving target group is nearly every client, and the forgery probe's marker lands in `marker_trusted`. The agent publishes the per-minute increase of that sum as `IngressProxyTrustViolations` in the `Carlos/Host` namespace, with the `Deployment` and `Region` dimensions the clock and admission metrics already use (`internal/host/memwatch.go:53-90`, `ingress/alarms.tf:49-90`), on every armed box with `CARLOS_HOST_METRICS=cloudwatch`. The agent runs the edge in-process (`internal/host/ingressdrain.go:87-88` holds it) and reads the counters directly. One alarm in the ingress module (§8.1) fires on Maximum > 0 for one minute, missing data not breaching (unarmed boxes publish nothing). The armed prerequisite (§6.1) includes `CARLOS_HOST_METRICS=cloudwatch` on every target.
### 4.6 A trusted connection without a client address answers the health check only
@@ -102,6 +104,10 @@ So no request ever reaches a client-address reader without a client address: `cl
In S3, ordinary clients (no header of their own) are refused loudly by this rule. A client that sends its own header is still believed; only §6 prevents that.
+### 4.7 Closing every trusted connection
+
+A root action on the box, `carlos system edge close-trusted`, makes the edge close at once, without a drain, every open public connection whose parse state is `proxied` or `no-client`, and report how many. It goes through the root-only drain socket that W6's and §25's root verbs already use (`internal/host/hadrain_socket.go`; the agent holds the edge in-process, `internal/host/ingressdrain.go:87-88`), served on every armed box, not through any public listener. The wrapper keeps the set of live trusted connections for it (added when the state resolves, removed on close). New connections are not refused: the action is for after preservation is back on (§6.5), when new connections are untrusted and safe. In-flight requests on the closed connections fail and clients reconnect; nothing else on the box changes. The action is the incident's containment step, so it does not depend on a drain, a roll or the target group finishing anything.
+
## 5. Client IP everywhere it is used
Every reader derives the client from `r.RemoteAddr`, directly or through `clientIP(r)`; none reads the socket. The wrapper changes the connection's `RemoteAddr`, net/http copies it into `r.RemoteAddr` (`server.go:1908`, and `:2152`/`:4002` for HTTP/2), so no reader changes.
@@ -133,14 +139,15 @@ In this order:
2. **The bootstrap object at vN or later.** Members run the separately seeded bootstrap binary (`group-init.sh.tftpl:200-215`) for `host-env write` (`:332`), and it refuses a key outside its compiled allowlist (`internal/hostenv/group.go:112`). So the region's `boot/bootstrap-object` and `boot/bootstrap-sha256` name a vN build, checked from SSM and the object's hash, **before** the key is published.
3. **The key.** `CARLOS_INGRESS_PROXY_SOURCES` equal to the module output (§8.1): in the region's host-env parameters, then a group roll so every member is launched with it (members write host.env only at launch, `hostenv.go:144-150`), and in each fixed box's host.env with a drained restart, as W6 delivered `CARLOS_INGRESS_TARGET_GROUPS`. Each target's journal shows the §4.5 armed line with exactly the module's addresses.
4. **The group module at vN**, whose precondition accepts the new states (§8.2). A group plan with the old module would refuse once the TGs change.
+5. **Metrics and alarm.** `CARLOS_HOST_METRICS=cloudwatch` on every target; the module's `IngressProxyTrustViolations` alarm applied and in OK (§4.5, §8.1).
Arming changes nothing on the wire: until step A80 no connection carries a header, and trusted peers are only health checks, which §4.6 serves.
-**Unwinding, in reverse:** both TGs back in S0 first; then the key removed from the parameters and fixed boxes; only then may the bootstrap object or any target go below vN. A bootstrap below vN with the key still published stops every new member at boot.
+**Before A80 everything can still be unwound** in reverse: the key removed from the parameters and the fixed boxes, then the bootstrap object or any target may go below vN. A bootstrap below vN with the key still published stops every new member at boot. **After A80 nothing below vN comes back** (§7.3).
### 6.2 States and steps
-Two attributes per TG, four combinations. The steps visit only S0, S1 and S2.
+Two attributes per TG, four combinations. The steps visit only S0, S1 and S2, and PPv2 is one-way: S1 never goes back to S0.
| State | preserve | PPv2 | Socket peer at target | First header | Edge result |
|---|---|---|---|---|---|
@@ -149,7 +156,7 @@ Two attributes per TG, four combinations. The steps visit only S0, S1 and S2.
| S2 target | off | on | NLB node | NLB's | trusted, header source = client |
| S3 **forbidden** | off | off | NLB node | none, or the client's | trusted: a client header is believed (§3) |
-In S1 the edge must ignore, not trust, the header, because the peer is the client and is not in the list; §4.4 does that. While one attribute propagates, nodes can disagree, so new connections are in one of the two states on either side of the step; every edge handles both of each allowed pair. The only pairs that touch S3 are S0 to S2 and S2 to S0 in one move, and §6.3 refuses both.
+In S1 the edge must ignore, not trust, the header, because the peer is the client and is not in the list; §4.4 does that. While one attribute propagates, nodes can disagree, so new connections are in one of the two states on either side of the step; every edge handles both of each allowed pair. The allowed moves are S0 to S1 and S1 to S2 forward, and S2 to S1 back. None of them changes PPv2 while preservation is off, so no node can be in S3 at any point of any of them, converged or not. That is why S2 to S1 needs no convergence proof and the probe's inability to tell S1 from S2 (round 2) no longer matters. The moves that could touch S3 (S0 to S2 and S2 to S0 in one go, and S1 to S0 after a reverse B that may not have reached every node) are refused.
Steps, per NLB, each a targeted tofu apply of one attribute on one TG (0 add / 1 change / 0 destroy):
1. **A80:** PPv2 on, `:80` TG (S0 to S1).
@@ -162,12 +169,12 @@ Steps, per NLB, each a targeted tofu apply of one attribute on one TG (0 add / 1
### 6.3 The step tool refuses any move that could pass through S3
A card script in each root (`scripts/ppv2-step.sh <tg-port> <attribute> <value>`) is the only way the attributes change:
-- it reads the TG's live attributes (`describe-target-group-attributes`) and refuses unless the move is one of S0 to S1, S1 to S2, S2 to S1, S1 to S0 for that TG;
+- it reads the TG's live attributes (`describe-target-group-attributes`) and refuses unless the move is one of S0 to S1, S1 to S2, S2 to S1 for that TG; any change that sets PPv2 off is refused, whatever the state;
- it runs `tofu plan -target` and refuses unless the plan changes exactly that one attribute on that one TG;
-- it refuses unless the previous step's convergence record (§6.4) exists and passed;
+- for a forward move, it refuses unless the previous forward step's convergence record (§6.4) exists and passed; S2 to S1 needs none;
- then it applies, and starts the next convergence check.
-The module also refuses S3 as a declared state (§8.1), so an ordinary plan cannot request it. Direct `aws elbv2 modify-target-group-attributes` is allowed in only one direction and only in an abort or incident: preservation **on** (S2 to S1, or S3 to S0), which can never create S3. Tofu is reconciled afterwards with a plan that shows no change.
+The module also refuses S3 as a declared state (§8.1), so an ordinary plan cannot request it. Direct `aws elbv2 modify-target-group-attributes` is allowed in only one direction and only in an abort or incident: preservation **on** (S2 to S1, or S3 to S0), which can never create S3. Tofu is reconciled afterwards with a plan that shows no change. Turning PPv2 off by any route (tofu, CLI, console) is outside every procedure; if it happens, §4.5's alarm fires and §6.5 runs.
### 6.4 Convergence evidence and the forgery probe
@@ -189,29 +196,27 @@ Because `:80` cannot show the forged address, the edge itself counts it: a trust
Convergence of a step, per TG port, needs all of:
- after A: the marker fails on **both** NLB addresses for 30 consecutive attempts (60 s); plain stays 200 with the probe's address;
- after B: the same, plus every target's counters show `proxied` rising from **both** node addresses and `no_client_refused` at 0;
-- after a reverse A (S1 to S0): the marker answers 200 with the probe's address on both addresses for 30 consecutive attempts;
- all the time: `malformed`, `timeout`, `ignored_private` and `marker_trusted` at 0.
**Transition gates and maintenance rows are separate.** From the start of an attribute step until its convergence record is written, every target is healthy in both TGs (`describe-target-health` every 10 s) and no drain, restart or group roll runs. Maintenance rows (§10 rows 5 and 6) run only between steps: during one, the named target may be `unhealthy.draining` or deregistered, every other target stays healthy, and the plain probe stays at 0 errors. The all-healthy gate is back before the next attribute step starts.
The script writes the record (times, counts, per-address results) that the next step requires.
-**Any marker answer echoing 192.0.2.1, or any `no_client_refused`, is S3 on some node: §6.5 at once.** The probe runs for the whole window, not only between steps.
+**Any marker answer echoing 192.0.2.1, any `marker_trusted`, or any `no_client_refused` is S3 on some node: §6.5 at once.** The probe runs for the whole window, not only between steps; outside windows the alarm (§4.5) carries the watch.
### 6.5 Rollback and the S3 incident
-Rollback is the steps in reverse, one per apply, each with its convergence evidence: B443, B80, A443, A80. Each lands in a state already covered.
+**Rollback ends at S1.** B443 then B80 back, each preservation **on**, by the step script or, in an abort, the direct command. S1 is today's client addresses through the NLB and today's collision behaviour, which is everything a rollback needs to restore; the edge stays armed and keeps ignoring the NLB's header as in S1. A80 and A443 are never reversed (§6.2, §7.3). No convergence proof is needed for S2 to S1, because every node is in S1 or S2 throughout and neither trusts a client header.
-S3 incident (forgery seen, or `no_client_refused` rising):
-1. Preservation **on** for the affected TG with the direct command (§6.3). S3 becomes S0 and S2 becomes S1 for new connections; neither trusts a client header.
-2. Close every connection that could have been opened in S3, because preservation changes apply only to new connections: drained restarts of the fixed targets (W6) and a group roll of the members, one target at a time.
-3. Stop the window and report to 8a3d302 with the probe and counter records.
-
-Edge rollback: an edge older than vN may run on a target only while both its TGs have PPv2 off. The roll card's rollback section says so, and the group re-pin card checks the TG attributes before naming a launch template older than vN.
+**S3 incident** (the alarm, any `marker_trusted`, or a marker answer echoing 192.0.2.1):
+1. Preservation **on** for the affected TG with the direct command (§6.3). New connections land in S0 (if PPv2 was turned off) or S1; neither trusts a client header.
+2. On every target in that TG, `carlos system edge close-trusted` (§4.7), run over SSM on all of them at once. Every connection that could carry a forged address is gone within seconds, without waiting for a drain or a roll. Clients reconnect as untrusted.
+3. Find who turned PPv2 off. Then go forward again with the step script (S0 to S1 to S2) in a window.
+4. Report to 8a3d302 with the alarm, the counters and the close-trusted counts.
### 6.6 Order across NLBs
-Dev IE first, in a dev #421 window after vN is on dev. Flagship US after the dev witness passes every row, in a flagship window with the lock posted on #421 (region HA live window rules), before G6 opens the US NLB to customers. Not in the same window as a release roll or a group roll, except the group roll that §6.1 or §6.5 calls for.
+Dev IE first, in a dev #421 window after vN is on dev. Flagship US after the dev witness passes every row, in a flagship window with the lock posted on #421 (region HA live window rules), before G6 opens the US NLB to customers. Not in the same window as a release roll or a group roll, except the group roll that §6.1 calls for.
## 7. Interactions
@@ -223,9 +228,25 @@ leo, sophie and adi carry NLB traffic and their own EIP traffic on the same list
Both TGs check `:80` `/.carlos/lb-health`. After A80 or A443, that TG's checks carry a LOCAL header from trusted peers. Between A80 and A443, `:80` sees both kinds at once, per connection. Admission gating (`lbhealth.go:38-46`) is unchanged.
-### 7.3 Mixed versions
+### 7.3 The cost: no release below vN on an NLB target, ever again
+
+**Once A80 is done on a region's NLB, no carlos build older than vN can run on any target of that NLB again.** PPv2 is one-way (§6.2), and an edge below vN answers the NLB's header with a 400 or a TLS error, fails its health checks and drops out (all of them at once is an outage). So for those boxes a platform release rollback below vN is off the table. Rollbacks stay possible to any build at or above vN, which all parse; a bad release after vN is rolled back to the previous good one as today, as long as that one is vN or later, or fixed forward. Boxes that are not NLB targets (annie, the AU and UK boxes, Tito's, self-hosters) are not affected.
-Before A80, any mix of versions and keys is fine. From A80 on, every target in that TG must be armed. Members launched while PPv2 is on must come from a launch template naming vN or later, with a vN bootstrap object and the key in the region's parameters (§6.1). A member that cannot parse fails ELB health and the group replaces it from the same template, a loop the HA capacity alarms report; the re-pin card's check (§6.5) prevents it.
+Today that means: dev leo, sophie and the IE members from dev's A80; flagship adi and the US members from flagship's A80. The list grows with every region that gets an HA group.
+
+**Refused up front on the box.** One guard, in the code that activates a carlos binary on a box (`carlos system apply` and `rollback`, and `install-channel` in member boot, `group-init.sh.tftpl:332`): a box whose host.env carries `CARLOS_INGRESS_PROXY_SOURCES` refuses to activate a binary that does not report the `ingress-proxy-v2` feature. The check runs the staged binary's `carlos version --json` (vN adds a `features` list; an older binary has none, so it is refused) and leaves the running binary in place. On a fixed box the update or rollback fails with the reason; a member launched from a template below vN fails its boot, which the group's launch hook and the HA capacity alarms already report. The key is the trigger, not the TG state, so the guard also holds before A80; unwinding before A80 removes the key first (§6.1).
+
+**What the release recipe must check** (written into the recipe by the build plan):
+- Before promoting any build to a channel pointer (canary or stable) of a deployment, read `proxy_protocol_v2.enabled` on every region NLB target group of that deployment (`aws elbv2 describe-target-group-attributes`, read-only). If any is `true`, the build must be vN or later. Re-promoting an old build as a quick rollback is refused; cut forward instead.
+- The same check before changing a region's bootstrap object or re-pinning a group launch template.
+- The recipe's state line records, per deployment, "PPv2 on since <date>: floor vN".
+
+**What the roll card must check:**
+- Pre-roll: the same read per region; for each region with PPv2 on, the card lists its NLB targets and states "rollback below vN is off the table on these boxes; rollback target is <previous build ≥ vN> or forward fix".
+- The card's rollback section names that target build explicitly, never "the previous release" unchecked.
+- Post-roll: every NLB target shows the §4.5 armed line with the module's addresses, and the trust-violation alarm is OK.
+
+Members launched while PPv2 is on must come from a launch template naming vN or later, with a vN bootstrap object and the key in the region's parameters (§6.1).
### 7.4 Hairpin (A21)
@@ -246,6 +267,7 @@ Unchanged. Targets already admit 80 and 443 from the NLB's security group (`grou
- `aws_lb_target_group.target` (`ingress/main.tf:97-126`): `preserve_client_ip` and `proxy_protocol_v2` from two map variables keyed by port (`{ "80" = ..., "443" = ... }`), defaults `true` and `false`, so a root can flip one TG at a time and re-pinning to vN plans no TG change. A validation refuses any port with preservation off and PPv2 off (S3).
- Output `proxy_protocol_sources`: the node private addresses, sorted. One singular `data "aws_network_interface"` per zone in `var.zones` (keys known at plan time), filtered on `description = "ELB ${aws_lb.nlb.arn_suffix}"` and that zone's `subnet-id`, each yielding exactly one interface and its `private_ip`. (The plural `aws_network_interfaces` returns only IDs.)
- Alarm on `PortAllocationErrorCount` Sum > 0 over 5 minutes, beside the module's existing alarms (`ingress/alarms.tf`), on the module's topic.
+- Alarm `<name>-proxy-trust` on `Carlos/Host` `IngressProxyTrustViolations` (§4.5), Maximum > 0 for one 60 s period, `treat_missing_data = "notBreaching"`, gated on `var.regional_metrics` and dimensioned like the clock and admission alarms (`ingress/alarms.tf:49-90`).
### 8.2 This repo, `infra/modules/region-host/group.tf` (rides vN)
@@ -265,7 +287,10 @@ First-of-kind applies need 8a3d302's GO; later NLBs' identical steps fall under
- Production wiring (house rule, production-wired witnesses): the listener stack built the way `Serve` builds it (`publicServers`, `ConfigureGroupHairpin`, the wrapper, the §4.6 handler wrapper), with a header-carrying request reaching the rate limiter and `X-Forwarded-For` with the header's address, a hairpin connection keeping its normalisation, a `no-client` health check answered and a `no-client` request for an app refused with 503 before routing.
- hostenv: the key's validation (private IPv4, 1-16, no duplicates), in both `Assemble` and the group `write` path.
- Tofu: `ingress` tests for the defaults (S0), each per-port step, the S3 refusal and the output with one interface per zone; `group.tf` test for the precondition in all four states.
-- The step script: a dry-run mode tested against recorded `describe-target-group-attributes` outputs for every allowed and refused move.
+- The step script: a dry-run mode tested against recorded `describe-target-group-attributes` outputs for every allowed and refused move, PPv2 off refused from every state.
+- `close-trusted` (§4.7): closes `proxied` and `no-client` connections, leaves `plain` ones, reports the count, and is reachable only on the drain socket.
+- The activation guard (§7.3): with the key set, a staged binary without the `ingress-proxy-v2` feature (including one with no `version --json`) is refused by `apply`, `rollback` and `install-channel`, and the running binary stays; without the key, nothing changes.
+- The trust-violation metric: the agent publishes the per-minute increase of `no_client_refused` plus `marker_trusted`, and nothing on an unarmed box.
- `go vet` and cross-builds (darwin, windows) for the new package.
## 10. Witness
@@ -281,17 +306,19 @@ Dev rows, all in one window:
6. In S2: one group roll replacing a member, under the probe, 0 errors, the new member armed from the vN bootstrap.
7. In S2: from a member, `curl` an NLB public address (hairpin redirect, unchanged path), 200.
8. **Collision row:** from one host, 200 pairs of connections with the same source port to both NLB addresses (the lost-post repro), in S0 and then S2. In S2, target-side `ss` shows the pairs as distinct 4-tuples from the node addresses. S0 is expected to pass too (the repro never failed); the row shows the mechanism, not a before and after.
-9. **Rollback drill:** B443 to A80 in reverse through the script, each with its convergence record, then forward again.
-10. **S3 refusals, dry:** the step script refuses S0 to S2 and S2 to S0 against the live TG, and the module refuses an S3 plan. S3 itself is never entered.
+9. **Rollback drill:** B443 then B80 back to S1 through the script, under the probe and the held connections, 0 errors; then forward to S2 again with convergence records.
+10. **Refusals, dry:** the step script refuses S0 to S2, S2 to S0 and S1 to S0 against the live TG, and the module refuses an S3 plan. S3 itself is never entered.
+11. **Containment and alarm, safely:** on one target in S2, `close-trusted` closes its NLB connections (the held connections of row 3 reconnect through the NLB, 0 failed probe requests beyond the closed in-flight ones), and the trust-violation alarm is shown to fire by publishing one test datapoint, then returns to OK.
+12. **The activation guard:** on one armed fixed box, `carlos system apply` of a build below vN is refused with the reason and the box keeps serving.
-Flagship rows: 1, 2, 3 (one held connection of each kind), 4 (echo and burst), 5 (2 adi restarts), 8 in S2 only.
+Flagship rows: 1, 2, 3 (one held connection of each kind), 4 (echo and burst), 5 (2 adi restarts), 8 in S2 only, 11 (the alarm datapoint only).
-## 11. Open questions for Paul
+## 11. Decisions (8a3d302, 2026-11-12)
-1. **Hairpin redirect (§7.4).** Keep it now and retire it later as its own change. Recommend keep.
-2. **Direct rollback command (§6.3).** Allow `aws elbv2 modify-target-group-attributes` for preservation **on** only, in an abort or S3 incident, reconciled by a no-change tofu plan after. Recommend yes.
-3. **S3 incident cost (§6.5).** Closing every possibly-forged connection means drained restarts of every target and a member group roll. Recommend as written; it should never run.
-4. **When.** Build after this is approved; dev window on the first dev roll after vN; flagship before G6. Switch-on date for the dormant code is that dev window.
+1. **Hairpin redirect (§7.4):** kept; retiring it is a later, separate change.
+2. **Direct rollback command (§6.3):** allowed for preservation **on** only, in an abort or S3 incident, reconciled by a no-change tofu plan after.
+3. **S3 containment (§6.5):** `close-trusted` on every target (§4.7) replaced rev 3's drained restarts and member roll.
+4. **When:** build after this is approved; dev window on the first dev roll after vN; flagship before G6. The dormant code's switch-on date is that dev window.
## 12. Astra round 1 and where it went
@@ -317,7 +344,9 @@ Flagship rows: 1, 2, 3 (one held connection of each kind), 4 (echo and burst), 5
| P2: the probe table is wrong for `:80` (302 redirect, not echo) | rollout evidence | Fixed in rev 3: per-port table with redirects not followed; the edge's own `marker_trusted` counter covers `:80` (§6.4). |
| P2: "every target healthy all the time" contradicts the drain and roll rows | rollout evidence | Fixed in rev 3: transition gates and maintenance rows separated (§6.4). |
-## 14. Decision for Paul: fault family F1
+## 14. Fault family F1: the decision
+
+**Decided 2026-11-12: A**, by agent manager 8a3d302 on Paul's standing acceptance of recommendations on this work (Paul informed, free to override). Rev 4 writes it in: §6.2 (allowed moves), §6.3 (the step script refuses PPv2 off from every state; the refusal sits in the script, not the module, because the module cannot read the live attribute of a target group it manages), §6.5 (rollback ends at S1; incident), §4.5 (metric and alarm), §4.7 (close-trusted), §7.3 (the cost, the activation guard, the release recipe and roll card checks). The options as put to Paul:
F1 is "client bytes becoming trusted identity". It lives in one AWS state the edge cannot see, S3, and in the transitions next to it. Round 1 found S3 unguarded; rev 2 guarded the forward path and added a probe; round 2 found the reverse path (S2 to S1 to S0) unprovable with that probe, no detector outside the window, and an incident that cannot close forged connections promptly. Stopping rule 2 says not to write a third fix in the same family. The choices:
@@ -327,4 +356,4 @@ F1 is "client bytes becoming trusted identity". It lives in one AWS state the ed
**C. Stop the work.** Keep preservation on. Clients behind port-preserving NAT keep the rare 20-30 s connect hang on HA-pool names (§1). G6 opens with the known limit.
-Recommendation: **A**. It removes the unprovable transition rather than proving it, and costs nothing a rollback needs. If A is chosen, rev 4 writes it in and Astra round 3 reviews it, as the last round.
+Recommendation was **A**: it removes the unprovable transition rather than proving it, and costs nothing a rollback needs. Astra round 3 reviews rev 4, as the last round.
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-ppv2.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-ppv2.md
index 1790e2e19..2535ae184 100644
--- a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-ppv2.md
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-edge-ppv2.md
@@ -1,4 +1,4 @@
-# Review brief: PROXY protocol v2 on the region HA NLBs (spec), round 2 of 3
+# Review brief: PROXY protocol v2 on the region HA NLBs (spec), round 3 of 3 (the last)
Repo carlos/platform, branch `design-edge-ppv2`, the commit named in your prompt.
Under review: `docs/superpowers/specs/2026-11-12-edge-proxy-protocol-design.md`.
@@ -15,6 +15,10 @@ live NLB attributes in `~/.cache/ppv2/aws/`.
- Paul approved the direction: client IP preservation off plus PROXY protocol v2 on both TGs of each region NLB,
edge parses on :80 and :443 trusting only the NLB's private addresses. Cross-zone off is NOT an option.
- Design only; no infra change is part of this review.
+- Decided after round 2 under stopping rule 2 (spec §14, §11): option A, PROXY protocol is one-way
+ (rollback ends at S1, PPv2 never goes off); keep the A21 hairpin redirect; direct aws rollback only for
+ preservation ON; timing as in §11. The cost (no build below vN on an NLB target after A80) is accepted.
+ Report only mechanisms that fail to honour these, not the choices themselves.
## What to check
@@ -34,16 +38,24 @@ live NLB attributes in `~/.cache/ppv2/aws/`.
7. Host-env delivery (§6.1): do members and fixed boxes really get the key the way the spec says?
8. Witness (§10): does it prove the fix and the zero-downtime claim as far as the spec claims?
-## Round 2
+## Round 3
-Earlier rounds: round 1, `docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R1.md` (NOT READY: one P1, six P2s);
-the spec's §12 gives each disposition.
+Earlier rounds: round 1 `docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R1.md` (NOT READY: P1 F1, six P2s),
+round 2 `docs/superpowers/specs/ASTRA-FINDINGS-edge-ppv2-R2.md` (NOT READY: P1 F1 again, two P2s). The spec's
+§12-§14 give each disposition.
-First give one line per P1 and P2 from round 1: resolved, partly, or not. Carry every unresolved or partly
-resolved finding forward at its current severity, then add new findings. The verdict covers everything
-outstanding. Pay particular attention to fault family F1 (client bytes becoming trusted identity): the rev 2
-answer is the step script (§6.3), the marker probe (§6.4) and the S3 incident (§6.5). Say whether any path
-still reaches S3 undetected, and whether the marker probe's per-state answers (§6.4 table) are right.
+First give one line per P1 and P2 from round 2: resolved, partly, or not. Carry every unresolved or partly
+resolved finding forward, then add new findings. The verdict covers everything outstanding.
+
+Rev 4 answers F1 with option A: allowed moves S0->S1, S1->S2, S2->S1 only (§6.2, §6.3); the trust-violation
+metric and alarm for the whole armed lifetime (§4.5, §8.1); `close-trusted` containment (§4.7, §6.5); and the
+cost section with a box-side activation guard and release/roll checks (§7.3). Check in particular: can any
+allowed move, mid-propagation, put a node in S3? Is the alarm's signal real in S3? Does close-trusted close
+every connection that could carry a forged identity? Does the activation guard cover every way a binary
+reaches a target (apply, rollback, install-channel at member boot, channel pointers)?
+
+This is round 3. A NOT READY must also say whether the P1s share one cause, and whether refusing the case up
+front or cutting the feature would remove them.
## Severity