carlos / platform Public

alias-socket-follow-338: Astra review brief, round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev ae549c5f2d0af2fb9aecb7fda9698897f0e7267c parent dcd8cde
1 file changed, +121 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-socket-follow-338.md +121 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-socket-follow-338.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-socket-follow-338.md
new file mode 100644
index 000000000..97759139d
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-alias-socket-follow-338.md
@@ -0,0 +1,121 @@
+# Review brief: branch alias-socket-follow-338, round 1 of 3
+
+Repo carlos/platform, branch `alias-socket-follow-338`, commit dcd8cde331f708657620a72ee7f29b35964df2bd.
+Under review: the diff `78c23655e35b1914386f4dd9a59c3e2c48c0f9ed..dcd8cde331f708657620a72ee7f29b35964df2bd` (`git diff origin/main...HEAD`).
+Authorities: AGENTS.md on main (stopping rules, the census); amadan
+discussions #338 and #392 (the fault). Do not review against unmerged
+branches; if this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer. Read the diff, then the code it touches
+and calls, and check every claim against that code.
+
+## The change
+
+A platform alias (`Route.Platform`, minted by internal/domains/reconcile.go
+`mintedRoute`, the `<app>.<sqid>.<apps-domain>` apex) copies its source
+route's socket once. The layout pass (internal/layout) moved instance rows
+from `/run/carlos/<host>.sock` to `/run/carlos/instances/<id>/app.sock`
+through `registry.SetInstancePaths` and never touched the aliases, so
+seven flagship aliases name a socket that does not exist and answer 502.
+
+1. internal/registry/aliassocket.go, registry.go: `SetInstancePaths` and
+ `Upsert` (for a non-platform, non-sidecar row with an app and a socket)
+ now run in one BEGIN IMMEDIATE transaction that also moves the same
+ tenant's platform rows (same effective account, same app) naming the
+ row's previous socket (Upsert: only if the previous row was the same
+ tenant) or its other-layout socket (`LayoutSibling`) to the row's
+ socket. Every other Upsert keeps the old single statement.
+2. internal/host/aliassocket.go: `repairPlatformAliases`, run by the
+ agent's domainsLoop after StampHealth on every platform box, every
+ tick: a platform row whose socket does not exist (Lstat, ModeSocket)
+ is repointed at the live socket of the one same-tenant route whose
+ other-layout socket it names, through `Registry.RepointPlatformSocket`,
+ which re-checks the tenant and the sibling relation in its own
+ transaction (agent handle only; refuses on a remote handle).
+3. internal/host/layoutleg.go: `carlos status --layout` names a platform
+ row `alias` (it was `external`, which also tripped the console's mixed
+ warning), with a reason when its socket does not exist. The console's
+ `layoutMixed` ignores unknown words already; a test pins it.
+4. Census: overlay `plan14-root-reads-alias-socket-follow-338`, card
+ docs/superpowers/notes/census-proposal-alias-socket-follow-338.md;
+ 9B8 inventory row for `LayoutSibling` (plan9_b8_census_test.go).
+
+## Fixed: do not re-argue
+
+- Paul approved building this box fix on 2026-10-26 ("Build the box
+ fix"). An apex on two boxes is by design (#392).
+- Out of scope, already reported as follow-ups: an alias whose source row
+ is gone from the box (moved away) stays stale and is logged; an alias
+ row has Hibernate false, so the edge never wakes a sleeping source
+ through it (pre-existing, internal/edge/edge.go:943).
+- Copy (the `alias` word, its reason, the cli.md sentence) is approved by
+ delegation; do not review wording.
+
+## What to check
+
+1. Tenant boundary (the invariant): no path in the diff ever points a
+ platform row at a socket of a row of another effective account or
+ another app: the SQL in `carryAliasesTx`, `RepointPlatformSocket`,
+ the repair's selection, the re-tenanted-host case in Upsert, legacy
+ rows with an empty or invalid account (EffectiveAccount).
+2. Upsert's semantics for every caller: the ON CONFLICT statement and its
+ claim-ownership refusal (ErrClaimOwnership must still leave nothing
+ written), normalizeRoute, the remote path (root's registry child runs
+ the same code), single-connection pool and BEGIN IMMEDIATE (deadlock
+ or SQLITE_BUSY risk for callers that already hold the connection or a
+ transaction, e.g. WithHoldsFrozen, claim transactions, import swap).
+3. `SetInstancePaths`: the CAS and its error texts unchanged; the carry
+ atomic with it; a missed CAS carries nothing; journal recovery
+ (internal/layout/pass.go recoverHost) gets the carry too.
+4. `LayoutSibling` against provision.DefaultSocket/NestedSocket/InstanceID
+ (the duplicate is pinned by internal/provision/layoutsibling_test.go);
+ odd inputs (hosts with dots only, long hosts, relative or unclean
+ paths).
+5. The repair: correctness, idempotence, races with a concurrent layout
+ move or Upsert, log volume on a box with many stale rows, cost per tick.
+6. Does anything else read a platform row's socket and depend on it not
+ changing (hostbox, claims, edge, appconfig syncexec, status, console)?
+7. Tests: are they production-wired where they claim (the layout test
+ drives the real Pass and registry), and do they fail when the
+ mechanism is removed?
+
+## Census
+
+Give a verdict for every unit and both re-pinned envelopes on the card
+(docs/superpowers/notes/census-proposal-alias-socket-follow-338.md), and
+for the new 9B8 inventory row, per AGENTS.md "The census": 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
+root relies on; if a new disposition is wrong for the unit's reads; or if
+the diff cannot settle any of these. Otherwise approve. Cite the lines
+you read.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work.
+ Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The
+ census, and review of any newly changed security, root, termination
+ or production-storage behaviour, still check the fix; see AGENTS.md,
+ "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for
+ another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not
+raise a P2 to P1 to keep the review open.
+
+## Output
+
+Census verdicts first. Then findings ranked P1, P2, P3. Each gives the
+section, the problem, the evidence (file:line, verified), the failure
+scenario, a concrete fix and the invariant or trust boundary it breaks
+(that is its fault family). End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another
+ round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.