claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 72128d15 · claude-code/2.1.321 · DOCS-T1
Follow-up from #511, recorded at the first user's request (2026-11-11). v0.35.0's stateless replicas cover staging: one instance per app with web and workers together, two copies on a two-box fleet, and xlarge (2 GiB) per copy. The measured resident memory at staging load fits that: about 0.1 to 1.2 GiB per app.
Production for a first-user-scale Rails estate is a different shape. Today, on another platform, it runs:
the largest app: 20 web processes (2 GiB limit, 5 threads each), 10 background-worker processes (about 2 GiB each) and 3 mailer workers (1 GiB);
the second-largest: 16 web processes (1 GiB) and 6 workers (2 GiB, no limit);
two smaller apps: 3 web plus 1 or 2 workers each.
To move that onto CARLOS, stateless replicas would need:
Separate worker instances, or worker-only copies. A worker process alone wants about 2 GiB, so web and workers cannot share one 2 GiB copy. Either workers become their own stateless instance with its own copy count, or a copy can run a chosen subset of processes.json.
Copy counts well above 2, across more fleet boxes. v1 is "never two copies on one box", so this means more boxes, or relaxing that rule. It also needs the hub routing and drill to hold at that scale.
Per-process sizes. A memory and CPU size per process type (web, worker, mailer) rather than one size per copy. This ties into the deferred Task 4 (fleet size tiers of 6g and up, plus overlap headroom).
None of this is v0.35.0. It needs a design pass, a brainstorm with Paul, before production cutover.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 52bbb57e · claude-code/2.1.321 · DOCS-T1
Picked up 2026-11-11 by a subagent of the Tito session (paseo 09cca118), at Paul's request to take #892 to merged code. Claimed.
Boundary with #511, agreed with the Plan 4 controller (adb7ef27) today:
#892 does not touch stateless-replicas-4 or any file Plan 4 lists until Plan 4 merges (stopping rule 4).
Plan 4 Task 4 (fleet sizes 6g and up, the fleet memory budget, the overlap reservation), deferred from v0.35.0 by R17, moves to #892. It is built after Plan 4 merges.
A per-copy memory figure in the environment is independent of Plan 4 and can be built now.
The Plan 4 controller's warning, taken into the design: a copy sized to most of its box cannot overlap-swap, so big copies need a swap that takes the box out of traffic and restarts the copy there. That changes Plan 4's swap code, so it comes after Plan 4 too.
Scale a copy up, keep copies to boxes. One copy per box, as 11-01 §5.4 already chose. Each copy runs several processes of each kind: Puma in cluster mode, and a Sidekiq swarm or several worker entries. Worker-only instances are rejected, because release runs once per instance, so two instances of one app would run migrations twice and at the same time. Worker-only copies are rejected because they reintroduce packing.
S1, now: every rootfs process gets CARLOS_MEMORY_MIB, so one Puma config and one swarm count work at every size.
S2, after Plan 4: Plan 4 Task 4's fleet sizes, with 4g, 8g, 16g and 32g added.
S3, after S2: a drain swap for copies above 1 at fleet sizes.
S4: a three-box drill and a production sizing guide.
§3 does the arithmetic. At the other platform's requests, the estate needs about 29.8 GiB per box, against a 27.3 GiB budget on a 32 GiB box. Resident memory has to be measured before cutover.
Astra is reviewing the design now. §9 lists six calls for Paul.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 52bbb57e · claude-code/2.1.321 · DOCS-T1
Progress, 2026-11-11.
Design: Astra round 1 returned READY AFTER FIXES, with no P1 and two P2s. Both P2s are fixed in rev 2 (8f2aa3ae): S1 now has one rule per process role, and S3's drain swap has explicit check, withdraw, settle, stop and abort steps. Under stopping rule 1 the review ends there. The Plan 4 controller's boundary reply is recorded in §7 (2d7fcb29). The merge is waiting on CI.
S1 is built on stateless-scale-1-memory-env. Rootfs web and workers now get CARLOS_MEMORY_MIB, the memory.max root starts them at, in MiB. Release, runs and sessions get none. Astra returned READY with no findings, and the census was approved and recorded on #280. Docs row PS-1-C01 was approved by delegation (Luna) and is listed for Paul's copy review.
CI: both branches failed only on tests outside their diffs. The failures include TestDemoAPIAliasStreaming, TestSweepBurstOf252MeetsTheDeadline (which also fails locally on unmodified main), a cross-device link in instancectl, and a full disk on main's own run. Main is red as well. I'm rerunning.
Next: merge the design, then S1, once CI is green. S2 to S4 wait for Plan 4 to merge.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 52bbb57e · claude-code/2.1.321 · DOCS-T1
Status at hand-off, 2026-11-11 ~17:00 UTC. Both #892 branches are reviewed. Neither can merge yet, because CI is not green for reasons outside their diffs (#897):
design-stateless-replicas-scale at 2d7fcb29. This is docs only. It still fails in TestDemoAPIAliasStreaming (every run today, on every branch) and in host TestRegistryChildPinnedExecutableAndMinimalFDs.
stateless-scale-1-memory-env at 64e7aba5. It fails in the same edge and host tests, a console demo stream test and flake #880, and passes them locally.
Each branch's handoff (amadan branch handoff) holds the exact merge command and -expect tip. Merge the design first, then S1. The release controller (8a3d302) knows, and the CI fleet operator has #897's evidence.
Waiting on Paul:
the design calls in spec §9, Q1 to Q6;
copy review of PS-1-C01 (the CARLOS_MEMORY_MIB docs bullet; Luna's text, approved by delegation).
After Plan 4 merges: plans for S2 (Plan 4 Task 4's fleet sizes, plus 4g, 8g, 16g and 32g), S3 (the drain swap) and S4 (the three-box drill and the sizing guide). The #511 controller will say when Plan 4 lands.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 52bbb57e · claude-code/2.1.321 · DOCS-T1
Paul's decisions on spec §9 (2026-11-11, after a Fable review of the spec; posted by the Tito infrastructure session at Paul's request):
Q1, big copies (one per box, Puma cluster plus a Sidekiq swarm in each copy): agreed.
Q2, drain swap chosen by the app's settings: agreed, with a change. Drain a copy only when every other copy of the app is healthy, unless forced. Otherwise a deploy while a box is already down leaves the app on one copy.
Q3, no platform-enforced memory limit per process: agreed, with a change. Add a runaway-worker test to the S4 drill, and say in the spec what hitting the copy's limit kills: one process, or the whole copy.
Q4, sizes may add up past a box's memory: agreed, with a change. Warn when a box's committed total passes its budget, rather than only displaying it.
Q5, measure memory use before cutover: agreed, with a change. It becomes a named task with an owner. Tito adds a memory metric to its Kubernetes cluster now, so a busy on-sale is captured before the apps move.
Q6, sizes 4g, 8g, 16g and 32g: agreed. Note that 24g is the largest that fits a 32 GiB box.
New Q7, hub redundancy: required before production cutover, delivered by region HA (#421) on Tito's IE region. Tito starts the IE region HA infrastructure now. The S4 drill should also push production-rate traffic through the hub, not 20 requests a second.
Fable also found a sizing point for §3. The rule that the remaining copies carry the peak means sizing each box for half of each app, not a third, because every drain swap is a planned box loss. At Kubernetes' requested sizes that is about 44.7 GiB per box. Tito's production boxes are 32 GiB, so they fit only if real use is under about 60% of requests. Q5's measurement decides between staying at 32 GiB and resizing to 64 GiB before cutover. Please fold that into §3. The spec should also say how long running Sidekiq jobs get to finish when a copy is drained.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 52bbb57e · claude-code/2.1.321 · DOCS-T1
Q5 data, from Tito production's in-cluster Prometheus (7 days to 2026-11-12; working-set memory):
Peak per app, all pods summed: Classic 56.7 GiB, Pro 22.7 GiB (including about 1.9 GiB for its own Gotenberg, which moves to the platform PDF service), ID 1.9 GiB, Billing 2.0 GiB. All four together peaked at 82.7 GiB.
Classic's web pods (20) average about 1.85 GiB against a 2 GiB limit, and peaked at 2,047 MiB, so the limit holds them down. Pro's web pods (16) sit at about 993 MiB against a 1 GiB limit. Real demand at both is likely higher.
Sidekiq: Classic's 10 pods average 1.2 GiB with one-pod peaks of 2.5 GiB. The mailers peak at 0.7 GiB. Pro's 6 pods average 0.86 GiB and peak at 1.07 GiB.
Under the half-per-box rule (one box down), two boxes must carry about 83 GiB, so about 41 GiB per box. Tito's 32 GiB production boxes are too small, so Tito will resize to m7g.4xlarge (64 GiB) before cutover, one box per PR. Tito will record a weekly snapshot here to catch a busy on-sale, since the cluster keeps 7 days.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 52bbb57e · claude-code/2.1.321 · DOCS-T1
A correction to the Q5 data above, from Paul (2026-11-12): Tito's measured demand has never needed much more than 25 requests a second, even in busy periods. The Kubernetes memory figures (82.7 GiB peak for the four apps) are the footprint of an over-provisioned cluster: 20 separate Classic web pods with 5 Puma threads each, all loading the whole app. They don't measure demand. At 25 requests a second, a Classic copy probably needs a Puma cluster of 2–4 workers plus a few Sidekiq processes, so single-digit GiB per copy. Tito is keeping its production fleet at 3 × m7g.2xlarge (32 GiB) and will size copies from a staging load test at production-like rates, not from the Kubernetes figures. That may also mean #892 S2's largest sizes aren't needed for Tito.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 72128d15 · claude-code/2.1.321 · DOCS-T1
Plan 4 (#511) is merged as ae1b8cc. Task 4 (fleet size tiers, worker instances, per-process sizes) can be built on it now. Copy rows SR-4-C19, C20 and C29 are marked "deferred (Task 4, #892), not shipped" in the Plan 4 copy deck. Nothing in the code uses them yet, and the docs page doesn't state fleet sizes.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 72128d15 · claude-code/2.1.321 · DOCS-T1
#1350 folded in (fleet app sizes above 2 GiB: one self-hosted app needs about 4.5 GiB per copy, another about 2.3 GiB). It is S2 here.
A builder (paseo d4517c20) now:
lands S1 (merge main into stateless-scale-1-memory-env, census re-check, CI, merge);
plans and builds S2 (sizes 4g, 8g, 16g and 32g on owned fleets, with placement checked against box memory), reusing Plan 4 Task 4's text and rulings R6, R11 and R12.
Rough date: S1 merged in the next day or so; S2 merged around 2026-11-26, then a release on Paul's go. Slices S3 and S4 follow.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 29a43d67 · claude-code/2.1.321 · DOCS-T1
S1 merged: 3d7f9538 (feat: give rootfs web and workers CARLOS_MEMORY_MIB (#892 S1)), squashed from stateless-scale-1-memory-env after merging main. The census was re-proposed on the new base and Astra re-approved it on #280. CI was green on the tip. It is not released; it rides the next release on Paul's go.
S2 (#1350), next. The plan is written and has been through two Astra rounds; the third and final round is running. It will be committed on a new branch from main. Points for the release:
Fleet sizes need a new floor, FleetSizesFloor = v0.43.0, so the release carrying S2 must be v0.43.0 or later. Until a box and the console reach it, fleet sizes stay refused.
The spec says S3 (the drain swap) ships in the same release as S2. S2 can merge on its own because nothing activates before the floor. Whether a release may carry S2 without S3 is Paul's call, and I'll ask it with the S2 merge. Without S3, a copy at a fleet size deploys only when the box has room for an overlap. That covers 4g to 8g on 32 GiB boxes.
Target: S2 merged around 2026-11-26.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 29a43d67 · claude-code/2.1.321 · DOCS-T1
S2 merged: a8c0fb98 (feat: fleet sizes 4g to 192g for apps on owned fleets (#892 S2, #1350)). CI was green on the tip, Astra and Fable both gave READY on the whole branch, and Astra approved the census on #280. It is merged, not released.
What it does. On a fleet the account owns, an app can be sized 4g, 6g, 8g, 12g, 16g, 24g, 32g, 48g, 96g or 192g. Each copy leaves its box max(1 GiB, total/8). Root accepts these sizes only on a box whose own host.env sets CARLOS_FLEET, outside gVisor, and within that box's budget. The console checks every door that can put an app on a box against the app's whole policy. An overlap deploy to one of these sizes reserves its memory first. If there's no room, the old build keeps serving and the instance gets one warn event. The sizes small to xlarge, and shared boxes, behave as before.
For the release (Paul's call):
Version floor. The release carrying S2 must be v0.43.0 or later (FleetSizesFloor). Until the console and every box of the fleet reach it, fleet sizes are refused.
S2 without S3? The spec ships S3 (the drain swap) in the same release as S2. Without S3, a copy deploys by overlap only when its box has room for the old and new copy together: - On a 32 GiB box (budget about 27.3 GiB), 4g to 8g deploy fine. That is the self-hosted operator's range (#1350). - 16g and 24g are accepted but cannot deploy by overlap. They are refused with the warn event, and the old build keeps serving. - Options: - (a) Release S2 now and tell operators to stay at 12g or below until S3. I recommend this, because it unblocks #1350 now. - (b) Hold S2 until S3. - (c) Add a console cap at half the budget until S3, a small follow-up.
Operator hand-off (Fable's review). Before a fleet size is set, each fleet box needs CARLOS_FLEET in /etc/carlos/host.env and must not run gVisor. Then smoke one instance.
Console rollback (Fable's review). A console below v0.43.0 cannot open a policy that names a fleet size. So rolling the console back while such a size is set stops policy re-signing, and the policy lapses on the boxes after 72 hours, egress allow list included. This needs a line in the release notes and the console rollback recipe.
S3 (the drain swap) and S4 (the three-box drill and sizing guide) are next.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 92eadb57 · claude-code/2.1.321 · DOCS-T1
v0.43.0 (tag 7754b6df -> main da8a1fe1) is published and carries S2. Its notes, Luna-reviewed, already say: before a box takes a fleet size it needs CARLOS_FLEET in its root-owned host.env and an effective sandbox of systemd, not gVisor; and a console rolled back below v0.43.0 lets a policy using a fleet size or an egress range expire after 72 hours, closing its allows and sizes. Follow-up line the notes do not carry: S3 (the drain swap) is not in v0.43.0, so on 32 GiB boxes 16g and 24g are accepted but cannot deploy by overlap. Use 12g or below there until S3 ships.