carlos / platform Public

G6 fence: recovery after a fence under main's unclean-marker wait

Main now holds an unclean marker that is neither settled nor finalized
for a lease term after its at (rev 6.7/6.8). A fenced release is always
that: finalize fails on rn.Err(), so Finalized is cleared, and no
replicator's marker is settled. Fence spec §4 and drill 4 now state the
return as the later of the owed marker landing and 15 minutes after the
release; the pool-path row says the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 3757702f54871c6128735691fdad02bb86b792fb parent b3760fb
2 files changed, +21 −10
  • docs/superpowers/specs/2026-11-11-g6-pool-path-design.md +1 −1
  • docs/superpowers/specs/2026-11-11-g6-write-fence-design.md +20 −9

Intent

diff --git a/docs/superpowers/specs/2026-11-11-g6-pool-path-design.md b/docs/superpowers/specs/2026-11-11-g6-pool-path-design.md
index 545f9847b..73d798e7a 100644
--- a/docs/superpowers/specs/2026-11-11-g6-pool-path-design.md
+++ b/docs/superpowers/specs/2026-11-11-g6-pool-path-design.md
@@ -172,7 +172,7 @@ The facts the §5 strings must state, each from a measured or specified bound:
| Normal running | the app runs on one server at a time; another server in the group can take it over | RHA §6.2, §7.1 |
| Planned work: a release, a member replaced or removed | most requests wait a few seconds, then succeed. Some still get 503 with `Retry-After: 10` for those seconds: bodies over 64 KiB or of unknown length, requests another box already forwarded (most cross-region ones), edge-local and tunnel calls, and requests after the member starts closing connections. Keep-alive connections close, event streams reconnect, WebSockets older than 60 s close, always-on workers pause for a few minutes | `docs/region-ha-runbook.md:147-158`, RHA §25 |
| A server dies without warning | requests get 503 with `Retry-After` until another server takes over; **up to about 15 minutes** until storage fencing exists | RHA §9.8 |
-| A server loses its storage connection while the app is writing | about 30 seconds after its writes stop reaching storage, the app refuses new requests at once (503 with `Retry-After: 10`) and stops through its ordinary stop. Writes acknowledged in about the last 32 seconds before that can be lost, plus those of requests already running; the stop ends the app's processes within 30 seconds, or within about 2 minutes when a deploy or a sidecar start is under way | fence spec §4 |
+| A server loses its storage connection while the app is writing | about 30 seconds after its writes stop reaching storage, the app refuses new requests at once (503 with `Retry-After: 10`) and stops through its ordinary stop. Writes acknowledged in about the last 32 seconds before that can be lost, plus those of requests already running; the stop ends the app's processes within 30 seconds, or within about 2 minutes when a deploy or a sidecar start is under way. The release is unclean, so the app comes back on a server about 15 minutes after it, or when storage returns if that is later | fence spec §4, RHA §5.2 |
| A server loses its storage connection while the app is idle | nothing is lost. The app keeps answering until its lease renewal fails (within about 5 minutes), then answers 503 with `Retry-After`. When storage returns it recovers by itself; if storage never returns to that server, an operator replaces it (paged at about 10 minutes) | RHA §6.7, §9.5, fence spec §4 |
| A server dies | writes from about the last second can be lost | RHA §5.3 |
| The whole region fails | not covered | out of scope |
diff --git a/docs/superpowers/specs/2026-11-11-g6-write-fence-design.md b/docs/superpowers/specs/2026-11-11-g6-write-fence-design.md
index 8de872cf9..fdb75b28d 100644
--- a/docs/superpowers/specs/2026-11-11-g6-write-fence-design.md
+++ b/docs/superpowers/specs/2026-11-11-g6-write-fence-design.md
@@ -414,12 +414,20 @@ The last row is the price Paul's ruling accepts: a bounded loss in place of an
unbounded one. Without the late flush (deferred), a fenced holder cannot hand
its tail over cleanly.
-After the store returns, the owed unclean marker lands, and any eligible pool
-member (the old holder included) acquires and restores. The service comes back
-without a terminate, which is the drill 4 rerun's behaviour after its fault
-ended. Once branch `ha-unclean-marker-waits` lands, an unclean marker is not
-taken at once, so that return comes later (the plan's "After merge" gives
-the timing); requests get 503 with `Retry-After: 10` throughout. If the box
+A fenced release is always unclean, and never settled or finalized (RHA
+§5.2, rev 6.7 and 6.8): its finalization fails, because `finishErr` joins
+`rn.Err()`, which holds `ErrReplicaStale` or the loss latched before it
+(`release.go`, `finalize`), so `ReleaseMarker` clears `Finalized` and every
+replicator's marker has `Settled` false. Under main's rule
+(`hafresh.MarkerOpensAt`, `DecideAcquire`) no box, the old holder included,
+takes the host until a lease term (`LeaseTTL`, 15 minutes) after the
+marker's `at`. `at` is set when the release writes the marker, after the
+finalization returns, so about the fence line plus the stop (§3.2) plus the
+release budget. An owed marker keeps that first `at` when it is retried
+(RHA §5.2). So after a fence the service comes back without a terminate, at
+the later of two times: the owed marker landing once the store returns,
+and 15 minutes after the release. Any eligible pool member then acquires
+and restores. Requests get 503 with `Retry-After: 10` throughout. If the box
never gets the store back, RHA §9.5 is unchanged: the suspect-holder page at
L+10 and the runbook terminate.
@@ -534,9 +542,12 @@ deploy or sidecar start in the window:
35 s**: the common-case stop bound of 30 s plus 5 s margin. The drill
keeps swaps and sidecar starts out of the window and records any it
finds; a run with one is judged against 110 s + 5 s;
- - after the fault ends the unclean marker lands and the fixture serves
- again within the bound of RHA §9.8 (read with the unclean-marker wait,
- §4); no other box takes the lease before the marker or a terminate;
+ - after the fault ends the owed unclean marker lands (not settled, not
+ finalized) and the fixture serves again at the later of that landing
+ and 15 minutes after the marker's `at` (§4, RHA §9.8's row for an
+ unclean release that replicated); no box, the old holder included,
+ takes the lease before then, and none before the marker without a
+ terminate;
- the F-A, F-B and F-D rows of the rerun still pass.
3. Two controls in the same window: a 20 s cut with writes (no fence, 0 lost)
and a 2-minute cut with the fixture idle (no fence).