carlos / platform Public

edge: harden replica coordinator forwarding and fencing

Apply controller ruling P25 after the Opus review of 7d072d77.
Keep version-marked console 404 responses as fencing, and leave escaped
or unclean replica API paths on the tunnel hub. Preserve wrapped swap
errors so rollout classification uses errors.Is instead of diagnostic
text. Register the provisionally approved console-unreachable copy as
SR-1-C14 and refresh the census proposal for Fix round 1.
Co-Authored-By: Codex (gpt-6-astra) <noreply@openai.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 92b24a7df93229c3e21f21456dd732c8907f2374 parent 7d072d7
15 files changed, +70 −28
  • approved_stateless_replicas_copy_test.go +1 −1
  • docs/superpowers/notes/census-claims-stateless-coordinator-route.tsv +2 −2
  • docs/superpowers/notes/census-proposal-stateless-coordinator-route.md +5 −5
  • docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md +1 −0
  • internal/activator/swap.go +7 −2
  • internal/activator/swap_error_test.go +21 −0
  • internal/edge/edge.go +1 −1
  • internal/edge/replicaconsole_test.go +5 −0
  • internal/host/replicacoordinator.go +1 −1
  • internal/host/replicacoordinator_test.go +5 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-stateless-coordinator-route.tsv +10 −9
  • internal/rollout/fake_test.go +6 −2
  • internal/rollout/scheduler.go +2 −2
  • internal/rollout/status_test.go +2 −1

CI passed — run details

Intent

Human

<task-notification> <task-id>b8nqlctiz</task-id> <tool-use-id>toolu_01NrruU9KKQHRXqbBvWi7QHV</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/7c5a7d70-0e28-42b9-896c-5d73b2d2a05d/tasks/b8nqlctiz.output</output-file> <status>completed</status> <summary>Background command "Wait for the coordinator-route fix" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>a1cf4cfe653311541</task-id> <tool-use-id>toolu_013qfWPMnzYLV8yLQ9T9xxs2</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/7c5a7d70-0e28-42b9-896c-5d73b2d2a05d/tasks/a1cf4cfe653311541.output</output-file> <status>completed</status> <summary>Agent "Review + census coordinator-route fix" 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>### Findings **Critical:** none. **Important:** none. **Minor** 1. **A console 404 is now "unreachable", not fenced.** `internal/host/replicacoordinator.go:100` sends every 404 to `ErrConsoleUnreachable`, including one that carries `X-Carlos-Version`. The console answers that 404 itself when `fleetIdentityOK` fails, the record is retired, the record has moved off this box (`rec.FleetBox != box`), or the in-lock re-check fails (`internal/console/replicacoordinator.go:21-41,72-80`). Those are real fence signals. - It stays safe. A failed renew is not definitive, so the authority survives only until its own `until` and then `errLocked` fences it (`internal/activator/coordinator.go:143,287`). - The cost: a box whose token was revoked, or whose instance moved, shows "console unreachable" and retries for good, where before it fenced at once. - It is defensible: an older console answers a newer op (`retire-ack`) with a marked 404. The test pins this choice (`replicacoordinator_test.go` "console 404"). - Fix, if the controller reads P24 as "unmarked answers only": change line 100 to `(404 &amp;&amp; version == "") || &gt;=500 || version == ""`. Otherwise just record the ruling. 2. **The edge checks the decoded path, so it relies on the console's router.** `internal/edge/edge.go:1931` tests `r.URL.Path`, which is decoded, and the proxy forwards the raw path. I ran Go 1.26's `ServeMux` against the console's patterns in scope: - Every encoded variant (`/api%2Ffleet%2Freplicas%2Fx`, `..%2F..%2Fenrol`, `%2e%2e/...`) gives 404. - Raw `/api/fleet/replicas/../../cli/apps/...` gets a 307 to the cleaned path. Followed, that lands back on the tunnel host and gets the hub's 404. - `a%2Fb` as the account segment matches the route, then `ValidAccount` refuses it. - No console pattern has a wildcard first segment, or a wildcard right after `/api/` or `/api/fleet/`. So nothing else is reachable today, but only because of how the console registers routes. Hardening: also require `r.URL.RawPath == ""` (or `EscapedPath()` with the same prefix) and `path.Clean(p) == p` in that branch, and add those cases to `replicaconsole_test.go`. 3. **This branch skips the edge's per-request layers.** It runs before acceptHop, the asset and upgrade header deletes, the guard, the rate limit, the meter and the 5xx/edge-error observer, exactly as `/store/` does. The leftover inbound headers (an unverified `X-Carlos-Hop`, asset fill, `Carlos-Upgrade`) reach the console, which ignores them. - The client address is right: `setForwarded` → `SetXForwarded` takes the box's RemoteAddr, `hopVerified` is false so the inbound XFF is not trusted, and `withForwardKey` is applied in the helper (`replicaconsole.go:38`), so the proof is signed. - `fleetIdentityOK` keys on the token and box name only, compared in constant time. - Unthrottled brute force against a high-entropy token is a negligible risk. Noting it only. 4. **Console lookup cost, and an ambiguity that stops the fix working.** - `replicaconsole.go:10` scans the whole upstream map on every call. That is fine at today's sizes; it could be computed once in Reload. - Two eligible rows (for example a second accountless `console`/`console.service` row for another hostname) mean a permanent 503. That fails closed, but the feature never works. Before the smoke, check that dev and flagship each have exactly one such row with `Version` set. With an empty `Version` every reply lacks the header, so every call would read as unreachable. 5. **The rollout change matches the reason by its text.** `internal/rollout/scheduler.go:350,426` and `status.go:136` compare `res.Reason` with the sentinel's text. That holds today because `Acquire` → `request` → `exchange` returns the sentinel unwrapped and `abandon` uses `err.Error()` (`activator/swap.go:115`). Any future wrap silently drops the reason. 6. **New user-facing copy.** "console unreachable" now appears in the CLI REASON cell (`instances_cli.go:607`) and the console rollout note (`instancepage.go:121`). Confirm that P24 counts as its copy approval, or run it through copy review. **Checked and fine** - **Correctness:** `/store/` stays first and `/register` stays the hub's (tested, 401). Other methods, near-miss paths, other `/api/` paths and other hosts behave as before (tested). The `isDoor` callers never reach the branch. - **F1b:** a marked 409 still gives `ErrFenced`, or `CoordinatorHeldError` when `retry_at` is set. Marked 408/429 are unchanged. 403 still fences. Transport errors and missing-header answers are unreachable. - **Rollout status:** the reason is cleared whenever a `done` arrives for the current revision, ignored once the desired build moves on, and hidden while a hold is shown. No failure-book hold is created. - **Tests:** they go through the real `Edge.ServeHTTP`. HTTP waits are bounded and the rollout test uses `waitFor`. The `TransientStatus` and real-console tests only gained the version header. No assertion was weakened. - **Inert elsewhere:** the only edge behaviour change is POST under `/api/fleet/replicas/` on the tunnel host, which used to get the hub's 404. The box-side classification only touches the fleet replica API adapter. The status, CLI and console changes only show when that sentinel is present. ### Census table | unit | class | verdict | reason (file:line) | |---|---|---|---| | `internal/edge/edge.go` `Edge.ServeHTTP` | body | APPROVE | `edge.go:1931-1934`: one branch for `!isDoor`, the tunnel host, POST and the prefix. It hands the request to the console's local proxy, which is already in memory. The request path is attacker-named, but it is only forwarded to doors the public console hostname already serves, and the console re-authenticates. No new file, registry or bucket read; no check weakened. | | `internal/edge/replicaconsole.go` `Edge.serveReplicaConsole` | new (accepted-legacy) | APPROVE | `replicaconsole.go:10-37`: reads only the loaded upstream map (Host, alias, regional, viaTunnel, Account, App, Unit, ActivatorOwned, Socket, Addr). The fields that select the upstream (`Account==""`, `App=console`, `Unit=console.service`) come from platform-written records and operator `carlos route -unit`. A tenant's routes always carry an Account, and the test pins the refusal of a tenant `console` (`replicaconsole_test.go:84-96`). It accepts only a Unix socket or loopback addresses, and an ambiguous or missing console gives 503. Nothing opened or followed from a tenant, app or box-agent input. | | `internal/rollout/scheduler.go` `scheduler.done` | body | APPROVE | `scheduler.go:348-353,426-428`: compares `res.Reason` with a fixed sentinel and stores an in-memory revision. It skips one log line. No new read and no failure-book authority. | | envelope `.` | envelope | APPROVE | `instances_cli.go:607`: renders a fixed string. | | envelope `internal/edge` | envelope | APPROVE | New file plus test only. | | envelope `internal/host` | envelope | APPROVE | `replicacoordinator.go:96-104,152-168`: classifies the response and logs `id.Host`. No new read or write. | | envelope `internal/replicas` | envelope | APPROVE | `types.go:44`: a sentinel. | | envelope `internal/rollout` | envelope | APPROVE | `queue.go:85`, `status.go:136-138`: an in-memory field and a fixed reason. | The chain is right. `plan14-root-reads-chain.tsv` keeps all of main's (origin/main f18da984) lines in order. Its last main line, `region-ha-followups` (seal `cfb026f1…`), is followed by the one new overlay line, `stateless-coordinator-route` `0843884e17faf64e4a957503f273421ba6b764c57a889e20cadfcb0339382a5e`, last, matching the card's seal. I did not re-run the census tests; the report says they passed. The local `main` branch (671d3d11) is stale, so I compared against origin/main. Census: APPROVED at 7d072d77 (seal `cfb026f1f9d59f325937cbddf26df2d94d5240d1f7846e80db713b8f6a15c387` → `0843884e17faf64e4a957503f273421ba6b764c57a889e20cadfcb0339382a5e`). Reviewer: Claude Opus 5.5. It is not yet recorded on #280; that is the controller's to post. ### Verdict **Ready to merge?** Yes. Nothing outside the console's two authenticated replica handlers is reachable; the controller should rule on Minor 1 (console 404 classification) and check for exactly one console row on dev and flagship before the smoke. Minor 2 is optional hardening.</result> <usage><subagent_tokens>134719</subagent_tokens><tool_uses>46</tool_uses><duration_ms>476867</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b8tyh9oqc</task-id> <tool-use-id>toolu_01VUigQzaCzkE1z7uMgK1EgN</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/7c5a7d70-0e28-42b9-896c-5d73b2d2a05d/tasks/b8tyh9oqc.output</output-file> <status>completed</status> <summary>Background command "Wait for CI on the fix branch" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 97.0 g CO₂e (6,825,740 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on stateless-coordinator-route, 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/approved_stateless_replicas_copy_test.go b/approved_stateless_replicas_copy_test.go
index 3fd9b1200..035bcf296 100644
--- a/approved_stateless_replicas_copy_test.go
+++ b/approved_stateless_replicas_copy_test.go
@@ -9,7 +9,7 @@ import (
const statelessReplicaCopyDeck = "docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md"
-var statelessReplicaBuiltCopy = []string{"SR-1-C08", "SR-1-C06", "SR-1-C07", "SR-1-C01", "SR-1-C02", "SR-1-C03", "SR-1-C04", "SR-1-C05", "SR-1-C12", "SR-1-C09", "SR-1-C10", "SR-1-C13"}
+var statelessReplicaBuiltCopy = []string{"SR-1-C08", "SR-1-C06", "SR-1-C07", "SR-1-C01", "SR-1-C02", "SR-1-C03", "SR-1-C04", "SR-1-C05", "SR-1-C12", "SR-1-C09", "SR-1-C10", "SR-1-C13", "SR-1-C14"}
func statelessReplicaCopyRows(t *testing.T) []copyRow {
t.Helper()
diff --git a/docs/superpowers/notes/census-claims-stateless-coordinator-route.tsv b/docs/superpowers/notes/census-claims-stateless-coordinator-route.tsv
index 98723e71b..8d6ff12a6 100644
--- a/docs/superpowers/notes/census-claims-stateless-coordinator-route.tsv
+++ b/docs/superpowers/notes/census-claims-stateless-coordinator-route.tsv
@@ -1,3 +1,3 @@
-internal/edge/edge.go:Edge.ServeHTTP P24: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy; no new read sites.
+internal/edge/edge.go:Edge.ServeHTTP P24/P25: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy only for an unescaped, already-clean path; malformed forms remain on the hub. No new read sites.
internal/edge/replicaconsole.go:Edge.serveReplicaConsole Reads existing in-memory route fields to select a unique accountless console.service local upstream; refuses missing or ambiguous console, tenant routes, remote and tunnel upstreams. Reuses proxy and version wrapper; leaves fleet identity authentication at console.
-internal/rollout/scheduler.go:scheduler.done Records console-unreachable against the current scheduler revision and suppresses duplicate abandoned logs (client logs reachability transitions); no new read sites or failure-book authority.
+internal/rollout/scheduler.go:scheduler.done P25: classifies the preserved SwapResult.Err with errors.Is, including wrapped console-unreachable causes, to record the current scheduler revision and suppress duplicate abandoned logs. Diagnostic text no longer grants this classification. No new read sites or failure-book authority.
diff --git a/docs/superpowers/notes/census-proposal-stateless-coordinator-route.md b/docs/superpowers/notes/census-proposal-stateless-coordinator-route.md
index bb675f6c5..151507a0c 100644
--- a/docs/superpowers/notes/census-proposal-stateless-coordinator-route.md
+++ b/docs/superpowers/notes/census-proposal-stateless-coordinator-route.md
@@ -1,15 +1,15 @@
# Census proposal: stateless-coordinator-route
-Status: pending independent review. No approval has been given.
+Review round 1: Opus approved commit 7d072d77 with no Critical/Important findings, as reported by the controller. This proposal refreshes the fingerprints for controller ruling P25, Fix round 1. It does not claim a separate Opus review of these follow-up changes.
Ruling `census-ruling-stateless-coordinator-route`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
-| `internal/edge/edge.go` `Edge.ServeHTTP` | body | unchanged (40) | P24: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy; no new read sites. |
-| `internal/rollout/scheduler.go` `scheduler.done` | body | unchanged (6) | Records console-unreachable against the current scheduler revision and suppresses duplicate abandoned logs (client logs reachability transitions); no new read sites or failure-book authority. |
+| `internal/edge/edge.go` `Edge.ServeHTTP` | body | unchanged (40) | P24/P25: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy only for an unescaped, already-clean path; malformed forms remain on the hub. No new read sites. |
+| `internal/rollout/scheduler.go` `scheduler.done` | body | unchanged (6) | P25: classifies the preserved SwapResult.Err with errors.Is, including wrapped console-unreachable causes, to record the current scheduler revision and suppress duplicate abandoned logs. Diagnostic text no longer grants this classification. No new read sites or failure-book authority. |
-Envelopes re-pinned: `.`, `internal/edge`, `internal/host`, `internal/replicas`, `internal/rollout`.
+Envelopes re-pinned: `.`, `internal/activator`, `internal/edge`, `internal/host`, `internal/replicas`, `internal/rollout`.
Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
@@ -22,6 +22,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/edge/replicaconsole.go:Edge.serveReplicaConsole`: reads +registry:Account, +registry:App, +registry:Host, +registry:Socket, +registry:Unit, +whole:Route; written legacy, accepted-legacy, frozen
-Seal: `cfb026f1f9d59f325937cbddf26df2d94d5240d1f7846e80db713b8f6a15c387` → `0843884e17faf64e4a957503f273421ba6b764c57a889e20cadfcb0339382a5e`.
+Seal: `cfb026f1f9d59f325937cbddf26df2d94d5240d1f7846e80db713b8f6a15c387` → `b129397d033dff1da950da3c6879132d003191c81d282de250ff72dff7444020`.
Overlay: `internal/provision/testdata/plan14-root-reads-stateless-coordinator-route.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
index 841036018..692e3a491 100644
--- a/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
+++ b/docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md
@@ -30,6 +30,7 @@ copy too. Internal wire enums are not an excuse to expose unreviewed text.
| SR-1-C11 | docs/site/cli.md | A stateless release can run more than one copy on a fleet after every fleet box and the console support replicas. Apps keep one copy until you set --copies. | approved by delegation (Luna pass, 2026-11-01) |
| SR-1-C12 | internal/console/replicacoordinator.go | this instance changed before the coordination update finished. try again | approved by delegation (Luna pass, 2026-11-01); was: this instance changed while coordination was being updated. try again |
| SR-1-C13 | docs/site/cli.md | If the box running the release command disappears, its result may be unknown. The deploy stops and the previous build keeps serving. Deploying again runs the command again, so release commands must be safe to repeat. Rails migrations record completed migrations in schema_migrations. | approved by delegation (Luna pass, 2026-11-01); Luna's text for SR-4-C26, reused here because Plan 1 documents repeat-safe release commands |
+| SR-1-C14 | internal/replicas/types.go | console unreachable | approved provisionally (controller ruling P25; for Paul's copy review) |
## Plan 2: count and placement
diff --git a/internal/activator/swap.go b/internal/activator/swap.go
index f5702d602..4fe0a3aa0 100644
--- a/internal/activator/swap.go
+++ b/internal/activator/swap.go
@@ -71,6 +71,7 @@ type SwapResult struct {
Outcome SwapOutcome
Gen Gen // the generation now current (on SwapDone)
Reason string
+ Err error // Preserves wrapped causes for scheduler classification.
// Drain is how long the retiring generation took from SIGTERM to its
// proven exit (an overlap), or the old generation's stop (a hold). Zero
// when nothing retired. The "swapped" event reports it (spec §9.4).
@@ -112,8 +113,12 @@ var (
errSwapMode = errors.New("swap: unknown mode")
)
-func abandon(err error) SwapResult { return SwapResult{Outcome: SwapAbandoned, Reason: err.Error()} }
-func failSwap(err error) SwapResult { return SwapResult{Outcome: SwapFailed, Reason: err.Error()} }
+func abandon(err error) SwapResult {
+ return SwapResult{Outcome: SwapAbandoned, Reason: err.Error(), Err: err}
+}
+func failSwap(err error) SwapResult {
+ return SwapResult{Outcome: SwapFailed, Reason: err.Error(), Err: err}
+}
// stepOutcome is how one step of an attempt (a spawn, a health check, a
// readiness or settle window, a pinned wake) ended.
diff --git a/internal/activator/swap_error_test.go b/internal/activator/swap_error_test.go
new file mode 100644
index 000000000..382fdb2c3
--- /dev/null
+++ b/internal/activator/swap_error_test.go
@@ -0,0 +1,21 @@
+package activator
+
+import (
+ "errors"
+ "fmt"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/replicas"
+)
+
+func TestSwapResultPreservesWrappedCause(t *testing.T) {
+ cause := fmt.Errorf("acquire coordinator: %w", replicas.ErrConsoleUnreachable)
+ for _, result := range []SwapResult{abandon(cause), failSwap(cause)} {
+ if !errors.Is(result.Err, replicas.ErrConsoleUnreachable) || result.Reason != cause.Error() {
+ t.Fatalf("lost diagnostic or wrapped cause: %+v", result)
+ }
+ }
+ if result := abandon(errors.New(replicas.ErrConsoleUnreachable.Error())); errors.Is(result.Err, replicas.ErrConsoleUnreachable) {
+ t.Fatal("diagnostic text was treated as the sentinel")
+ }
+}
diff --git a/internal/edge/edge.go b/internal/edge/edge.go
index 7217636da..fcfbedc2e 100644
--- a/internal/edge/edge.go
+++ b/internal/edge/edge.go
@@ -1928,7 +1928,7 @@ func (e *Edge) ServeHTTP(w http.ResponseWriter, r *http.Request) {
e.door.ServeHTTP(w, r)
return
}
- if r.Method == http.MethodPost && strings.HasPrefix(r.URL.Path, "/api/fleet/replicas/") {
+ if p := r.URL.Path; r.Method == http.MethodPost && r.URL.RawPath == "" && path.Clean(p) == p && strings.HasPrefix(p, "/api/fleet/replicas/") {
e.serveReplicaConsole(w, r)
return
}
diff --git a/internal/edge/replicaconsole_test.go b/internal/edge/replicaconsole_test.go
index cec903f13..277102b77 100644
--- a/internal/edge/replicaconsole_test.go
+++ b/internal/edge/replicaconsole_test.go
@@ -55,6 +55,11 @@ func TestFleetReplicaConsoleOnTunnelHost(t *testing.T) {
{"POST", "tunnel.test", "/api/fleet/replicas", 404, "", false},
{"POST", "tunnel.test", "/api/fleet/replicas-other/a", 404, "", false},
{"POST", "tunnel.test", "/api/accounts", 404, "", false},
+ {"POST", "tunnel.test", "/api%2Ffleet%2Freplicas%2Fx", 404, "", false},
+ {"POST", "tunnel.test", "/api/fleet/replicas/../../cli/apps/x", 404, "", false},
+ {"POST", "tunnel.test", "//api/fleet/replicas/x", 404, "", false},
+ {"POST", "tunnel.test", "/api/fleet/replicas/%2e%2e/x", 404, "", false},
+ {"POST", "tunnel.test", "/api/fleet/replicas/a%2Fb/app/h/coordinator", 404, "", false},
{"GET", "tunnel.test", "/register", 401, "", false},
{"POST", "app.test", prefix + "coordinator", 200, "app", false},
{"POST", "unknown.test", prefix + "coordinator", 404, "", false},
diff --git a/internal/host/replicacoordinator.go b/internal/host/replicacoordinator.go
index 0883490d6..a8fefe31d 100644
--- a/internal/host/replicacoordinator.go
+++ b/internal/host/replicacoordinator.go
@@ -97,7 +97,7 @@ func (a *replicaCoordinatorAPI) post(ctx context.Context, id replicas.Identity,
return replicas.ErrConsoleUnreachable
}
defer resp.Body.Close()
- if resp.StatusCode == http.StatusNotFound || resp.StatusCode >= 500 || resp.Header.Get("X-Carlos-Version") == "" {
+ if resp.StatusCode >= 500 || resp.Header.Get("X-Carlos-Version") == "" {
return replicas.ErrConsoleUnreachable
}
d := json.NewDecoder(io.LimitReader(resp.Body, 8192))
diff --git a/internal/host/replicacoordinator_test.go b/internal/host/replicacoordinator_test.go
index 3710a41ca..328a0c48c 100644
--- a/internal/host/replicacoordinator_test.go
+++ b/internal/host/replicacoordinator_test.go
@@ -89,6 +89,10 @@ func TestReplicaReleaseFleetAPI(t *testing.T) {
t.Fatal(err)
}
id := replicas.Identity{Account: rec.Account, App: rec.App, Host: rec.Host, Incarnation: inc}
+ unauthorized := &replicaCoordinatorAPI{base: ts.URL, fleet: "home", box: "b1", token: "wrong-token", client: &http.Client{Timeout: time.Second}}
+ if _, err := unauthorized.coordinator(ctx, id, replicas.CoordinatorChange{Op: "acquire"}); !errors.Is(err, replicas.ErrFenced) || errors.Is(err, replicas.ErrConsoleUnreachable) {
+ t.Fatalf("console's marked authorization 404: %v", err)
+ }
authority, err := client.Acquire(ctx, id)
if err != nil {
t.Fatal(err)
@@ -558,7 +562,7 @@ func TestCoordinatorAPIConsoleUnreachable(t *testing.T) {
want error
}{
{"hub 404", 404, "", "", replicas.ErrConsoleUnreachable},
- {"console 404", 404, "test", "", replicas.ErrConsoleUnreachable},
+ {"console 404", 404, "test", "", replicas.ErrFenced},
{"proxy 502", 502, "test", "", replicas.ErrConsoleUnreachable},
{"console 503", 503, "test", "", replicas.ErrConsoleUnreachable},
{"unmarked conflict", 409, "", "", replicas.ErrConsoleUnreachable},
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index a50698e2b..a6e9c666c 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -79,4 +79,4 @@ plan14-root-reads-region-host-store-deny.tsv 951f33500fdf9e47408fd2b8fe8cab419ea
plan14-root-reads-managed-fleets-2a.tsv f85f8dabebc725fa75b88853af634fa9ca08323721f879e220da44c1e3fdbc38
plan14-root-reads-agent-start-demo-1.tsv 6ef1e3bc1dbacd5b548b1cbfe3a6d37bd5f701e03969feef2736212ee11713df
plan14-root-reads-region-ha-followups.tsv cfb026f1f9d59f325937cbddf26df2d94d5240d1f7846e80db713b8f6a15c387
-plan14-root-reads-stateless-coordinator-route.tsv 0843884e17faf64e4a957503f273421ba6b764c57a889e20cadfcb0339382a5e
+plan14-root-reads-stateless-coordinator-route.tsv b129397d033dff1da950da3c6879132d003191c81d282de250ff72dff7444020
diff --git a/internal/provision/testdata/plan14-root-reads-stateless-coordinator-route.tsv b/internal/provision/testdata/plan14-root-reads-stateless-coordinator-route.tsv
index c9a120a69..a0d380a3a 100644
--- a/internal/provision/testdata/plan14-root-reads-stateless-coordinator-route.tsv
+++ b/internal/provision/testdata/plan14-root-reads-stateless-coordinator-route.tsv
@@ -1,14 +1,15 @@
-# Census overlay stateless-coordinator-route, written by census-propose (#369). census-ruling-stateless-coordinator-route, independent approval on #280 REQUIRED before merge (pending); the approval card is docs/superpowers/notes/census-proposal-stateless-coordinator-route.md.
-# 2 body, 0 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# Census overlay stateless-coordinator-route, written by census-propose (#369). census-ruling-stateless-coordinator-route, Opus approved 7d072d77; refreshed for controller ruling P25 Fix round 1; the approval card is docs/superpowers/notes/census-proposal-stateless-coordinator-route.md.
+# 2 body, 0 sites, 6 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
-@legacy b917cb02c81a58a78943505b42119cb65ddeaedb0f0682cedaa828c4718bf54f internal/edge/edge.go Edge.ServeHTTP legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with the import gate checked after the door's scope and a gated row left out of the response cache; serving only;rev3=census-ruling-edge-request-records;basis=one more call in the observer defer, observeRecords(up.route, ...), passing on the route the defer already holds; no new kind of read;rev3=census-ruling-design-edge-rate-limit-358;basis=calls rateAdmit twice, and an admitted request holds a slot on both paths: on the upgrade path before the activator or proxy (the handshake holds its slot through slotWriter, given back at the first final answer or at the reverse proxy's hijack on a 101, so an open WebSocket is not counted; released by a defer), and on the ordinary path after the response-cache check and before the activator and proxy (an admitted request holds a slot through slotWriter, released by a defer); a refusal is a 429 written there and returns; the upgrade path's comment now names slotWriter as its one wrapper; one comment on the door mark reworded; read sites unchanged (22: main's 21 plus edge-request-records' observeRecords pass of the route), offsets moved; no read added;rev3=census-ruling-plans-4c-box-throttle;basis=calls planThrottleAdmit before the response cache, and on an upgrade trackUpgrade then planUpgradeAdmit (plans 4c, Astra findings 1 and 2); the new reads live in those units (plans-4c-units decision). The same read sites here.;rev3=census-ruling-plans-4d-lapse;basis=calls planDisabledAdmit right after the import gate, passing the final upstream's route and the request host; a turned-off route gets the fixed disabled page before the meter, gate, cache and activator (plans 4d). The new read lives in that unit (plans-4d-units decision); one more whole-row pass here.;rev3=census-ruling-edge-protection-2;basis=runs the guard, a pure in-memory matcher on r.URL.Path and RawQuery (internal/edgeguard), once per request after the meter and observer defer and before the password gate, the upgrade branch, the cache and the activator, for a request that is not a door call, a backhauled door hop or a tunnel delivery; a matched block answers a 404 itself through guardDecide; the two new sites are one expression, up.route.Kind == "static" (a static route this box serves checks only the hard tier here and leaves the probe tier to serveTree), a read of the route row the edge already resolved; no new kind of read;rev3=census-ruling-edge-asset-cache-3;basis=the asset cache's three hooks (asset cache plan 3): the request's reserved asset headers are deleted at entry (the fill assertion kept only beside a verified hop); on the exact-remote and lookup-miss branches the far catch (serveAssetFar) is tried before backhaulTo and backhaul; after the observer defer and main's hard and probe checks, a verified hop with a valid fill assertion is answered by serveAssetFillForHop; after the upgrade branch and before gzip and the shared cache, the local catch (serveAssetLocal); the observer defer skips only the usage meter for an acknowledged home fill (out.unbilled); the new reads live in the new units of the edge-asset-cache-3-decisions overlay; the same route row and read sites (25); no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: straight after lookupUpstreamPath it calls regionalGate (regional.go), which for an entry built from a regional_domains row answers 503 to a hop or a deny entry before any arm that can leave the box (the exact-home backhaul, the far asset catch, the door dial, the miss backhaul), and lets a star match through only to the exact-home arm when ExactHome names another box for that distinct exact name; after the exact-home arm a regional deny entry the arm did not answer is refused (regionalRefuse, 503); refusals only, on the route map the edge already holds; read sites unchanged (25);rev3=census-ruling-static-headers;basis=the shared response cache is no longer looked up or filled for a static-kind route: one more read of the route row the edge already resolved (up.route.Kind == "static") in the cacheable expression; a refusal only, nothing new opened or followed;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2 (N-HA10): one call, frontForwardHA, right after the route lookup's !ok block and before the login POST; same reads;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4: loginPost and cacheable treat a forward row as not this box's to answer (IsForward(), +whole:Route x2): no login form and no shared cache for a forward host. Serving only.;rev3=census-ruling-tunnel-websockets;basis=Deletes the Carlos-Upgrade marker header from incoming requests and puts the upgrade admission (host, path, the entry tenancy, all in hand) on a tunnel arm request. For a login POST on an ungated ArmTunnel row it reads the visitor request body (bounded by gate.MaxFormBody, 413 past it; a request body, not a file) and resolves next against the entry Reload built (Gate, Route); the bytes pass on only when loginPassesThrough holds (spec 7, Tasks 3, 5 and 6).;rev3=census-ruling-console-protection-tab;basis=one more call in the observer defer, observeGuardCount(up.route, out), beside the observeRecords call that files the guard Match: it passes on the route row the defer already holds (+whole:Route) and the request outcome to the usage meter, which counts the check in memory. Called whether or not the request was unbilled, as observeRecords is. Nothing is opened, read or followed; no new kind of read; no check, refusal or serving decision changes.;rev3=census-ruling-probe-burst-limit;basis=answers a probe-burst notice POST (serveBurstNotice) ahead of every route for a non-door caller; builds the guard state for up.route and stamps its account and app (RouteAccount, App) for the cool-down's this-app/other-app label; for a catalogue match on a non-static or tunnelled route, offers the burst rule (in-memory limiter, burstDecide: 429 or a watch verdict, never a block for a fleet or forward row); the observer defer calls noteBurst(up.route, ...); the added sites are the route value already in hand (+registry:App, +whole:Route x5); no new root read or write kind;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): parses the request's query once (stripHoldMarker) to record the carlos_hold=1 mark in the request context; calls classifyHold on the upstream already resolved from the loaded map (the +whole:Route is that in-memory Route), including a second pass for a login POST; gives a marked request on a door-refused route the plain 404; adds the hold branch (planThrottleAdmit, rateAdmit, serveHeld) after the gate; and excludes marked requests from the shared cache. Reads only the request and the already-loaded upstream map; no registry or bucket read added.;rev3=census-ruling-stateless-coordinator-route;basis=P24: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy; no new read sites. file:ReadAll@15122,registry:App@21220,registry:Gate@14096,registry:Gate@25611,registry:Gate@25671,registry:Gate@25729,registry:Host@25714,registry:ImportGate@33114,registry:Kind@20082,registry:Kind@23520,registry:Kind@33056,registry:Kind@33085,whole:Route@13991,whole:Route@14102,whole:Route@17644,whole:Route@18102,whole:Route@18294,whole:Route@20085,whole:Route@21146,whole:Route@21212,whole:Route@21223,whole:Route@21476,whole:Route@21571,whole:Route@21647,whole:Route@21691,whole:Route@21993,whole:Route@22023,whole:Route@23523,whole:Route@23808,whole:Route@25614,whole:Route@25674,whole:Route@25717,whole:Route@25732,whole:Route@26650,whole:Route@28713,whole:Route@33059,whole:Route@33088,whole:Route@33117,whole:Route@33149,whole:Route@34997 e12598172e9f86cea011254c1b84f83afa417f7a8cc57c3332f1495c468894e8
-@legacy 423b224e8feca36202f06f77c5b87ba39755f09108d717d9333abbdfd87cb2fc internal/rollout/scheduler.go scheduler.done legacy accepted-legacy accepted-legacy;rev3=J1,J4;basis=route-and-input;rev3=census-ruling-stateless-coordinator-route;basis=Records console-unreachable against the current scheduler revision and suppresses duplicate abandoned logs (client logs reachability transitions); no new read sites or failure-book authority. file:Exec@5205,whole:Route@8412,whole:Route@8670,whole:Route@8828,whole:Route@8900,whole:Route@9019 c4baec1d6a6eba2de70ece855387f4a4c8da38d15575819c2ad42fbf10d679d1
+@legacy 0ef6c01868499d52915a720842a60a3958d2857b78f61bd5a14c53433518e791 internal/edge/edge.go Edge.ServeHTTP legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with the import gate checked after the door's scope and a gated row left out of the response cache; serving only;rev3=census-ruling-edge-request-records;basis=one more call in the observer defer, observeRecords(up.route, ...), passing on the route the defer already holds; no new kind of read;rev3=census-ruling-design-edge-rate-limit-358;basis=calls rateAdmit twice, and an admitted request holds a slot on both paths: on the upgrade path before the activator or proxy (the handshake holds its slot through slotWriter, given back at the first final answer or at the reverse proxy's hijack on a 101, so an open WebSocket is not counted; released by a defer), and on the ordinary path after the response-cache check and before the activator and proxy (an admitted request holds a slot through slotWriter, released by a defer); a refusal is a 429 written there and returns; the upgrade path's comment now names slotWriter as its one wrapper; one comment on the door mark reworded; read sites unchanged (22: main's 21 plus edge-request-records' observeRecords pass of the route), offsets moved; no read added;rev3=census-ruling-plans-4c-box-throttle;basis=calls planThrottleAdmit before the response cache, and on an upgrade trackUpgrade then planUpgradeAdmit (plans 4c, Astra findings 1 and 2); the new reads live in those units (plans-4c-units decision). The same read sites here.;rev3=census-ruling-plans-4d-lapse;basis=calls planDisabledAdmit right after the import gate, passing the final upstream's route and the request host; a turned-off route gets the fixed disabled page before the meter, gate, cache and activator (plans 4d). The new read lives in that unit (plans-4d-units decision); one more whole-row pass here.;rev3=census-ruling-edge-protection-2;basis=runs the guard, a pure in-memory matcher on r.URL.Path and RawQuery (internal/edgeguard), once per request after the meter and observer defer and before the password gate, the upgrade branch, the cache and the activator, for a request that is not a door call, a backhauled door hop or a tunnel delivery; a matched block answers a 404 itself through guardDecide; the two new sites are one expression, up.route.Kind == "static" (a static route this box serves checks only the hard tier here and leaves the probe tier to serveTree), a read of the route row the edge already resolved; no new kind of read;rev3=census-ruling-edge-asset-cache-3;basis=the asset cache's three hooks (asset cache plan 3): the request's reserved asset headers are deleted at entry (the fill assertion kept only beside a verified hop); on the exact-remote and lookup-miss branches the far catch (serveAssetFar) is tried before backhaulTo and backhaul; after the observer defer and main's hard and probe checks, a verified hop with a valid fill assertion is answered by serveAssetFillForHop; after the upgrade branch and before gzip and the shared cache, the local catch (serveAssetLocal); the observer defer skips only the usage meter for an acknowledged home fill (out.unbilled); the new reads live in the new units of the edge-asset-cache-3-decisions overlay; the same route row and read sites (25); no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: straight after lookupUpstreamPath it calls regionalGate (regional.go), which for an entry built from a regional_domains row answers 503 to a hop or a deny entry before any arm that can leave the box (the exact-home backhaul, the far asset catch, the door dial, the miss backhaul), and lets a star match through only to the exact-home arm when ExactHome names another box for that distinct exact name; after the exact-home arm a regional deny entry the arm did not answer is refused (regionalRefuse, 503); refusals only, on the route map the edge already holds; read sites unchanged (25);rev3=census-ruling-static-headers;basis=the shared response cache is no longer looked up or filled for a static-kind route: one more read of the route row the edge already resolved (up.route.Kind == "static") in the cacheable expression; a refusal only, nothing new opened or followed;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2 (N-HA10): one call, frontForwardHA, right after the route lookup's !ok block and before the login POST; same reads;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4: loginPost and cacheable treat a forward row as not this box's to answer (IsForward(), +whole:Route x2): no login form and no shared cache for a forward host. Serving only.;rev3=census-ruling-tunnel-websockets;basis=Deletes the Carlos-Upgrade marker header from incoming requests and puts the upgrade admission (host, path, the entry tenancy, all in hand) on a tunnel arm request. For a login POST on an ungated ArmTunnel row it reads the visitor request body (bounded by gate.MaxFormBody, 413 past it; a request body, not a file) and resolves next against the entry Reload built (Gate, Route); the bytes pass on only when loginPassesThrough holds (spec 7, Tasks 3, 5 and 6).;rev3=census-ruling-console-protection-tab;basis=one more call in the observer defer, observeGuardCount(up.route, out), beside the observeRecords call that files the guard Match: it passes on the route row the defer already holds (+whole:Route) and the request outcome to the usage meter, which counts the check in memory. Called whether or not the request was unbilled, as observeRecords is. Nothing is opened, read or followed; no new kind of read; no check, refusal or serving decision changes.;rev3=census-ruling-probe-burst-limit;basis=answers a probe-burst notice POST (serveBurstNotice) ahead of every route for a non-door caller; builds the guard state for up.route and stamps its account and app (RouteAccount, App) for the cool-down's this-app/other-app label; for a catalogue match on a non-static or tunnelled route, offers the burst rule (in-memory limiter, burstDecide: 429 or a watch verdict, never a block for a fleet or forward row); the observer defer calls noteBurst(up.route, ...); the added sites are the route value already in hand (+registry:App, +whole:Route x5); no new root read or write kind;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): parses the request's query once (stripHoldMarker) to record the carlos_hold=1 mark in the request context; calls classifyHold on the upstream already resolved from the loaded map (the +whole:Route is that in-memory Route), including a second pass for a login POST; gives a marked request on a door-refused route the plain 404; adds the hold branch (planThrottleAdmit, rateAdmit, serveHeld) after the gate; and excludes marked requests from the shared cache. Reads only the request and the already-loaded upstream map; no registry or bucket read added.;rev3=census-ruling-stateless-coordinator-route;basis=P24/P25: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy only for an unescaped, already-clean path; malformed forms remain on the hub. No new read sites. file:ReadAll@15175,registry:App@21273,registry:Gate@14149,registry:Gate@25664,registry:Gate@25724,registry:Gate@25782,registry:Host@25767,registry:ImportGate@33167,registry:Kind@20135,registry:Kind@23573,registry:Kind@33109,registry:Kind@33138,whole:Route@14044,whole:Route@14155,whole:Route@17697,whole:Route@18155,whole:Route@18347,whole:Route@20138,whole:Route@21199,whole:Route@21265,whole:Route@21276,whole:Route@21529,whole:Route@21624,whole:Route@21700,whole:Route@21744,whole:Route@22046,whole:Route@22076,whole:Route@23576,whole:Route@23861,whole:Route@25667,whole:Route@25727,whole:Route@25770,whole:Route@25785,whole:Route@26703,whole:Route@28766,whole:Route@33112,whole:Route@33141,whole:Route@33170,whole:Route@33202,whole:Route@35050 9942d7d2bf987fbb9c8432f983c18875f69ba49748455709426882fae32c9933
+@legacy c5779f8357a6f496f695d25c9997b0b121b7fee7b10554aad613c84c15c2ec01 internal/rollout/scheduler.go scheduler.done legacy accepted-legacy accepted-legacy;rev3=J1,J4;basis=route-and-input;rev3=census-ruling-stateless-coordinator-route;basis=P25: classifies the preserved SwapResult.Err with errors.Is, including wrapped console-unreachable causes, to record the current scheduler revision and suppress duplicate abandoned logs. Diagnostic text no longer grants this classification. No new read sites or failure-book authority. file:Exec@5205,whole:Route@8410,whole:Route@8668,whole:Route@8826,whole:Route@8898,whole:Route@9017 be7a510e4735ea1770f9ef9e5c24e20d8991e826931ef6daab943428c866bda9
@legacy f556651f876e3633ca8f37a367df46660c6d3dee4838e49d96321869de90e39f internal/edge/replicaconsole.go Edge.serveReplicaConsole legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-coordinator-route;basis=Reads existing in-memory route fields to select a unique accountless console.service local upstream; refuses missing or ambiguous console, tenant routes, remote and tunnel upstreams. Reuses proxy and version wrapper; leaves fleet identity authentication at console. registry:Account@237,registry:App@257,registry:Host@178,registry:Socket@355,registry:Unit@280,whole:Route@159 dc98dc841eb2dc9b7f8f1e4a63a4b875c69c384b1af97ebfc5b563691362fa70
-internal/edge/edge.go Edge.ServeHTTP legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with the import gate checked after the door's scope and a gated row left out of the response cache; serving only;rev3=census-ruling-edge-request-records;basis=one more call in the observer defer, observeRecords(up.route, ...), passing on the route the defer already holds; no new kind of read;rev3=census-ruling-design-edge-rate-limit-358;basis=calls rateAdmit twice, and an admitted request holds a slot on both paths: on the upgrade path before the activator or proxy (the handshake holds its slot through slotWriter, given back at the first final answer or at the reverse proxy's hijack on a 101, so an open WebSocket is not counted; released by a defer), and on the ordinary path after the response-cache check and before the activator and proxy (an admitted request holds a slot through slotWriter, released by a defer); a refusal is a 429 written there and returns; the upgrade path's comment now names slotWriter as its one wrapper; one comment on the door mark reworded; read sites unchanged (22: main's 21 plus edge-request-records' observeRecords pass of the route), offsets moved; no read added;rev3=census-ruling-plans-4c-box-throttle;basis=calls planThrottleAdmit before the response cache, and on an upgrade trackUpgrade then planUpgradeAdmit (plans 4c, Astra findings 1 and 2); the new reads live in those units (plans-4c-units decision). The same read sites here.;rev3=census-ruling-plans-4d-lapse;basis=calls planDisabledAdmit right after the import gate, passing the final upstream's route and the request host; a turned-off route gets the fixed disabled page before the meter, gate, cache and activator (plans 4d). The new read lives in that unit (plans-4d-units decision); one more whole-row pass here.;rev3=census-ruling-edge-protection-2;basis=runs the guard, a pure in-memory matcher on r.URL.Path and RawQuery (internal/edgeguard), once per request after the meter and observer defer and before the password gate, the upgrade branch, the cache and the activator, for a request that is not a door call, a backhauled door hop or a tunnel delivery; a matched block answers a 404 itself through guardDecide; the two new sites are one expression, up.route.Kind == "static" (a static route this box serves checks only the hard tier here and leaves the probe tier to serveTree), a read of the route row the edge already resolved; no new kind of read;rev3=census-ruling-edge-asset-cache-3;basis=the asset cache's three hooks (asset cache plan 3): the request's reserved asset headers are deleted at entry (the fill assertion kept only beside a verified hop); on the exact-remote and lookup-miss branches the far catch (serveAssetFar) is tried before backhaulTo and backhaul; after the observer defer and main's hard and probe checks, a verified hop with a valid fill assertion is answered by serveAssetFillForHop; after the upgrade branch and before gzip and the shared cache, the local catch (serveAssetLocal); the observer defer skips only the usage meter for an acknowledged home fill (out.unbilled); the new reads live in the new units of the edge-asset-cache-3-decisions overlay; the same route row and read sites (25); no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: straight after lookupUpstreamPath it calls regionalGate (regional.go), which for an entry built from a regional_domains row answers 503 to a hop or a deny entry before any arm that can leave the box (the exact-home backhaul, the far asset catch, the door dial, the miss backhaul), and lets a star match through only to the exact-home arm when ExactHome names another box for that distinct exact name; after the exact-home arm a regional deny entry the arm did not answer is refused (regionalRefuse, 503); refusals only, on the route map the edge already holds; read sites unchanged (25);rev3=census-ruling-static-headers;basis=the shared response cache is no longer looked up or filled for a static-kind route: one more read of the route row the edge already resolved (up.route.Kind == "static") in the cacheable expression; a refusal only, nothing new opened or followed;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2 (N-HA10): one call, frontForwardHA, right after the route lookup's !ok block and before the login POST; same reads;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4: loginPost and cacheable treat a forward row as not this box's to answer (IsForward(), +whole:Route x2): no login form and no shared cache for a forward host. Serving only.;rev3=census-ruling-tunnel-websockets;basis=Deletes the Carlos-Upgrade marker header from incoming requests and puts the upgrade admission (host, path, the entry tenancy, all in hand) on a tunnel arm request. For a login POST on an ungated ArmTunnel row it reads the visitor request body (bounded by gate.MaxFormBody, 413 past it; a request body, not a file) and resolves next against the entry Reload built (Gate, Route); the bytes pass on only when loginPassesThrough holds (spec 7, Tasks 3, 5 and 6).;rev3=census-ruling-console-protection-tab;basis=one more call in the observer defer, observeGuardCount(up.route, out), beside the observeRecords call that files the guard Match: it passes on the route row the defer already holds (+whole:Route) and the request outcome to the usage meter, which counts the check in memory. Called whether or not the request was unbilled, as observeRecords is. Nothing is opened, read or followed; no new kind of read; no check, refusal or serving decision changes.;rev3=census-ruling-probe-burst-limit;basis=answers a probe-burst notice POST (serveBurstNotice) ahead of every route for a non-door caller; builds the guard state for up.route and stamps its account and app (RouteAccount, App) for the cool-down's this-app/other-app label; for a catalogue match on a non-static or tunnelled route, offers the burst rule (in-memory limiter, burstDecide: 429 or a watch verdict, never a block for a fleet or forward row); the observer defer calls noteBurst(up.route, ...); the added sites are the route value already in hand (+registry:App, +whole:Route x5); no new root read or write kind;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): parses the request's query once (stripHoldMarker) to record the carlos_hold=1 mark in the request context; calls classifyHold on the upstream already resolved from the loaded map (the +whole:Route is that in-memory Route), including a second pass for a login POST; gives a marked request on a door-refused route the plain 404; adds the hold branch (planThrottleAdmit, rateAdmit, serveHeld) after the gate; and excludes marked requests from the shared cache. Reads only the request and the already-loaded upstream map; no registry or bucket read added.;rev3=census-ruling-stateless-coordinator-route;basis=P24: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy; no new read sites. file:ReadAll@15122,registry:App@21220,registry:Gate@14096,registry:Gate@25611,registry:Gate@25671,registry:Gate@25729,registry:Host@25714,registry:ImportGate@33114,registry:Kind@20082,registry:Kind@23520,registry:Kind@33056,registry:Kind@33085,whole:Route@13991,whole:Route@14102,whole:Route@17644,whole:Route@18102,whole:Route@18294,whole:Route@20085,whole:Route@21146,whole:Route@21212,whole:Route@21223,whole:Route@21476,whole:Route@21571,whole:Route@21647,whole:Route@21691,whole:Route@21993,whole:Route@22023,whole:Route@23523,whole:Route@23808,whole:Route@25614,whole:Route@25674,whole:Route@25717,whole:Route@25732,whole:Route@26650,whole:Route@28713,whole:Route@33059,whole:Route@33088,whole:Route@33117,whole:Route@33149,whole:Route@34997 e12598172e9f86cea011254c1b84f83afa417f7a8cc57c3332f1495c468894e8
-internal/rollout/scheduler.go scheduler.done legacy accepted-legacy accepted-legacy;rev3=J1,J4;basis=route-and-input;rev3=census-ruling-stateless-coordinator-route;basis=Records console-unreachable against the current scheduler revision and suppresses duplicate abandoned logs (client logs reachability transitions); no new read sites or failure-book authority. file:Exec@5205,whole:Route@8412,whole:Route@8670,whole:Route@8828,whole:Route@8900,whole:Route@9019 c4baec1d6a6eba2de70ece855387f4a4c8da38d15575819c2ad42fbf10d679d1
+internal/edge/edge.go Edge.ServeHTTP legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with the import gate checked after the door's scope and a gated row left out of the response cache; serving only;rev3=census-ruling-edge-request-records;basis=one more call in the observer defer, observeRecords(up.route, ...), passing on the route the defer already holds; no new kind of read;rev3=census-ruling-design-edge-rate-limit-358;basis=calls rateAdmit twice, and an admitted request holds a slot on both paths: on the upgrade path before the activator or proxy (the handshake holds its slot through slotWriter, given back at the first final answer or at the reverse proxy's hijack on a 101, so an open WebSocket is not counted; released by a defer), and on the ordinary path after the response-cache check and before the activator and proxy (an admitted request holds a slot through slotWriter, released by a defer); a refusal is a 429 written there and returns; the upgrade path's comment now names slotWriter as its one wrapper; one comment on the door mark reworded; read sites unchanged (22: main's 21 plus edge-request-records' observeRecords pass of the route), offsets moved; no read added;rev3=census-ruling-plans-4c-box-throttle;basis=calls planThrottleAdmit before the response cache, and on an upgrade trackUpgrade then planUpgradeAdmit (plans 4c, Astra findings 1 and 2); the new reads live in those units (plans-4c-units decision). The same read sites here.;rev3=census-ruling-plans-4d-lapse;basis=calls planDisabledAdmit right after the import gate, passing the final upstream's route and the request host; a turned-off route gets the fixed disabled page before the meter, gate, cache and activator (plans 4d). The new read lives in that unit (plans-4d-units decision); one more whole-row pass here.;rev3=census-ruling-edge-protection-2;basis=runs the guard, a pure in-memory matcher on r.URL.Path and RawQuery (internal/edgeguard), once per request after the meter and observer defer and before the password gate, the upgrade branch, the cache and the activator, for a request that is not a door call, a backhauled door hop or a tunnel delivery; a matched block answers a 404 itself through guardDecide; the two new sites are one expression, up.route.Kind == "static" (a static route this box serves checks only the hard tier here and leaves the probe tier to serveTree), a read of the route row the edge already resolved; no new kind of read;rev3=census-ruling-edge-asset-cache-3;basis=the asset cache's three hooks (asset cache plan 3): the request's reserved asset headers are deleted at entry (the fill assertion kept only beside a verified hop); on the exact-remote and lookup-miss branches the far catch (serveAssetFar) is tried before backhaulTo and backhaul; after the observer defer and main's hard and probe checks, a verified hop with a valid fill assertion is answered by serveAssetFillForHop; after the upgrade branch and before gzip and the shared cache, the local catch (serveAssetLocal); the observer defer skips only the usage meter for an acknowledged home fill (out.unbilled); the new reads live in the new units of the edge-asset-cache-3-decisions overlay; the same route row and read sites (25); no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: straight after lookupUpstreamPath it calls regionalGate (regional.go), which for an entry built from a regional_domains row answers 503 to a hop or a deny entry before any arm that can leave the box (the exact-home backhaul, the far asset catch, the door dial, the miss backhaul), and lets a star match through only to the exact-home arm when ExactHome names another box for that distinct exact name; after the exact-home arm a regional deny entry the arm did not answer is refused (regionalRefuse, 503); refusals only, on the route map the edge already holds; read sites unchanged (25);rev3=census-ruling-static-headers;basis=the shared response cache is no longer looked up or filled for a static-kind route: one more read of the route row the edge already resolved (up.route.Kind == "static") in the cacheable expression; a refusal only, nothing new opened or followed;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2 (N-HA10): one call, frontForwardHA, right after the route lookup's !ok block and before the login POST; same reads;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4: loginPost and cacheable treat a forward row as not this box's to answer (IsForward(), +whole:Route x2): no login form and no shared cache for a forward host. Serving only.;rev3=census-ruling-tunnel-websockets;basis=Deletes the Carlos-Upgrade marker header from incoming requests and puts the upgrade admission (host, path, the entry tenancy, all in hand) on a tunnel arm request. For a login POST on an ungated ArmTunnel row it reads the visitor request body (bounded by gate.MaxFormBody, 413 past it; a request body, not a file) and resolves next against the entry Reload built (Gate, Route); the bytes pass on only when loginPassesThrough holds (spec 7, Tasks 3, 5 and 6).;rev3=census-ruling-console-protection-tab;basis=one more call in the observer defer, observeGuardCount(up.route, out), beside the observeRecords call that files the guard Match: it passes on the route row the defer already holds (+whole:Route) and the request outcome to the usage meter, which counts the check in memory. Called whether or not the request was unbilled, as observeRecords is. Nothing is opened, read or followed; no new kind of read; no check, refusal or serving decision changes.;rev3=census-ruling-probe-burst-limit;basis=answers a probe-burst notice POST (serveBurstNotice) ahead of every route for a non-door caller; builds the guard state for up.route and stamps its account and app (RouteAccount, App) for the cool-down's this-app/other-app label; for a catalogue match on a non-static or tunnelled route, offers the burst rule (in-memory limiter, burstDecide: 429 or a watch verdict, never a block for a fleet or forward row); the observer defer calls noteBurst(up.route, ...); the added sites are the route value already in hand (+registry:App, +whole:Route x5); no new root read or write kind;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): parses the request's query once (stripHoldMarker) to record the carlos_hold=1 mark in the request context; calls classifyHold on the upstream already resolved from the loaded map (the +whole:Route is that in-memory Route), including a second pass for a login POST; gives a marked request on a door-refused route the plain 404; adds the hold branch (planThrottleAdmit, rateAdmit, serveHeld) after the gate; and excludes marked requests from the shared cache. Reads only the request and the already-loaded upstream map; no registry or bucket read added.;rev3=census-ruling-stateless-coordinator-route;basis=P24/P25: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy only for an unescaped, already-clean path; malformed forms remain on the hub. No new read sites. file:ReadAll@15175,registry:App@21273,registry:Gate@14149,registry:Gate@25664,registry:Gate@25724,registry:Gate@25782,registry:Host@25767,registry:ImportGate@33167,registry:Kind@20135,registry:Kind@23573,registry:Kind@33109,registry:Kind@33138,whole:Route@14044,whole:Route@14155,whole:Route@17697,whole:Route@18155,whole:Route@18347,whole:Route@20138,whole:Route@21199,whole:Route@21265,whole:Route@21276,whole:Route@21529,whole:Route@21624,whole:Route@21700,whole:Route@21744,whole:Route@22046,whole:Route@22076,whole:Route@23576,whole:Route@23861,whole:Route@25667,whole:Route@25727,whole:Route@25770,whole:Route@25785,whole:Route@26703,whole:Route@28766,whole:Route@33112,whole:Route@33141,whole:Route@33170,whole:Route@33202,whole:Route@35050 9942d7d2bf987fbb9c8432f983c18875f69ba49748455709426882fae32c9933
+internal/rollout/scheduler.go scheduler.done legacy accepted-legacy accepted-legacy;rev3=J1,J4;basis=route-and-input;rev3=census-ruling-stateless-coordinator-route;basis=P25: classifies the preserved SwapResult.Err with errors.Is, including wrapped console-unreachable causes, to record the current scheduler revision and suppress duplicate abandoned logs. Diagnostic text no longer grants this classification. No new read sites or failure-book authority. file:Exec@5205,whole:Route@8410,whole:Route@8668,whole:Route@8826,whole:Route@8898,whole:Route@9017 be7a510e4735ea1770f9ef9e5c24e20d8991e826931ef6daab943428c866bda9
internal/edge/replicaconsole.go Edge.serveReplicaConsole legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-coordinator-route;basis=Reads existing in-memory route fields to select a unique accountless console.service local upstream; refuses missing or ambiguous console, tenant routes, remote and tunnel upstreams. Reuses proxy and version wrapper; leaves fleet identity authentication at console. registry:Account@237,registry:App@257,registry:Host@178,registry:Socket@355,registry:Unit@280,whole:Route@159 dc98dc841eb2dc9b7f8f1e4a63a4b875c69c384b1af97ebfc5b563691362fa70
@coverage . 7e95942f29f593fab48b5c9759c445ab95481b6c9bc89ba80347c447b163745f
-@coverage internal/edge 50254727dda8a006aed510f1a6a4ba5b66f47d26545f9c43419619b9e0e4e83d
-@coverage internal/host 0a5f65dc51c1d39bd46b4e30890d388ae87bcb8d6d272e20790aefe831a0bd8c
+@coverage internal/activator 4f67e6cfdb9ec5b7047f78400eb112f1518eb31a9c4a57893d57d48348bc6a4b
+@coverage internal/edge 9073920441c6cc3959c7c799f946efaa086f792f16aa6dcf1de78f0c66ae7c2f
+@coverage internal/host 80e56e53aa89d66d94a632b610ea3b6259a33dd3ff6b22ffdaa26db4da389231
@coverage internal/replicas f76f8a259d2d13f0225975171e6d97df4eec49eab6cb9d794e411500b0c91796
-@coverage internal/rollout 09a74e8e7e0b325629d522e3b25cae63cc659295abcb5135a02462da470ac5d6
+@coverage internal/rollout 8df1b67e05ffb20872edc17e263385cb0119a44575f2e238cbd57485090cec80
diff --git a/internal/rollout/fake_test.go b/internal/rollout/fake_test.go
index 95a2529cb..f6e5c20d7 100644
--- a/internal/rollout/fake_test.go
+++ b/internal/rollout/fake_test.go
@@ -46,7 +46,8 @@ type fakeAct struct {
mode activator.SwapMode
// reason, when set, is a failed Swap's diagnostic text in place of
// "health check failed".
- reason string
+ reason string
+ resultErr error
// onHeldPublish, when set, runs on every PublishHeldServing: a test's
// view of the moment the scheduler releases a held worker publication.
onHeldPublish func(host string)
@@ -225,7 +226,10 @@ func (f *fakeAct) Swap(_ context.Context, a activator.Attempt, newest func(strin
if f.reason != "" {
reason = f.reason
}
- return activator.SwapResult{Outcome: out, Reason: reason, Mode: f.mode, Executed: executed}
+ if f.resultErr != nil {
+ reason = f.resultErr.Error()
+ }
+ return activator.SwapResult{Outcome: out, Reason: reason, Err: f.resultErr, Mode: f.mode, Executed: executed}
}
f.n++
g := activator.Gen{N: f.n, Build: a.Build, StagedPath: a.StagedPath, Digest: a.Digest, Demand: a.Demand}
diff --git a/internal/rollout/scheduler.go b/internal/rollout/scheduler.go
index 1d6c7d1c7..f14a6c08a 100644
--- a/internal/rollout/scheduler.go
+++ b/internal/rollout/scheduler.go
@@ -347,7 +347,7 @@ func (s *scheduler) done(d dispatch, res activator.SwapResult, mode activator.Sw
h := s.q.hosts[d.ID.Host]
if h != nil && h.buildRev == d.SchedRev {
h.consoleUnreachableRev = 0
- if res.Outcome == activator.SwapAbandoned && res.Reason == replicas.ErrConsoleUnreachable.Error() {
+ if res.Outcome == activator.SwapAbandoned && errors.Is(res.Err, replicas.ErrConsoleUnreachable) {
h.consoleUnreachableRev = d.SchedRev
}
}
@@ -423,7 +423,7 @@ func (s *scheduler) done(d dispatch, res activator.SwapResult, mode activator.Sw
m.emit(rt, EvConfigPending, "warn", textConfigPending(reasonWord(res.Reason), cfgWait))
}
case activator.SwapAbandoned:
- if res.Reason == replicas.ErrConsoleUnreachable.Error() {
+ if errors.Is(res.Err, replicas.ErrConsoleUnreachable) {
return
}
m.d.Logf("rollout: %s: %s attempt onto %s abandoned: %s", d.ID.Host, d.ID.Cause, d.ID.Build, res.Reason)
diff --git a/internal/rollout/status_test.go b/internal/rollout/status_test.go
index 2feef415f..3d6cc73a1 100644
--- a/internal/rollout/status_test.go
+++ b/internal/rollout/status_test.go
@@ -2,6 +2,7 @@ package rollout
import (
"context"
+ "fmt"
"runtime"
"strings"
"sync"
@@ -371,7 +372,7 @@ func TestStatusCallsAHostThatJoinedAfterTheNamesWereReadTransient(t *testing.T)
func TestStatusReportsConsoleUnreachableUntilRecovery(t *testing.T) {
h := newHarness(t, "a")
h.stage("v2")
- h.act.reason = replicas.ErrConsoleUnreachable.Error()
+ h.act.resultErr = fmt.Errorf("acquire coordinator: %w", replicas.ErrConsoleUnreachable)
var recovered atomic.Bool
h.act.outcome = func(activator.Attempt) activator.SwapOutcome {
if recovered.Load() {