region HA P3b plan: Opus R1 findings (NOT READY, 1 P1, 6 P2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/plans/REVIEW-REGION-HA-P3B-R1.md+143 −0
CI failed — run details
Intent
<task-notification> <task-id>ac9e486fd4c9ba183</task-id> <tool-use-id>toolu_01KmjgwNH4XiZY9wg3aRPWPp</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/322ac65e-c7fd-49f1-985b-a0352676881d/tasks/ac9e486fd4c9ba183.output</output-file> <status>completed</status> <summary>Agent "Opus R1 review of P3b plan" 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>**Verdict: NOT READY.** There is one P1. The review is at `/home/paulca/.cache/tmp/p3b-plan/REVIEW-REGION-HA-P3B-R1.md`. The P1 depends on one AWS behaviour I could not confirm from the docs. The lifecycle diagram and the PreInService status in the ExitStandby example point to it, but no page says it outright. So the fix starts with one dev observation of ExitStandby. The spec §12.1 edit matches the approved sentence in P3 rev 3 (line 110) word for word, and nothing else changed. I checked about 90 file:line citations; all are accurate apart from the two in P3-1 and P3-2. **P1** - **P1-1, T1/I4 restart authority.** ExitStandby probably sends the returning member back through `Pending:Wait` on the launch hook. The plan's receipt then suppresses the completion call (lines 116 and 194), and the operator has no right to complete it (154, 156). After 900 s the default ABANDON fires and the rolled box is terminated, which N-HA14 forbids. The fakes in Tasks 4 and 7 assume Standby goes straight to InService, so they would pass anyway. **P2** - **P2-1, H4/A1 namespace authority.** The "upgrade every reader before group opt-in" gate is a manual record, not enforced in code. An old reader next to group publishers brings back R2-1 or R2-2. Fix: a new edges-file capability, and group boxes refuse to admit while any peer lacks it. - **P2-2, I6/N-HA11 duty recovery.** The group's termination queue is never specified. "Existing queue" in Task 2 would mean group members take a fixed box's termination events. - **P2-3, A1/I6.** It is not said whether a group member that is not yet admitted may import a dead peer's duties from the shared queue. The current departure code has no admission check, so it would. - **P2-4, T1/I4.** OS-level restarters are outside the root guard. Every existing init template enables unattended-upgrades. Any restart of a box that is in service fails the load-balancer health check and gets the box replaced. - **P2-5, G2 evidence.** Drills 1-3 record measurements but have no pass condition. - **P2-6, S1 / rules 5-6.** No executable task needs P2b code, but the first slice can't merge until P2b merges, and no date is named before building. The plan also treats G1 as unrecorded, although its switch-on finished on 2026-11-03. **P3** - **P3-1:** `internal/groupadmission/observability.go` is cited but doesn't exist; the file is `observation.go`. - **P3-2:** stale platform-infrastructure evidence (sophie is now t4g.medium on origin/main), plus the out-of-memory risk with Restart=no. - **P3-3:** the channel for delivering the root permit (Session Manager) is never named. - **P3-4:** the group role's list of existing policies is not spelled out. - **P3-5:** a lost CONTINUE response always leads to replacement. - **P3-6:** the HealthyHostCount alarm will fire during a long Standby. - **P3-7:** the expected target count on the reused dev NLB during the drill is not stated. I wrote only the review file and edited nothing in the repo. I made no scratch files.</result> <usage><subagent_tokens>215761</subagent_tokens><tool_uses>60</tool_uses><duration_ms>570078</duration_ms></usage> </task-notification>
Attributed to this commit: 4.06 g CO₂e (417,315 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-p3b-plan, 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/plans/REVIEW-REGION-HA-P3B-R1.md b/docs/superpowers/plans/REVIEW-REGION-HA-P3B-R1.md| new file mode 100644 |
| index 000000000..e01cf3ff9 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/REVIEW-REGION-HA-P3B-R1.md |
| @@ -0,0 +1,143 @@ |
| +# Review: region HA P3b plan, round 1 of 3 |
| + |
| +Reviewer: Opus (independent), 2026-11-04. Read-only. |
| +Under review: `docs/superpowers/plans/2026-11-04-region-ha-p3b-group.md` (rev 1, cac62f37) and the spec §12.1 edit in the same commit. Base: main 016599d5 + cac62f37 + f6720fda (brief). |
| +Every file:line below was read at that tree. AWS behaviour is cited from the public docs pages named. |
| + |
| +**Spec edit check.** The §12.1 replacement is word for word the approved sentence recorded in P3 rev 3 (`docs/superpowers/plans/2026-11-01-region-ha-p3-group.md:110`). The only other changes are the rev line (6.1 to 6.2) and one rev-history bullet. Dropping the bold "**An Auto Scaling group:**" lead is part of replacing that sentence. No other spec text changed. Clean. |
| + |
| +**File:line check.** About 90 cited anchors were checked: infra `main.tf`, ingress, plan gate, boxroles, group_admission, edgesfile, homemap, homeelect, wakeplacement, hostenv, installchannel, boxreference/boxrecord/awsaddr/boxaddress, door, systemapply, systemunits, memwatch, group_metrics, hadeparture, reconcile and console. All are accurate except the two noted in P3-1 and P3-2. |
| + |
| +--- |
| + |
| +## P1 |
| + |
| +### P1-1. ExitStandby can put the returning member back through the launch hook. The plan's receipt then guarantees default ABANDON, which terminates the box the roll was meant to keep (Task 4, Task 7, budget row "Launch completion") |
| + |
| +- **Problem.** The return path is "ExitStandby increments desired N, verify same iid InService/healthy, restore min N" (plan :126, :195). The plan assumes no lifecycle action exists on return. Its receipt rule says a valid receipt on an admitted maintenance restart "suppresses completion only" (:116). The budget says "Valid receipt maintenance restart **0** box ASG calls" (:194). |
| + - In EC2 Auto Scaling, an instance leaving Standby goes back through `Pending` before `InService`. This is the documented instance-lifecycle state diagram (`ec2-auto-scaling-lifecycle.html`, "Enter and exit standby" and its figure). ExitStandby's own example response shows the activity in `StatusCode: PreInService` (`API_ExitStandby.html`, and the plan's own cited `as-enter-exit-standby.html` CLI example). |
| + - With an `autoscaling:EC2_INSTANCE_LAUNCHING` hook on the group (Task 2 :100, `initial_lifecycle_hook`, 900 s, default `ABANDON`), a member in `Pending` waits in `Pending:Wait` for a completion. |
| +- **Failure scenario.** The operator puts member X in Standby and rolls it. X re-admits locally, and the operator calls ExitStandby. |
| + - X enters `Pending:Wait`. X's agent holds a valid receipt, so it does not call CompleteLifecycleAction (:116, :194). |
| + - Nothing else completes the action: the operator IAM in Task 7 :154 has no CompleteLifecycleAction, and Task 7 :156 explicitly requires "no lifecycle completion". |
| + - After 900 s the default result `ABANDON` fires, and Auto Scaling terminates X and launches a replacement. |
| + - That is a roll terminating a box, exactly what N-HA14 forbids. The Task 4/7 fakes (`standby_roll_order`, `standby_resume`) model Standby to InService directly, so they would pass while production terminates. |
| +- **Evidence.** |
| + - Plan :116, :126, :154, :156, :194. |
| + - `internal/groupadmission/state.go:47-101`: Admit's single completion is per process lifetime, with no notion of a second launch action for the same iid. |
| + - P3 rev 3 :106 has the same return sequence. The closed P3 review never addressed this, and no Pending:Wait-on-return case exists anywhere in `docs/superpowers/plans/`. |
| +- **Fix.** |
| + 1. Before Task 4 is built, settle the provider behaviour with one disposable dev ASG observation: EnterStandby(decrement), ExitStandby, `DescribeAutoScalingInstances` LifecycleState over time. Record the result in the plan. |
| + 2. If the hook does fire, make the return transaction own it explicitly. Either the box, after fresh local admission, completes CONTINUE for the same iid and lifecycle token with a receipt phase keyed to the transaction (not suppressed by the first-boot receipt), or the operator completes it, with a scoped `CompleteLifecycleAction` on the card. |
| + 3. The operator command must read `Pending:Wait` after ExitStandby and never leave it to time out. |
| + 4. Add a fake-provider case `standby_exit_pending_wait` and the mutation "receipt suppresses return completion". Adjust the budget row (+1 completion per return). |
| + 5. If the hook does not fire, record that evidence and keep a guard test that fails if a `Pending:Wait` is ever observed on return. |
| +- **Family.** T1/I4 restart authority: a roll or restart must never get a box terminated or replaced (N-HA14). |
| + |
| +--- |
| + |
| +## P2 |
| + |
| +### P2-1. The rollout gate "every reader upgraded before any group box opts in" is stated, not enforced (Task 1, last step of :91; Task 6 :148; Task 8 :163) |
| + |
| +- **Problem.** The plan's own mechanism is that the "deployment owner records every box/console reader on the accepted build", and "Rollback cannot put an old reader beside active group publishers" (:91). Nothing in code refuses a group box's admission, or its booting publication, while a peer reader runs the pre-Task-1 name resolution. Nothing refuses a fixed-box rollback while group publishers are live. |
| +- **Evidence.** Edges files already carry a per-writer capability list that readers consult (`internal/host/edgesfile.go:186,198,360`; `internal/edgesfile/snapshot.go:71`). The plan adds no new capability, and it gates nothing on one. |
| +- **Failure scenario.** A fixed box is rolled back, or one is missed in the roll, while group boxes are booting. That box folds the group's held names with main's dial-first collision ordering (`internal/edge/homemap.go:903-915`, "any dial target beats none"). It then reproduces R2-1 or R2-2 for its own visitors. Task 1's guard tests only exercise new readers. |
| +- **Fix.** |
| + - Publish a name-authority capability (for example `names-2`) from upgraded writers. |
| + - Make the group admission predicate refuse CONTINUE, and refuse to publish a booting group edges file, while any live peer edges file in the deployment lacks it. Log the refusal. |
| + - For the console reader (it publishes no edges file), keep the card step but also check the console's published version where one exists. |
| + - Add the mutation "admit with an old peer reader present". |
| + - Make the rollback recipe in Task 8 :169 enforce "group publishers gone" by readback, not by statement. |
| +- **Family.** H4/A1 namespace authority across mixed-version readers. |
| + |
| +### P2-2. The group's termination queue is unspecified, and the plain reading ("existing queue") would steal a fixed box's termination events (Task 2 :103, Task 3 :112, budget :196) |
| + |
| +- **Problem.** Task 2 says "Box gets existing queue receive/delete/attributes only; no new queue consumer". The group module's resource list (:98-100) names no queue, EventBridge rule, target or anti-forgery queue policy. |
| + - Today each module instance owns one queue fed by a region-wide `terminated` rule (`infra/modules/region-host/main.tf:843-898`). |
| + - The dev fixed boxes each consume their own (P1b-3b plan :305: "Do not point leo at sophie's queue"). |
| + - SQS delivers each message to one consumer. If group members read sophie's or leo's existing queue, that fixed box silently loses termination events, and N-HA11's "one consumer per box" invariant breaks for it. |
| +- **Failure scenario.** A group member and sophie share carlos-dev-host-terminations. Leo is terminated, and the event is received by the group member, not sophie. Sophie's recovery of leo's duties then falls back to the 15-minute view ageing. |
| +- **Fix.** |
| + - State that the group module creates its own queue, rule, target and queue policy (the same shape as `main.tf:843-898`), shared by the group's members and named in `group_shape`/`group_iam_exact_scope`. |
| + - Deliver its URL through regional SSM `CARLOS_TERMINATION_QUEUE_URL`. |
| + - State that a group message reaches one member (competing consumers), which T accepted (P1b-3b :285), and count it in the budget row. |
| +- **Family.** I6/N-HA11 duty recovery (least authority, E1). |
| + |
| +### P2-3. Departure import on a not-yet-admitted group member is unspecified (Task 3 :117; Global constraints :79) |
| + |
| +- **Problem.** The consumer must be running before admission (it is the TerminationStarted fact, `internal/host/group_admission.go:121-127`), so a booting group member receives departures from the shared group queue (P2-2). The departure controller has no admission check (`internal/host/hadepartures_wiring.go:108-148`; there is no reference to admission in `internal/host/hadepartures*.go` or `internal/hadeparture/`). |
| +- **The contradiction.** The plan says duty import is "behind the same tenant-start gate" (:79). Task 3's withheld-facts test asserts zero acquires, key mints, restores, starts or holder headers (:117). It does not assert zero AdoptHost imports, and it does not say whether a closed member must leave the message un-acked. |
| +- **Failure scenario.** A booting member adopts a dead peer's hosts (AdoptHost names it the adopter) and then fails its boot. It is ABANDONed at 900 s. The adopted timers and due wakes now belong to a box that never served, and recovery waits for that box's own departure to be processed. That adds about 15 minutes plus a scan to I6's bound, and it was never modelled. |
| +- **Fix.** Decide explicitly, and test both halves in the production-wired departure test, with the matching sim action in Task 6 :147: |
| + - (a) a non-admitted group member receives but does not import or ack (the message becomes visible again for an admitted member or a fixed queue); or |
| + - (b) it may import, and the I6 bound is restated. |
| +- **Family.** A1/I6: no tenant-affecting work before admission. |
| + |
| +### P2-4. OS-level restarters are not covered by the restart guard. On an InService member, any edge restart becomes an ASG replacement (Task 3 :111, Task 4 :123-124) |
| + |
| +- **Problem.** The guard covers carlos's own entries: system apply/recover/rollback, the update path, unit repair and Restart=no. The proposed `group-init.sh.tftpl` is new, but the plan never states the OS update policy. |
| +- **Evidence.** |
| + - Every existing init template installs and enables `unattended-upgrades`: private `dev/host-init.sh:24-25` at platform-infrastructure origin/main 80d20c4; `infra/modules/pdf-host/pdf-init.sh.tftpl:20,25`; `infra/modules/scanner-host/scanner-init.sh.tftpl:32,38`. |
| + - A restarted agent stays closed until all four facts recur. TerminationStarted alone needs a successful first Receive with a 20 s long poll (`internal/host/group_admission.go:121-140`). Health answers 503 while not admitted (`internal/edge/lbhealth.go:38`). Two failed 10 s checks mark the target unhealthy (`infra/modules/region-host/ingress/main.tf:111-113`). There is no grace after InService, so Auto Scaling's ELB health check replaces the member. |
| +- **Failure scenario.** A package upgrade's maintainer script, an automatic reboot, needrestart (memory #359 is the same class of fault on CI workers), or an operator's ad hoc `systemctl restart` restarts or reboots an admitted member outside Standby. The member is replaced, and its hosts wait out the N-HA9 lease. That is N-HA14's forbidden outcome, and it was caused by a restart. |
| +- **Fix.** |
| + - In Task 3's boot hardening, pin the group OS update policy: no `Unattended-Upgrade::Automatic-Reboot`, no needrestart auto-restart, or unattended-upgrades disabled with OS updates carried by the Standby roll. |
| + - Add a group-init test that greps the rendered template. |
| + - Add a Task 7 card check that no automatic restarter is armed. |
| + - Name any remaining unguarded restart as an operator-only action that must go through Standby. |
| +- **Family.** T1/I4 restart authority. |
| + |
| +### P2-5. G2 drills 1-3 record measurements but have no pass condition (Task 8 :166) |
| + |
| +- **Problem.** §19 G2 needs "I4's drills pass within §9.8's bound". Task 8 asks only to "capture health exclusion, termination proof, lease expiry, replacement boot, first200 and data loss". Drill 4 has a pass rule; 1-3 do not. |
| +- **Evidence.** |
| + - §9.8 (spec, "Timeline") gives bounds: the NLB stops new connections in 20-30 s; the hang just after first service is replaced within the 60 s grace plus about a minute; totals run up to about 15 minutes after the last renewal under N-HA9. |
| + - §21.2 requires committed-write loss per replication class. |
| + - :167 records "loss around one second only for stream DB", with no threshold on the other classes. |
| +- **Fix.** Give each of drills 1-3 numeric pass conditions taken from §9.8: |
| + - NLB exclusion ≤30 s; |
| + - for the hang, replacement start ≤ grace + 2 min; |
| + - first 200 ≤ the remaining lease + 3 min; |
| + - zero requests served by the failed iid after exclusion; |
| + - no second writer (lock generations monotonic, one acquirer); |
| + - loss ≤1 s for stream DB and ≤ the configured interval for the other classes. |
| + Also state what FAIL means (stop, restore, report) and the cleanup for each drill (replacement verified admitted, SIGCONT or termination of the hung iid confirmed, fixtures asleep cleanly). |
| +- **Family.** G2 evidence (I4/I5). |
| + |
| +### P2-6. The first slice cannot land without unmerged P2b, and no switch-on date is named before building (Switch-on gate :39, Task 6 :148, D1 :255; rules 5 and 6) |
| + |
| +- **Problem.** No executable task reads a P2b interface, so this is not a rule-4 P1. But P3b-1's finish line and merge (:33, :148, "Only then land P3b-1") need a live dev first service. :39 requires that service to wait for "P2b must merge and ... G1 evidence", and D1 recommends waiting. P2b has no merge date. Rule 5 says to name the switch-on before building, and rule 6 says the first merge must be visible. |
| + - Also, G1's switch-on happened on 2026-11-03: items 1-8 are done on sophie and leo, per #421 in `/home/paulca/.cache/tmp/d421.txt`, "G1 dev switch-on DONE". The plan still treats G1 as wholly unrecorded. |
| +- **Fix.** |
| + - Record exactly which G1 prerequisites remain: the P2 role and readiness doors, and P1b-3b slice S if counted. |
| + - Get Paul's D1 ruling before implementation starts, not "before landing". |
| + - Either name P2b's expected merge and the dev window, or have Paul approve the limited pre-P2b group experiment, a §19 amendment, as the first slice. |
| +- **Family.** S1, stopping rules 5 and 6. |
| + |
| +--- |
| + |
| +## P3 |
| + |
| +- **P3-1.** Task 6 :142 lists "existing `internal/groupadmission/observability.go`". The file is `internal/groupadmission/observation.go`; there is no `observability.go`. |
| +- **P3-2.** :73 cites platform-infrastructure HEAD e57979d (`dev/region-ie.tf:10`, t4g.micro). origin/main 80d20c4 has `host_ie` on t4g.medium after the 1 GiB out-of-memory crash on 2026-11-03 (e3b34bd); only `host_ie_b` is still t4g.micro. Group boxes run no console, so t4g.micro may still be right for D3. But the evidence is stale. Also, with Restart=no, an out-of-memory kill of carlos-edge now means replacement rather than a 1 s restart. D3 should say so. |
| +- **P3-3.** The root permit delivery channel is unnamed (:125, :154: "authenticated root delivery"). The only admin path is Session Manager (`infra/modules/region-host/main.tf:428-435`). State it, keep `AmazonSSMManagedInstanceCore` on the group role in `group_iam_exact_scope`, and count session requests on the card. |
| +- **P3-4.** Group IAM least authority (:102-103) does not say which existing role policies the group role gets: route53 DNS-01 and steering (`main.tf:256,301`), costexplorer (`:390`), console mail (`:777`), store (`:693`), store scan (`:815`). List them in the exact-scope test. |
| +- **P3-5.** A lost CONTINUE response always leads to replacement. "No active lifecycle action" never counts (:116), and the box has no describe right, so the InService-but-closed member fails ELB health. That is acceptable for an initial boot, but put it in Task 8's observed cases and in the diagnostics copy (P3-C3), so it is not misread as a failed boot. |
| +- **P3-6.** The ingress `HealthyHostCount < count` alarm (25/25, `ingress/alarms.tf:28`) will fire during an approved long Standby, such as the T1/I4 witness that holds for more than 15 minutes plus the restore. Note on the card that this alarm is expected, or suppress it on the maintenance path. Do not change the ASG deficit alarm. |
| +- **P3-7.** :41 and :163 reuse the P3a dev NLB, whose target groups also hold the fixed pair. State the expected-count value the ingress alarms use during the drill, and the restore value, in Task 8. |
| + |
| +--- |
| + |
| +## Checked and sound (no finding) |
| + |
| +- A1 core: the edge refuses tenant dispatch and answers health 503 while not admitted (`internal/edge/group_admission.go:10-24`, `internal/edge/lbhealth.go:38`). Starts need `role == Serve && Admitted` (`internal/host/group_admission.go:92-96`). The plan correctly notes that the current `tick` holds `a.mu` across `Admit` (:116-140) and requires that no orchestration mutex be held across the cloud call. |
| +- Task 1's single helper, its separate held, dialable and route bits, and its name-class census address R2-1 and R2-2 as stated. Mutations cover both. |
| +- The infra rails are present: no instance refresh, AZRebalance suspended, initial hook, gate on ordinary decreases, `prevent_destroy` EIPs, and cleanup of protected disposable EIPs (:169). |
| +- Request budget: arithmetic checked (operator 1,080 reads; SSM ≤22; boot 5 or 6 GETs). No new per-box poll. |
| +- Cost table: arithmetic checked ($55.396 per month; $2.9652 for 24 h). |
| +- Hairpin design: SO_ORIGINAL_DST, own-region list, no header trust, and egress checked before the rewrite, with root-runner witnesses. This is sound as a plan. Live kernel behaviour is correctly left unverified. |
| + |
| +--- |
| + |
| +**Verdict: NOT READY.** One P1: P1-1 (ExitStandby launch hook versus receipt suppression; T1/I4). |