plans: P3a Opus review round 1 (NOT READY, 2 P1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/plans/REVIEW-REGION-HA-P3-R1.md+107 −0
Intent
<task-notification> <task-id>af218a6c58a8c456c</task-id> <tool-use-id>toolu_013sPwdBVDAA1ETyTTTuwsEa</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/aab63774-dfe6-44a4-9cd9-230e6f4c3d13/tasks/af218a6c58a8c456c.output</output-file> <status>completed</status> <summary>Agent "Opus review of P3a plan R1" 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>**Region HA P3a plan review, round 1 (commit 59cc03af, plan `docs/superpowers/plans/2026-11-01-region-ha-p3-group.md`)** I checked the plan against spec rev 6.1, discussion #421, AGENTS.md and the code at 65420a4d. The worktree had no code changes, only the two docs. I also read `/home/paulca/amadan.net/carlos/platform-infrastructure` (dev root) without changing it. I made no edits, ran no tests and ran no tofu. **What holds.** Almost every cited file:line is right. The install-floor discrepancy is real (`installchannel.go:456-458`). There is no production `SetHosting` caller. `internal/compute` is absent. #446 is cited correctly. P3a's executable tasks use only interfaces on main, so rule 4 is not broken. No new core package imports AWS. The arithmetic in the budget example ($0.0000884) and in the NLB and IPv4 cost rows is correct. The census notes match AGENTS.md. ## P1 **P1-1. Any agent restart on an admitted group box gets it replaced by the Auto Scaling group (ASG)** - **Task:** 1 Step 3, 2 Step 4, 3 Step 4, 6 Step 4. - **Problem:** The plan treats a restart like a fresh boot, so health answers 503 until the box is re-admitted. The plan does not cover planned restarts, and spec §10 does not either. - **Evidence:** - The group uses ELB health with a 60 s grace and 2/2 thresholds at 10 s (plan :119, :121). - On restart the box "rechecks all local startup facts/health before re-admission" (:146). Those facts are the first reconcile pass, the edges PUT and the termination consumer. - "With no trustworthy read stay closed" (:76, :133). - Health answers 503 whenever hosting is false (`lbhealth.go:159`). - Platform rolls restart carlos-edge. - Spec §10 says S3 reachability is not part of health, and §9.5 says health stays 200 on S3 loss. - **Failure:** - Every roll or self-update keeps the restarted box at 503 for more than about 20 s, then the ASG terminates it. Its leases wait for expiry (N-HA9) or for shutdown markers. - During an S3 blip, every restarted box fails its role read or reconcile and is replaced, and the new boxes fail the same way. - The plan's own Task 6 Step 4 drill ("restart admitted agent to exercise receipt") would trigger a replacement. - **Fix:** Define the restart path. Either: - keep the external answer 200 through a bounded, receipt-verified restart window while the local tenant gate stays closed; or - make the roll recipe put the box in ASG Standby, turn off unattended self-update on group boxes, and add a witness. Either way, a restart must not make S3 a health input. If this needs a ruling on spec §10, raise it with Paul. - **Invariant:** T1 / I4 (and S2 §6: a shared dependency never terminates a box). **P1-2. The SSM grants as written would deny the box's own host.env read** - **Task:** 4 Step 4. - **Problem:** The plan allows reads, and scopes the NotResource Deny, only on `/carlos/<dep>/<region>/*` and `/carlos/<dep>/shared/*`. GetParametersByPath is authorised against the path itself. - **Evidence:** - `hostenv/awsssm.go:62-63` sends `Path: TrimSuffix(prefix,"/")`, so the resource is `parameter/carlos/<dep>/<region>`. - The ancestor-path deny at `main.tf:517-526` uses that same path-ARN model. - The reviewed 2b plan granted "GetParametersByPath on exactly `/carlos/<deployment>/<region>` and `/carlos/<deployment>/shared`" (`2026-10-17-region-ha-2b-joining.md:8459`). - **Failure:** The explicit Deny matches the by-path call, so `host-env write` gets AccessDenied. The box is never healthy and hits ABANDON every launch. Mock tofu tests cannot catch this. - **Fix:** - Allow and NotResource-except both the exact path ARNs and `<path>/*`. - Never use `<region>*`, which would also match a sibling such as `ie2`. - Add a policy-shape assertion to `group_iam.tftest.hcl`. - **Invariant:** IAM least privilege / A1 (boot). ## P2 1. **Task 2: role re-reads have no defined gate.** - **Problem:** Roles are re-read "only when the scope moves". But the change index is armed only by `CARLOS_CHANGE_INDEX=read` (`host/changeindex.go:31-33`), and that variable is not in the hostenv allowlist (`hostenv.go:70-101`). When the index is disarmed, "every read is due". - A lost index bump is only logged (`changeindex.go:122-124, 192`). Existing gated readers have a 30-minute backstop (`changewatch.go:17`). - **Failure:** Either a saved drain is never applied until restart, or roles are re-read every pass, which is new per-box polling. - **Fix:** Use a ReadGate with the backstop and compare against `Observed`. Require the index to be armed for group boxes and add the variable to the allowlist. Budget the 2G per 30 minutes. Define the disarmed case. - **Invariant:** R1 / B1. 2. **Task 3: nothing says what turns admission on for a fixed box.** - **Problem:** The plan says only "Nil preserves non-P3 fixed behavior" (:141). Flagship boxes and the dev pair's legacy tenants could end up behind a closed gate after every restart. Edges `box_role: booting` from fixed boxes that are never admitted would later drop them from serving. - **Fix:** Name the switch, prove flagship is unchanged without it, and decide whether boxes without P3 publish `box_role`. - **Invariant:** I4 / R1 / S1. 3. **Task 2/4/6: no way to get root-owned settings onto the P3a fixed pair.** - **Problem:** `region_code`, `/etc/carlos/region-ingress.json` and the hairpin rules come only from the group boot template. - **Why it matters:** Changing user_data on leo/sophie stops and restarts the instance, and the existing fixed bootstrap doesn't write these files. - **Fix:** Name the delivery mechanism for the fixed pair, or drop hairpin from P3a. - **Invariant:** N1 / S1. 4. **Task 2 and outline: booting, drain and platform boxes can still be chosen as homes.** - **Problem:** A booting box publishes its adopted rows before admission. The home choice for cross-region backhaul takes the newest claim, then the first file in sorted order (`homemap.go:781-786`, `:944-963`). `g-` references sort before status labels. The plan's front gate refuses before ForwardTarget. - **Failure:** Backhauled requests get 503 for the whole boot (up to 15 minutes), and indefinitely from a box that is never admitted until its file ages out. - **Fix:** Publish no home rows until admitted, or make the home choice skip boxes that are not admitted, draining or platform when another candidate exists. - **Invariant:** A1 / H4. 5. **Task 4 Step 5: hairpin shows tenants a private or loopback client address.** - **Problem:** Redirected connections reach the edge from the box's private, bridge or loopback address. Today they arrive as the public EIP. - **Evidence:** The codebase forbids presenting such an address because frameworks treat it as trusted (`door.go:138-145`). - **Fix:** Present the box's public address for hairpinned connections, or refuse them. Add a check of the client address to the kernel witness. - **Invariant:** N1. 6. **Task 4 Step 4: the group role inherits claim-era wildcard grants.** - **Problem:** The group role gets unscoped `s3:DeleteObjectVersion` and `ListBucketVersions` (`main.tf:181-197`, #478). The plan never mentions #478. - **Fix:** Group mode drops or narrows them, with a mock assertion. - **Invariant:** IAM least privilege. 7. **Task 1/6: merging P3a changes dev's IAM, and a full dev apply restores a known outage.** - **Problem:** The dev root sources `region-host?ref=main` for ie, ie-b, uk and standby-ie (`dev/region-ie-b.tf:10`). Main still carries the store Deny with `s3:DeleteObject` (`main.tf:721-730`). The fix branch `region-host-store-deny` is not merged. - **Failure:** A full P3a dev apply puts back the Deny that caused sophie's lease-release 403s on 2026-10-29. - **Fix:** Merge the fix first or `-target` the apply. Read-plan the whole dev root before merging. - **Invariant:** E1 / S1. 8. **Task 1 Step 4: the JSON plan gate only refuses replacement and deletion.** - **Problem:** It does not catch in-place updates that stop a fixed instance (user_data, instance_type; flagship already has user_data drift), or changes to fixed security groups or IAM. - **Fix:** Refuse any change to fixed `aws_instance`, `aws_security_group.host` and the host IAM policies unless an allow-list names it. - **Invariant:** E1 / T1. 9. **Task 1: the security-group plan won't work on the fixed pair's SG.** - **Problem:** The fixed SG uses inline rules. A standalone rule fights the inline set and is stripped on every apply (`variables.tf:144`, `main.tf:47-49`), and `extra_ingress` takes only CIDRs. - **Fix:** State that P3a adds no rule to the fixed SG; public 80/443 already admits the NLB. Apply the `target_security` assertions to group mode only. - **Invariant:** E1. 10. **Task 6 Step 2: P3a has no stated rollback.** - **Problem:** Nothing says how to back out the admission and hairpin release, the target attachments or the NLB if acceptance fails. - **Fix:** State the rollback steps and who runs them. - **Invariant:** S1 / E1. ## P3 - Line 11 says #421 supplies N-HA10, but N-HA10 is recorded in the P1b-2 plan (`2026-10-29-region-ha-p1b2-forwarding.md:21`), not on #421. - Line 27 says P3a waits for the "ingress prerequisites". P2a's `CONSOLE_REGION_INGRESS` gates only group publication (P3b). Say that P3a's only outside producer is the P1b-3b consumer's start acknowledgment. - The ingress tests live at `ingress/tests/`, but Step 2 filters `tests/group_ingress.tftest.hcl`. - `prevent_destroy` is literal, so describe the "unprotect cleanup" mechanism. - Watch for an SG reference cycle (host SG inline rule referencing the NLB SG, NLB SG egress referencing the host SG). - The cost line leaves out the new custom metric series (about $0.30 per metric-month, plus churn from per-instance series) and roughly 10 alarms at $0.10 each. - The copy deck misses the JSON gate's refusal text, the boot template's messages and the new 503 health condition name. P3-C2 reuses "waking elsewhere", which implies another box holds the instance. - E1 says IE platform is outside all target groups, but P3a registers sophie (the dev console box). State that dev exception. - Add door calls and tunnel deliveries to the pre-admission witnesses; `frontForwardHA` skips them (`forwardha.go:148`). - The source of the chrony offset reading is not specified. - Task 2 edits edgesfile at the same time as the P1b-3a build; coordinate. **Verdict: NOT READY**</result> <usage><subagent_tokens>252913</subagent_tokens><tool_uses>70</tool_uses><duration_ms>1045141</duration_ms></usage> </task-notification>
Attributed to this commit: 9.08 g CO₂e (1,090,397 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-p3-group, 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-P3-R1.md b/docs/superpowers/plans/REVIEW-REGION-HA-P3-R1.md| new file mode 100644 |
| index 000000000..83193116c |
| --- /dev/null |
| +++ b/docs/superpowers/plans/REVIEW-REGION-HA-P3-R1.md |
| @@ -0,0 +1,107 @@ |
| +**Region HA P3a plan review, round 1 (commit 59cc03af, plan `docs/superpowers/plans/2026-11-01-region-ha-p3-group.md`)** |
| + |
| +I checked the plan against spec rev 6.1, discussion #421, AGENTS.md and the code at 65420a4d. The worktree had no code changes, only the two docs. I also read `/home/paulca/amadan.net/carlos/platform-infrastructure` (dev root) without changing it. I made no edits, ran no tests and ran no tofu. |
| + |
| +**What holds.** Almost every cited file:line is right. The install-floor discrepancy is real (`installchannel.go:456-458`). There is no production `SetHosting` caller. `internal/compute` is absent. #446 is cited correctly. P3a's executable tasks use only interfaces on main, so rule 4 is not broken. No new core package imports AWS. The arithmetic in the budget example ($0.0000884) and in the NLB and IPv4 cost rows is correct. The census notes match AGENTS.md. |
| + |
| +## P1 |
| + |
| +**P1-1. Any agent restart on an admitted group box gets it replaced by the Auto Scaling group (ASG)** |
| +- **Task:** 1 Step 3, 2 Step 4, 3 Step 4, 6 Step 4. |
| +- **Problem:** The plan treats a restart like a fresh boot, so health answers 503 until the box is re-admitted. The plan does not cover planned restarts, and spec §10 does not either. |
| +- **Evidence:** |
| + - The group uses ELB health with a 60 s grace and 2/2 thresholds at 10 s (plan :119, :121). |
| + - On restart the box "rechecks all local startup facts/health before re-admission" (:146). Those facts are the first reconcile pass, the edges PUT and the termination consumer. |
| + - "With no trustworthy read stay closed" (:76, :133). |
| + - Health answers 503 whenever hosting is false (`lbhealth.go:159`). |
| + - Platform rolls restart carlos-edge. |
| + - Spec §10 says S3 reachability is not part of health, and §9.5 says health stays 200 on S3 loss. |
| +- **Failure:** |
| + - Every roll or self-update keeps the restarted box at 503 for more than about 20 s, then the ASG terminates it. Its leases wait for expiry (N-HA9) or for shutdown markers. |
| + - During an S3 blip, every restarted box fails its role read or reconcile and is replaced, and the new boxes fail the same way. |
| + - The plan's own Task 6 Step 4 drill ("restart admitted agent to exercise receipt") would trigger a replacement. |
| +- **Fix:** Define the restart path. Either: |
| + - keep the external answer 200 through a bounded, receipt-verified restart window while the local tenant gate stays closed; or |
| + - make the roll recipe put the box in ASG Standby, turn off unattended self-update on group boxes, and add a witness. |
| + |
| + Either way, a restart must not make S3 a health input. If this needs a ruling on spec §10, raise it with Paul. |
| +- **Invariant:** T1 / I4 (and S2 §6: a shared dependency never terminates a box). |
| + |
| +**P1-2. The SSM grants as written would deny the box's own host.env read** |
| +- **Task:** 4 Step 4. |
| +- **Problem:** The plan allows reads, and scopes the NotResource Deny, only on `/carlos/<dep>/<region>/*` and `/carlos/<dep>/shared/*`. GetParametersByPath is authorised against the path itself. |
| +- **Evidence:** |
| + - `hostenv/awsssm.go:62-63` sends `Path: TrimSuffix(prefix,"/")`, so the resource is `parameter/carlos/<dep>/<region>`. |
| + - The ancestor-path deny at `main.tf:517-526` uses that same path-ARN model. |
| + - The reviewed 2b plan granted "GetParametersByPath on exactly `/carlos/<deployment>/<region>` and `/carlos/<deployment>/shared`" (`2026-10-17-region-ha-2b-joining.md:8459`). |
| +- **Failure:** The explicit Deny matches the by-path call, so `host-env write` gets AccessDenied. The box is never healthy and hits ABANDON every launch. Mock tofu tests cannot catch this. |
| +- **Fix:** |
| + - Allow and NotResource-except both the exact path ARNs and `<path>/*`. |
| + - Never use `<region>*`, which would also match a sibling such as `ie2`. |
| + - Add a policy-shape assertion to `group_iam.tftest.hcl`. |
| +- **Invariant:** IAM least privilege / A1 (boot). |
| + |
| +## P2 |
| + |
| +1. **Task 2: role re-reads have no defined gate.** |
| + - **Problem:** Roles are re-read "only when the scope moves". But the change index is armed only by `CARLOS_CHANGE_INDEX=read` (`host/changeindex.go:31-33`), and that variable is not in the hostenv allowlist (`hostenv.go:70-101`). When the index is disarmed, "every read is due". |
| + - A lost index bump is only logged (`changeindex.go:122-124, 192`). Existing gated readers have a 30-minute backstop (`changewatch.go:17`). |
| + - **Failure:** Either a saved drain is never applied until restart, or roles are re-read every pass, which is new per-box polling. |
| + - **Fix:** Use a ReadGate with the backstop and compare against `Observed`. Require the index to be armed for group boxes and add the variable to the allowlist. Budget the 2G per 30 minutes. Define the disarmed case. |
| + - **Invariant:** R1 / B1. |
| +2. **Task 3: nothing says what turns admission on for a fixed box.** |
| + - **Problem:** The plan says only "Nil preserves non-P3 fixed behavior" (:141). Flagship boxes and the dev pair's legacy tenants could end up behind a closed gate after every restart. Edges `box_role: booting` from fixed boxes that are never admitted would later drop them from serving. |
| + - **Fix:** Name the switch, prove flagship is unchanged without it, and decide whether boxes without P3 publish `box_role`. |
| + - **Invariant:** I4 / R1 / S1. |
| +3. **Task 2/4/6: no way to get root-owned settings onto the P3a fixed pair.** |
| + - **Problem:** `region_code`, `/etc/carlos/region-ingress.json` and the hairpin rules come only from the group boot template. |
| + - **Why it matters:** Changing user_data on leo/sophie stops and restarts the instance, and the existing fixed bootstrap doesn't write these files. |
| + - **Fix:** Name the delivery mechanism for the fixed pair, or drop hairpin from P3a. |
| + - **Invariant:** N1 / S1. |
| +4. **Task 2 and outline: booting, drain and platform boxes can still be chosen as homes.** |
| + - **Problem:** A booting box publishes its adopted rows before admission. The home choice for cross-region backhaul takes the newest claim, then the first file in sorted order (`homemap.go:781-786`, `:944-963`). `g-` references sort before status labels. The plan's front gate refuses before ForwardTarget. |
| + - **Failure:** Backhauled requests get 503 for the whole boot (up to 15 minutes), and indefinitely from a box that is never admitted until its file ages out. |
| + - **Fix:** Publish no home rows until admitted, or make the home choice skip boxes that are not admitted, draining or platform when another candidate exists. |
| + - **Invariant:** A1 / H4. |
| +5. **Task 4 Step 5: hairpin shows tenants a private or loopback client address.** |
| + - **Problem:** Redirected connections reach the edge from the box's private, bridge or loopback address. Today they arrive as the public EIP. |
| + - **Evidence:** The codebase forbids presenting such an address because frameworks treat it as trusted (`door.go:138-145`). |
| + - **Fix:** Present the box's public address for hairpinned connections, or refuse them. Add a check of the client address to the kernel witness. |
| + - **Invariant:** N1. |
| +6. **Task 4 Step 4: the group role inherits claim-era wildcard grants.** |
| + - **Problem:** The group role gets unscoped `s3:DeleteObjectVersion` and `ListBucketVersions` (`main.tf:181-197`, #478). The plan never mentions #478. |
| + - **Fix:** Group mode drops or narrows them, with a mock assertion. |
| + - **Invariant:** IAM least privilege. |
| +7. **Task 1/6: merging P3a changes dev's IAM, and a full dev apply restores a known outage.** |
| + - **Problem:** The dev root sources `region-host?ref=main` for ie, ie-b, uk and standby-ie (`dev/region-ie-b.tf:10`). Main still carries the store Deny with `s3:DeleteObject` (`main.tf:721-730`). The fix branch `region-host-store-deny` is not merged. |
| + - **Failure:** A full P3a dev apply puts back the Deny that caused sophie's lease-release 403s on 2026-10-29. |
| + - **Fix:** Merge the fix first or `-target` the apply. Read-plan the whole dev root before merging. |
| + - **Invariant:** E1 / S1. |
| +8. **Task 1 Step 4: the JSON plan gate only refuses replacement and deletion.** |
| + - **Problem:** It does not catch in-place updates that stop a fixed instance (user_data, instance_type; flagship already has user_data drift), or changes to fixed security groups or IAM. |
| + - **Fix:** Refuse any change to fixed `aws_instance`, `aws_security_group.host` and the host IAM policies unless an allow-list names it. |
| + - **Invariant:** E1 / T1. |
| +9. **Task 1: the security-group plan won't work on the fixed pair's SG.** |
| + - **Problem:** The fixed SG uses inline rules. A standalone rule fights the inline set and is stripped on every apply (`variables.tf:144`, `main.tf:47-49`), and `extra_ingress` takes only CIDRs. |
| + - **Fix:** State that P3a adds no rule to the fixed SG; public 80/443 already admits the NLB. Apply the `target_security` assertions to group mode only. |
| + - **Invariant:** E1. |
| +10. **Task 6 Step 2: P3a has no stated rollback.** |
| + - **Problem:** Nothing says how to back out the admission and hairpin release, the target attachments or the NLB if acceptance fails. |
| + - **Fix:** State the rollback steps and who runs them. |
| + - **Invariant:** S1 / E1. |
| + |
| +## P3 |
| + |
| +- Line 11 says #421 supplies N-HA10, but N-HA10 is recorded in the P1b-2 plan (`2026-10-29-region-ha-p1b2-forwarding.md:21`), not on #421. |
| +- Line 27 says P3a waits for the "ingress prerequisites". P2a's `CONSOLE_REGION_INGRESS` gates only group publication (P3b). Say that P3a's only outside producer is the P1b-3b consumer's start acknowledgment. |
| +- The ingress tests live at `ingress/tests/`, but Step 2 filters `tests/group_ingress.tftest.hcl`. |
| +- `prevent_destroy` is literal, so describe the "unprotect cleanup" mechanism. |
| +- Watch for an SG reference cycle (host SG inline rule referencing the NLB SG, NLB SG egress referencing the host SG). |
| +- The cost line leaves out the new custom metric series (about $0.30 per metric-month, plus churn from per-instance series) and roughly 10 alarms at $0.10 each. |
| +- The copy deck misses the JSON gate's refusal text, the boot template's messages and the new 503 health condition name. P3-C2 reuses "waking elsewhere", which implies another box holds the instance. |
| +- E1 says IE platform is outside all target groups, but P3a registers sophie (the dev console box). State that dev exception. |
| +- Add door calls and tunnel deliveries to the pre-admission witnesses; `frontForwardHA` skips them (`forwardha.go:148`). |
| +- The source of the chrony offset reading is not specified. |
| +- Task 2 edits edgesfile at the same time as the P1b-3a build; coordinate. |
| + |
| +**Verdict: NOT READY** |
| \ No newline at end of file |