Platform rolls as a queued blip: no 503s while the edge restarts Feature Requestopen
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 0f90d256 · claude-code/2.1.310 · DOCS-T1
Goal (Paul, 2026-10-26): rolling a platform release should be a short queued wait for clients, not ~10 s of 502/503. Moving every instance off a box for a roll is out of scope. That is region HA's job (separate session), and it's overkill for a planned restart.
Today
App deploys are already zero-downtime: overlap swaps have been armed on all flagship and dev boxes since 2026-10-14/15. A platform roll is not:
Edge ports close.carlos-edge.service opens :80/:443 itself. No socket activation or listener handoff. Each update is stop then start, so connections are refused in between. #281 (v0.27.1) shortened the gap: listen first, startup in the background behind the admission latch.
Every running instance dies. Sleeping-mode instances are the edge's children (Delegate=), and carlos-instance@ has BindsTo=carlos-edge.service. Each restarts cold on its next request.
The console gets one restart from root's adopt, about 10 s of 502 via the edge.
Proposed, in order
A. Measure first, on dev under load. How long are the ports closed, how long does the console 502, how long do cold wakes take? Not measured yet.
B. Small branch: queue, don't refuse. - Add carlos-edge.socket for :80/:443, so the kernel keeps accepting connections across the restart. The pattern already exists in carlos-instance-control.socket and carlos-app@.socket. - Have the edge hold console-bound requests while console.service restarts (as it already holds wakes), or socket-activate the console. Pick whichever is simpler after A. - Roll trap: the unit change must be safe under the old binary/new unit mix, and under rollback.
C. Separate spec: keep instances alive across an edge restart. - Drop BindsTo, and have the new edge re-attach to running generations (g<n>/app.sock) instead of cold-starting them. - Touches lease ownership at handoff (#292 territory), so coordinate with the region HA session.
Known limits
Requests in flight when the old edge stops still drain, and that drain adds to the wait.
Websockets and other long-lived connections drop regardless.
Paused for token budget. Pick up in a few days, starting with A.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 0f90d256 · claude-code/2.1.310 · DOCS-T1
Part B overnight: stopped at spec review round 2 (stopping rule 2). Paul's choice needed.
Branch edge-roll-blip, tip 58cf429e. Nothing built, nothing merged, nothing rolled.
Spec: docs/superpowers/specs/2026-10-27-edge-roll-blip-design.md. Mechanism: a carlos-edge.socket holds :80/:443, and the edge inherits them through LISTEN_FDS, or binds them itself when it gets none. The fd store was rejected: stop+start loses it by default, and on rollback it hands the stored listeners to an old binary. The edge also holds dials to local upstreams for 13 s instead of answering 502 (D10). Probed local routes wait for readmission instead of answering 503 (D10b). The console route can take either shape, so both are covered. Boxes run systemd 257 (Debian 13).
Review rounds (Astra)
R1 (CODEX-REVIEW-FINDINGS-edge-roll-blip-spec.md): NOT READY, 2 P1, 4 P2. - P1, rollback compatibility: recovery can rename the old binary in and then fail before it disables the socket, leaving an old edge behind an active socket (EADDRINUSE, box dark). - P1, restart admission: probed local routes still 503.
R2 (CODEX-REVIEW-FINDINGS-edge-roll-blip-spec-R2.md): NOT READY, 1 P1, 1 P2. All four R1 P2s resolved. - P1, same family as R1 P1 (rollback compatibility, INV-R): the new guard drop-in's shell line, systemctl stop … || ! systemctl -q is-active …, reads a failed status query as "socket inactive". That lets an old binary start behind a live socket. - P2, same family as R1's admission P1: the readmission allowance ignores the 2 s probe timeout and sequential probing.
The R2 fix itself is small: require an explicit manager answer before the guard passes. But this is the second round running in the same family, so rule 2 says stop and offer the choice. The root cause doesn't go away: rollback and recovery code in builds already on the boxes can't change, so every activation path has to defend against it.
Activation in the current spec is two-step on existing boxes. Only this build's root code writes the guard drop-in, so the next roll is the switch-over and the roll after it is the first with 0 refused. Fresh boxes get it at once.
Options
Fix INV-R in one place and prove it. The guard fails closed unless systemctl show reports the socket inactive/failed/not-found. Add a guard simulation that injects systemctl failures and every restoreFiles/installUnits failure point. Fix the D10b P2. Then spec round 3 (the last), plan and build. Root/unit risk stays in this branch.
Cut socket activation (cut the feature). Ship only the local-upstream hold (D10 + D10b with the P2 fix) and the listener log line. The console's ~10 s of 502 per roll becomes a held wait. The edge-restart gap stays at today's #281 size. No unit, root or rollback change.
Refuse up front. Ship option 2 now. Activate the socket in a later release that refuses (by version floor) any rollback or apply target older than the first socket-aware build, so old rollback code never meets the socket.
Recommended: 2 now, then 3. Option 2 is something you can see at the next roll (rule 6) and carries no rollback exposure. Option 3 removes the whole fault family instead of patching one guard line at a time.
No restart gap measured yet: the local witness was not built.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 0f90d256 · claude-code/2.1.310 · DOCS-T1
Ruling (Paul, 2026-10-28): option 2, then option 3.
Now (this branch): the local-upstream hold plus the startup log line. No socket unit, and no unit, root or rollback change. The spec is revised to that scope and goes to Astra round 3, the final round. If round 3 has a P1, stop and bring Paul a cut; no fourth round.
Later, as its own slice after option 2 ships:carlos-edge.socket, in a release that refuses any rollback or apply to a build older than the first socket-aware one.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 0f90d256 · claude-code/2.1.310 · DOCS-T1
Part B, option 2: MERGE-READY. Branch edge-roll-blip, tip e6f90eaf, CI passed. Not merged, released or rolled.
What it does
Local upstreams are held, not 502'd. A loopback TCP upstream that refuses, or a unix upstream whose socket refuses or is missing, is redialled every 100 ms for up to 13 s (localDialHold). One deadline is fixed when the dial starts and bounds every attempt. Unix upstreams already had this window, and now share the same code. Non-local upstreams are unchanged.
Probed routes with a local upstream wait for readmission, not 503. The edge never dials an ejected upstream; only the prober readmits it. The hold is min(13 s + R, 30 s), where R is the prober's real readmission time: sequential probes, 2 s probe timeout, rise_after. That is 19 s with defaults.
Startup line. The edge now binds before it serves and logs edge: listeners: bound http <addr> and https <addr> itself (flags ...).
No unit, root, updater or rollback change. No socket unit.
Local witness (TestLocalUpstreamRestartWitness, runs in CI). Eight workers send load through the real edge on 127.0.0.1 while the upstream shuts down, stays down for about 1.5 s, and comes back on the same address:
tcp: 2713 requests, 0 failed. Max added wait 1.512 s (gap 1.509 s).
unix: 2707 requests, 0 failed. Max 1.512 s.
probed: 2363 requests, 0 failed. Max 1.710 s (the gap plus readmission).
Hold off (control): 2126 of 4807 requests answered 502.
So the client-visible wait is the upstream's own downtime, plus readmission on probed routes.
Known limit (not fixed here). A request already queued in the upstream's accept backlog when its listener closes is reset after connect. The dial hold cannot cover that. In the witness it happens 0 to 4 times per restart, in about 3 of 10 runs. The test counts these separately (resets=) and allows at most 8, one per worker. The fix would be one replay of a bodiless GET/HEAD to a local upstream after a reset. That is offered as a follow-up, not built, because it changes request semantics beyond the ruling.
Reviews
Spec: R1 NOT READY (2 P1), R2 NOT READY (1 P1, rule 2), ruling, R3 READY AFTER FIXES (4 P2, applied).
Branch: R1 READY AFTER FIXES (2 P2, 1 P3). The P2s were fixed, and an Astra fix check found them resolved with nothing new.
Census: Edge.Reload, RunWithActivatorReady and the internal/edge envelope approved by Astra, recorded on #280.
Morning steps
Merge: amadan branch merge -squash carlos/platform edge-roll-blip, with full arguments.
Release, then roll dev first: dev boxes, dev console, check, flagship boxes, flagship console.
In the journal: - journalctl -u carlos-edge -g 'edge: listeners:' shows one bound http ... and https ... itself line per edge start. - During root's adopt restart of the console, the edge should file no refused 502s for the console host. Requests wait instead. A rare reset at the exact moment the console closes its listener is the known limit.
Measure the console's real restart time on dev. If it is over 13 s, 502s come back after the hold. Raising localDialHold is a one-line change.
Follow-ups: the reset replay above, and option 3 (carlos-edge.socket behind a rollback version floor) as its own slice. The list is in docs/superpowers/reviews/edge-roll-blip-ledger-minors.md.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 0f90d256 · claude-code/2.1.310 · DOCS-T1
Option 2 MERGED as 9665606 (2026-10-28), from CI-green tip 59c91a37. Census re-sealed twice on main's moving chain, with the same units and claims.
Release: it ships in v0.30.0 (cut from main, dev roll first). The release agent times the dev console's restart and checks that the edge logs no refused 502 for the console during it.
Still open:
Option 3 (carlos-edge.socket plus the rollback refusal) starts after v0.30.0 reaches the flagship.
Paul decides whether to add one GET/HEAD retry after a reset.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession c2acaf22 · claude-code/2.1.310 · DOCS-T1
Option 2 shipped in v0.30.1 (main de23fa5e; v0.30.0 was published but never rolled). It is rolled on dev and flagship as of 2026-10-28 17:35Z. Log: ~/.cache/release-v0.30.1/roll-log.md on DOCS-T1.
Dev console: 1.2 s from stop to serving. A probe every 0.25 s for 240 s sent 444 requests, all 200. The one request in flight during the restart was held and answered in 1.32 s. The edge logged 0 refused.
Flagship console (annie): partial. 18.6 s from stop to serving (17:34:51.039Z to 17:35:09.706Z), longer than the 13 s hold. The probe sent 544 requests and 1 failed: it was held 13.1 s, then got a 502. The next request was held 5.1 s and got a 200. The edge logged 2 refused (holds that ran out) and 11 context canceled (clients that gave up while held). The slow start is not new: the 07:29Z start took 19.7 s.
Follow-up for this thread: either a hold longer than 13 s for this route, or a faster flagship console start. The start time is the bigger lever: dev starts in about 1 s, flagship in about 19 s.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 9b370a04 · claude-code/2.1.312 · DOCS-T1
2026-10-31 11:25:47Z to 11:26:10Z on annie: a 23.2 s start against the 13 s hold, and 40 x 502 (38 at v0.32.0). New this time: at start the console logged once that its hosts-used start-up check timed out reading the hostname list from S3, which annie hasn't logged since 2026-10-29. It retries every minute, and no second failure was logged through 11:34Z, so it most likely cleared on the first retry. A success isn't logged, so that's inferred. Until it clears, creating apps that hold data is refused, so that was probably blocked for about a minute. It's probably tied to the slow start. Evidence: ~/.cache/release-v0.32.2/tmp/annie-console-post.txt on DOCS-T1.
LLM
v0.32.2 flagship console roll: 23.2 s start, 40 x 502, plus a one-off hosts-used start-up timeout reading the hostname list from S3
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession aab63774 · claude-code/2.1.312 · DOCS-T1
Pickup note for option 3 (2026-11-01, platform-7d). Paul confirmed today that #434 belongs in the queue beside region HA P1b-3. It wants a fresh session, so this note is for whoever picks it up. Nobody has claimed it.
Where it stands
Option 2 (the 13 s edge hold) is live everywhere since v0.30.1.
Option 3 has not started.
The spec is at 6e029fd9 on branch edge-roll-blip. It covers carlos-edge.socket holding :80/:443 and the rollback refusal.
Astra R1 and R2 found the rollback family. R3 was used on option 2, so option 3's spec needs a fresh review budget. Ask Paul whether it starts at round 1.
Evidence from rolls since then
Dev edge restart: a window of about 1 s (v0.33.1, a fleet box's tunnel reconnecting).
annie edge restart: a gap of about 12 s.
Flagship console start: 18.6 to 23.2 s against the 13 s hold, with 1 to 40 x 502 per console roll. The 2026-10-31 roll also logged a hosts-used check timing out at start.
Suggested order
Flagship console start time. It's the bigger lever, because dev starts in about 1 s. Profile what annie's console does before it listens, and say whether the 13 s hold should cover the console route.
Option 3, as a release-floor change, the way release.FleetForwardFloor was done.
Part C (instances survive an edge restart). It waits on region HA's BindsTo/lease premise (#440 item 1) and probably on storage fencing (#501).
Region HA isn't the tool for routine rolls (Paul, 2026-10-26). After G5 it covers box replacement and OS-level rolls by draining.