spec rev 10: ruling 12, no live memory change (#329)
Paul, 2026-10-25: a new size's memory lands at the next start or swap; CPU and IO still change live. §5.4 rewritten; §9 and §11 aligned.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+46
−61
docs/superpowers/specs/2026-10-21-instance-sizes-and-egress-design.md+46 −61
diff --git a/docs/superpowers/specs/2026-10-21-instance-sizes-and-egress-design.md b/docs/superpowers/specs/2026-10-21-instance-sizes-and-egress-design.md| index 072805643..3cae1662a 100644 |
| --- a/docs/superpowers/specs/2026-10-21-instance-sizes-and-egress-design.md |
| +++ b/docs/superpowers/specs/2026-10-21-instance-sizes-and-egress-design.md |
| @@ -1,7 +1,8 @@ |
| # Instance sizes and egress allows |
| Amadan #328 (an isolated instance reaching a private service its operator |
| -runs) and #329 (operator-set CPU and memory per instance). Revision 9 (with its plan-writer cost notes), |
| +runs) and #329 (operator-set CPU and memory per instance). Revision 10, 2026-10-25: Paul's ruling 12 (no live memory change, §5.4). |
| +Revision 9 (with its plan-writer cost notes), |
| 2026-10-25. Revision 9 adds Paul's rulings 9 to 11 (claim-mode |
| egress deferred, one policy writer per bucket, a request budget, §3a). |
| Revision 8 folds in what the three plan writers found |
| @@ -55,6 +56,12 @@ written by root onto each instance's own slice** |
| (§3a); readers re-read an app's policy only when its generation moves, |
| plus the 30-minute backstop. The steady-state budget is in §3a and is |
| tested. |
| +12. **No live memory change** (2026-10-25, rev 10). A new size's memory |
| + takes effect at the instance's next start (a wake, a restart) or swap |
| + (a deploy); CPU and IO weights still change live. Every hard defect |
| + the build found in live memory growth (concurrent resizes, a resize |
| + during a start, a generation's own drop-in undoing a live growth on |
| + `daemon-reload`) is removed with it, not patched. |
| ## 1. Why |
| @@ -479,55 +486,33 @@ A size is enforced in two places, and a change must account for both: |
| (Astra R1-2). The run, seed, sidecar and cmd templates carry no |
| memory cap of their own; the slice is theirs. |
| -**The activator applies live changes**, under the same per-host |
| -serialization as swaps, because it owns swaps (`swap.go:517` raises the |
| -parent before the successor starts). It never sends a resize while a |
| -parent is raised; a change that arrives mid-swap waits for the swap to |
| -retire and restore the slice. The populated-slice skips in `startGen` |
| -(`gen.go:116`) and the run path (`server.go:503`) stay exactly as they |
| -are: they protect the overlap allowance (Astra R1-1). |
| - |
| -- **Under host claims there is no live change** (rev 8): the legacy |
| - control verbs answer 503 under claims, so a new size, growth included, |
| - takes effect at the host's next start. Claims are dormant; a live verb |
| - for claim mode is follow-up work. |
| -- **Growing** (memory up, or any CPU or IO change): applied live by a |
| - `POST /size?host=` call. Root sets the slice first, then the serving |
| - generation unit (`set-property --runtime` on the unit), and reads both |
| - back. |
| -- **The activator's captured tier follows the read-back** (Astra R2-1). |
| - A swap sizes its overlap from the incumbent's captured `Gen.Tier` |
| - (`swap.go:498`), so a live growth that left it at the old figure would |
| - raise the parent too little. Under the same serialization, the |
| - activator sets `Gen.Tier` from root's read-back of the serving unit |
| - after a live change. If a change is partly applied (slice written, unit |
| - not, or the reply lost), the host is marked unsettled: no swap starts |
| - until a fresh read-back settles it, and the captured tier is then taken |
| - from that read-back, never from the request. |
| -- **Memory never shrinks while anything runs in the slice** (Astra |
| - R1-3, R2 new 1, R3 new 1; a gate, not a tolerance: three rounds of |
| - proving each co-tenant of the slice stopped kept finding another). A |
| - usage sample cannot make lowering `memory.max` safe, and a swap's |
| - restore runs while the old sidecar and the retiring generation's `carlos |
| - run` commands may still hold memory (`swap.go:678`, |
| - `activator/cmd.go:336,377`). So: |
| - - when the host has an operator-set size (its registry `size` is not |
| - empty), a swap's successor starts at **the larger of** the effective |
| - size and the incumbent's size, so the restore never lowers the |
| - parent. The same holds when the incumbent runs at a size other than |
| - its own build's tier (an operator size since cleared). With no |
| - operator size now or at the incumbent's start, each artifact keeps |
| - its own tier as today, so a host with no policy is byte-identical (rev 8: the |
| - unconditional rule changed a release that drops `children`); |
| - - a smaller memory size takes effect only at a **cold start**, when |
| - the slice is empty (a wake from hibernation, or a restart the |
| - operator asks for); CPU and IO shrinks still apply live, as they kill |
| - nothing; |
| - - until then the instance reports `pending` with the size it will take |
| - (§5.6). An operator who needs it now restarts the instance. |
| - |
| - No swap ever lowers memory, so today's restore order, the sidecar |
| - replacement and command admission are untouched. |
| +**Memory never changes while an instance runs** (ruling 12, rev 10). |
| +A new size's memory lands when the host next starts: a wake from |
| +hibernation, a restart the operator asks for, or a swap. Under an |
| +operator size, a swap's successor starts at **the larger of** the |
| +effective size and the incumbent's size, so a deploy applies a growth |
| +and the restore never lowers the parent. The same holds when the |
| +incumbent runs at a size other than its own build's tier (an operator |
| +size since cleared). With no operator size now or at the incumbent's |
| +start, each artifact keeps its own tier as today, so a host with no |
| +policy is byte-identical. A smaller memory size waits for a **cold |
| +start** (the slice empty), because no swap lowers memory. |
| + |
| +**CPU and IO change live.** `POST /size?host=&size=` sets the slice's |
| +`CPUWeight`, `CPUQuota` and `IOWeight` to the size's shares and reads |
| +them back; it never writes `MemoryMax`, `MemoryHigh` or `MemorySwapMax`, |
| +and touches no generation unit. These are hierarchical cgroup limits |
| +that kill nothing, and the slice has no drop-in of its own that a |
| +`daemon-reload` could restore over them. The activator sends the call |
| +under the same per-host serialization as swaps, never while a parent is |
| +raised; a failed or lost call is retried on the next sweep. Under host |
| +claims the legacy verbs answer 503, so CPU and IO also wait for the next |
| +start. |
| + |
| +Until the memory in force matches, the instance reports `pending` with |
| +the size it will take (§5.6). An operator who needs it now restarts the |
| +instance. No swap ever lowers memory, so today's restore order, the |
| +sidecar replacement and command admission are untouched. |
| - **Read-back** reports the serving generation unit's `MemoryMax` when |
| there is one, else the slice's, and `swap` while the parent is raised. |
| @@ -635,7 +620,7 @@ does exist, at `internal/activator/`. |
| | # | Finding | Disposition | |
| |---|---|---| |
| -| R1-2 | Captured `Gen.Tier` not updated on growth | Accepted: set from read-back under the serialization; unsettled hosts start no swap (§5.4) | |
| +| R1-2 | Captured `Gen.Tier` not updated on growth | Accepted, then superseded by ruling 12: memory never changes live, so the captured tier stays true (§5.4) | |
| | R1-3 / new 1 | A lowering restore can squeeze the old sidecar | Accepted: a lowering restore waits for the incumbent and old sidecar to be proven stopped (§5.4) | |
| | R1-5 | Root re-admits an address when a file expires | Accepted: no expiry; age is not absence; root fails closed on an incomplete read (§4.2) | |
| | new 2 | Freshness and totals depend on region HA | Accepted: `addrs` and `mem_total_mib` are gated fields, no freshness relied on (§4.2, §5.5) | |
| @@ -679,9 +664,12 @@ claims (§5.4); sidecar members make a box not wholly nested and get no |
| policy (§4.3); the below-tier CLI warning is dropped (§5.2). Also from |
| the plans, recorded here so nobody re-derives them: a long host's slice |
| name is a hash, so root closes the allow on a slice it cannot map to a |
| -host; a generation's live `set-property` lands in `system.control` and |
| -outranks its drop-in, so root removes it when a generation starts or |
| -stops. |
| +host. (Rev 10: no live memory change reaches a generation unit. A |
| +runtime drop-in in `system.control` merges by file name with the |
| +generation's own `50-carlos-generation.conf`, which sorts after it, so a |
| +`daemon-reload` would have undone a live growth: one reason for ruling |
| +12. Root still clears a generation's control drop-in directory when it |
| +starts or stops, as tidying.) |
| ## 10. Left to the builder |
| @@ -705,13 +693,10 @@ stops. |
| - A grant naming another box's address is refused; one naming an address |
| another box publishes later raises the report's alert and stays in |
| force; one this box acquires later is dropped by root and reported. |
| -- Resize during a swap waits; growth reaches the serving generation's |
| - own cap; a memory shrink leaves every running process's limits alone, |
| - a swap's successor starts at the larger size, and the shrink lands at |
| - the next cold start. |
| -- `small` and `xlarge` through the complete claim launch. |
| -- A live growth updates the captured tier; a partly applied change |
| - blocks the next swap until a read-back settles it. |
| +- A size change while running moves CPU and IO only, survives a |
| + `daemon-reload`, and leaves every memory limit alone; a change during |
| + a swap waits; a swap's successor starts at the larger size; a smaller |
| + memory size lands at the next cold start (rev 10). |
| - The grant check refuses another box's address (including one listed |
| only in an old edges file) and refuses while a listed file is |
| unreadable or lacks `addrs`; a box that publishes nothing is named |