carlos / platform Public

Region HA P1b-2 plan (forwarding between boxes), rev 1, with the Astra round 1 brief

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 2a6a483508a3e5bb0c0edbf5fc4d8e1865614d04 parent 1fa2a99
2 files changed, +225 −0
  • docs/superpowers/plans/2026-10-29-region-ha-p1b2-forwarding.md +184 −0
  • docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B2-BRIEF-1.md +41 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>a5575490de58c2e01</task-id> <tool-use-id>toolu_01DTxoBufXiQa1DpNN7pDWKj</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/a5575490de58c2e01.output</output-file> <status>completed</status> <summary>Agent "Map edge/activator forwarding seams" 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>All paths below are under `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-p1b2`. The sandbox failed to start (a stale worktree gitdir broke bwrap), so I ran the read-only greps unsandboxed. The worktree's HEAD is `1fa2a99b` on branch `static-headers`, not `main`. Nothing was edited. **1. Local vs remote in the edge** - `func (e *Edge) ServeHTTP(w, r)` at `internal/edge/edge.go:1603`. Order: strip port, `acceptHop` (1670), `lookupUpstreamPath(host, r.URL.Path)` (1696), then `regionalGate`. - Two backhaul arms: - **Exact-home arm (1716-1722).** Fires when `ok &amp;&amp; !hopped &amp;&amp; !isDoor &amp;&amp; !e.servesExactly(host)`, meaning the local match came only through a `*.parent` key. It calls `e.homes.Load().ExactHome(host)`, then `serveAssetFar || backhaulTo`. - **Miss arm (`!ok`, 1728-1768).** - A hop gets `staleHopRefusal`. - A door call gets `Owner()` then `backhaulTo`. - Everything else gets `serveAssetFar || e.backhaul(w, r, host)`, then `unknownHost`. - `backhaul(w, r, host) bool` (3387) is `m.Home(host)` plus `backhaulTo`. - `func (e *Edge) backhaulTo(w, r, host, eip, box string) bool` is at 3398. - `host` is the concrete request host, and it is what the MAC covers. - `eip` is the dial address. `Reader.Dial` picks the box's private IP when it is in the same region and placement with `CARLOS_REGION_HA` on, otherwise its public EIP (`edgesfile/homeelect.go:60`, folded in `homemap.go:783`). - `box` is the home box's label (`homeEntry.box`, `edgesFileView.Box`). - A hop that already arrived is refused first (3399-3402): `staleHopRefusal`, return `true`. - It returns `false` only when no mesh key is mirrored (3408-3412). Both callers then fall through to the unknown-host answer. - Saturation or fair-share shedding is answered inside `backhaulAdmit` and returns `true`. - A dial failure does not return `false`. `backhaulProxy.ErrorHandler` (3626-3636) writes a 502 and `backhaulTo` still returns `true` (3445). So a dial failure cannot fall through to a local activator unless you add that. **2. The hop marker** - `signHop(key []byte, host string, now time.Time) string` (`mesh.go:188`). - `verifyHop(key, host, header, now) bool` (199). - `verifyHopEitherKey(current, next, host, header, now)` (234) is what the request path uses. - `signHopDoor` (255) is the door variant. - `backhaulProxy` (`edge.go:3589`) sets `X-Carlos-Hop: 1`, `X-Carlos-Hop-Auth` and optionally `X-Carlos-Hop-Door`. - `func (e *Edge) acceptHop(r, host) (*http.Request, bool)` is at `homemap.go:1258`. - It deletes the hop headers in all cases. - On a verified hop it sets `hopVerifiedKey` on the context. - On an unverified hop it strips the forwarded headers. - After a verified hop, a host this box serves locally goes through the normal path. That includes the `up.hibernating` branch to `e.act.ServeHTTP` (`edge.go:2007-2008`). Nothing hop-specific skips the activator. - The no-reforward rule is explicit and has two layers: - `homemap.go:58-63`: "One hop, ever, is STRUCTURAL ... There is no path from an accepted hop to Home() at all". - `edge.go:3375-3379`: "A forwarding loop must take TWO mistakes, not one." The `hopVerified` guards at 3390-3392 (`backhaul`) and 3399-3402 (`backhaulTo`) repeat it. - `hopVerified(ctx) bool` is unexported, at `homemap.go:1218`. The activator cannot read it directly. **3. Edge to activator and `errLeaseHeld`** - The seam is `edge.Activator` (`edge.go:91`): `ServeHTTP(w, r, rt registry.Route, proxy http.Handler) bool` and `RetireExcept(keep map[string]bool)`. The edge calls it at 2008 when `up.hibernating`. - `activator.Service.serve` is at `activator.go:5943`. It calls `a.begin(...)` (`activator.go:1632`) and sends errors to `serveWakeError` (6026). - `type errLeaseHeld struct { holder string; retryAfter time.Duration }` is at `activator.go:1168`. - It is built in `leaseError` (`hawake.go:252-259`) from `*lease.HeldError{Owner string; ExpiresAt time.Time}` (`lease/lease.go:120`). `retryAfter` is the time until `ExpiresAt`, with a 1s floor. - The 503 is at `activator.go:6064-6067`: `Retry-After` is `holder.retryAfter` in seconds plus 1, `edge.MarkAnswered(r)`, then the "instance is waking elsewhere; retry shortly" text. - `holder` is read only to log it (`activator.go:2557`). It never leaves the activator, and the edge only sees a bool from `ServeHTTP`. - No existing hook exists for serving a request elsewhere. A grep for `ServeRemote`, `Forward` and `Mesh` in `internal/activator/*.go` finds nothing. The only trace is a prose comment at `activator.go:6013-6017` ("mesh seam: Eleven proxied ... Single-box v1 always wakes locally"). **4. `homemap.go` data** - Each box's file is `control/edges/&lt;box&gt;.json`, parsed into `edgesFileView{V, Box, EIP, Hosts map[string]edgesHostView, PrivateIP, PrivateCIDR, Region, Placement}` (134-146). - `edgesHostView` (162) carries `Role`, `Stamp`, `Account`, `App` and others. - `foldHomes(files, self, privateDial)` (783) produces `map[string]homeEntry{eip, box, dial, account, app, stamp, ...}`, with the self box excluded. - Lookups are keyed by host only: `Home` (983), `ExactHome` (997), `Owner` (1038). - I found no 15-minute freshness rule in the edge's map. A failed read carries the previous parse forward (`refreshHosts`, 449-530). The poll is every 30s (`homeMapInterval`). The writer republishes every 5 minutes plus jitter, and sooner on a registry change (`internal/host/edgesfile.go:958`). The only freshness filter I found is on box status snapshots, in `edgesfile/fold.go`. - The writer publishes every route with `Status == "ready"`, and hibernating routes stay "ready" (`host/edgesfile.go:~552`). So an HA host on B should appear in B's file as `role: home`, with a `Stamp`. - I did not verify that the HA host's registry row exists on both boxes. If it does, A's own map would also contain B's entry for H, since only A is excluded. - There is no box-ref to address lookup. `snapshot().files` is keyed by bucket key, and `Box` equals the box label (`WithBoxLabel`, `edge.go:387`). The owner's `Ref` is the metrics label from the same source. I found no function that resolves it, so you would have to add one. - Owner parsing is `hafresh.ParseOwner(s) (Owner{Ref, IID string; PID int; HA bool}, bool)` (`hafresh/owner.go`). **5. Reading the holder without acquiring** - `lease.LockState(ctx, bucket, location, region string) (held bool, owner string, expires time.Time, err error)` is at `lockstate.go:47`. It does a read-only S3 GET. An absent lock returns `held=false` with a nil error. An expired lock returns the owner with `held=false`. - `lease.ReadLock(ctx, bucket, prefix, region string) (hafresh.View, error)` is at `ha.go:169`. `View{Absent bool; Lock{Generation, ExpiresAt, Owner, Release *Marker}; ETag}`. It exposes the release marker, which `LockState` does not. - Existing non-test callers of `LockState` are in `internal/host/movespass.go`, `movesoffline_seal.go` and `movesoffline_land.go`, and in `internal/console/seedfinish.go`. None are on the request path. - A released HA lock has owner `released/v1;...`. `ParseOwner` rejects it, which tells you the lock is free. **6. Holder cache and same-region backhaul** - A grep for "holder cache" and `holderCache` finds nothing. - Nothing refuses a same-region backhaul. The reverse is true: same region plus the same placement is dialled at the private IP (`Reader.Dial`, `homeelect.go:60`; `homemap_private_test.go`). - The only "never leaves its region" rule is for regional names (#447). `regionalGate` (`regional.go:64`) refuses a hop for a regional name and refuses to backhaul one. **7. Tests to reuse** - `internal/edge/backhaul_e2e_test.go` is the real two-edge harness. It has `newBackhaulScene` and `newBackhaulSceneWith(t, backhaulSceneExtra{homeAct, homeRoutes, farRoutes, homeEntries, farEntries, certs})`. - Edge A is "annie", the home. Edge B is "betty", the far edge. - A fake `Activator` can be injected through `homeAct` or `newBackhaulEdgeWith(... act Activator, routes)`. - Helpers: `converge`, `publishEdgesEntries`, `get`. - Main test: `TestBackhaulE2EAcrossTwoEdges` (726). - Related files: - `backhaul_share_test.go` - `regional_e2e_test.go` - `asset_e2e_test.go` (uses `homeAct`) - `asset_far_test.go` (`newFarEdge`) - `homemap_test.go` and `homemap_private_test.go` (private dial) - For the activator side, `internal/activator/hatakeover_test.go`, `harelease_test.go`, `hasecrets_test.go` and `rootfs_resident_lease_test.go` construct `&amp;errLeaseHeld{...}`.</result> <usage><subagent_tokens>114447</subagent_tokens><tool_uses>20</tool_uses><duration_ms>101069</duration_ms></usage> </task-notification>

Attributed to this commit: 85.5 g CO₂e (10,724,662 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-p1b2-forwarding, 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/2026-10-29-region-ha-p1b2-forwarding.md b/docs/superpowers/plans/2026-10-29-region-ha-p1b2-forwarding.md
new file mode 100644
index 000000000..a2958c427
--- /dev/null
+++ b/docs/superpowers/plans/2026-10-29-region-ha-p1b2-forwarding.md
@@ -0,0 +1,184 @@
+# Region HA P1b-2: forwarding between boxes Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** A request for a born-HA host that reaches a box which does not hold the host's lease is forwarded to the box that does, over the existing signed backhaul hop, instead of answering 503 "instance is waking elsewhere".
+
+**Architecture:**
+- **The edge** learns to answer "is box `ref` in my view, and how do I dial it" from the edges files it already folds, and gains one forward call that reuses the backhaul hop with its own failure answers.
+- **The activator** keeps a bounded in-memory holder cache (host to box reference), forwards an HA host's request when the cache or a held-lease answer names a box in view, and never forwards a request that already arrived as a hop.
+- **The agent** wires the edge into the activator. Cold wakes stay where the request lands; nothing about leases changes.
+
+**Tech Stack:** Go 1.26, `internal/edge` (backhaul hop, `homeMap`), `internal/activator`, `internal/hafresh` (owner parsing).
+
+**Spec:** `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` §6.2, §6.4, §6.6, §4.3 (views), on main.
+
+**Status: rev 1, for Astra round 1 of 3. A P1 in round 3 goes to Paul as a cut.**
+
+## Scope (slicing, 2026-10-29)
+
+P1b is cut into slices (N-HA8). This slice, P1b-2, is forwarding only:
+
+| Spec | In P1b-2 | Later |
+|---|---|---|
+| §6.2 decision | Steps 1, 2, the held-by-owner-in-view and terminated outcomes of step 4 | §6.3's placement step ("free but not for A: forward to the box §6.3 chose") |
+| §6.3 cold-wake placement | Cold wakes happen where the request lands, as today | Proven reuse (forward to the box a clean marker names) and `ChooseRoomiest`: P1b-3. A restore from S3 costs about a second, so this is speed, not correctness. |
+| §6.4 forwarded requests | All of it | |
+| §6.5 one retry by the first box | | Later slice. The holder cache is fed by every answer, so a stale holder costs one 503 with `Retry-After: 1`. |
+| §6.6 holder cache | All of it | |
+| §4.3 views | The view test: fresh edges file, same region and placement | Roles (`serving(r)` minus drain/platform, `booting`): P3, with the NLB |
+| §7 duties, §10 latch, §12.4 hairpin | | P1b-3 (duties); P3 (latch, hook, hairpin) |
+
+Visible result on dev: with `hapair-a1` awake on leo, a request through sophie's address is answered by leo's instance (200), and a request through leo's address is served directly.
+
+## Global Constraints
+
+- **Only born-HA hosts forward.** A host forwards only when its route row is HA (`registry.Route.HA`). Legacy hosts behave exactly as today.
+- **One hop, ever (§6.4).** A request that arrived as a verified hop is never forwarded again, by any path. The edge's existing structural rule (`homemap.go:58-63`, `edge.go:3375-3402`) stays; the activator adds its own check before it forwards.
+- **View (§4.3):** box `ref` is in view only when its edges file is in the current fold, `ref` is not this box, the file's `generation` is no older than `boxchoice.MaxEdgesAge` (15 min) and no more than 1 min in the future, and its `region` and `placement` equal this box's own file's. If this box's own file is not in the fold, nothing is in view (fail closed).
+- **Holder cache (§6.6):** host to box reference; at most 50,000 entries; an entry lives at most 1 hour. It costs no S3 request.
+ - Set from a held-lease answer naming an HA box-format owner (`hafresh.ParseOwner`, `HA` true), and from a forward's `X-Carlos-Holder: <ref>`.
+ - Dropped when this box takes the lease, when the named box is not in view, when a forward fails to connect, and when the holder answers `X-Carlos-Holder: none`.
+- **Answers.**
+ - A forwarded request this box cannot serve (held by another box, not acquirable): 503, `Retry-After: 1`, `X-Carlos-Holder: <ref>` naming the live holder this box saw, or `X-Carlos-Holder: none`. Body: the existing "instance is waking elsewhere; retry shortly".
+ - A forward that cannot connect within 2 s: 503, `Retry-After: 10`, body "instance is waking elsewhere; retry shortly". Not the backhaul's 502.
+ - Everything else is today's answer.
+- **S3 budget:** a request for a host held elsewhere costs 0 S3 requests on a holder-cache hit, and today's one lock GET on a miss. No new polling.
+- **Copy:** none new. Every body string above already exists. Headers are diagnostics.
+- **Cross-compile** darwin and windows. **Tests:** touched packages only, with `-run` and `nice -n 19`. Leave `GOCACHE` at its default.
+- **Census:** agent-run packages (`internal/edge`, `internal/activator`, `internal/host` wiring). Expected classes: `body` and `sites`.
+
+## Review Focus
+
+1. **The holder box dies.** A cached holder whose dial fails gets 503 `Retry-After: 10` and the entry is dropped, so the next request runs the acquire (and, after expiry, P1b-1's takeover). Task 2: `TestForwardHADialFailureIs503RetryTen`; Task 3: `TestHolderCacheDroppedOnUnreachable`.
+2. **The holder moved** (slept on B, woken on C). B answers `X-Carlos-Holder: C` or `none`, and A's cache follows. Task 3: `TestHolderCacheFollowsHolderHeader`.
+3. **A forwarded request at a box that is not the holder.** It is never forwarded on. Task 3: `TestHoppedRequestIsNeverForwarded`.
+4. **A WebSocket upgrade for a host held elsewhere.** It rides the forward and switches protocols end to end. Task 2: `TestForwardHAUpgradeSwitchesProtocols`.
+5. **A box out of view** (stale file, other region, other placement). Never a forward target. Task 1: `TestHolderViewRules`.
+
+---
+
+Tasks 2 and 3 are **[own review]** (stopping rule 3): they decide where a request is served. Task 5 is the dev drill and needs Paul's go.
+
+### Task 1: The edge's view of a box
+
+**Files:**
+- Modify: `internal/edge/homemap.go` (`edgesFileView`, a new method on `*homeMap`)
+- Create: `internal/edge/holderview.go`
+- Test: `internal/edge/holderview_test.go`
+
+**Interfaces:**
+- Produces:
+ - `edgesFileView` gains `Generation string \`json:"generation"\`` (the writer's RFC 3339 write time, `internal/edgesfile/snapshot.go:86-88`).
+ - `func (m *homeMap) boxInView(ref string, now time.Time) (dial string, ok bool)`: the rules in Global Constraints. `dial` is what `edgesfile.Reader.Dial` answers for that file, with this box's own file as `Self` and this edge's `privateDial`, exactly as `foldHomes` builds its reader (`homemap.go:796`).
+ - `func HopVerified(r *http.Request) bool`: exported wrapper of `hopVerified(r.Context())` (`homemap.go:1218`), for the activator.
+
+- [ ] **Step 1: Write the failing tests** in `holderview_test.go`, building `homeSnapshot`s directly:
+ - `TestHolderViewRules`: own file `{Box:"a", Region:"ie", Placement:"p", Generation:now}`; peer `b` same region and placement, generation now-1m → in view with its EIP; `b` generation now-16m → out; now+2m → out; region "uk" → out; placement "q" → out; `ref == "a"` (self) → out; unknown ref → out; own file absent → everything out.
+ - `TestHolderViewDialsPrivateWithRegionHA`: `privateDial` true and a matching `PrivateIP`/`PrivateCIDR` → the private address (same answer as `foldHomes`).
+ - `TestHopVerifiedExported`: a request whose context carries the verified-hop key answers true; a plain request false.
+- [ ] **Step 2: Run** `nice -n 19 go test ./internal/edge -run 'TestHolderView|TestHopVerifiedExported' -count=1`. Expected: FAIL (undefined).
+- [ ] **Step 3: Implement** the field, `boxInView` and `HopVerified`.
+- [ ] **Step 4: Run** the Step 2 command. Expected: PASS.
+- [ ] **Step 5: Commit** `region-ha p1b-2: the edge's view of a box`.
+
+### Task 2: The edge forwards an HA host's request to a named box [own review]
+
+**Files:**
+- Create: `internal/edge/forwardha.go`
+- Test: `internal/edge/forwardha_test.go` (reuse `backhaul_e2e_test.go`'s `newBackhaulSceneWith`, `converge`, `publishEdgesEntries`)
+
+**Interfaces:**
+- Consumes: `boxInView` (Task 1); the backhaul hop signing, admission and proxy that `backhaulTo` uses (`edge.go:3398-3445`, `backhaulProxy` `:3589`).
+- Produces:
+ - `type ForwardOutcome int` with `ForwardNotInView`, `ForwardUnreachable`, `ForwardDone`.
+ - `type ForwardResult struct { Outcome ForwardOutcome; Holder string }`. `Holder` is the upstream's `X-Carlos-Holder` value when the upstream answered 503 with one ("" when absent; "none" passes through as "none").
+ - `func (e *Edge) ForwardHA(w http.ResponseWriter, r *http.Request, host, ref string) ForwardResult`:
+ - `HopVerified(r)` true: writes nothing, returns `ForwardNotInView` (the caller answers; the edge never forwards a hop).
+ - `boxInView(ref)` false: writes nothing, `ForwardNotInView`.
+ - Otherwise signs the hop for `host` and proxies to the dial address through the same admission (`backhaulAdmit`) and transport as `backhaulTo`, with a 2 s connect timeout. A connect failure writes 503, `Retry-After: 10`, "instance is waking elsewhere; retry shortly", marks the request answered (`MarkAnswered`), and returns `ForwardUnreachable`. Any upstream response is relayed as is and returns `ForwardDone` with `Holder` read in `ModifyResponse`.
+ - A missing mesh key: writes nothing, returns `ForwardNotInView` (as `backhaulTo` returns false today).
+
+- [ ] **Step 1: Write the failing tests** in `forwardha_test.go` with the two-edge scene (box "annie" forwards to box "betty", both region "ie", same placement):
+ - `TestForwardHAReachesTheHolder`: betty's activator answers 200 "betty-served"; annie's `ForwardHA(w, r, host, "betty")` returns `ForwardDone`; the client gets 200 and betty's body; betty saw a verified hop for `host`.
+ - `TestForwardHARefusesAHop`: a request already marked as a verified hop → `ForwardNotInView`, nothing written, no dial.
+ - `TestForwardHANotInView`: ref "carol" with no file → `ForwardNotInView`, nothing written.
+ - `TestForwardHADialFailureIs503RetryTen`: betty's file names a closed port → 503, `Retry-After: 10`, the body above, `ForwardUnreachable`, within 3 s.
+ - `TestForwardHAReadsHolderHeader`: betty answers 503 with `X-Carlos-Holder: carol` → client gets that 503; result `{ForwardDone, "carol"}`; with `X-Carlos-Holder: none` → `Holder "none"`.
+ - `TestForwardHAUpgradeSwitchesProtocols`: a WebSocket upgrade forwarded to betty gets 101 and echoes one message.
+- [ ] **Step 2: Run** `nice -n 19 go test ./internal/edge -run 'TestForwardHA' -count=1`. Expected: FAIL.
+- [ ] **Step 3: Implement** `forwardha.go`. Share code with `backhaulTo` rather than copying it: extract the common sign-admit-proxy part into one unexported helper that both call, with the error answer and response hook as parameters.
+- [ ] **Step 4: Run** the Step 2 command, then `nice -n 19 go test ./internal/edge -run 'Backhaul|Hop|Home' -count=1` (the existing backhaul tests still pass). Expected: PASS.
+- [ ] **Step 5: Commit** `region-ha p1b-2: the edge forwards an HA host's request to a named box`.
+
+### Task 3: The activator forwards HA hosts held elsewhere; the holder cache [own review]
+
+**Files:**
+- Create: `internal/activator/hacache.go` (the holder cache), `internal/activator/haforward.go` (the decision)
+- Modify: `internal/activator/activator.go` (`Service.serve` before `a.begin`, ~line 6018; `serveWakeError`'s `errLeaseHeld` case, ~line 6064)
+- Test: `internal/activator/haforward_test.go`
+
+**Interfaces:**
+- Consumes: `edge.ForwardHA`, `edge.ForwardResult`, `edge.HopVerified` (Tasks 1-2); `hafresh.ParseOwner`; `errLeaseHeld.holder` (the owner string, `activator.go:1168`).
+- Produces:
+ - `type Forwarder interface { ForwardHA(w http.ResponseWriter, r *http.Request, host, ref string) edge.ForwardResult }`.
+ - `func (a *Service) SetForwarder(f Forwarder)`. Nil: no forwarding (today).
+ - `type holderCache struct { /* mutex, map host -> {ref, at}, max 50000, ttl 1h, now func() time.Time */ }` with `get(host) (string, bool)`, `set(host, ref)`, `drop(host)`. At the cap, `set` evicts the oldest entry.
+ - **The decision, for an HA route (`rt.HA`) with a forwarder set:**
+ 1. Awake or waking here (the same live-entry check `begin` makes first): serve, as today.
+ 2. Not a verified hop and the cache names `ref`: `ForwardHA`. `ForwardDone`: done (apply `Holder`: a ref sets the entry, "none" drops it). `ForwardUnreachable`: drop the entry; done (the edge answered). `ForwardNotInView`: drop the entry, go to 3.
+ 3. `begin` (the HA acquire). Success: drop the entry, serve. `errLeaseHeld` whose owner parses as an HA box owner with a `Ref` other than this box's:
+ - not a hop: set the entry, `ForwardHA` as in 2; on `ForwardNotInView`, today's 503.
+ - a verified hop: 503, `Retry-After: 1`, `X-Carlos-Holder: <ref>`, the existing body.
+ 4. Any other error: today's answer; for a verified hop that is not served, add `X-Carlos-Holder: none`.
+ - This box's own reference is `lease.CurrentSelf().Ref` (what P1a's owner uses).
+
+- [ ] **Step 1: Write the failing tests** in `haforward_test.go` with a fake `Forwarder` recording calls and returning scripted results, and the existing HA lease fakes (as `hatakeover_test.go` sets up):
+ - `TestHAHeldElsewhereIsForwarded`: lock held by `box/v1;ref=b;iid=i-b;pid=7;ha=1`, unexpired; the request is forwarded once to "b"; no 503 written by the activator; the cache now names "b".
+ - `TestHolderCacheHitSkipsTheAcquire`: cache names "b"; the forward happens with zero lock reads (the fake store counts GETs).
+ - `TestHoppedRequestIsNeverForwarded`: the same lock, the request marked as a verified hop → no forward; 503, `Retry-After: 1`, `X-Carlos-Holder: b`.
+ - `TestHoppedRequestAcquiresAndServes`: a verified hop for a host with a clean release marker → acquired and served here.
+ - `TestHolderCacheDroppedOnUnreachable`: forwarder returns `ForwardUnreachable` → entry dropped; the next request runs the acquire.
+ - `TestHolderCacheFollowsHolderHeader`: forwarder returns `{ForwardDone, "c"}` → entry is "c"; `{ForwardDone, "none"}` → dropped.
+ - `TestLegacyHostNeverForwards`: a non-HA route held elsewhere → today's 503, forwarder not called.
+ - `TestHolderCacheBounds`: 50,001 sets keep 50,000 entries, the oldest evicted; an entry 61 minutes old reads as absent.
+ - `TestTakingTheLeaseDropsTheEntry`: cache names "b", the acquire succeeds (the lock was a marker) → served here, entry dropped.
+- [ ] **Step 2: Run** `nice -n 19 go test ./internal/activator -run 'TestHA.*Forward|TestHolderCache|TestHopped|TestLegacyHostNeverForwards|TestTakingTheLeaseDrops' -count=1`. Expected: FAIL.
+- [ ] **Step 3: Implement** `hacache.go`, `haforward.go`, `SetForwarder`, and the two insertion points. Replace the "mesh seam" comment at `activator.go:~6013` with one line pointing at `haforward.go`.
+- [ ] **Step 4: Run** the Step 2 command and `nice -n 19 go test ./internal/activator -run 'HA|SameBox|Takeover|Lease' -count=1`. Expected: PASS.
+- [ ] **Step 5: Commit** `region-ha p1b-2: the activator forwards HA hosts held elsewhere`.
+
+### Task 4: The agent wires the edge into the activator
+
+**Files:**
+- Modify: `internal/host/agent.go` (the `RunWithActivatorReady` ready callback, ~line 1025)
+- Test: the nearest existing agent-wiring test in `internal/host`
+
+**Interfaces:**
+- Consumes: `Service.SetForwarder` (Task 3); `*edge.Edge` satisfies `activator.Forwarder` (Task 2).
+
+- [ ] **Step 1: Write the failing test** `TestAgentWiresTheForwarder`: after the ready callback runs, the activator's forwarder is the edge (through whatever seam the existing wiring tests use).
+- [ ] **Step 2: Run** it. Expected: FAIL.
+- [ ] **Step 3: Implement** `svc.SetForwarder(e)` in the ready callback, on every box (it acts only for HA routes).
+- [ ] **Step 4: Run** it, then the three builds (`go build ./...`, `GOOS=darwin`, `GOOS=windows`) and the linux/arm64 size (ceiling 64,000,000). Expected: PASS.
+- [ ] **Step 5: Commit** `region-ha p1b-2: the agent wires the edge into the activator`.
+
+### Task 5: Dev drill. Needs Paul's go before anything touches dev.
+
+Release dev-only and roll as the README and the roll-order rule say. Log every step with UTC times.
+
+- [ ] **Step 1: Forward.** With `hapair-a1` awake on leo (wake it through leo), send 20 requests through sophie's address (`curl --resolve`). Expected: 20 × 200 with leo's `host=`; sophie's log shows one lock read at most (the first, a cache miss), then none.
+- [ ] **Step 2: Upgrade.** One WebSocket request through sophie, if the test app has an echo path; otherwise note it as covered by `TestForwardHAUpgradeSwitchesProtocols`.
+- [ ] **Step 3: Holder dies.** `systemctl kill -s KILL carlos-edge` on leo with probes through sophie every 2 s. Expected: 503 `Retry-After: 10` (not 502) while leo is down, then 200 again after leo's same-box re-take (P1a), with sophie forwarding to leo again.
+- [ ] **Step 4: Report** on amadan #421: request counts, the S3 reads on sophie, the outage window.
+
+## Census
+
+Agent-run changes only. Run `make census-card`, CLAIMS, `make census-propose`; a cross-model reviewer approves. If the record-write census (9B8) reports a changed digest, add a re-pin layer as `fresh_box_446_census_test.go` did.
+
+## Spec gaps and follow-ups
+
+- §6.3 placement (proven reuse, `ChooseRoomiest`) and the over-capacity alert: P1b-3.
+- §6.5's one retry by the first box: a later slice.
+- Roles, `booting`, the serving latch, the lifecycle hook and hairpin: P3.
+- **Cross-region requests** for an HA host backhaul to whichever box the fold elects as home (both boxes publish the host). If that box is not the holder, the backhauled request is a hop, so it gets 503 `Retry-After: 1` with `X-Carlos-Holder` (§6.4) and is not forwarded on. That is no worse than today's 503. Letting the far edge retry to the named holder, or feed its own holder cache, is the §6.5 slice.
diff --git a/docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B2-BRIEF-1.md b/docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B2-BRIEF-1.md
new file mode 100644
index 000000000..5c06ef225
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-PLAN-REGION-HA-P1B2-BRIEF-1.md
@@ -0,0 +1,41 @@
+# Review brief: Region HA P1b-2 plan (forwarding between boxes), round 1 of 3
+
+Repo carlos/platform, branch `region-ha-p1b2-forwarding`, the commit that adds this brief.
+Under review: `docs/superpowers/plans/2026-10-29-region-ha-p1b2-forwarding.md`.
+Authorities: `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (§6, §4.3; rulings N-HA8, N-HA9), P1a and P1b-1
+as merged on main, and the code on this branch. Do not review against unmerged branches.
+
+You are an independent reviewer. Read the plan, then the code it names, and check every claim against that code.
+
+## Fixed: do not re-argue
+
+- The slicing in the plan's "Scope" table (Paul, 2026-10-29: pick up region HA, small slices). Report only mechanisms in this slice that
+ fail, not the absence of deferred pieces, unless a deferred piece makes this slice unsafe.
+- N-HA9 and the lease rules from P1a/P1b-1 are unchanged by this slice.
+
+## What to check
+
+1. **Single writer and loops.** Can forwarding ever cause a second wake, a wake on a box that should not wake, or a forwarding loop?
+ Check the activator's decision order against `Service.serve`/`begin` (`internal/activator/activator.go` ~5943-6070), the edge's one-hop
+ rule (`internal/edge/homemap.go:58-63`, `edge.go:3375-3402`) and how a verified hop reaches the activator.
+2. **The view test.** Is `boxInView` sound given how `homeMap` folds files (`homemap.go:440-530`, `:783-800`) and the writer's
+ `generation` (`internal/edgesfile/snapshot.go:86`)? Can a box out of region, stale, or self be chosen?
+3. **The forward.** Does sharing `backhaulTo`'s sign/admit/proxy path (`edge.go:3398-3445`, `:3589-3636`) with a 2 s connect timeout,
+ a 503 `Retry-After: 10` on connect failure, and a `ModifyResponse` reading `X-Carlos-Holder` work without changing `backhaulTo`'s own
+ behaviour? WebSocket upgrades through it?
+4. **The holder cache.** Are its set/drop rules enough to stop a stale entry from black-holing a host? Is its bound and TTL right?
+5. **S3 budget.** Does a cache hit really skip the lock GET, and a miss cost at most today's one GET?
+6. **Tests and the drill.** Do the named tests prove the claims? Is Task 5 runnable on dev (pool `hapair` on leo and sophie)?
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review.
+- **P3**: clarity or polish. Follow-up list.
+
+A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3, each with the task, problem, evidence (file:line), failure scenario, fix and fault family. End with exactly one
+verdict: READY, READY AFTER FIXES, or NOT READY. Do not edit files, spawn subagents of your own, or run full suites.