| new file mode 100644 |
| index 000000000..f5d61e72d |
| --- /dev/null |
| +++ b/docs/superpowers/notes/2026-11-06-region-ha-g2-follow-ups.md |
| @@ -0,0 +1,122 @@ |
| +# Region HA G2 follow-ups |
| + |
| +These items remain after the G2 fix branch. The agent manager owns each item |
| +unless another owner is named. Evidence labels F-A through F-E and T1 refer to |
| +`/home/paulca/.cache/region-ha-next/G2-FINDINGS.md`. That analysis uses v0.34.7 |
| +line numbers; the code paths below name the current files. |
| + |
| +1. **F-A: cancel and join S3 work on stop.** |
| + Owner: agent manager. Trigger: before G5. |
| + Evidence: findings F-A; `internal/lease/release.go` calls `SyncAndWait`; |
| + Litestream `Replica.Sync` waits for `syncMu` without context cancellation. |
| + In-flight background sync uses the DB context and a 24 h HTTP timeout. |
| + `internal/activator/hafiles.go` has an unbounded `<-done` in `stopFiles`. |
| + Finish: cancel and join replica sync and file publishers before release, |
| + with a witness for blocked work. Never abandon publishers. |
| + |
| +2. **F-E: recover drill access and retain journals.** |
| + Owner: agent manager. Trigger: the next partition drill. |
| + Evidence: findings F-E and the lost holder journal in drill 4. |
| + Finish: the harness restarts `amazon-ssm-agent` at fault expiry. Ship the |
| + `carlos-edge` journal off-box during drills through the CloudWatch agent, |
| + or copy it to S3 before termination. Verify access recovery and journal |
| + retention after the fault and termination. |
| + |
| +3. **F-B: withdrawal shapes left pending by design.** |
| + Owner: agent manager. Trigger: a request to support these shapes. |
| + Evidence: `internal/activator/poolwithdrawal.go` and |
| + `internal/provision/poolwithdrawal.go`. Pending cases include any HA row |
| + with timer or duty state, a successor that consumed the marker before |
| + observation with no local clean record, missing or deleted instance |
| + records, unsupported owners, and a static-only box without an activator. |
| + There is no live-box duty transfer. The operator path today is to leave |
| + the host fenced: it no longer serves or advertises. |
| + Finish: a live-box duty transfer design and evidence that each supported |
| + shape can complete withdrawal without losing duties or dropping an |
| + unfinished stop/release handle. |
| + |
| +4. **F-B: crash recovery on an ineligible holder (review P3-3).** |
| + Owner: agent manager. Trigger: the card/runbook update before another |
| + drill with a previously ineligible holder. |
| + Evidence: findings F-B, leo's generation 207, and dispatch review P3-3. |
| + An ineligible box that crashes while holding an HA lease has no automatic |
| + recovery. It may not re-take the lease. Eligible peers need EC2 termination |
| + proof while that box is still live. |
| + Finish: the card/runbook tells the operator to restart it cleanly for a |
| + clean release, or terminate it. Neither route relaxes pool eligibility. |
| + |
| +5. **T1: instrument termination before changing shutdown.** |
| + Owner: agent manager. Trigger: before changing stop order or |
| + `TimeoutStopSec`; resolve before G5. |
| + Evidence: findings T1; `internal/host/units/carlos-instance-gen@.service` |
| + has `After=carlos-edge.service`. The drill 1 and 2 journals were lost. |
| + Finish: run an instrumented terminate drill with retained journals, then |
| + use that evidence to decide any ordering or timeout change. |
| + |
| +6. **F-A: an unexpired lease still permits forwarding to a hung holder.** |
| + Owner: agent manager. Trigger: a later forwarding-latency investigation. |
| + Evidence: `internal/activator/hacache.go`, |
| + `internal/activator/haleaseloss.go`, `internal/edge/forwardha.go`, and the |
| + F-A controller ruling in the Task 12 dispatch. |
| + Silence suspicion no longer refuses a same-holder unexpired lease. A |
| + truly hung holder with a valid lease can still hang forwarded clients |
| + until expiry, as before this branch. The holder-side lost-lease 503 |
| + covers the drill-4 case. |
| + Finish: measure the remaining hang and decide whether to measure the |
| + three seconds from `GotConn` instead of dispatch. Preserve the rule |
| + against replaying uncertain requests. |
| + |
| +7. **Copy: revisit C1 in the next copy round.** |
| + Owner: agent manager. Trigger: the next shared refusal-copy review. |
| + Evidence: `/home/paulca/.cache/region-ha-next/g2fix/luna-result.md`, C1. |
| + Luna suggested: "This service is temporarily unavailable. Please try |
| + again shortly." The controller retained the existing approved C1. |
| + Finish: review the suggestion across existing pages before changing the |
| + shared `internal/edge/haingress.go` constant. |
| + |
| +8. **Deferred minor: forwarding checks take the activator lock.** |
| + Owner: agent manager. Trigger: a routing-performance investigation. |
| + Evidence: `forwardTarget` in `internal/activator/haforward.go` takes |
| + `a.mu` and scans startup obligations on every edge decision, including |
| + non-HA routes. |
| + Finish: measure the cost and, if needed, reduce it while preserving |
| + startup and lease-loss refusals. |
| + |
| +9. **Tooling: establish a usable OpenTofu gate.** |
| + Owner: agent manager. Trigger: the next infrastructure test-tooling pass. |
| + Evidence: `scripts/region_group_contract_test.py` fails with |
| + "fixed resource attributes changed from Task 2 base" under OpenTofu |
| + 1.13.9 and AWS provider 6.57.1 on main `25ca6faf` too. This is pre-existing. |
| + Module mock tests need OpenTofu >= 1.13; 1.12.5 rejects indexed mocks. |
| + CI has no OpenTofu. |
| + Finish: resolve the baseline failure and provide a pinned, compatible |
| + toolchain with a recorded contract and module-mock test result. |
| + |
| +10. **F-C: write fencing remains outside this branch.** |
| + Owner: agent manager. Trigger: before G5. |
| + Evidence: `G2-FINDINGS.md`, F-C, at the path above. |
| + Finish: complete the write-fence work and spec text required there. |
| + No new design is proposed here. The 300 s promise text is unchanged. |
| + |
| +11. **G3 card: authorize and verify both US page sinks.** |
| + Owner: G3 card owner. Trigger: before G3, under its separately approved |
| + scope. Evidence: findings F-D and the Task 12 dispatch. |
| + Copy this card item verbatim: |
| + |
| + > Before G3, grant sns:Publish on the US group alerts topic arn:aws:sns:us-east-1:271376211898:carlos-flagship-us-ha-alerts to the US group role carlos-flagship-us-ha and adi-knitting's fixed role carlos-flagship-host-us. Configure and verify both page sinks against that same topic. Record the two identity-policy grants, preserve the CloudWatch/EventBridge topic statements, and verify page delivery under the separately approved G3 scope. Target the suspect log/page at L+10 under continuous probes and the alarm at L+12. Do not add ha to adi's CARLOS_POOLS. |
| + |
| + The IE dev grants are in pinfra PR #72, not merged or applied. Fixed |
| + boxes' sinks must be set to the group topic and read back. |
| + Finish: record the grants, sink readbacks and page-delivery evidence on |
| + the G3 card. L is the observed lease expiry. |
| + |
| +## Seeded escalation locations |
| + |
| +If stopping rule 2 selects simulation, extend |
| +`internal/sim/regionha/invariants_test.go` and `actions_test.go` for the |
| +pool/wake/withdrawal family. Call the real predicate, acquire and placement |
| +decisions. Use `internal/activator/hasuspect_test.go` for cache epoch |
| +sequences, `internal/lease/renew_attempt_test.go` for renew/pause/late-ack |
| +order, and `internal/activator/hasuspectholder_test.go` for expiry, owner and |
| +generation sequences. Require fixed seeds and a failing mutation. A new |
| +simulation does not reopen a closed review round. |