carlos / platform Public

spec: edge page cache rev 2 after Astra round 1

Round 1 findings committed unedited. Clears fence publication, HA routes
refused in v1, marked pages never enter the LRU, one page predicate on
the asset policy, validated sequences, message rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 5421a0f0a605303a15460a973815547510a39740 parent 82e62c0
3 files changed, +571 −222
  • docs/superpowers/specs/2026-11-08-edge-page-cache-design.md +393 −222
  • docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md +73 −0
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md +105 −0
diff --git a/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
index 051d82933..80bb63cdc 100644
--- a/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
+++ b/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md
@@ -1,9 +1,11 @@
# Edge page cache: design
-Status: draft rev 1, 2026-11-08. Branch `design-edge-page-cache`.
+Status: draft rev 2, 2026-11-08. Branch `design-edge-page-cache`.
Builds on the edge asset cache (`2026-10-24-edge-asset-cache-design.md`,
merged and armed on dev and flagship) and on today's `Carlos-Purge`
channel (`internal/edge/purge_header.go`, `internal/edge/purge.go`).
+Review history is in §16. Marks like **(astra R1-3)** point at the finding
+a passage answers.
## 1. Why
@@ -35,6 +37,12 @@ could switch to this and drop its own workarounds (§13).
- On how fast a clear must reach a far reader: "Ideally low seconds if
not instant."
+**Words used here.** An *instance* is one deployed copy of an app, with
+its own record, route and hosts (what `carlos assets purge --app` walks
+over). The *home* is the box whose route table serves the instance
+directly. Clear state, leases and switches are all per instance
+**(astra R1 builder Q3)**.
+
## 2. What exists today
Facts the design leans on. File references are to `main` at 06bb3f7e.
@@ -43,14 +51,18 @@ Facts the design leans on. File references are to `main` at 06bb3f7e.
(`internal/edge/cache.go`). It holds 4096 entries of up to 1 MiB each,
and every lifetime is cut to `DefaultCacheMaxTTL`, 5 minutes
(`edge.go:82-88`). Five minutes is there because a purge only reaches
- the box that saw it, so a lost purge must heal itself quickly. A
- response is stored when it is 2xx with a positive `s-maxage` or
- `max-age`, has no `Set-Cookie`, and does not vary on `Cookie` or `*`
- (`maybeStore`, `edge.go:2879-2970`). The request's own `Cookie` header
- is not checked. The lookup sits after the plan throttle and before the
- rate limit and the activator (`edge.go:2673-2690`), so a hit never
- wakes the app. Far edges never use it: they backhaul before reaching
- it.
+ the box that saw it, so a lost purge must heal itself quickly.
+ - **What it stores:** a response that is 2xx with a positive
+ `s-maxage` or `max-age`, has no `Set-Cookie`, and does not vary on
+ `Cookie` or `*` (`maybeStore`, `edge.go:2879-2970`).
+ - **What it doesn't check:** the request's own `Cookie` header. It
+ allows a request with `Authorization` when the response says
+ `public`.
+ - **Where the lookup sits:** after the password gate
+ (`edge.go:2498-2505`) and the plan throttle, and before the rate
+ limit and the activator (`edge.go:2673-2690`). A hit never wakes the
+ app.
+ - **Far edges** never use it: they backhaul before reaching it.
- **The purge channel.**
- **Header.** The app sends `Carlos-Purge: <targets>` on any response:
- `*` clears the host;
@@ -64,25 +76,38 @@ Facts the design leans on. File references are to `main` at 06bb3f7e.
unit-backed (DynamicUser) instance has no socket (`purge.go:115-125`).
- **Reach.** Both channels act on the local LRU only. Nothing forwards
a purge to another box.
+ - **A known race.** A response in flight while a purge runs can
+ resurrect what the purge removed (`purge_header.go:266`).
- **The edge asset cache** keeps immutable, declared-prefix, non-HTML
- responses in a disk store (`internal/assetcache`): a budget, a per-app
- share, eviction, reserved fills and gzip at serve time. Far edges
- catch a declared path, ask the home for it with a signed fill
- (`X-Carlos-Asset-Fill`, HMAC under the mesh key, `assetfill.go`), and
- store only what the home acknowledges (`X-Carlos-Asset-Fill-Ack`).
- Purge is a per-instance generation in the key, written to the record,
- and reaches far edges through the 30-second home-map poll: "within a
- minute" (`homemap.go:124`, asset spec §6). HTML is refused
- (`assetadmit.go:95`).
+ responses in a disk store (`internal/assetcache`). The store has a
+ budget, a per-app share, eviction, reserved fills, and gzip at serve
+ time.
+ - **Fills.** Far edges catch a declared path and ask the home for it
+ with a signed fill (`X-Carlos-Asset-Fill`, HMAC under the mesh key).
+ They store only what the home acknowledges. The acknowledgement
+ MACs the original assertion (`assetfill.go:120`).
+ - **Which hosts may serve.** The home decides with one predicate,
+ `assetPolicy.decide` (`internal/host/assetpolicy.go:291-320`). It
+ refuses:
+ - a row that isn't ready, or is a sidecar;
+ - the record's opt-out;
+ - a password gate or an import gate;
+ - hostnames with path rows;
+ - a throttled or lapsed account.
+ - **Purge.** A per-instance generation in the key, written to the
+ record. It reaches far edges through the 30-second home-map poll,
+ "within a minute" (`homemap.go:124`, asset spec §6).
+ - **HTML is refused** (`assetadmit.go:95`).
- **Box-to-box push exists once:** probe-burst notices,
`POST /.carlos/burst-notice`, sealed with AES-GCM under an HKDF of the
- mesh key. They go over `backhaulTransport` with a bounded queue per
- peer, and a notice not sent within 10 s is dropped
- (`burst_notice.go`). Everything else between boxes is pulled from the
- bucket.
+ mesh key. Each one is receiver-bound and replay-checked, with bounded
+ reads and acceptance limits (`burst_notice.go:444-520`). Everything
+ else between boxes is pulled from the bucket.
- **Several boxes can serve one app.**
- - **Region HA:** a request that reaches a non-holder is forwarded to
- the lease holder before the cache (`forwardha.go`).
+ - **Region HA.** A request that reaches a non-holder is forwarded to
+ the holder before the cache, except for verified hops, door calls
+ and tunnel deliveries (`forwardha.go:175-180`). A hibernating
+ holder releases its serving lease (`activator.go:5253`).
- **Stateless replicas and managed fleets** use forward rows, which
the hub never caches (`edge.go:2663-2675`).
@@ -94,32 +119,47 @@ Facts the design leans on. File references are to `main` at 06bb3f7e.
- G2. A cached page lasts as long as the app's `Cache-Control` says, up
to a year. No 5-minute ceiling for opted-in pages.
- G3. Clear one page, a list of pages, one host, or every host of the
- app, from a response header, from the control socket, or from the CLI.
-- G4. Once a clear reaches the home box, no edge serves a page it covers
- more than L seconds later (§8, invariant I1). L is a few seconds. In
+ instance, from a response header, from the control socket, or from
+ the CLI.
+- G4. Once a clear reaches the home, no edge serves a page it covers
+ more than L seconds later (§8.4, invariant I1). L is a few seconds. In
the usual case the clear lands on every edge in well under a second.
- G5. Far boxes serve cached pages to readers near them, without waking
the app and without new S3 requests.
-- G6. Requests from signed-in readers (cookies or `Authorization`) never
- read from or write to the cache.
-- G7. A new release of the app clears its pages automatically.
+- G6. Requests with a cookie the app hasn't declared harmless, or with
+ `Authorization`, never read from or write to the page cache. A
+ response marked for the page cache never enters the LRU (§5.3).
+- G7. A new release of the instance clears its pages automatically.
**Non-goals (v1)**
-- Pages served through forward rows: stateless replicas, managed
- fleets and fleet public routes. The hub never caches these today, and
- this spec doesn't change that.
-- Variants other than `Accept-Encoding` (geo country, language
- headers). A response with any other `Vary` is not stored.
-- Caching statuses other than 200: no 404s and no redirects.
-- Giving unit-backed instances a control socket. Today they can clear
+- **Region HA routes** (`route.HA`): refused up front, so their pages
+ are never page-cached **(astra R1-2)**. The serving authority moves
+ between members, and a hibernating holder gives up its lease, so no
+ box can vouch for an entry while the app sleeps. HA apps keep today's
+ LRU. A follow-up can tie page authority to the HA lease once there is
+ a use for it.
+- **Forward rows:** stateless replicas, managed fleets and fleet public
+ routes. The hub never caches these today, and this spec doesn't change
+ that.
+- **Hosts the asset policy refuses** (§2): password gates, import
+ gates, path-routed hostnames, sidecars, and throttled or lapsed
+ accounts **(astra R1-4)**.
+- **Variants** other than `Accept-Encoding`: no geo country, no
+ language headers. A response with any other `Vary` is not stored.
+- **Statuses** other than 200: no 404s and no redirects.
+- **A control socket for unit-backed instances.** Today they can clear
only from a response header (§4.4).
-- Clearing the copies browsers keep. The edge can't reach them; §4.2
- tells apps what to send.
-- Static sites (`kind:static`) and the asset cache keep their own rules.
+- **Browser copies.** The edge can't clear them; §4.2 tells apps what to
+ send.
+- **Static sites and the asset cache** keep their own rules.
+- **The LRU's cookie gap** (§2) is older than this feature, and this
+ design doesn't change unmarked responses. It goes on a follow-up
+ discussion for the LRU's own owner.
**Anti-goals** (failures even if everything else works)
- A reader sees a page drawn for someone else: a signed-in view, a paid
- member's view, or another account's page.
+ member's view, a page behind a password gate, or another account's
+ page.
- An author publishes, a reader reloads a few seconds later and sees the
old homepage, and nothing will ever fix it short of a manual clear.
- The edge keeps serving copies it can't vouch for while the home is
@@ -145,9 +185,13 @@ Cache-Control: public, s-maxage=31536000, max-age=0
- **Lifetime.** `s-maxage`, else `max-age`. It must be positive and is
capped at 365 days. `private`, `no-store` and `no-cache` refuse.
- **Ignorable cookies.** An optional parameter names cookies that don't
- change the page, such as a consent cookie:
- `Carlos-Page-Cache: on; ignore-cookies="consent"`. A request whose
- cookies are all on that list still counts as anonymous (§5.1).
+ change this page, such as a consent cookie:
+ `Carlos-Page-Cache: on; ignore-cookies="consent"`.
+ - **Scope:** the list belongs to the stored entry only. It is not a
+ host-wide policy, and no box learns or carries it from one entry to
+ another **(astra R1 builder Q2)**.
+ - **Effect:** it lets a request carrying only those cookies *hit*
+ that entry (§5.1).
- **Exact syntax.** The plan settles the syntax, with copy review. The
two parts, the marker and an ignore list, are fixed.
@@ -176,20 +220,20 @@ on repeat views.
- **Targets** keep today's meaning: `*` for the host, a path for every
query under it, `path?query` for one URL. `Carlos-Purge-Host` keeps
today's rules.
-- **New: an app-wide clear.** One target clears every host the app
- serves on that box: its own host, aliases and custom domains. Today
- the socket's `*` can't reach aliases (`purge.go:38-41`). The plan
- names the token and the socket field. A bare word is unambiguous
- because path targets must start with `/`.
+- **New: an instance-wide clear.** One target clears every host the
+ instance serves: its own host, aliases and custom domains. Today the
+ socket's `*` can't reach aliases (`purge.go:38-41`). The plan names
+ the token and the socket field. A bare word is unambiguous because
+ path targets must start with `/`.
- **Channels:** the response header, the control socket, and a CLI and
- console door (`carlos pages clear --app shop [--path /p]`, name to
- copy review). The CLI is for operators and agents working from
- outside the app.
-- **What a clear touches:** on the home box, it clears the page store
- and the LRU (as today), then reaches far boxes (§8). A clear that
- arrives on a response applies before that response is considered for
- storing, as today.
-- **What doesn't change:** the LRU's behaviour for unmarked responses.
+ console door. The CLI is
+ `carlos pages clear --app shop [--instance …] [--path /p]`, with names
+ to copy review, for operators and agents working from outside the
+ app.
+- **What a clear touches:** on the home it clears the page store and the
+ LRU (as today), then reaches far boxes (§8). A clear that arrives on a
+ response applies before that response is considered for storing, as
+ today.
### 4.4 What the app must still do
@@ -202,32 +246,44 @@ approval all arrive as admin POSTs whose responses can carry the clear.
## 5. What is kept, and when
-### 5.1 Which requests may use the cache
+### 5.1 Which requests may use the page cache
+
+**Host eligibility.** The host must pass the page predicate, which is the
+asset policy's host predicate (`assetPolicy.decide`) with two changes:
+- the page switch replaces the assets opt-out and generation;
+- it adds: the route is not HA and not a forward row.
-A request may read from or be stored into the page cache only when all
-of these hold:
+The home evaluates the predicate:
+- for every home hit;
+- for every fill it acknowledges;
+- for every host it lists in a lease answer.
+So a policy change takes effect on the home at once, and on far boxes at
+their next renewal **(astra R1-4)**.
+
+**Request eligibility.** A request may read from the page store only when
+all of these hold:
- it is GET or HEAD, with no `Range`, not an upgrade, not a door call;
- it is not a request held for a stream (`carlos_hold`, as the LRU
already excludes);
-- the route is an instance route: not `static`, not `status`, not a
- forward row, no import gate;
- it carries no `Authorization` header;
- it carries no `Cookie` header, or every cookie name in it is on the
- ignore list the app declared for that host (§4.1);
+ ignore list of the entry it would hit;
- the path is canonical (the asset cache's rule; anything else is
`bypass`).
+A request may be *stored* (or fill) only when it carries no `Cookie` and
+no `Authorization` at all. A request with ignorable cookies can hit an
+entry, but never creates one.
+
A HEAD is answered from a stored GET and is never stored itself.
-Everything else is a bypass: forwarded as today, never stored.
### 5.2 Which responses are kept
-A response is kept only when all of these hold:
-
+A response goes into the page store only when all of these hold:
- the response carries the marker;
- the status is 200;
-- the request was eligible (§5.1);
+- the request was storable (§5.1);
- there is no `Set-Cookie`, as a header or as a trailer;
- the lifetime is valid (§4.1);
- `Vary` is absent or exactly `Accept-Encoding`;
@@ -241,18 +297,31 @@ Pages are stored identity-encoded and compressed at serve time, as
assets are. The stored headers follow the asset cache's list. The
`Carlos-*` control headers are never stored or replayed.
-### 5.3 The key and the entry
+### 5.3 The two caches never mix (astra R1-3)
+
+- A response that carries the marker never enters the LRU, whether or
+ not the page store kept it, and whatever the request carried. A
+ marked response the page store refused is simply not cached.
+- The page store is looked up before the LRU. A request the page store
+ bypasses still reaches the LRU, which keeps today's rules for
+ unmarked responses.
+- An instance whose page switch is on gets one more rule (my call): the
+ LRU neither stores nor serves for a request that carries `Cookie` or
+ `Authorization`. That closes the cookie gap from §2 for every app
+ that opts in, without changing apps that don't.
+
+### 5.4 The key and the entry
-- **Key:** account, app, host, path and raw query exactly as sent. No
- query normalisation in v1.
+- **Key:** account, app, instance, host, path and raw query exactly as
+ sent. No query normalisation in v1.
- **Each entry also records:**
- - the serving home box and that box's clear epoch (§8);
- - the clear sequence at the time the page was rendered;
+ - the home box and its clear epoch for the instance (§8);
+ - the clear sequence the entry is valid at (§6);
- the absolute expiry;
- the ignore list;
- the `ETag`, if any.
-### 5.4 Where it lives
+### 5.5 Where it lives
Pages live in the asset cache's disk store (`internal/assetcache`). They
use the same budget, and each app's share covers its assets and its
@@ -263,121 +332,159 @@ instance whose page switch is on (§10).
## 6. Serving on the home box
-At the point where the LRU lookup happens today (after the plan throttle,
-before the rate limit and the activator), an eligible request is looked
-up in the page store first.
-
-- **A hit** is a live entry whose epoch is this box's current epoch for
- the app. It is served with `Carlos-Cache: hit`.
-- **A miss** goes to the app as today. A response kept under §5.2 is
- stored in the page store, not the LRU.
-- **Storing races a clear.** Note the app's clear sequence when the
- request starts. Store the response only if no clear for the app
- happened before the response arrived. That check is coarse, but it
- can't keep a page rendered before a clear (Tito's page cache uses the
- same idea).
-- **Single-flight per key** (my call). A render that isn't kept (a 500,
- a redirect, a response without the marker) sends its waiters to the
+At the point where the LRU lookup happens today (after the password gate
+and the plan throttle, before the rate limit and the activator), an
+eligible request is looked up in the page store first.
+
+**A hit** is a live entry whose epoch is this box's current epoch for the
+instance, on a host the page predicate allows right now. It is served
+with `Carlos-Cache: hit`.
+
+A miss goes to the app as today.
+
+**Clears fence publication (astra R1-1).** Clearing and publishing take
+the same per-instance lock:
+- **Clearing:** under the lock, the box increments the sequence,
+ records the clear in its log, removes the matching entries and
+ rejects matching pending fills.
+- **Publishing:** writing the file happens outside the lock. Indexing
+ it, the step that makes it servable, happens under the lock, and only
+ if no clear since the render started matches the entry's key. A
+ matching clear means the file is discarded and nothing is indexed.
+ The store's existing compress, sync and rename steps
+ (`assetcache/fill.go:474`) all sit before that check.
+- **Validity:** an entry indexed this way is valid at the sequence
+ current when it was indexed. An entry still present later is valid at
+ every later sequence, because any clear that matched it would have
+ removed it under the same lock.
+
+**Single-flight per key** (my call):
+- **Who may join:** a request may join a render only if no clear
+ matching the key has happened since that render started. Later
+ requests start a new render.
+- **When nothing is kept:** a render that isn't kept (a 500, a
+ redirect, no marker, or a clear fenced it) sends its waiters to the
app for themselves, never an error or an empty body.
+**Losing authority.** When the instance's route leaves this box, or the
+page switch turns off, the box ends the epoch and drops the instance's
+entries **(astra R1-2)**. When the route arrives again, a new epoch
+starts with nothing in it.
+
## 7. Serving on far boxes
A far box today backhauls every request for a host homed elsewhere. With
page caching armed on the far box and the request eligible:
-1. **A hit:** the far box has a live entry for the key, a valid lease
- for that home and app (§8), the home is still the home map's dial
- target for the host, and the host is in the lease's host set. It
- serves the entry with `Carlos-Cache: hit`. Neither the home nor the
- app is contacted, except for a background lease renewal (§8.3).
-2. **Otherwise it fills:** the far box sends the request to the home as
- a signed page fill. This is a normal signed hop plus an assertion,
- modelled on `X-Carlos-Asset-Fill`, in its own MAC domain
- (`carlos-page-fill-v1`). The assertion binds the host, path and
- query, the account, the app and the far box's lease epoch. The home
- runs its ordinary pipeline: page store, throttle, wake, app.
-3. **The home's acknowledgement.** If the response is kept under §5.2,
- the home stores it and answers with a signed acknowledgement in its
- own domain. The acknowledgement carries the expiry, the epoch, the
- sequence at render, the ignore list and the account and app from the
- home's own route table, not from the far box's claim.
-4. **What the far box stores.** It stores the response only if the
- acknowledgement's epoch and sequence equal its lease's current ones.
- Otherwise it serves the response once and doesn't store it. Account
- and app come from the acknowledgement.
-5. **Cookies on a fill.** The far box learns each host's ignore list
- from the acknowledgements, and keeps it in bounded memory. A request
- carrying only ignorable cookies may fill, with those cookies passed
- to the app unchanged, because the app declared they don't change the
- page. Until the far box knows a host's list, any cookie means a plain
- backhaul.
-
-Fill limits (waiters, deadlines, concurrency per box and per app) follow
-the asset cache's. Fills the home acknowledged are unbilled at the home,
-and the delivering edge meters them, as for assets.
+1. **A hit.** The far box serves the entry with `Carlos-Cache: hit` when
+ all of these hold:
+ - it has a live entry for the key;
+ - its lease for that home and instance is valid (§8);
+ - the home is still the home map's dial target for the host;
+ - the host is in the lease's host list;
+ - the home map's account and app for the host match the entry's.
+
+ Neither the home nor the app is contacted, except for a background
+ lease renewal (§8.3).
+2. **A fill.** Otherwise, if the request is storable (no cookies, no
+ `Authorization`), the far box sends it to the home as a signed page
+ fill. This is a normal signed hop plus an assertion, modelled on
+ `X-Carlos-Asset-Fill`, in its own MAC domain (`carlos-page-fill-v1`).
+ The assertion binds:
+ - the host, path and query;
+ - the account, app and instance;
+ - the far box's lease epoch;
+ - a nonce.
+
+ The home runs its ordinary pipeline: the predicate, the page store,
+ the throttle, the wake and the app. A request with cookies goes as a
+ plain backhaul.
+3. **The home's acknowledgement.** The home acknowledges only an entry
+ it holds valid under the §6 lock: a fresh render it just indexed, or
+ a retained entry it still holds. The acknowledgement is signed in its
+ own domain and MACs the assertion, as asset acks do. It carries:
+ - the expiry and the epoch;
+ - the **validated sequence**: the home's sequence when it read the
+ entry under the lock;
+ - the ignore list;
+ - the account, app and instance from the home's own route table, not
+ from the far box's claim.
+4. **What the far box stores (astra R1-5).** Let `a` be the
+ acknowledgement's validated sequence and `f` the sequence the far
+ box's lease has applied, on the same epoch:
+ - **`a == f`:** store.
+ - **`a < f`:** store only if no clear in `(a, f]`, from the far box's
+ own copy of recent clears, matches the key.
+ - **`a > f`:** serve this response once, don't store it, and renew the
+ lease in the background.
+ - **A different epoch:** serve once, don't store.
+
+ Account, app and instance come from the acknowledgement.
+
+Fill limits (waiters, deadlines, concurrency per box and per instance)
+follow the asset cache's. Fills the home acknowledged are unbilled at the
+home, and the delivering edge meters them, as for assets.
## 8. Clearing across boxes
### 8.1 Epoch and sequence
-For each app it serves as home, a box keeps a clear epoch and a clear
-sequence.
+For each instance it serves as home, a box keeps a clear epoch and a
+clear sequence.
- **Epoch:** a random 64-bit value, drawn when the box starts serving
- the app's route (process start, route arrival, or taking the HA
- lease).
+ the instance's route (process start or route arrival).
- **Sequence:** starts at 0 and goes up by one for every clear of that
- app, whatever its target.
-- **Clear log:** the box keeps a bounded log of recent clears per app:
- the sequence, the hosts and the targets. The size is the builder's
- call. Something like the last 256 clears or 10 minutes, whichever
- holds less.
-- **Starting a new epoch:** the box drops its own page entries for that
- app. A box that wasn't serving the app can't know which clears it
- missed.
+ instance, whatever its target.
+- **Clear log:** a bounded log of recent clears: the sequence, the
+ hosts and the targets. The size is the builder's call. Something like
+ the last 256 clears or 10 minutes, whichever holds less.
+- **Far boxes** keep the same bounded log per (home, instance) for what
+ they've applied (§7 step 4).
+- **Starting a new epoch:** the box holds no entries for the instance
+ (§6, losing authority).
### 8.2 Push
-After applying a clear locally, the home pushes it to every far box that
-holds, or recently held, a lease for that app: renewed within L plus a
-small margin. The push is modelled on burst notices:
-
+After applying a clear locally, the home pushes it to every far box with
+a live or recent lease for the instance, renewed within L plus a small
+margin. The push is modelled on burst notices:
- `POST /.carlos/page-clear` over `backhaulTransport`;
- sealed and signed under an HKDF of the mesh key in its own domain;
- a bounded queue per peer;
- dropped if not sent within about 2 s. The lease covers a lost push.
-The body carries the account, the app, the home box, the epoch, the
-sequence, and the hosts and targets.
+The body carries the destination box, the account, app and instance, the
+home box, the epoch, the sequence, and the hosts and targets.
**On the far box:**
- **Next in order** (the next sequence on the same epoch): apply it.
-- **Any gap or a different epoch:** stop serving hits for that home and
- app until a lease renewal resolves it.
+- **Already applied:** ignore it. A replay is a no-op.
+- **A gap or a different epoch:** stop serving hits for that home and
+ instance until a lease renewal resolves it.
### 8.3 Leases
-A far box may serve a hit for (home box, app) only while it holds a
-lease. A lease is the home's answer to a signed renewal:
-`GET /.carlos/page-lease` on a hop, door-style.
+A far box may serve a hit for (home, instance) only while it holds a
+lease. A lease is the home's answer to a signed renewal,
+`GET /.carlos/page-lease`, sent on a hop, door-style.
**The answer carries:**
- the epoch and the sequence;
- the clears after the far box's sequence, when the log still covers
them, or "reset" when it doesn't;
-- the hosts the app serves on that box;
-- whether page serving is allowed for the app.
-
-Allowed is false when the instance's switch is off, the host is lapsed
-or throttled (the asset cache's parity rule), or the box no longer
-serves the app.
+- the hosts of the instance that pass the page predicate right now. An
+ instance with none is "not allowed".
**How the far box applies it:**
- a different epoch or "reset" drops every entry it holds for that home
- and app;
-- otherwise it applies the missing clears.
+ and instance;
+- otherwise it applies the missing clears;
+- a host missing from the list drops that host's entries.
**The lease lasts L seconds,** measured on the far box's monotonic clock
-from when it **sent** the renewal, not when the answer arrived.
+from when it **sent** the renewal, not when the answer arrived. It accepts
+only an answer that matches its one outstanding renewal for that home
+and instance (§8.5).
- **Default:** L = 5 s (my call). The builder may tune it between 2 and
10, and the plan states the number.
- **Renewing:** a hit that finds the lease expired waits on a
@@ -385,12 +492,13 @@ from when it **sent** the renewal, not when the answer arrived.
renewal fails, the request goes as a plain backhaul and nothing is
served from the cache. A hit that finds less than half the lease left
renews in the background.
-- **Cost:** about one renewal per far box per app every L/2 seconds
+- **Cost:** about one renewal per far box per instance every L/2 seconds
while readers are arriving, and nothing when the box is quiet. All of
it is box-to-box, with no S3 requests. The app is never woken for a
renewal.
-- **Push targets:** the home records which far boxes renewed recently.
- That record is the push list for §8.2.
+- **Push targets:** the home records which far boxes renewed recently,
+ in a table bounded by the boxes in the mesh. That record is the push
+ list for §8.2.
### 8.4 The bound
@@ -398,55 +506,81 @@ from when it **sent** the renewal, not when the answer arrived.
serves a page it covers after t + L. In-flight responses already being
written are the only exception.
-- **Why it holds:** any lease the far box sent before t either includes
- the clear (the home answered after t), or expires by
- `sent + L < t + L`. Any lease sent after t includes the clear.
-- **What the push adds:** it makes the usual case far faster. The bound
- doesn't depend on it.
-- **The home's own store:** it applies the clear synchronously, before
- the clear is acknowledged to the app (header or socket).
-
-### 8.5 A new release
-
-When the app's build or its delivered configuration changes on the home,
-the home performs an app-wide clear as part of switching to the new
-route. The plan names the exact signal; the config receipts work (#522)
-may already provide one. A hibernation wake is not a change, and must
-not clear.
+**Why it holds:**
+- **On the home:** the clear and publication share a lock (§6), so no
+ entry it covers is servable there after t.
+- **On a far box:** any renewal sent before t either was answered after
+ t, and so carries the clear, or expires by `sent + L < t + L`. Any
+ renewal sent after t carries the clear.
+- **Fills:** a far box stores a fill only when its sequences show the
+ clear can't apply (§7 step 4).
+- **The push** makes the usual case far faster. The bound doesn't depend
+ on it.
+
+### 8.5 Message rules (astra R1-6)
+
+Every new message inherits the asset fill's and burst notice's
+protections and adds these:
+
+- **Fill acknowledgement:** MACs the whole assertion (including its
+ nonce), as `assetfill.go:120` does, so it authorizes storing exactly
+ the URL the far box asked for.
+- **Lease renewal:** carries the sender box, the home box, the account,
+ app and instance, a fresh nonce and a timestamp. The answer is MACed
+ over the request and its nonce.
+ - The far box keeps at most one outstanding renewal per (home,
+ instance), and accepts only the answer to it.
+ - The lease runs from that request's send time. An old answer, or one
+ for another box, is refused.
+- **Clear push:** receiver-bound (it names the destination box), and
+ ordered by (epoch, sequence), which makes replays no-ops.
+- **Receivers:** bound body size, reading time and acceptance rate, as
+ burst notices do.
+- **Home state:** the lease-holder table and the far boxes' clear logs
+ are bounded by mesh membership, the number of instances and the log
+ size.
+- **Numbers:** left to the builder.
+
+### 8.6 A new release
+
+When the instance's build or its delivered configuration changes on the
+home, the home performs an instance-wide clear as part of switching to
+the new route. The plan names the exact signal; the config receipts work
+(#522) may already provide one. A hibernation wake is not a change, and
+must not clear.
## 9. More than one box serving the app
-- **Region HA.** Only the lease holder renders and serves the app, and
- other members forward to it before the cache. The holder is the home
- for page purposes. When the holder changes:
- - the new holder starts a new epoch and drops any page entries it
- kept from an earlier term;
- - far boxes see a different home in the home map, or get "no longer
- serving" from the old one, so their old entries stop being served
- and age out.
-- **Moves.** Same as an HA holder change: new box, new epoch.
+- **Region HA:** out of v1 (§3). The page predicate refuses HA routes,
+ so neither home hits nor leases exist for them.
+- **Moves:** the old home's route leaves, so its epoch ends and its
+ entries go (§6). Its lease answers stop listing the hosts, and far
+ boxes drop them. The new home starts a new epoch. A plain backhaul
+ that still reaches the old box finds no entry to serve, because the
+ entries are gone.
- **Forward rows** (stateless replicas, fleets) are not cached (§3).
## 10. Switches, tenancy and metering
- **Box arming.** `CARLOS_PAGE_CACHE=1` in host.env, armed home first,
then far boxes, as for assets. A box that isn't armed treats the
- marker as absent and strips it.
+ marker as absent and strips it (§5.3 still applies: a marked response
+ never enters the LRU).
- **Instance switch.** An off switch on the instance record, the asset
- cache's R1 parity (`carlos pages off|on --app`, names to copy review).
- Off means:
- - the home drops the app's page entries and starts a new epoch;
- - every lease answer says not allowed.
- It is the operator's tool when an app caches something it shouldn't.
-- **Tenancy.** Entries are keyed by the account and app from the home's
- route table. A far hit also needs the home map's current account and
- app for the host to match the entry's. No field the far box asserts
+ cache's R1 parity (`carlos pages off|on`, names to copy review). Off
+ means:
+ - the home ends the epoch and drops the instance's entries (§6);
+ - lease answers list no hosts.
+ It is per instance: other instances of the same app keep theirs. It is
+ the operator's tool when an app caches something it shouldn't.
+- **Tenancy.** Entries are keyed by the account, app and instance from
+ the home's route table. A far hit also needs the home map's current
+ account and app for the host to match. No field the far box asserts
is trusted for ownership.
-- **Plan throttle, lapse and protection.**
- - Home hits come after the plan throttle, as LRU hits do today.
- - Far hits stop when the lease says not allowed.
- - Far hits pass the far edge's request protection the same way asset
- hits do. The builder confirms the order.
+- **Plan throttle, lapse, password gate.** These are part of the page
+ predicate (§5.1). Home hits come after the gate and the throttle, as
+ LRU hits do today. Far hits pass the far edge's request protection
+ the same way asset hits do; the builder confirms the order.
- **Metering.** Page bytes count as usage like any response (asset
cache ruling R2). The delivering edge meters hits. Whatever the edge
records for a request (usage, analytics, logs), it records for a page
@@ -454,9 +588,9 @@ not clear.
builder checks that edge analytics count hits.
- **Visibility.** `Carlos-Cache: hit|miss|bypass` on every eligible
response, using the asset cache's header and words. A
- `carlos pages status --app` shows, per home box:
+ `carlos pages status --app` shows, per instance:
- armed or not;
- - the instance switch;
+ - the switch;
- the entry count and bytes;
- the epoch and sequence.
Its contents are the builder's call, and its copy goes to review.
@@ -466,15 +600,16 @@ not clear.
Each slice changes something Paul can see (stopping rule 6).
1. **Home box.**
- - **Built:** the marker, the page store on the home, the clear epoch
- and sequence, the app-wide clear, clear on a new release, the
- instance switch and `Carlos-Cache` on pages.
+ - **Built:** the marker, the page predicate, the page store on the
+ home with the clear lock, the epoch and sequence, the
+ instance-wide clear, clear on a new release, the instance switch,
+ the §5.3 rules and `Carlos-Cache` on pages.
- **Rollout:** armed on dev.
- **Patrix:** sends the header (in its own repo), and repeat views
are served without waking it.
2. **Far boxes.**
- - **Built:** page fills, leases, push and catch-up, plus the
- randomized simulation (§12).
+ - **Built:** page fills, leases, push and catch-up, the message rules,
+ and the randomized simulation (§12).
- **Rollout:** armed on dev far boxes.
- **Check:** a reader through a far box gets hits, and a clear lands
there within L.
@@ -484,28 +619,37 @@ Each slice changes something Paul can see (stopping rule 6).
## 12. How we know it works
-- **A randomized simulation** of homes, far boxes, clears, renewals and
- pushes, with lost, delayed and reordered pushes, box restarts, holder
- changes and clock skew between boxes. It checks:
+- **A randomized simulation** of homes, far boxes, clears, renders,
+ fills, renewals and pushes. It runs with lost, delayed, duplicated
+ and reordered pushes, renders that straddle clears, box restarts,
+ moves, switch and predicate flips, and clock skew between boxes. It
+ checks:
- **I1:** nothing covered by a clear is served after t + L;
- - **I2:** nothing stored from a request that carried a cookie that
- wasn't ignorable, or an `Authorization` header, is ever served;
- - **I3:** a hit is never served under a different account, app or
- host than the one the home stored it for.
+ - **I2:** nothing stored from a request that carried a cookie or an
+ `Authorization` header is ever served, by either cache, for an
+ instance with the switch on;
+ - **I3:** a hit is never served under a different account, app,
+ instance or host than the home stored it for, nor for a host the
+ predicate refuses at the last renewal.
This follows the rule to check invariants with simulations rather than
fix examples one at a time.
- **An end-to-end test through the real edge wiring:**
- fill, hit, clear and miss on home and far;
+ - a render that straddles a clear is never indexed;
- HEAD from a stored GET;
- a 500 never stored;
- - a signed-in request never served from or stored into the cache;
+ - a cookie-bearing request never served from or stored into either
+ cache;
+ - enabling a password gate stops far hits by the next renewal;
- a clear on the response that carried it;
- a new release clearing.
- **Fences** (each watched failing under its own mutation):
- a page without the marker still goes to the LRU with the 5-minute
ceiling;
+ - a marked response never enters the LRU;
- the marker and the internal headers never reach a visitor;
- - a far box with an expired lease forwards.
+ - a far box with an expired lease forwards;
+ - an HA route is never page-cached.
## 13. Reference: what an existing app learned
@@ -531,7 +675,7 @@ takes:
- **Pages that change on a schedule** expire at the next scheduled
change. Hence §4.2.
- **Racing stores** use per-scope clear sequences to refuse stores that
- started before a clear. Hence §6 and §7 step 4.
+ started before a clear. Hence §6.
- **HEAD and failed renders:** a HEAD is never stored, and a failed
render never hands its waiters an error. Hence §6.
@@ -543,28 +687,55 @@ existing purge calls.
These are mine, not Paul's. They are listed so they can be checked.
- An explicit marker header rather than reading `s-maxage` alone (§4.1).
-- Any cookie bypasses unless the app declares it ignorable; the ignore
- list rides the marker (§4.1, §5.1).
-- 200 only; `Vary` only `Accept-Encoding`; an 8 MiB body cap (§5.2).
-- Pages share the asset store and each app's share (§5.4).
-- The lease (L = 5 s, measured from send) is what guarantees the bound;
+- **Cookies:** any cookie bypasses unless the entry declares it
+ ignorable. The list belongs to each entry, and only cookieless
+ requests create entries (§4.1, §5.1).
+- **Responses:** 200 only; `Vary` only `Accept-Encoding`; an 8 MiB body
+ cap (§5.2).
+- **LRU:** a marked response never enters it. For opted-in instances,
+ it also skips cookie and `Authorization` requests (§5.3).
+- **Storage:** pages share the asset store and each app's share (§5.5).
+- **Leases:** L = 5 s, measured from send, is what guarantees the bound;
the push only makes the usual case fast. The far box fails closed
when the home is unreachable (§8).
-- Clears are a per-home epoch and sequence with a bounded log, not a
- generation in the record. The record route takes a 30 s poll, too
- slow for G4 (§8.1).
-- A new release clears the app's pages; a wake does not (§8.5).
-- Forward rows, other variants, non-200 statuses, and a socket for
- unit instances are out of v1 (§3).
-- An `If-None-Match` hit answers 304 (§4.2).
+- **Clear state:** a per-home, per-instance epoch and sequence with a
+ bounded log, not a generation in the record. The record route takes a
+ 30 s poll, too slow for G4 (§8.1).
+- **Releases:** a new release clears the instance's pages; a wake does
+ not (§8.6).
+- **Region HA routes** are refused in v1 (§3, §9).
+- **Also out of v1:** forward rows, other variants, non-200 statuses,
+ and a socket for unit instances (§3).
+- **Conditional requests:** an `If-None-Match` hit answers 304 (§4.2).
## 15. Left to the builder
- Exact header, token, socket-field and CLI names, through copy review.
-- The clear log's size, the push margin, and L within 2-10 s.
+- The clear log's size, the push margin, the message limits, and L
+ within 2-10 s.
- Eviction order between pages and assets inside an app's share.
- How the console reaches the home box for a CLI clear: a door call is
preferred. Whatever the route, the clear must reach the box within
seconds.
-- The signal for "new release" (§8.5).
+- The signal for "new release" (§8.6).
- The contents of `carlos pages status`.
+
+## 16. Review history
+
+**Round 1** (Astra, `CODEX-FINDINGS-PAGE-CACHE-R1.md`, rev 1 at 82e62c09).
+NOT READY: four P1s and two P2s, each in a different fault family. All
+were accepted:
+
+| Finding | Fault family | Resolution |
+|---|---|---|
+| **R1-1 (P1)** | I1, a clear must fence pending publications | §6: clears and publications share a per-instance lock, and joining a render after a clear is refused |
+| **R1-2 (P1)** | I1, cached responses must not bypass ownership | §3, §9: HA routes refused in v1. §6: a home that loses the route or the switch ends the epoch |
+| **R1-3 (P1)** | I2, no second shared-cache path | §5.3: marked responses never enter the LRU, and opted-in instances' LRU skips cookie and `Authorization` requests |
+| **R1-4 (P1)** | Access control on far hits | §5.1: one page predicate built on the asset policy's, checked for home hits, acknowledgements and every lease answer |
+| **R1-5 (P2)** | Refilling unaffected entries | §7 step 4: the validated sequence, plus the far box's own clear log |
+| **R1-6 (P2)** | Mesh trust | §8.5 |
+
+**Builder questions:**
+- **Q1 (HA while sleeping):** settled by refusing HA routes in v1.
+- **Q2 (cookie list scope):** settled as per entry, with no learning.
+- **Q3 (switch scope):** settled as per instance throughout.
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md
new file mode 100644
index 000000000..4d6f26d3d
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-PAGE-CACHE-R1.md
@@ -0,0 +1,73 @@
+Reviewed commit `82e62c099a7715f76bd4e8bd24cb62eda717307f`, round 1 of 3, against the merged authorities. No files changed, subagents spawned, or tests run.
+
+1. **P1 — §6: the clear fence ends before publication.**
+
+ **Problem and evidence:** The design checks whether a clear happened before the response arrived, then permits storage ([design:274](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:274)). Arrival and publication are separate: the existing disk store compresses, syncs and renames files before indexing the entry ([fill.go:474](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/assetcache/fill.go:474)). The existing purge code explicitly documents this resurrection race ([purge_header.go:266](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/purge_header.go:266)).
+
+ **Failure scenario:** A response arrives at sequence 0 and passes the check. A clear increments the sequence to 1 and removes existing entries. The pending response then commits. Its epoch still matches, so §6 permits subsequent home hits, potentially for a year.
+
+ **Fix:** Make publication conditional on the captured epoch and sequence still being current, atomically with respect to clearing. Include single-flight waiter delivery in the same validity rules. Checking immediately before an independently synchronized `Commit` is insufficient.
+
+ **Fault family:** I1 — a clear must fence pending publications.
+
+2. **P1 — §§2, 6, 8.3 and 9: an old HA holder can answer the fallback from its cache.**
+
+ **Problem and evidence:** The design assumes non-holders forward before caching, but verified hops and door calls explicitly bypass `frontForwardHA` ([forwardha.go:175](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/forwardha.go:175)). The proposed home-hit predicate checks expiry and epoch, without checking current serving authority ([design:270](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:270)). Starting a new epoch is specified on acquisition, not on losing authority.
+
+ **Failure scenario:** A retains a page after B becomes holder. B clears the page. A far edge still routes to A; its page lease expires or is refused, so §8.3 sends a plain backhaul. That verified hop bypasses HA forwarding at A and reaches A’s page hit before the activator. A returns the old page after B’s clear plus L.
+
+ **Fix:** Require current serving authority for every home hit, fill acknowledgement and lease grant, including ordinary backhaul and door paths. Retire the old authority’s cache eligibility when ownership ends. Specify how this works while the app sleeps, without introducing bucket polling.
+
+ **Fault family:** I1 — cached responses must not bypass ownership fencing.
+
+3. **P1 — §§4.1, 5.1 and 6: the privacy guarantee does not close the LRU path.**
+
+ **Problem and evidence:** The design promises cookie/authorization bypass while retaining today’s unmarked-response behaviour and putting page lookup before the LRU ([design:138](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:138), [design:205](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:205)). Today’s LRU lookup checks neither credential type ([edge.go:2673](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2673)); storage ignores request cookies and allows authorization when the response says `public` ([edge.go:2914](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2914)).
+
+ **Failure scenario:** A cookie-bearing request bypasses the page store and follows the existing pipeline. Its personalized 200, with positive shared lifetime and no `Set-Cookie` or `Vary: Cookie`, enters the LRU. A later anonymous page-store miss receives that response. A marked response rejected by page admission also needs an explicit prohibition against falling into this path.
+
+ **Fix:** Define bypass across both caches for the protected request classes. Explicitly prohibit marked responses from falling back to LRU storage, including when page admission fails. Resolve the compatibility promise for unmarked responses and existing LRU entries.
+
+ **Fault family:** I2 — page-cache rejection must not expose a second shared-cache path.
+
+4. **P1 — §§5.1, 7 and 8.3: leases can keep a password-protected page publicly readable.**
+
+ **Problem and evidence:** Page eligibility excludes `ImportGate`, but not `Route.Gate`. Lease permission checks list the instance switch, lapse, throttle and whether the home serves the app ([design:210](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:210), [design:363](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:363)). The existing asset policy explicitly refuses password gates and hosts with path-routing rows ([assetpolicy.go:299](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/host/assetpolicy.go:299)). Ordinary requests enforce the password gate before cache lookup ([edge.go:2499](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/edge.go:2499)).
+
+ **Failure scenario:** A public page warms a far cache. The operator enables its password gate. Ownership and home remain unchanged, and the listed lease checks still allow serving. Anonymous far hits continue bypassing the gate, even through renewed leases.
+
+ **Fix:** Derive lease host eligibility from an explicit route-policy predicate. For v1, refuse password-gated hosts and path-routed hosts unless their protection can be represented safely. Policy changes must revoke eligibility for retained entries as well as prevent new fills.
+
+ **Fault family:** Access control — far hits must enforce the protections of the resolved route.
+
+5. **P2 — §7 steps 3–4: an unrelated clear prevents refilling an unchanged page.**
+
+ **Problem and evidence:** The acknowledgement carries the sequence **at render**, and far storage requires equality with the lease’s **current** sequence ([design:299](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:299)). Every clear increments that app-wide sequence, regardless of target ([design:323](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:323)).
+
+ **Failure scenario:** `/about` is cached at sequence 0. Clearing `/news` advances the app to 1 but correctly retains `/about`. A new far reader fills `/about` from the home’s retained entry. Its acknowledgement says 0, its lease says 1, and it cannot store the page. Repeated requests keep backhauling until that otherwise-valid home entry expires or is removed.
+
+ **Fix:** Distinguish render sequence from a sequence through which the home has validated the entry. A retained entry may be acknowledged against the current clear state only after an atomic validity check. Preserve its original expiry.
+
+ **Fault family:** Clear sequencing — selective invalidation must preserve refillability of unaffected entries.
+
+6. **P2 — §§7–8: the control-message authentication and replay contract is incomplete.**
+
+ **Problem and evidence:** The fill acknowledgement’s listed claims omit binding to its initiating assertion; lease request/response bindings and replay rules are unspecified ([design:293](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:293), [design:359](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/docs/superpowers/specs/2026-11-08-edge-page-cache-design.md:359)). Existing asset acknowledgements explicitly MAC the originating assertion ([assetfill.go:120](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/assetfill.go:120)). Burst notices additionally enforce bounded reads, receiver-bound authentication, replay rejection and acceptance limits ([burst_notice.go:503](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/edge/burst_notice.go:503)). Ordinary hop authentication binds only host and timestamp.
+
+ **Failure scenario:** An implementation following only the listed acknowledgement fields cannot cryptographically distinguish acknowledgements for different URLs with otherwise matching claims. Likewise, accepting an old lease answer against a new renewal’s send time would invalidate the freshness proof. A bounded sender queue does not bound receiver work or subscription state.
+
+ **Fix:** Specify request-bound acknowledgements and lease answers, authenticated scope and peer identity, duplicate/out-of-order handling, receiver size/time limits, and bounded subscription state. Define inherited asset/burst protections explicitly; leave numerical tuning to the builder.
+
+ **Fault family:** Mesh trust — authenticated messages must authorize one bounded, correctly scoped operation.
+
+No P3 findings.
+
+**Builder questions, ranked**
+
+1. **HA authority while sleeping:** Who may grant page leases after hibernation releases the serving lease? The current stop path releases it ([activator.go:5253](/home/paulca/amadan.net/carlos/platform-design-edge-page-cache/internal/activator/activator.go:5253)). This needs a defined answer that preserves both no-wake caching and the ownership fence.
+
+2. **Cookie-policy scope and lifetime:** Is `ignore-cookies` one host-wide policy or a property of each cached representation? Entries record individual lists, while far boxes learn one list per host. What resolves conflicting declarations, and what invalidates learned lists on clears, releases, owner changes and epoch changes? A stale or broader list must not authorize a different entry.
+
+3. **Instance switches versus app-wide leases:** If two instances of one app share a home and only one has page caching disabled, which hosts remain allowed? The record switch is per instance, but the lease has one app-wide permission and §10 describes dropping the app’s entries. Define whether permission is per host/instance or disabling one deliberately disables all.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md
new file mode 100644
index 000000000..9aa5b8ced
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-PAGE-CACHE-R2.md
@@ -0,0 +1,105 @@
+# Review brief: edge page cache spec, round 2 of 3
+
+Repo carlos/platform, branch `design-edge-page-cache`, the commit named in
+your prompt.
+Under review: `docs/superpowers/specs/2026-11-08-edge-page-cache-design.md`.
+Authorities (merged on main): `docs/superpowers/specs/2026-10-24-edge-asset-cache-design.md`,
+`docs/superpowers/specs/2026-11-01-stateless-replicas-design.md`, the code
+under `internal/edge/` (cache.go, purge.go, purge_header.go, asset*.go,
+burst_notice.go, mesh.go, homemap.go, forwardha.go), `internal/assetcache/`,
+`internal/host/assetpolicy.go`. Do not review against unmerged branches; if
+this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer and also the person who will plan the
+build from this document without being able to ask its author anything.
+Read the document, then the code it names, and check every claim against
+that code.
+
+## Fixed: do not re-argue
+
+Paul's requirements, recorded in spec §1:
+- an app opts in with a response header and a page stays until the app
+ clears it;
+- clearing one page or all pages, from inside the app or by an agent;
+- no stale content left hanging around;
+- a clear reaches far readers in low seconds.
+
+Also fixed: no new per-box polling of the S3 bucket (S3 request cost
+rulings), and page bytes count as usage (asset cache ruling R2). Report
+only mechanisms that fail to honour these. The calls listed in spec §14
+are the author's, not Paul's, and are open to challenge.
+
+## What to check
+
+1. **Invariant I1 (§8.4).** Can a far box, or the home, serve a page
+ covered by a clear more than L after the home applied it? Try lost,
+ delayed and reordered pushes, renewals racing clears, home restarts,
+ HA holder changes, moves, clock skew, and a fill that races a clear
+ (§6, §7 step 4).
+2. **Personalised pages (I2).** Can a response drawn for a signed-in or
+ cookie-carrying request be stored or served to someone else? Check
+ the ignore-list learning on far boxes (§7 step 5), HEAD, and the
+ interaction with today's LRU, which doesn't check request cookies.
+3. **Tenancy (I3).** Can an entry be served under the wrong account, app
+ or host? Check the fill acknowledgement, the lease's host set, and the
+ home-map checks against how `farAssetCatch` and `AssetsFor` work
+ today.
+4. **Trust.** Are the new push, lease and fill messages bounded and
+ unforgeable at least to the standard of asset fills and burst notices?
+ Can any of them be replayed for a wrong effect?
+5. **Fit with the code.** Is the claimed position of the page-store
+ lookup (after the plan throttle, before the rate limit and activator)
+ right, and does the far branch have a place to look up before
+ backhaul? Does anything in §2 misstate the code?
+6. **Builder check.** As the planner: list the questions you would still
+ need answered before planning well, where a wrong guess would matter.
+ Rank them. Skip anything §15 leaves to the builder or that you could
+ reasonably decide yourself.
+
+## Round 2
+
+Earlier rounds: `CODEX-FINDINGS-PAGE-CACHE-R1.md` (round 1, rev 1). The
+round number counts every earlier review of this design or change, under
+any file name or reviewer.
+
+First give one line per P1 and P2 from round 1: resolved, partly, or
+not. Spec §16 says how the author resolved each. Carry every unresolved
+or partly resolved finding forward at its current severity, then add new
+findings. The verdict covers everything outstanding, earlier rounds
+included. Refusing region HA routes in v1 (§3) is the author's cut for
+R1-2. Challenge it only if it does not remove the failure.
+
+## 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. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+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 gives:
+- the section;
+- the problem;
+- the evidence (file:line, verified);
+- the failure scenario;
+- a concrete fix;
+- the invariant or trust boundary it breaks. That is its fault family.
+
+Then the builder questions (item 6), as a separate ranked list. End with
+exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.