carlos / platform Public

edge-roll-blip: overnight brief (#434 part B)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev eaa96328d21b12696b1240c5de2d6a9a5b10cdbc parent 080ce59
1 file changed, +117 −0
  • .superpowers/sdd/2026-10-27-edge-roll-blip/BRIEF.md +117 −0

CI passed — run details

Intent

Human

I think we can go ahead and build this overnight

diff --git a/.superpowers/sdd/2026-10-27-edge-roll-blip/BRIEF.md b/.superpowers/sdd/2026-10-27-edge-roll-blip/BRIEF.md
new file mode 100644
index 000000000..d214e2d3f
--- /dev/null
+++ b/.superpowers/sdd/2026-10-27-edge-roll-blip/BRIEF.md
@@ -0,0 +1,117 @@
+# Overnight brief: edge-roll-blip (#434 part B)
+
+Paul, 2026-10-27: "I think we can go ahead and build this overnight." Finish line he chose:
+**merge-ready, no merge, no roll.** Read amadan discussion #434 (carlos/platform) first;
+it is the problem statement.
+
+## Goal
+
+A platform roll (`carlos system update` restarting `carlos-edge.service`, and root's adopt
+restarting `console.service`) must become a short queued wait for clients. No refused
+connections, no 502/503 from the restart itself. Today:
+- the edge opens :80/:443 itself, so between stop and start connections are refused;
+- the console restarts once per roll, giving ~10 s of 502 through the edge.
+
+## Scope
+
+IN (part B):
+1. **Edge listeners survive a restart.** The kernel keeps accepting on :80/:443 (and any
+ other public port the edge binds; find them all) while the old edge exits and the new one
+ starts. Candidate mechanisms: a `carlos-edge.socket` unit, or systemd's fd store
+ (`FileDescriptorStoreMax=`, `sd_notify FDSTORE=1`, `FileDescriptorStorePreserve=`). The
+ spec picks one with evidence. Verify the boxes' systemd version (find the AMI / OS in
+ infra/ or the bootstrap code) and the exact semantics of an explicit
+ `systemctl restart` / `stop`+`start` for each mechanism, from systemd's own docs.
+2. **The console no longer 502s while it restarts.** Prefer an edge-side hold: when the
+ edge's dial to a local upstream (console, and any other named-unit / proxied local
+ upstream; it is a general-purpose platform, so no console special case unless forced)
+ fails with refused / no such socket, retry the dial for a bounded window instead of
+ 502ing. A failed dial never reached the upstream, so the retry is safe for any method.
+ Bound it by the request context and a cap in line with the existing wake hold.
+ Socket-activating console.service instead is acceptable only if console's unit lives in
+ this repo and the spec shows it's simpler.
+3. **Local witness, no cloud.** A test or script that restarts a socket-activated edge
+ under load and counts refused/failed requests (0 is the pass). Use what DOCS-T1 offers
+ without sudo: `systemd-socket-activate`, `systemd-run --user`, or a Go test that passes
+ fds the way `testdata/echoapp` and `internal/instancectl/peer_linux.go` already do.
+ Report the measured gap.
+4. A startup log line saying how the edge got its listeners (inherited N from systemd, or
+ bound itself), so the morning roll can be verified from the journal.
+
+OUT: part C (apps surviving an edge restart; it touches region HA's BindsTo/lease premise,
+#440 item 1, so it waits: AGENTS.md stopping rule 4). Any AWS, infra, DNS or box change.
+Releasing, rolling, merging. Dev box measurement (Paul decides that in the morning).
+
+## The hard part: every binary/unit mix must serve
+
+The old edge binds :80 itself. If a socket unit (or a stored fd) holds :80 and an OLD binary
+starts (rollback, the 20 s update gate failing, `carlos-system-recover.service`, a box whose
+updater predates this), it gets EADDRINUSE and the box goes dark. The spec must walk every
+mix: old binary + old units, new + old, new + new, old + new (rollback), first install,
+bootstrap of a fresh box, and the update gate's own rollback path. Find out how units get
+onto a box (embedded `internal/host/units`, who installs them, when, as root?) and how the
+updater restarts the edge. Prefer "refuse up front" (AGENTS.md rule 2 alternatives) over
+tolerance layers. If no mechanism is safe across rollback, say so and stop with options for
+Paul rather than building a risky one.
+
+Also cover: graceful stop must not shut down the shared listener for the successor (closing
+an inherited fd copy is fine; anything that empties the backlog is not); the #281
+listen-first + admission latch interaction; TLS/cert readiness before accepting; the
+`RestrictAddressFamilies`/capability hardening of the unit; cross-compile (darwin/windows
+CI: linux-only code needs `//go:build linux` and a stub).
+
+## Process (AGENTS.md "Stopping rules" bind you and every reviewer you brief)
+
+You are the controller. Keep your own context lean: dispatch children for the heavy work
+and dispatch them in the FOREGROUND (`run_in_background: false`), never background, or the
+root session stalls.
+
+1. **Spec** (child, Opus): `docs/superpowers/specs/2026-10-27-edge-roll-blip-design.md`.
+ Short. No user questions; Paul's decisions are above. Note each decision and why.
+2. **Spec review: Astra** (codex, OpenAI quota). Brief from
+ `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, committed beside the spec. Stop at
+ the first round with no P1. Max three rounds. If rule 2 triggers (same fault family twice)
+ or round 3 still has a P1: stop, post the choice on #434, and write it in the handoff.
+3. **Plan** (child): `docs/superpowers/plans/2026-10-27-edge-roll-blip.md` via
+ superpowers:writing-plans. No separate plan review unless the spec review changed the
+ mechanism late. Add one amadan task per plan task (`amadan task add`) and advance each as
+ it closes.
+4. **Build**: superpowers:subagent-driven-development. Per-task Astra review only for tasks
+ touching root, unit install/update/rollback, or termination (rule 3). Everything else is
+ covered by one whole-branch Astra review at the end (same round limits).
+5. **Census**: if the census check fails, follow AGENTS.md / README's census recipe
+ (census-card, CLAIMS, census-propose); the cross-model reviewer (Astra) approves. Never
+ ask Paul for a census ruling.
+6. **Finish**: merge origin/main in, push, wait for branch-tip CI green (re-run once on a
+ known flake and say so). Then `amadan branch handoff`, a reply on #434 with results and
+ the measured gap, and the morning steps for Paul (merge, release, dev-first roll, what
+ to look for in the journal).
+
+## Codex (Astra) mechanics
+
+- Script file per run; launch with the sandbox OFF via `setsid nohup <script> > log 2>&1 &`.
+ Within 20 s check the log exists and grows, and `pgrep -af "codex exec"` shows it.
+- `codex exec -s read-only -c model_reasoning_effort="high" -c 'sandbox_permissions=["disk-full-read-access"]' -o <findings.md> "<prompt>" </dev/null`
+ (always `</dev/null`). Read the header: if reasoning effort says none, restart.
+- Every Codex brief says: do not spawn Anthropic-model subagents or reviewers.
+- Commit the brief and the findings files unedited beside the spec. Verify every code
+ citation before accepting a finding.
+
+## House rules
+
+- Worktree: `.claude/worktrees/edge-roll-blip`, branch `edge-roll-blip`, identity
+ claude~paul@keymail.dev (check `git config user.email` before committing). Push often.
+- Tests: locally only the touched packages, with `-run` where possible; CI does the full
+ run. Never `make test`. Leave GOCACHE at its default. Scratch in `$TMPDIR`. Socket tests
+ may need a short TMPDIR (unix socket path length); see the repo's existing test helpers.
+- Never: `git worktree prune`, a bare `amadan branch merge`, `git stash` without a unique
+ tag, `git checkout -- <file>`, `pkill -f`, pattern deletes (`rm` with globs), `sudo`,
+ binding anything to 0.0.0.0 (use 127.0.0.1 in tests).
+- No tenant names in code, docs or examples (use shop, example.com).
+- User-facing copy: avoid adding any. Operator log lines and diagnostics don't need copy
+ review. If a member-facing string is unavoidable, collect it in the handoff for Paul's
+ morning copy review rather than blocking.
+- Usage limits: commit WIP, write a resume note in `progress.md` here, and stop. The root
+ session resumes you after the reset.
+- Ledger: keep `progress.md` in this directory current (phase, round history, decisions,
+ open items). It's the resume point.