carlos / platform Public

stateless-coordinator-route

No handoff yet. An agent working here writes one with amadan branch handoff, so that whoever picks the branch up next — a person, or another agent on another machine — can start without reading the whole history.

Recently

Human

<task-notification> <task-id>bw5l7btpm</task-id> <tool-use-id>toolu_01FiyJpo9VQQ79XVsRePPZXg</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/7c5a7d70-0e28-42b9-896c-5d73b2d2a05d/tasks/bw5l7btpm.output</output-file> <status>completed</status> <summary>Background command "Push the merge and wait for CI" completed (exit code 0)</summary> </task-notification>

Human

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

Human

<paseo-system version="1" kind="agent-message" source-agent-id="335399d5-3ec5-4e92-ae37-08e6aaae74c8" message-id="1698aadc-81dd-4932-8ec1-d2dab447666d"> From Paul (2026-11-04 ~01:05Z, relayed by platform-83): &apos;Go.&apos; Merge Plan 2 as you proposed. Right before merging, re-check that origin/main is still an ancestor of e9cd5fc7; if main moved, merge it in and wait for CI first. Then: amadan branch merge carlos/platform stateless-replicas-2-placement -squash -expect e9cd5fc752037804690ac8fa0a002b2a4252663f with a short subject and a body. Not released. Record the go as a ledger ruling, then carry on with the Plan 1 dev smoke (v0.34.0 is on dev since 21:06:21Z) and Plan 3. </paseo-system>

Human

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

Human

<task-notification> <task-id>a0f77aab818303732</task-id> <tool-use-id>toolu_01Pr2pZWrDsG22eLbeeTX3k8</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/7c5a7d70-0e28-42b9-896c-5d73b2d2a05d/tasks/a0f77aab818303732.output</output-file> <status>completed</status> <summary>Agent "Re-review coordinator-route fix round" 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>### Item verdicts - **(a) ADDRESSED.** `internal/host/replicacoordinator.go:100` now treats only these as `ErrConsoleUnreachable`: a status of 500 or higher, a response without `X-Carlos-Version`, or a transport error (line 97). A marked 404 falls through to `ErrFenced` (line 116). In the table test at `internal/host/replicacoordinator_test.go:564-565`, an unmarked "hub 404" gives unreachable and a marked "console 404" gives `ErrFenced`. The real-console test at `replicacoordinator_test.go:92-95` sends a wrong fleet token and asserts the marked 404 comes back `ErrFenced` and not unreachable. Marked 409 and the 429/408 transient cases are unchanged. - **(b) ADDRESSED.** `internal/edge/edge.go:1931` forwards only when all of these hold: the method is POST, `RawPath == ""`, `path.Clean(p) == p`, and the path has the `/api/fleet/replicas/` prefix. Anything else falls through to the hub branch as before. `internal/edge/replicaconsole_test.go:58-62` covers all five requested paths, each expecting a 404 and no console hit. The guard only narrows the old condition, so nothing that previously stayed on the hub is forwarded now. - **(c) ADDRESSED.** `SwapResult.Err` (`internal/activator/swap.go:74`) is set by `abandon`/`failSwap` (lines 116-121). Both classifications in `internal/rollout/scheduler.go:350` and `:426` use `errors.Is(res.Err, replicas.ErrConsoleUnreachable)`. `swap_error_test.go` proves two things: a wrapped sentinel survives, and an error with the same text but a different identity does not match. `status_test.go:375` now drives recovery with a wrapped cause. Status still emits the canonical text from typed state (`status.go:136-137`). - **(d) ADDRESSED.** SR-1-C14 is in `docs/superpowers/plans/2026-11-01-stateless-replicas-copy.md:33`. It points at `internal/replicas/types.go`, where the literal is defined (line 44), with the text `console unreachable` and status "approved provisionally (controller ruling P25; for Paul's copy review)". It is in `statelessReplicaBuiltCopy`, so the built, applied and no-em-dash gates cover it. The deck has no em dashes (grep count 0). It still needs Paul's copy review before it counts as fully approved. ### New breakage in the fix diff None found. - Every `SwapResult` literal built in the scheduler (`scheduler.go:118/137/154/164/204`) leaves `Err` nil. None of them carried console-unreachable before (the reasons are fixed strings, or a staging `resolve` error), so moving off text matching loses no case. - Tenant-chosen text equal to "console unreachable" can no longer set the flag, which is a small improvement. - Wrapped causes, for example through `prepareStatelessEscrow`'s `refuse` wrapper, are now classified as intended. - I found no JSON or wire use of `SwapResult`, so the new interface field cannot break a serialised shape. ### Census | unit / envelope | change | verdict | |---|---|---| | `internal/edge/edge.go` `Edge.ServeHTTP` | body: a stricter guard before forwarding | Approve. It reads only the parsed request path. It is narrower than the approved P24 body, adds no read sites, and opens, runs, queries or follows nothing a tenant, app or box agent can name. | | `internal/rollout/scheduler.go` `scheduler.done` | body: `errors.Is` on an in-memory error | Approve. It adds no read sites and gets no new failure-book authority. Diagnostic text, which a tenant can influence, no longer grants the classification. | | envelope `internal/activator` (new) | `abandon`/`failSwap` keep the error; one struct field | Approve. Only an in-memory value is carried. There are no reads. | | envelopes `internal/edge`, `internal/host`, `internal/rollout` (re-pinned) | the changes above, plus the host fix for item (a) (status and header checks on a response) | Approve. No new reads. | | envelopes `.`, `internal/replicas` | unchanged pins | Approve. | | `internal/edge/replicaconsole.go` `Edge.serveReplicaConsole` | unchanged since the approved 7d072d77 (same fingerprint) | Approval stands. | On the chain: the branch's `plan14-root-reads-chain.tsv` equals origin/main's file (merge base f18da984) plus one final line for this overlay, after main's last `region-ha-followups` line. The seal moves from `cfb026f1…c387` to `b129397d033dff1da950da3c6879132d003191c81d282de250ff72dff7444020`. My focused run of `TestPlan14RootReadCensus$` passed. Census: APPROVED at 92b24a7d (seal `b129397d033dff1da950da3c6879132d003191c81d282de250ff72dff7444020`) I could not re-run the root-package copy tests myself. The test harness refuses a TMPDIR under home, and the sandbox makes `/tmp/g` read-only. I relied on the report's passing run and on reading the gate code, which does cover the new row. ### Verdict **Ready to merge?** Yes. All four P25 items are fixed and the census is approved; SR-1-C14 still waits on Paul's copy review.</result> <usage><subagent_tokens>71282</subagent_tokens><tool_uses>19</tool_uses><duration_ms>161209</duration_ms></usage> </task-notification>

Human

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

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>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>