carlos / platform Public

Merge remote-tracking branch 'origin/main' into egress-allow-cidr

# Conflicts:
#	internal/provision/testdata/plan14-root-reads-chain.tsv
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 668ced6b23c2b5c905853bfaa19b4698a2d2118b parent d121cecparent 86ac055
26 files changed, +1,050 −19
  • approved_stateless_scale_copy_test.go +62 −0
  • docs/site/rootfs.md +2 −0
  • docs/superpowers/notes/LUNA-COPY-BRIEF-STATELESS-SCALE-S1.md +454 −0
  • docs/superpowers/notes/census-proposal-egress-allow-cidr-console.md +1 −1
  • docs/superpowers/notes/census-proposal-egress-allow-cidr.md +1 −1
  • docs/superpowers/notes/census-proposal-group-revoke-readback-1255.md +11 −0
  • docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md +25 −0
  • docs/superpowers/plans/2026-11-11-stateless-replicas-scale-copy.md +12 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R1.md +23 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R2.md +25 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1-R2.md +8 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md +72 −0
  • docs/superpowers/specs/2026-11-09-group-roll-verb-design.md +1 −0
  • internal/activator/cmd_swap_test.go +5 −1
  • internal/activator/cmd_test.go +8 −3
  • internal/activator/rootfs.go +2 −1
  • internal/activator/rootfs_invariants_test.go +3 −2
  • internal/activator/rootfs_memoryvar_test.go +134 −0
  • internal/activator/rootfsenv.go +30 −5
  • internal/activator/rootfsenv_test.go +1 −1
  • internal/activator/rootfsrelease_test.go +7 −0
  • internal/grouproll/roll.go +18 −2
  • internal/grouproll/roll_test.go +127 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +4 −2
  • internal/provision/testdata/plan14-root-reads-group-revoke-readback-1255.tsv +3 −0
  • internal/provision/testdata/plan14-root-reads-stateless-scale-1-memory-env.tsv +11 −0

Intent

Human

<task-notification> <task-id>ac810769c39e60e93</task-id> <tool-use-id>toolu_01VujAeVrbjnmvmPbpHcwaoh</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/22311489-9a69-4708-aa90-e32c2ae39ed2/tasks/ac810769c39e60e93.output</output-file> <status>completed</status> <summary>Agent "Implement Task 4: kernel prefix witness" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: Fix round 1 is done. My test now uses the existing `egressTargetNetnsAt` fixture instead of its own copy; it is compiled and vetted but not yet re-run on the root runner. Commit: d121ceca, built on dd845e4a. - `egressTargetNetnsAt` now takes the addresses as well as the names, through a new `egressNetnsAddrs` type. Its name is unchanged, so its recorded code-health sites did not move. - The tests that already used it pass the old addresses (`egressNetnsTask13Addrs`) and get the same `ip` commands in the same order. Nothing they assert changed. - `egressPrefixTargets` is now a short wrapper around it. My test's assertions are unchanged. One change from the run that passed: checking the targets from the box now uses the shared 10 s retry loop instead of a single 5 s dial. Checks: the rootrunner build and `go vet -tags rootrunner` pass for linux/amd64 and arm64. The default build and vet are clean. `make code-health` passes. Re-run on the root runner: 13 existing tests now go through the changed fixture. This regex selects exactly those 13 plus `TestRootEgressPrefixKernelProof` (confirmed with `-list`): `^(TestRootEgress(StartPathsPreClaim|RevokeWhileRunning|MixedBoxWritesNothing|InstanceControlUnderClaims|Isolation|NoPolicyByteIdentical|InterruptedRevoke|FlatProcessFalsifiedRow|PrefixKernelProof)|TestPlan14EgressClaimLaunchRootRunner|TestEgressSurvivesALiveSizeRootRunner|TestSizesThroughEveryStartPathRootRunner|TestLiveSizeMovesOnlyCPUAndIORootRunner|TestReusedGenerationNumberStartsAtItsOwnSizeRootRunner)$` Concern: there is an empty `/home/paulca/amadan.net/carlos/platform/.git/packed-refs.lock` dated 11:43 that I did not create. Each commit printed a lock error because of it, but both commits and the branch ref landed. I left it alone; someone should check whether it is stale. Report (fix section appended): `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/egress-allow-cidr/.superpowers/sdd/2026-11-22-egress-allow-cidr/task-4-report.md`</result> <usage><subagent_tokens>125436</subagent_tokens><tool_uses>17</tool_uses><duration_ms>384904</duration_ms></usage> </task-notification>

diff --git a/approved_stateless_scale_copy_test.go b/approved_stateless_scale_copy_test.go
new file mode 100644
index 000000000..74cca3cfc
--- /dev/null
+++ b/approved_stateless_scale_copy_test.go
@@ -0,0 +1,62 @@
+package main
+
+import (
+ "os"
+ "regexp"
+ "strings"
+ "testing"
+)
+
+// The #892 copy deck (stateless replicas at production scale).
+const statelessScaleCopyDeck = "docs/superpowers/plans/2026-11-11-stateless-replicas-scale-copy.md"
+
+var statelessScaleBuiltCopy = []string{"PS-1-C01"}
+
+func statelessScaleCopyRows(t *testing.T) []copyRow {
+ t.Helper()
+ raw, err := os.ReadFile(statelessScaleCopyDeck)
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Normalize only the status column. Approval notes are never applied text.
+ lines := strings.Split(string(raw), "\n")
+ for i, line := range lines {
+ cells := strings.Split(line, "|")
+ if len(cells) >= 6 {
+ status := strings.TrimSpace(cells[len(cells)-2])
+ if strings.HasPrefix(status, "approved") {
+ cells[len(cells)-2] = " approved "
+ } else if strings.HasPrefix(status, "pending (") {
+ cells[len(cells)-2] = " pending "
+ }
+ lines[i] = strings.Join(cells, "|")
+ }
+ }
+ rows, err := parseCopyTableStatuses(strings.Join(lines, "\n"), statelessScaleCopyDeck, regexp.MustCompile(`^PS-[1-4]-C[0-9]{2}$`), "a PS-<slice>-C<nn>", "pending", "approved")
+ if err != nil {
+ t.Fatal(err)
+ }
+ return rows
+}
+
+func TestStatelessScaleBuiltCopyIsApproved(t *testing.T) {
+ reportAll(t, checkRunBuilt(statelessScaleCopyRows(t), statelessScaleBuiltCopy))
+}
+
+func TestStatelessScaleCopyIsApplied(t *testing.T) {
+ rows := builtRows(statelessScaleCopyRows(t), statelessScaleBuiltCopy)
+ for i := range rows {
+ rows[i].Text = rootfsAppliedText(rows[i].Text)
+ }
+ reportAll(t, checkRunApplied(rows, "."))
+}
+
+func TestStatelessScaleCopyHasNoEmDash(t *testing.T) {
+ raw, err := os.ReadFile(statelessScaleCopyDeck)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if strings.Contains(string(raw), "—") {
+ t.Fatal("copy deck contains an em dash")
+ }
+}
diff --git a/docs/site/rootfs.md b/docs/site/rootfs.md
index b23704779..d1b4aa9a6 100644
--- a/docs/site/rootfs.md
+++ b/docs/site/rootfs.md
@@ -45,6 +45,8 @@ Every process of the instance gets the same environment: web, the workers and re
- CARLOS_HOST, CARLOS_REGION, CARLOS_CONTROL_SOCKET and CARLOS_PURGE mean what they mean for a binary instance, as [What an instance is started with](/docs/cli#what-an-instance-is-started-with) says.
+- CARLOS_MEMORY_MIB is the memory limit, in MiB, that web and each worker start with. For example, it is 2048 at the xlarge size. Use it to choose how many processes to start, such as Puma workers. Release, carlos run and consoles do not get this variable.
+
- HOME is /tmp unless the image or the app sets it.
## Health
diff --git a/docs/superpowers/notes/LUNA-COPY-BRIEF-STATELESS-SCALE-S1.md b/docs/superpowers/notes/LUNA-COPY-BRIEF-STATELESS-SCALE-S1.md
new file mode 100644
index 000000000..d2f522578
--- /dev/null
+++ b/docs/superpowers/notes/LUNA-COPY-BRIEF-STATELESS-SCALE-S1.md
@@ -0,0 +1,454 @@
+# Copy review brief: CARLOS_MEMORY_MIB in the rootfs docs (#892 S1)
+
+Paul delegates copy review for platform CLI, console and docs copy to you. You
+are the copy editor; your edits will be applied as approved copy.
+
+## The facts
+
+A rootfs app's processes are declared in processes.json: web (serves HTTP),
+workers (background jobs such as Sidekiq), release (runs once per deploy, for
+migrations) and console (an interactive session). The platform now gives web
+and every worker a new environment variable, CARLOS_MEMORY_MIB: the memory
+limit that process was started with, in MiB (for example 1024, or 2048 at the
+xlarge size). The app's files cannot set it. Release, `carlos run` commands
+and consoles do not get it. Its purpose: one image and one config can pick
+how many processes to start (Puma's workers, the number of Sidekiq processes)
+from the instance's size. The size changes at the next start, and the
+variable with it.
+
+Readers: developers deploying a Rails or similar app on the platform.
+
+## The string (draft; the id is fixed)
+
+- PS-1-C01, a new bullet in docs/site/rootfs.md under "What every process
+ gets", after the CARLOS_HOST bullet. The section starts "Every process of
+ the instance gets the same environment: web, the workers and release
+ alike." Draft:
+
+ > CARLOS_MEMORY_MIB is the memory limit web and each worker were started with, in MiB, such as 2048 at the xlarge size. Use it to choose how many processes to start, such as Puma's workers. Release, carlos run and consoles do not get it.
+
+## House rules (Paul's, all binding)
+
+- No em dashes, ever. Use a full stop and a new sentence.
+- Plain words. No jargon a reader would not know. Short.
+- Neutral names only (shop, example.com). Never a tenant's name.
+- Keep the literal names CARLOS_MEMORY_MIB, carlos run and xlarge.
+- One paragraph, no line breaks inside it.
+- Do not change the facts. If a fact looks wrong, flag it.
+
+## Output
+
+1. A table of changes only: `id | current | new | why`.
+2. A list of flagged rows: `id | problem`.
+3. One line of counts: changed, flagged, left alone.
+
+## Result (gpt-5.6-luna, 2026-11-11), applied verbatim
+
+I’m using the copy-review skill because this task is specifically a review gate for user-facing copy. I’ll read its instructions and the requested brief, then return only the brief’s required output.
+exec
+/bin/bash -lc "sed -n '1,240p' /home/paulca/.agents/skills/copy-review/SKILL.md && sed -n '1,260p' docs/superpowers/notes/LUNA-COPY-BRIEF-STATELESS-SCALE-S1.md && sed -n '1,220p' docs/site/rootfs.md" in /home/paulca/amadan.net/carlos/platform/.claude/worktrees/stateless-scale-1
+ succeeded in 0ms:
+---
+name: copy-review
+description: Mandatory review gate for all user-facing language. Use whenever writing or changing user-facing copy — marketing pages, landing pages, headlines, taglines, UI strings, emails, error messages, docs prose, READMEs — BEFORE that copy is written into any file or artifact. Extract every string, launch the review server, wait for the user's edits, and apply them verbatim. Never ship copy the user has not reviewed. Translations are not reviewed — translate approved source copy yourself. Not for Amadan issues, comments or channel posts — that is agents talking to agents.
+---
+
+# Copy Review
+
+The user reviews and rewrites every user-facing string before it ships.
+Claude drafts; the user has final say over every word.
+
+## Workflow
+
+### 1. Draft into a string index, not into files
+
+Do not write copy directly into templates/components. First produce
+`copy-review/strings.json` in the project root:
+
+```json
+[
+ {
+ "id": "hero.headline",
+ "section": "Hero",
+ "label": "Headline",
+ "text": "Draft copy here",
+ "context": "The first thing you see on the page, above the signup form. It has to say what the product is for someone who arrived from a search result.",
+ "notes": "H1, keep under ~8 words"
+ }
+]
+```
+
+- `id`: stable dot-path key. This is the contract — it must map 1:1 to
+ where the string ends up in the codebase.
+- `section`: groups strings in the UI (Hero, Pricing, Footer, Email: welcome…).
+- `label`: human name for the string.
+- `context`: two or three sentences of plain English, shown under the copy
+ in the review UI. Where the string appears, and what it is trying to do.
+ Write it for someone who cannot see the page — no component names, no CSS,
+ no `<h1>`. "Sits under the plan cards on the pricing page. It is there to
+ stop people worrying about being locked in," not "hero H1, marketing site."
+ If the string only makes sense next to another one (a heading and its
+ button, an error and the field it belongs to), say so here.
+- `notes`: optional constraints — length limits, a word that must appear,
+ markup that must survive. Shown in italics under the context.
+- Order the array top-to-bottom as the copy appears on the page.
+
+The strings file must be `<project>/copy-review/strings.json`, under `~/amadan.net` or `~/src` (or a folder listed in `~/.config/copy-review/roots`), outside hidden folders (a `.claude/worktrees/` checkout is fine), with no symlinked `preview/`. `copy-review` refuses anything else (exit 2) and says why. `serve.sh` still takes a strings file anywhere.
+
+Reviewing existing copy rather than drafting new copy is the same flow: put
+the current, live wording into each string's `text` as the draft, and carry
+on from step 1b.
+
+Include EVERY user-facing string: headlines, body, button labels, alt text,
+meta descriptions, form placeholders, error/empty states. If a human will
+read it, it goes in the index.
+
+**Source language only.** Translations never go in the index. The user
+reviews the words in the language they wrote them in; asking them to check
+French or Japanese is a wasted round trip. Once the source strings are
+approved, translate them yourself as a best guess and write them straight
+into the locale files, keeping the same keys, placeholders and markup. They
+get corrected as they are used. Say in your hand-back which locales you
+filled in, so nobody mistakes them for reviewed copy.
+
+Every string gets a `context`. The user is reviewing words stripped out of
+the page they live on; without it they are guessing at what a button label
+is for. Writing it is also a check on you — if you cannot say in plain
+English what a string is doing there, it probably should not be there.
+
+### 1b. Build the preview
+
+When the copy lives on a screen (a web page, app UI, an HTML email), build
+`copy-review/preview/` as well. The user then reviews the copy where it
+lives: they see the page, click the text they want to change, edit it
+beside the page and watch it update as they type. Docs and READMEs get
+their Markdown rendered. Plain-text copy (SMS, push notifications,
+plain-text email) has no page; skip this step and the review is the list,
+as before.
+
+Where the page comes from:
+
+- **An existing page you can render.** Start the project's dev server if
+ it isn't running, then snapshot the page:
+
+ ```bash
+ <path-to-this-skill>/snapshot.sh http://localhost:3000/pricing copy-review/preview
+ ```
+
+ It loads the page in headless Chrome, saves the rendered HTML as
+ `<out-dir>/index.html` (the second argument; it defaults to
+ `copy-review/preview` if you leave it off, shown above for clarity) with
+ local copies of its stylesheets, fonts, images and SVG sprite references,
+ and strips scripts, event handlers, frames and embeds. It prints `FAILED`
+ for every asset it couldn't fetch and `LEFTOVER` for every absolute or
+ root-relative reference that would still load from elsewhere, and exits 2
+ when there are any. Deal with each one; don't ignore them. For a page
+ behind a login, pass the session cookie as
+ `SNAPSHOT_COOKIE='_app_session=…'`; it is sent to that page's origin only.
+ Then replace the page's text with your draft strings and add the bindings
+ below.
+
+ The review server looks for `preview/` next to `strings.json`, wherever
+ that is — not always `copy-review/`. If yours lives somewhere else, point
+ the snapshot at `<dir-of-strings.json>/preview` instead of the default.
+
+ Re-running `snapshot.sh` into the same out-dir replaces `index.html`
+ outright, so any bindings you hand-added are lost with it — only
+ re-snapshot when the page structure changed (see rerolls, below), and
+ redo the bindings after. Exit 1 means the run failed. Some causes are
+ refused up front, before anything is touched: no URL given, no headless
+ Chrome found, a URL that isn't a valid `http://` or `https://` address, a
+ bad timeout value, or an out-dir that already held files `snapshot.sh`
+ didn't create itself (it only touches a directory that's empty, new, or
+ still carries the `.copy-review-snapshot` marker an earlier successful run
+ of its own left behind) — none of these remove an existing `index.html`.
+ Only a failure once capture is under way — the page didn't load (a
+ non-2xx response: an expired `SNAPSHOT_COOKIE`, a wrong URL) or the page's
+ own script errored while it settled — also removes any `index.html` a
+ previous successful run left, so a stale page is never mistaken for this
+ one. Fix what it printed and re-run, or hand-build the page instead.
+- **A new page.** Hand-build `index.html` in the project's markup style and
+ copy the project's compiled stylesheet into `preview/` beside it.
+- **An HTML email.** Use the rendered email HTML (the framework's mailer
+ preview, where there is one).
+- **A README or docs page.** Render the Markdown to HTML, copy
+ `<path-to-this-skill>/ui/doc.css` into `preview/` and link it.
+- **A page you can't reach** (a login you can't satisfy, no runnable app).
+ Hand-build it.
+
+Tie each element to its string with an attribute. The element's text, or
+the attribute's value, must be exactly the string's `text` in
+`strings.json`:
+
+| Attribute | Use it when |
+|---|---|
+| `data-copy="id"` | The element's text is the string. The element holds only that text: when an icon or other text shares it, wrap the string in a `<span>` and bind the span. |
+| `data-copy-html` (with `data-copy`) | The string carries markup that must survive (say so in its `notes`). |
+| `data-copy-placeholder="id"`, `data-copy-alt="id"`, `data-copy-title="id"`, `data-copy-aria-label="id"` | The string is that attribute's value. One element can carry several. |
+
+The same id can sit on several elements (a button in both the header and
+the footer); all of them update. Bindings may not nest. A string with no
+element on the page (a meta description, an error message, another email)
+is list-only. That's fine: the user finds it in the List view.
+
+Check before you hand over:
+
+```bash
+node <path-to-this-skill>/preview-check.mjs copy-review/strings.json
+```
+
+Fix every `Preview error` line: an id that isn't in `strings.json`, a
+nested binding, or an element whose text doesn't match its string (usually
+a string bound to the wrong element). The list-only line is information,
+not an error. The server runs the same check when it starts and shows any
+errors to the user in a warning banner, so an unfixed one gets seen.
+
+Then look at it, with `screenshot.sh <url-or-file> <width> <out.png>`:
+
+```bash
+<path-to-this-skill>/screenshot.sh http://localhost:3000/pricing 390 /tmp/source-390.png
+<path-to-this-skill>/screenshot.sh http://localhost:3000/pricing 1280 /tmp/source-1280.png
+<path-to-this-skill>/screenshot.sh copy-review/preview/index.html 390 /tmp/preview-390.png
+<path-to-this-skill>/screenshot.sh copy-review/preview/index.html 1280 /tmp/preview-1280.png
+```
+
+For a snapshot, screenshot the source page and the preview at 390px and
+1280px wide and compare them. A page that builds itself with JavaScript
+after it loads may not survive the snapshot; hand-build it instead. For a
+hand-built preview, screenshot it at both widths and check it reads as the
+page it stands for. A page taller than 1600px needs `--full` (a fourth
+argument) on each call above — the default window crops everything below
+that, which misses most of a long page.
+
+The preview is a copy under `copy-review/`. Building it never touches the
+project's code, so step 4 still holds.
+
+### 2. Start the review
+
+```bash
+copy-review submit copy-review/strings.json --watch-pid $PPID
+```
+
+It hands the review to the copy review app, which is always running on this machine, and prints one line: the review's URL. Give the user that URL as a Markdown link, with the URL as both text and target, and nothing else: never `localhost`, never `127.0.0.1`, never a URL you assembled yourself. `--watch-pid $PPID` names the session that is waiting, so the index can mark the review "agent gone" if this session ends; the review stays open either way.
+
+Running `submit` again for the same file while its review is open sends your new draft under the same link, and the user's page asks them to reload. If another session is still waiting on that review, `submit` refuses (exit 4); pass `--replace` only when you are taking that review over.
+
+**If `copy-review` exits 3**, the app isn't running here. Say so, and use `serve.sh` instead (below).
+
+**Sandbox.** `copy-review` talks to the app over a socket a sandboxed shell can't reach, so it always runs outside the sandbox. Claude Code is set up for that in `~/.claude/settings.json` (`"sandbox": { "excludedCommands": ["copy-review:*"] }` and `"permissions": { "allow": ["Bash(copy-review:*)"] }`), so it runs without a prompt: don't turn the sandbox off for it. Codex is set up the same way by a rule file, `~/.codex/rules/copy-review.rules`, containing `prefix_rule(pattern = ["copy-review"], decision = "allow")`, so it runs outside Codex's sandbox without asking. If it says it can't reach the app from inside a sandbox, that setup is missing: tell the user rather than retrying with the sandbox off. Waiting for the result needs nothing outside the sandbox.
+
+Nothing runs per review: one app serves them all. A review stays open until the user approves it, rerolls it, or dismisses it from the index (a dismissed review has no result: if none comes, ask the user), and it survives the app restarting. Leave `draft.json` alone while a review is open; the app deletes it when the review is done.
+
+**Inline reroll.** Under every string the page has a small instructions box and
+a Reroll button. The user types what they want instead ("shorter", "don't
+mention pricing", or nothing at all) and the app rewrites that one string on
+the spot through `reroll.sh`. GPT-5.6 Luna drafts it, through Codex running in
+a sealed-off sandbox that holds none of the user's files; if that fails, Claude
+Sonnet drafts it with every tool switched off. Either way the drafter sees only
+the copy and the instructions, and the page shows which one answered
+(`WRITING_DRAFT_MODEL` picks another Codex model, `WRITING_FALLBACK_MODEL`
+another Claude model). The edit box updates in place, the draft on the left
+stays for comparison, and the page never closes. If the user typed while the
+reroll was out, the new text is offered beside theirs rather than replacing it.
+You do nothing; the round trip is between the browser and the app. It needs
+`codex` (signed in to ChatGPT) and `bwrap`, or `claude`, on the app's PATH, so
+if the user reports "Reroll failed" the fix is on this box, not in the strings.
+
+**With a preview**, the page opens on the preview with an editor beside it
+(a bottom sheet on a phone), and a List view holds the cards. When you give
+the user the URL, say whether the preview is a snapshot or hand-built, and
+name the list-only strings (the server prints them on start as `Preview: n
+strings are list-only: …`), so they know what they won't find on the page.
+
+**Edits autosave** to `copy-review/draft.json`, about a second after the
+user stops typing, so a reload, a closed tab or a move from phone to
+desktop loses nothing. A `draft.stale.json` is a draft left from an
+earlier `strings.json`, set aside when the strings changed.
+
+The app writes the outcome to `copy-review/result.json`, as before, with two more fields: `review`, the id at the end of the URL, and `generation`. Poll for it, and check it is this review's:
+
+```bash
+until grep -qs '"review": "<id>"' copy-review/result.json; do sleep 5; done; cat copy-review/result.json
+```
+
+A `result.json` from an earlier review is renamed to `result.<n>.json` when you submit a new one, so it never answers for this one.
+
+(Poll in chunks if needed; the result file survives any timeout.)
+
+### 3. Handle the result
+
+`result.json` is one of:
+
+```json
+{ "action": "approve",
+ "strings": [ { "id": "...", "text": "...", "original": "...", "edited": true,
+ "rerolled": false, "rerolls": [], "done": true } ] }
+```
+
+```json
+{ "action": "reroll", "guidance": "less breathless, shorter, no em dashes",
+ "strings": [ { "id": "...", "text": "...", "original": "...", "edited": false } ] }
+# Copy review brief: CARLOS_MEMORY_MIB in the rootfs docs (#892 S1)
+
+Paul delegates copy review for platform CLI, console and docs copy to you. You
+are the copy editor; your edits will be applied as approved copy.
+
+## The facts
+
+A rootfs app's processes are declared in processes.json: web (serves HTTP),
+workers (background jobs such as Sidekiq), release (runs once per deploy, for
+migrations) and console (an interactive session). The platform now gives web
+and every worker a new environment variable, CARLOS_MEMORY_MIB: the memory
+limit that process was started with, in MiB (for example 1024, or 2048 at the
+xlarge size). The app's files cannot set it. Release, `carlos run` commands
+and consoles do not get it. Its purpose: one image and one config can pick
+how many processes to start (Puma's workers, the number of Sidekiq processes)
+from the instance's size. The size changes at the next start, and the
+variable with it.
+
+Readers: developers deploying a Rails or similar app on the platform.
+
+## The string (draft; the id is fixed)
+
+- PS-1-C01, a new bullet in docs/site/rootfs.md under "What every process
+ gets", after the CARLOS_HOST bullet. The section starts "Every process of
+ the instance gets the same environment: web, the workers and release
+ alike." Draft:
+
+ > CARLOS_MEMORY_MIB is the memory limit web and each worker were started with, in MiB, such as 2048 at the xlarge size. Use it to choose how many processes to start, such as Puma's workers. Release, carlos run and consoles do not get it.
+
+## House rules (Paul's, all binding)
+
+- No em dashes, ever. Use a full stop and a new sentence.
+- Plain words. No jargon a reader would not know. Short.
+- Neutral names only (shop, example.com). Never a tenant's name.
+- Keep the literal names CARLOS_MEMORY_MIB, carlos run and xlarge.
+- One paragraph, no line breaks inside it.
+- Do not change the facts. If a fact looks wrong, flag it.
+
+## Output
+
+1. A table of changes only: `id | current | new | why`.
+2. A list of flagged rows: `id | problem`.
+3. One line of counts: changed, flagged, left alone.
+# Rootfs apps
+
+A rootfs app is an app shipped as a read-only Linux image instead of a single binary. You build the image on your own machine, from a Dockerfile or anything else that makes an OCI image or a directory, and carlos ship --rootfs uploads it. The platform never builds anything and never pulls from a registry.
+
+A rootfs app runs only on boxes your account owns: a fleet of yours on a deployment that runs apps for other people, or any box of a deployment run for one customer. The box must be on the nested layout, must run overlap deploys and must have passed its rootfs check. The console refuses anywhere else, and so does the box.
+
+A fleet app's secrets and its store credential are sealed to the fleet's own secrets key, so register one before the app needs a secret. [carlos fleets](/docs/cli#carlos-fleets) explains how.
+
+## What fixes an app's kind
+
+An app's first release makes it a binary app or a rootfs app, and it stays that kind. A release of the other kind is refused when you ship it. To change kinds, create a new app.
+
+Each instance takes its hibernation setting from the release it is created with, and keeps it. A rootfs app is always on unless that release was shipped with carlos ship --hibernate. A later release that asks for the other setting is refused when you ship it.
+
+## Processes
+
+The JSON file you pass to carlos ship --processes names the commands the image runs. Each is an argv array, either an absolute path or a name found on the image's PATH, with an optional env of plain values (never secrets) and an optional working_dir.
+
+```json
+{
+ "web": {"command": ["bundle", "exec", "puma", "-C", "config/puma.rb"]},
+ "worker": {"command": ["/rails/bin/jobs"]},
+ "release": {"command": ["/rails/bin/rails", "db:migrate"]},
+ "console": {"command": ["/rails/bin/rails", "console"]}
+}
+```
+
+- web is required, exactly one. It serves HTTP on CARLOS_SOCKET.
+
+- release is optional, at most one. It runs on every deploy, the first included, before the new web starts. It may run for ten minutes unless it sets timeout_sec.
+
+- console is optional, at most one. It is the command an interactive session starts. The platform never starts it on its own.
+
+- Any other name is a worker, up to four of them. A name is lowercase letters, digits and hyphens, starts with a letter, and is at most 16 characters long.
+
+Commands are not run through a shell, so a $CARLOS_SOCKET written in a command is passed as it is. Read the variable in your server's config file instead, or run the command with sh -c if your image has a shell.
+
+## What every process gets
+
+Every process of the instance gets the same environment: web, the workers and release alike. That is the app's config bundle, the instance's own variables and secrets, its store's coordinates, and these:
+
+- CARLOS_SOCKET is the unix socket web serves HTTP on.
+
+- CARLOS_DB is the instance's SQLite database, the one file the platform replicates. An app that keeps its data somewhere else can ignore it.
+
+- CARLOS_HOST, CARLOS_REGION, CARLOS_CONTROL_SOCKET and CARLOS_PURGE mean what they mean for a binary instance, as [What an instance is started with](/docs/cli#what-an-instance-is-started-with) says.
+
+- HOME is /tmp unless the image or the app sets it.
+
+## Health
+
+web must answer GET / on CARLOS_SOCKET with a status below 500 within 120 seconds of starting. Until it does, the instance does not serve and its workers do not start.
+
+## What it can write
+
+The image is the instance's root filesystem, and it is read-only. An instance writes in two places: the directory CARLOS_DB is in, which is kept across restarts and deploys, and /tmp, which is empty at every start. /tmp is held in memory, so what is in it counts against the instance's memory.
+
+## Memory and CPU
+
+All of an instance's processes share one memory and CPU limit, the same tiers a binary instance gets, 1 GB by default. A process that goes over it is stopped and started again.
+
+## JIT compilers
+
+Memory is never writable and executable at once, unless the release is shipped with carlos ship --jit. A JIT compiler needs that: Node, Bun and Deno, the JVM, Ruby's YJIT and PHP's opcache JIT. Ruby, PHP and Python run well without one.
+
+A release shipped with --jit has jit set in its manifest, and every process of its instances runs with that protection off: web, the workers and release. Nothing else about the instance changes. The setting belongs to the release, so a later release can turn it on or off.
+
+Node stops at start without --jit. node --jitless does run, but only as an interpreter and without WebAssembly, which makes most apps much slower. Ship a Node app with --jit instead.
+
+carlos ship --check warns when a process runs Node, Bun or Deno and the release is not shipped with --jit, because the check passes on your machine and the box then stops the process at start.
+
+## Network
+
+An instance can reach public addresses, such as an object store or a managed database's public endpoint. It cannot reach a private address unless a system operator allows it for the app with carlos apps set --egress-allow, and it never reaches the box it runs on or the cloud's metadata service.
+
+## Commands and consoles
+
+carlos run runs a one-off command on an instance: a data fix, a rake task, an artisan or manage.py command. It runs inside the instance's image, in web's working_dir, with web's environment and the same database. Its output comes back to your terminal, and carlos exits with the command's own status.
+
+```sh
+carlos run --app shop --instance shop.example.com -- bin/rails db:seed
+carlos run --app shop --instance shop.example.com -- php artisan cache:clear
+carlos run --app shop --instance shop.example.com -- python manage.py clearsessions
+```
+
+A command with a slash in it, like bin/rails, is found from web's working_dir. A bare name, like php, is found along the image's PATH. Commands are not run through a shell, so for a pipe or a variable, run sh -c with the line in quotes.
+
+A console runs the same way, in a terminal session. Sessions are off until an owner turns them on for the app. Then carlos console starts the app's console process, and carlos run -it starts any other command, such as a shell.
+
+```sh
+carlos apps set shop --interactive on
+carlos console --app shop --instance shop.example.com
+carlos run -it --app shop --instance shop.example.com -- sh
+```
+
+carlos ship fills in console when a release declares none: bin/rails console for Rails, php artisan tinker for Laravel and python manage.py shell for Django. Any other app declares its own in processes.json.
+
+A session can read and change everything the instance can. It ends after 30 minutes without a keystroke, and a deploy or a restart ends it too. [carlos run](/docs/cli#carlos-run) has the limits, the exit statuses and how to run commands from CI.
+
+## Deployments run for one customer
+
+A deployment whose boxes all belong to one customer says so with CARLOS_DEPLOYMENT_SINGLE_TENANT=1, in the console's environment and in every box's host.env. A rootfs app can then run on any of its boxes, not only on a fleet. Leave it unset on a deployment that runs apps for other people. The console does not start if the value is anything but 0 or 1.
+
+```ini
+CARLOS_DEPLOYMENT_SINGLE_TENANT=1
+```
+
+Dedicated pools do not count as a customer's own boxes yet, because nothing ties a pool to one account. On a deployment that runs apps for other people, a rootfs app cannot run in one.
+
+## Not in this version
+
+More than one copy of an app across boxes, more than one SQLite database per instance, moving a rootfs instance to another fleet or region, and starting a new rootfs instance from a copy of another database.
+
+codex
+| id | current | new | why |
+|---|---|---|---|
+| PS-1-C01 | CARLOS_MEMORY_MIB is the memory limit web and each worker were started with, in MiB, such as 2048 at the xlarge size. Use it to choose how many processes to start, such as Puma's workers. Release, carlos run and consoles do not get it. | CARLOS_MEMORY_MIB is the memory limit, in MiB, that web and each worker start with. For example, it is 2048 at the xlarge size. Use it to choose how many processes to start, such as Puma workers. Release, carlos run and consoles do not get this variable. | Fixes the grammar, uses shorter plain sentences, and makes “it” explicit. |
+
+No flagged rows.
+
+changed: 1, flagged: 0, left alone: 0
diff --git a/docs/superpowers/notes/census-proposal-egress-allow-cidr-console.md b/docs/superpowers/notes/census-proposal-egress-allow-cidr-console.md
index 7bad71495..ee88bc15f 100644
--- a/docs/superpowers/notes/census-proposal-egress-allow-cidr-console.md
+++ b/docs/superpowers/notes/census-proposal-egress-allow-cidr-console.md
@@ -6,6 +6,6 @@ Envelopes re-pinned: `.`, `internal/egressaddr`, `internal/instancectl`, `intern
Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. 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 the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
-Seal: `f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6` → `f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6`.
+Seal: `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132` → `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132`.
Overlay: `internal/provision/testdata/plan14-root-reads-egress-allow-cidr-console.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/census-proposal-egress-allow-cidr.md b/docs/superpowers/notes/census-proposal-egress-allow-cidr.md
index 63ae22c34..6b13fc839 100644
--- a/docs/superpowers/notes/census-proposal-egress-allow-cidr.md
+++ b/docs/superpowers/notes/census-proposal-egress-allow-cidr.md
@@ -6,6 +6,6 @@ Envelopes re-pinned: `internal/apppolicy`, `internal/egressaddr`, `internal/inst
Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. 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 the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
-Seal: `f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6` → `f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6`.
+Seal: `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132` → `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132`.
Overlay: `internal/provision/testdata/plan14-root-reads-egress-allow-cidr.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/census-proposal-group-revoke-readback-1255.md b/docs/superpowers/notes/census-proposal-group-revoke-readback-1255.md
new file mode 100644
index 000000000..309293ee6
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-group-revoke-readback-1255.md
@@ -0,0 +1,11 @@
+# Census approval: group-revoke-readback-1255
+
+Ruling `census-ruling-group-revoke-readback-1255`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+Envelopes re-pinned: `internal/grouproll`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. 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 the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Seal: `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132` → `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-group-revoke-readback-1255.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md b/docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md
new file mode 100644
index 000000000..8ff3e5f41
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md
@@ -0,0 +1,25 @@
+# Census approval: stateless-scale-1-memory-env
+
+Ruling `census-ruling-stateless-scale-1-memory-env`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/activator/rootfs.go` `ExecBackend.spawnRootfs` | body | unchanged (24) | #892 S1: the web launch environment also gets CARLOS_MEMORY_MIB, the tier argument's MemoryMax (the limit this call already passes StartRootfs) in MiB, through withMemoryVar (map composition, set after the file environment); no read added, read sites unchanged |
+| `internal/activator/rootfsenv.go` `ExecBackend.rootfsCmdVars` | body | unchanged (3) | #892 S1: CARLOS_MEMORY_MIB removed from a run's (and so a release's) environment with withoutVars, so a tenant file cannot supply it; map composition only, no read added |
+| `internal/activator/rootfsenv.go` `ExecBackend.rootfsTTYVars` | body | unchanged (3) | #892 S1: CARLOS_MEMORY_MIB removed from a session's environment with withoutVars; map composition only, no read added |
+| `internal/activator/rootfsenv.go` `ExecBackend.rootfsWorkerVars` | body | unchanged (4) | #892 S1: a worker's environment also gets CARLOS_MEMORY_MIB from g.Tier.MemoryMax (the limit LaunchRootfsWorker already passes StartRootfsWorker) in MiB, through withMemoryVar; map composition only, no read added |
+
+Envelopes re-pinned: `internal/activator`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. 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 the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/activator/rootfs.go` `ExecBackend.spawnRootfs`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-route (J1, as spawnUnitFrom, whose shape it has): new (rootfs Plan 2 Tasks 5 and 9): prepareKeyedAt (the instance's own directories, environment and listeners, unchanged), the schema-2 tenant launch file (environment only, CARLOS_SOCKET and CARLOS_DB set by the agent), the caller's exec gate, then StartRootfs over the control socket naming the image and web; root resolves the command from its own staged manifest (C4) and the tenant file may name no command (the trampoline refuses one); the failure handling is spawnUnitFrom's; its sites are the row's host and route; no root decision; final fix I1: root's answers that guarantee no start (ErrStartRefused: 503 not ready or claim-armed, 501 unconfigured, 400, 409, 507), like its 403, are marked a refusal (refuseRootfs), so verdictOf and classifyStep record no failure of the build and no stop is asked; a 502 and a transport failure still may have run; the same nineteen sites, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 fix wave 1 (d35fcb1f, census P1-1): takes the tier root is asked for as an argument; a zero tier means GenTier's (the former body), so a caller that chose a limit has it kept, as spawnChildFrom and spawnUnitFrom keep theirs; the same nineteen sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=sets up.inputs = launchInputs(id.Version, fileEnv): the image version and env this spawn already read, hashed in memory; no new read; read sites unchanged (20); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main launchInputs on rootfs handle from existing staged image version and fileEnv. Keep branch sandbox gate and root identity validation. No new read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedRootfsGen naming the host, the unit and the error already in hand; the +registry:Host site is that argument to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-platform-mail-submission;basis=Task 6: the same warnUndeclaredMailBuild call for a rootfs spawn. Agent, not root.
+- `internal/activator/rootfsenv.go` `ExecBackend.rootfsCmdVars`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 6: a rootfs cmd's environment is the binary cmdVars composed through rootfsVars (the image's socket and database paths); reads Socket;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.
+- `internal/activator/rootfsenv.go` `ExecBackend.rootfsTTYVars`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: a rootfs session environment: ttyVars over the generation launch environment, then rootfsVars with the row canonical socket and dbPath set after the file environment, as rootfsCmdVars does; map composition only;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.
+- `internal/activator/rootfsenv.go` `ExecBackend.rootfsWorkerVars`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, D1: a worker's launch environment is web's launch environment for the generation (the handle's LaunchEnv, the agent-owned variables as web got them), with the generation's control socket only when web's listener bound, then rootfsVars with the row's canonical socket and database path; nothing from a tenant or app is added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.
+
+Seal: `f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6` → `47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-stateless-scale-1-memory-env.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/plans/2026-11-11-stateless-replicas-scale-copy.md b/docs/superpowers/plans/2026-11-11-stateless-replicas-scale-copy.md
new file mode 100644
index 000000000..5cac89b3c
--- /dev/null
+++ b/docs/superpowers/plans/2026-11-11-stateless-replicas-scale-copy.md
@@ -0,0 +1,12 @@
+# Stateless replicas at production scale: copy deck
+
+Copy for #892 (spec `docs/superpowers/specs/2026-11-11-stateless-replicas-production-scale-design.md`).
+Use the rootfs copy deck's id/file/text/status format. No em dashes. Examples
+use shop and example.com. Rows are approved by delegation (a Luna pass) and
+listed for Paul's copy review; his edits replace them verbatim.
+
+## S1: CARLOS_MEMORY_MIB
+
+| id | file | text | status |
+|---|---|---|---|
+| PS-1-C01 | docs/site/rootfs.md | CARLOS_MEMORY_MIB is the memory limit, in MiB, that web and each worker start with. For example, it is 2048 at the xlarge size. Use it to choose how many processes to start, such as Puma workers. Release, carlos run and consoles do not get this variable. | approved by delegation (Luna pass, gpt-5.6-luna, 2026-11-11; brief and result in docs/superpowers/notes/LUNA-COPY-BRIEF-STATELESS-SCALE-S1.md); for Paul's copy review |
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R1.md
new file mode 100644
index 000000000..4bc89dc0b
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R1.md
@@ -0,0 +1,23 @@
+# Astra findings: #892 S1 branch and census, round 1
+
+Reviewer: Astra (codex exec -m gpt-6-astra, read-only), brief CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md, code tip 4dd2825a. Final answer verbatim below.
+
+Findings: **P1: none. P2: none. P3: none.**
+
+Reviewed `origin/main..4dd2825a`, using the authority specified in the brief.
+
+- All five launch roles satisfy S1. Web and workers derive MiB from the exact limit passed to root; release, run and session environments remove the name after composition. Manifest validation also rejects `CARLOS_*` variables.
+- Config-change comparisons, `launchInputs`, escrow and moves retain their existing file-environment inputs. The worker/web equality check remains consistent.
+- The tests have assertions that can detect incorrect values, tenant overrides, missing removal, rounding errors, map mutation and unapplied copy. The web memory test compares against the captured root request; the worker test deliberately changes `g.Tier`.
+
+Targeted tests **could not run**: Go failed to create its work directory under `/home/paulca/.cache/tmp` because the sandbox is read-only. This is a source-review verdict, not a test-pass claim.
+
+| unit | approve or reject | lines read | reason |
+|---|---|---|---|
+| `ExecBackend.spawnRootfs` | approve | `internal/activator/rootfs.go:331–446` | Sets the variable after environment composition from `tier.MemoryMax`, also passed to root at line 387. Existing gates, reads and failure handling remain intact. |
+| `ExecBackend.rootfsCmdVars` | approve | `internal/activator/rootfsenv.go:39–46,56–63`; `backend_rootfs.go:340–346` | Removes the name after all merges; release inherits that removal. No new read or weakened check. |
+| `ExecBackend.rootfsTTYVars` | approve | `internal/activator/rootfsenv.go:48–54`; `backend_rootfs.go:340–343` | Removes the name from the final session environment without changing socket, database or authentication checks. |
+| `ExecBackend.rootfsWorkerVars` | approve | `internal/activator/rootfsenv.go:65–76`; `backend_rootfs.go:502–589` | Uses `g.Tier.MemoryMax`, matching root’s request at line 562; overrides the retained file environment. No new authority or read source. |
+| `internal/activator` envelope | approve | `rootfs.go:78–103,331–446`; `rootfsenv.go:19–76`; `backend_exec.go:3410–3439`; `prepare.go:345–368`; changed tests | The new helper only copies maps and formats an existing integer. All changed production functions preserve root’s existing paths, commands, validation and refusal behavior. |
+
+**READY**
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R2.md
new file mode 100644
index 000000000..559d340da
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-STATELESS-SCALE-S1-R2.md
@@ -0,0 +1,25 @@
+# Astra findings: #892 S1 census after merging main, round 2
+
+Reviewer: Astra (codex exec -m gpt-6-astra, effort high, read-only), brief CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1-R2.md, tip 819b7cfb. Final answer verbatim below.
+
+**P1: none. P2: none. P3: none.** Round 1 had no outstanding findings.
+
+Reviewed commit `819b7cfb4f26719583b9ae1143e629dcf0199c33` against amadan’s `origin/main` at `d3266e8e6fbbad5367453a9d75ed016182b84a84`.
+
+The `spawnRootfs` merge resolution preserves both parents’ changes without meaningful reordering. `withMemoryVar` wraps the completed environment composition; `warnUndeclaredMailBuild` remains immediately afterward, before the launch-file write and execution gate. The warning neither modifies that environment nor changes the requested memory limit.
+
+All paths below are under `internal/activator/`; ranges identify lines read.
+
+| Unit | Verdict | Lines read | Reason |
+|---|---|---|---|
+| `ExecBackend.spawnRootfs` | Approve | `rootfs.go:331–446`; `mailbuild.go:12–59` | Uses `tier.MemoryMax`, also passed to root at line 388. Preserves gates, identity validation, refusal handling and retained file environment. No new read source or root authority. |
+| `ExecBackend.rootfsCmdVars` | Approve | `rootfsenv.go:39–46,56–63`; `cmdunit.go:209–239`; `backend_rootfs.go:385–407` | Removes the name after composition; release inherits removal. Existing socket, database and credential handling remains intact. |
+| `ExecBackend.rootfsTTYVars` | Approve | `rootfsenv.go:48–54`; `cmdunit.go:232–239`; `backend_rootfs.go:385–407` | Removes the name from the final session environment without weakening existing checks or introducing reads. |
+| `ExecBackend.rootfsWorkerVars` | Approve | `rootfsenv.go:65–76`; `backend_rootfs.go:563–651` | Uses `g.Tier.MemoryMax`, matching root’s request at line 623. Overrides tenant input while preserving storage-mode handling and launch checks. |
+| `internal/activator` envelope | Approve | Above; `rootfsenv.go:19–37`; `backend_exec.go:2883–2912,3624–3654`; `prepare.go:344–373`; `rootfs_memoryvar_test.go:1–134`; `rootfs_invariants_test.go:1197–1220`; `rootfsenv_test.go:55–98` | All changed production functions preserve existing root boundaries. The helper copies maps and formats an existing integer. Changed tests cover requested limits, tenant overrides, one-shot removal, rounding and input preservation. |
+
+The census chain retains main’s entries and appends the S1 overlay. All four units retain their recorded dispositions.
+
+Source review only: no Go commands or tests ran, as instructed. No files changed or external verdicts posted.
+
+**READY**
\ No newline at end of file
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1-R2.md
new file mode 100644
index 000000000..24f70a9b3
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1-R2.md
@@ -0,0 +1,8 @@
+# Astra brief: #892 S1 census re-approval after merging main (round 2)
+
+You approved this branch's census in round 1 (CODEX-FINDINGS-STATELESS-SCALE-S1-R1.md, code tip 4dd2825a, base 01d6ca78). Main has since moved 142 commits. Merge commit f15d5aba brings origin/main in; the only conflicts were:
+
+1. internal/activator/rootfs.go, ExecBackend.spawnRootfs: the branch's withMemoryVar(...) line and main's new b.warnUndeclaredMailBuild(rt, id.Version) call (census-ruling-platform-mail-submission). Both are kept.
+2. internal/provision/testdata/plan14-root-reads-chain.tsv: main's chain lines taken; the S1 overlay re-proposed with make census-propose on the new base (seal f959a362 -> 47ebd734), same four units and claims.
+
+Task: read docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md (the card) and `git diff origin/main...HEAD` for internal/activator/. Answer the card's review question for every unit and the re-pinned internal/activator envelope: approve or reject, with lines read. Also say whether the merge resolution in spawnRootfs loses or reorders anything from either side in a way that matters. Report P1/P2/P3 findings, then the table, then READY or NOT READY. Read-only; do not run go (the sandbox has no build cache).
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md
new file mode 100644
index 000000000..cd5d8041f
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-STATELESS-SCALE-S1.md
@@ -0,0 +1,72 @@
+# Review brief: #892 S1, CARLOS_MEMORY_MIB (branch and census), round 1 of 3
+
+Repo carlos/platform, branch `stateless-scale-1-memory-env`, commit 4dd2825a.
+Under review: the diff `origin/main..4dd2825a` (main is 01d6ca78), and the census
+card `docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md`.
+Authorities (merged on main): `docs/superpowers/specs/2026-11-11-stateless-replicas-production-scale-design.md`
+§4 S1, rev 2, read from branch `design-stateless-replicas-scale` at 2d7fcb29
+(`git show 2d7fcb29:<path>`). Its review is closed (Astra round 1, READY AFTER FIXES,
+fixes applied); its merge waits only on CI, so treat that file as the authority.
+Also `docs/site/rootfs.md`,
+AGENTS.md "The census: the reviewer decides".
+
+You are an independent reviewer (the author is a Claude model). You give two
+verdicts: one for the branch, and one census verdict for every unit and re-pinned
+envelope on the card.
+
+## Fixed: do not re-argue
+
+- The spec's S1 rules: web gets the tier `spawnRootfs` passes root; a worker gets
+ `g.Tier`, the figure `LaunchRootfsWorker` passes root; release, runs and sessions
+ get none, and the name is removed from theirs.
+- Copy row PS-1-C01 is approved by delegation (Luna) and goes to Paul separately.
+ Do not edit the wording.
+
+## What to check
+
+1. For each of web, worker, release, run and session: is the variable exactly what
+ the spec says (the same number passed to root on that start, in MiB rounded
+ down, or absent), and can no tenant file, config bundle or earlier launch
+ environment put a different value in front of the process? Check every path
+ that writes a rootfs launch file (`writeRootfsLaunchFor`, `writeRootfsWorkerLaunch`).
+2. Does anything compare or hash a launch environment such that a new variable
+ changes behaviour: restarts on config change, edge page cache inputs
+ (`launchInputs`), escrow of the launch env, moves' box-owned variables, the
+ worker-equals-web check?
+3. Census: for each unit on the card (`spawnRootfs`, `rootfsCmdVars`,
+ `rootfsTTYVars`, `rootfsWorkerVars`) and the re-pinned `internal/activator`
+ envelope, apply AGENTS.md's rule: reject if root now opens, runs, queries or
+ follows anything new from a path or input a tenant, app or box agent controls,
+ or if a check, refusal or environment root relies on is weakened. Cite lines.
+4. Are the tests (`internal/activator/rootfs_memoryvar_test.go`, the updated
+ `TestRootfsWebLaunchCarriesTheContract`, `approved_stateless_scale_copy_test.go`)
+ able to fail for the behaviour they name?
+
+## 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
+
+Findings ranked P1, P2, P3, each with the evidence (file:line, verified), the
+failure scenario, a concrete fix and its fault family. Then the census table:
+`unit | approve or reject | lines read | reason`, one row per unit and one for the
+envelope. End with exactly one branch 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; targeted `go test -run` is fine.
diff --git a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
index 649057ab9..eaabec038 100644
--- a/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
+++ b/docs/superpowers/specs/2026-11-09-group-roll-verb-design.md
@@ -381,6 +381,7 @@ build to it.
| V18 | A request that gets no response is one failed call | A read whose request got no response at all (the SDK's RequestSendError: a reset or EOF on a reused connection, no call in CloudTrail) is retried as a throttle is (V17's budget); a timeout is not, and stays one bound. A failure to get credentials (AssumeRole, SSO), throttled or unanswered, is never retried, so no credential call repeats. Writes and sessions are never retried | G5 release 1, dev, 2026-11-11: the post-prepare group describe failed in 14 ms with no CloudTrail call; resume closed it (8a3d302) |
| V19 | The provider observation names one launch template version; any other pinned version refuses `observation` | The observation carries across a re-pin that changes only user data (§7.1). A launch template version other than the observation's, with the same template id and name, is accepted when the two versions' launch template data are identical once UserData is removed; anything else refuses `observation` as before | G5 release 1, 2026-11-11: every release's re-pin left the next roll needing a pin-back (Paul approved option b, 11-11) |
| V20 | close-lost reads the group and EC2 only | After the group and EC2 checks, close-lost lists `control/edges/` once (journaled, like the floor's listing; a failure refuses and leaves the transaction open). If the member's edges record is still listed it records `edges_published: true` and says so, naming the record. It never deletes it: the boxes' termination recovery retires it once every host naming the member is settled, and a drain does not wait for a member whose departure the box has enrolled | #1192, dev IE 2026-11-17: a member closed with close-lost kept its edges record (its departure was held by a trashed app's host) and the next drain failed waiting on it (8a3d302: report, never delete) |
+| V21 | The status read after a revoke (finish_return, and rollback's revoke of a remaining apply permit) is one session; an Uncertain read stops the verb with the transaction open | That read alone is asked once more when it is Uncertain (a session cut at its 15 s bound, a plugin that did not run): status writes nothing on the box, the first session's error stays journaled (with its terminate, when it was cut at its bound with a known session id), and the revoke already answered. A Refusal, or a second Uncertain, stops the verb as before; resume reads it again. Other box sessions stay single-attempt (V17) | Flagship v0.39.0 window 2026-11-19, US move 2 (#1255): one post-revoke status session timed out at 15 s, where 74 others took 0.6 to 2.6 s; the verb refused and one resume closed the move |
Not deviations, recorded so nobody "fixes" them in the port: the drain-rerun
backoff and the TakeHost `wake_timeout` follow-ups from the held build stay
diff --git a/internal/activator/cmd_swap_test.go b/internal/activator/cmd_swap_test.go
index 5dc2e1826..b6e346ab3 100644
--- a/internal/activator/cmd_swap_test.go
+++ b/internal/activator/cmd_swap_test.go
@@ -221,7 +221,11 @@ func TestARetiredRunKeepsItsBuildPinnedUntilItSettles(t *testing.T) {
if res.Outcome != SwapDone {
t.Fatalf("Swap = %+v", res)
}
- waitFor(t, "the interrupt's failed settle", func() bool { n, _ := cb.unit.stopped(); return n >= 1 })
+ // The count rises as the settle begins; Stop below must not join it.
+ waitFor(t, "the interrupt's failed settle", func() bool {
+ n, _ := cb.unit.stopped()
+ return n >= 1 && h.(*cmdRun).h.settlingDone()
+ })
pinned := func() bool { return slices.Contains(readPinPaths(t, path, f.host), f.incumbent.StagedPath) }
if err := f.a.persistGenerations(); err != nil {
t.Fatal(err)
diff --git a/internal/activator/cmd_test.go b/internal/activator/cmd_test.go
index 3fe6acceb..56b322a19 100644
--- a/internal/activator/cmd_test.go
+++ b/internal/activator/cmd_test.go
@@ -397,11 +397,16 @@ func TestAnUnprovenRunStopKeepsReplicationAndTheLease(t *testing.T) {
}
a.Bounce(rt.Host)
waitFor(t, "the first settle", func() bool { n, _ := cb.unit.stopped(); return n >= 1 })
- // Every sweep retries, and every retry fails: nothing is given up.
+ // Sweeps retry, and every retry fails: nothing is given up. A
+ // sweep while the last attempt is still settling, or before its
+ // stop is pending, skips it, so each wait sweeps as it polls.
for i := 0; i < 3; i++ {
before, _ := cb.unit.stopped()
- a.sweepOnce()
- waitFor(t, "a retried settle", func() bool { n, _ := cb.unit.stopped(); return n > before })
+ waitFor(t, "a retried settle", func() bool {
+ a.sweepOnce()
+ n, _ := cb.unit.stopped()
+ return n > before
+ })
if a.entryCount() != 1 {
t.Fatal("the entry went while its run was not proven stopped")
}
diff --git a/internal/activator/rootfs.go b/internal/activator/rootfs.go
index 952e06266..81ae32e26 100644
--- a/internal/activator/rootfs.go
+++ b/internal/activator/rootfs.go
@@ -367,7 +367,8 @@ func (b *ExecBackend) spawnRootfs(ctx context.Context, rt registry.Route, sock s
_ = os.Remove(filepath.Join(p.dataDir, instancectl.GenLaunchFileName(gen)))
}
}
- childVars := storageVars(rt, rootfsVars(b.agentOwnedVars(rt, sock+".control", fileEnv, ctl != nil), sock, p.dbPath))
+ // memoryVar is tier, the limit root is asked for below (#892 S1).
+ childVars := withMemoryVar(storageVars(rt, rootfsVars(b.agentOwnedVars(rt, sock+".control", fileEnv, ctl != nil), sock, p.dbPath)), tier.MemoryMax)
b.warnUndeclaredMailBuild(rt, id.Version)
steps.mark(time.Now(), "prepare ("+prep.String()+")")
if err := b.writeRootfsLaunchFor(p, instancectl.RoleRun, gen, rt.Host, release.ProcessWeb, rootfsLaunchEnv(childVars)); err != nil {
diff --git a/internal/activator/rootfs_invariants_test.go b/internal/activator/rootfs_invariants_test.go
index 57c4e6d39..43538ae43 100644
--- a/internal/activator/rootfs_invariants_test.go
+++ b/internal/activator/rootfs_invariants_test.go
@@ -1211,8 +1211,9 @@ var rootfsLaunchRows = map[string]func(t *testing.T) (instancectl.Launch, map[st
l := readLaunchNamed(t, b, rt, instancectl.GenLaunchFileName(7))
// What startRootfs composed: the file environment the generation
// launched with (its handle keeps it), the agent-owned variables,
- // then the socket and the database.
- vars := rootfsVars(b.agentOwnedVars(rt, sock+".control", p.(*unitProc).LaunchEnv(), true), sock, b.pathsFor(rt).dbPath)
+ // then the socket and the database, and the memory limit root was
+ // asked for (#892 S1).
+ vars := withMemoryVar(rootfsVars(b.agentOwnedVars(rt, sock+".control", p.(*unitProc).LaunchEnv(), true), sock, b.pathsFor(rt).dbPath), webMemoryMaxAsked(t, ctl))
if vars["SHOP_MODE"] != "live" {
t.Fatalf("the instance's file did not reach the composed variables: %v", vars)
}
diff --git a/internal/activator/rootfs_memoryvar_test.go b/internal/activator/rootfs_memoryvar_test.go
new file mode 100644
index 000000000..6e3b69710
--- /dev/null
+++ b/internal/activator/rootfs_memoryvar_test.go
@@ -0,0 +1,134 @@
+package activator
+
+import (
+ "context"
+ "fmt"
+ "path/filepath"
+ "regexp"
+ "strconv"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/cgroup"
+ "github.com/carlosframework/platform/internal/instancectl"
+)
+
+// #892 S1 (spec 2026-11-11-stateless-replicas-production-scale-design.md
+// §4 S1): web and every worker get CARLOS_MEMORY_MIB, the memory.max root
+// is asked to start that unit at, in MiB; a tenant's file cannot set it;
+// release, runs and sessions never carry it.
+
+// The tenant's file tries to set the figure itself.
+const memoryVarEnvFile = "SHOP_MODE=live\nCARLOS_MEMORY_MIB=99999\n"
+
+var startRootfsMemRe = regexp.MustCompile(`^start-rootfs \S+ gen=7 memory_max=(\d+) `)
+
+// webMemoryMaxAsked is the memory_max of root's start of generation 7.
+func webMemoryMaxAsked(t *testing.T, ctl *fakeControl) int64 {
+ t.Helper()
+ for _, c := range ctl.callList() {
+ if m := startRootfsMemRe.FindStringSubmatch(c); m != nil {
+ n, err := strconv.ParseInt(m[1], 10, 64)
+ if err != nil {
+ t.Fatal(err)
+ }
+ return n
+ }
+ }
+ t.Fatalf("root was never asked to start generation 7: %q", ctl.callList())
+ return 0
+}
+
+func TestRootfsWebMemoryVarIsTheLimitRootIsAsked(t *testing.T) {
+ for _, size := range []string{"", "large", "xlarge"} {
+ t.Run("size="+size, func(t *testing.T) {
+ b, ctl := newRootfsBackend(t)
+ rt := rootfsRoute(b)
+ rt.Size = size
+ startRootfsGen7(t, b, ctl, rt, memoryVarEnvFile)
+ asked := webMemoryMaxAsked(t, ctl)
+ if size != "" {
+ s, _ := cgroup.SizeByName(size)
+ if asked != s.Limit.MemoryMax {
+ t.Fatalf("root was asked memory_max=%d for size %s, want %d", asked, size, s.Limit.MemoryMax)
+ }
+ }
+ env := envMap(t, readLaunchNamed(t, b, rt, instancectl.GenLaunchFileName(7)).Env)
+ if want := strconv.FormatInt(asked>>20, 10); env[memoryVar] != want {
+ t.Errorf("%s = %q, want %q (memory_max %d)", memoryVar, env[memoryVar], want, asked)
+ }
+ if env["SHOP_MODE"] != "live" {
+ t.Errorf("the tenant's own variable is gone: %v", env)
+ }
+ })
+ }
+}
+
+func TestRootfsWorkerMemoryVarIsItsGenerationsTier(t *testing.T) {
+ t.Parallel()
+ b, ctl, rt, units := newWorkerBackend(t)
+ web, g := startWorkerWeb(t, b, ctl, rt, units, memoryVarEnvFile)
+ // A generation kept at a larger tier than the row's (a swap keeping the
+ // incumbent's while a shrink waits): the worker follows the generation,
+ // which is what root is asked for.
+ xl, _ := cgroup.SizeByName("xlarge")
+ g.Tier = xl.Limit
+ units.set(instancectl.WorkerUnitName(rt.Host, "jobs"), "active", "inv1", true)
+ before := len(ctl.callList())
+ wp, err := b.LaunchRootfsWorker(context.Background(), rt, "jobs", g, web)
+ if err != nil {
+ t.Fatalf("LaunchRootfsWorker: %v", err)
+ }
+ t.Cleanup(func() { stopWorker(t, wp) })
+ want := fmt.Sprintf("start-rootfs-worker %s jobs memory_max=%d ", rt.Host, xl.Limit.MemoryMax)
+ if calls := ctl.callList()[before:]; len(calls) != 1 || len(calls[0]) < len(want) || calls[0][:len(want)] != want {
+ t.Fatalf("root was asked %q, want a start beginning %q", calls, want)
+ }
+ env := envMap(t, readLaunchNamed(t, b, rt, instancectl.WorkerLaunchFileName("jobs")).Env)
+ if env[memoryVar] != "2048" {
+ t.Errorf("worker %s = %q, want 2048", memoryVar, env[memoryVar])
+ }
+}
+
+func TestRootfsOneShotsCarryNoMemoryVar(t *testing.T) {
+ b, ctl := newRootfsBackend(t)
+ rt := rootfsRoute(b)
+ up, _ := startRootfsGen7(t, b, ctl, rt, memoryVarEnvFile)
+ genEnv := up.LaunchEnv()
+ if genEnv[memoryVar] != "99999" {
+ t.Fatalf("the generation's file environment lost the tenant's value before the composer ran: %v", genEnv)
+ }
+ p := b.pathsFor(rt)
+ for name, vars := range map[string]map[string]string{
+ "run": b.rootfsCmdVars(rt, genEnv, p.dbPath, "r1", filepath.Join(p.dataDir, CmdRunDirName, "r1")),
+ "session": b.rootfsTTYVars(rt, genEnv, p.dbPath, "s1", "xterm"),
+ "release": b.rootfsReleaseVars(rt, genEnv, p.dbPath),
+ } {
+ if v, ok := vars[memoryVar]; ok {
+ t.Errorf("a %s carries %s=%q", name, memoryVar, v)
+ }
+ }
+}
+
+func TestWithMemoryVar(t *testing.T) {
+ t.Parallel()
+ in := map[string]string{memoryVar: "7", "A": "1"}
+ for _, c := range []struct {
+ max int64
+ want string
+ set bool
+ }{
+ {512 << 20, "512", true},
+ {(1 << 30) + (1 << 19), "1024", true}, // rounded down
+ {0, "", false},
+ {-1, "", false},
+ } {
+ got := withMemoryVar(in, c.max)
+ v, ok := got[memoryVar]
+ if ok != c.set || v != c.want || got["A"] != "1" {
+ t.Errorf("withMemoryVar(%d) = %v, want set=%v %q", c.max, got, c.set, c.want)
+ }
+ }
+ if in[memoryVar] != "7" {
+ t.Errorf("withMemoryVar wrote its argument: %v", in)
+ }
+}
diff --git a/internal/activator/rootfsenv.go b/internal/activator/rootfsenv.go
index 1c82e25c3..b63e16bb4 100644
--- a/internal/activator/rootfsenv.go
+++ b/internal/activator/rootfsenv.go
@@ -10,7 +10,31 @@
// logged.
package activator
-import "github.com/carlosframework/platform/internal/registry"
+import (
+ "strconv"
+
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// memoryVar is the memory limit, in MiB, that root is asked to start a
+// rootfs web or worker unit at (#892 S1, spec
+// 2026-11-11-stateless-replicas-production-scale-design.md §4 S1), so an
+// app can size its own process managers (Puma's workers, a Sidekiq swarm)
+// from it. Agent-owned: set after the instance's files on every web and
+// worker launch (withMemoryVar), and removed from every one-shot's
+// environment (release, run, session), whose unit does not set the limit
+// it runs under, so no tenant file supplies a false one.
+const memoryVar = "CARLOS_MEMORY_MIB"
+
+// withMemoryVar is vars with memoryVar set to memoryMax in MiB, rounded
+// down, or removed when memoryMax names no limit. memoryMax is exactly the
+// figure the caller passes root for this start: nothing is read for it.
+func withMemoryVar(vars map[string]string, memoryMax int64) map[string]string {
+ if memoryMax <= 0 {
+ return withoutVars(vars, memoryVar)
+ }
+ return withVar(vars, memoryVar, strconv.FormatInt(memoryMax>>20, 10))
+}
// rootfsCmdVars is a carlos run's environment on a rootfs row: cmdVars over
// fileEnv, the file environment the run's generation launched with (no
@@ -18,7 +42,7 @@ import "github.com/carlosframework/platform/internal/registry"
// run's id and directory set), then rootfsVars with the row's canonical
// socket and dbPath.
func (b *ExecBackend) rootfsCmdVars(rt registry.Route, fileEnv map[string]string, dbPath, runID, runDir string) map[string]string {
- return storageVars(rt, rootfsVars(b.cmdVars(rt, fileEnv, dbPath, runID, runDir), rt.Socket, dbPath))
+ return withoutVars(storageVars(rt, rootfsVars(b.cmdVars(rt, fileEnv, dbPath, runID, runDir), rt.Socket, dbPath)), memoryVar)
}
// rootfsTTYVars is a session's environment on a rootfs row (Plan 6 Task
@@ -26,7 +50,7 @@ func (b *ExecBackend) rootfsCmdVars(rt registry.Route, fileEnv map[string]string
// launched with (no run id or directory; TERM and CARLOS_SESSION_ID set),
// then rootfsVars with the row's canonical socket and dbPath.
func (b *ExecBackend) rootfsTTYVars(rt registry.Route, fileEnv map[string]string, dbPath, sessionID, term string) map[string]string {
- return storageVars(rt, rootfsVars(b.ttyVars(rt, fileEnv, dbPath, sessionID, term), rt.Socket, dbPath))
+ return withoutVars(storageVars(rt, rootfsVars(b.ttyVars(rt, fileEnv, dbPath, sessionID, term), rt.Socket, dbPath)), memoryVar)
}
// rootfsReleaseVars is a release command's environment on a rootfs row
@@ -44,8 +68,9 @@ func (b *ExecBackend) rootfsReleaseVars(rt registry.Route, fileEnv map[string]st
// g's control socket only when web's listener bound (haveControl), then
// rootfsVars with the row's canonical socket and dbPath. So a worker's
// launch file is web's, CARLOS_SOCKET aside: a worker serves nothing, and
-// names the instance's socket, never a generation's.
+// names the instance's socket, never a generation's. Its memoryVar is g's
+// tier, the limit LaunchRootfsWorker asks root for.
func (b *ExecBackend) rootfsWorkerVars(rt registry.Route, g Gen, dbPath string, genEnv map[string]string, haveControl bool) map[string]string {
rt.Stateless = g.Stateless
- return storageVars(rt, rootfsVars(b.agentOwnedVars(rt, g.Control, genEnv, haveControl), rt.Socket, dbPath))
+ return withMemoryVar(storageVars(rt, rootfsVars(b.agentOwnedVars(rt, g.Control, genEnv, haveControl), rt.Socket, dbPath)), g.Tier.MemoryMax)
}
diff --git a/internal/activator/rootfsenv_test.go b/internal/activator/rootfsenv_test.go
index b3b02992a..62a7c87e6 100644
--- a/internal/activator/rootfsenv_test.go
+++ b/internal/activator/rootfsenv_test.go
@@ -88,7 +88,7 @@ func TestRootfsWebLaunchCarriesTheContract(t *testing.T) {
// The whole list, so a variable that starts reaching the web process
// is a visible change here. CARLOS_PURGE is the agent's (no cache on
// this backend: removed, the tenant's value with it).
- wantKeys := []string{"CARLOS_ADMIN_TOKEN", "CARLOS_CONTROL_SOCKET", "CARLOS_DB", "CARLOS_HOST", "CARLOS_INSTANCE_KEY", "CARLOS_REGION", "CARLOS_SOCKET", "SHOP_MODE"}
+ wantKeys := []string{"CARLOS_ADMIN_TOKEN", "CARLOS_CONTROL_SOCKET", "CARLOS_DB", "CARLOS_HOST", "CARLOS_INSTANCE_KEY", "CARLOS_MEMORY_MIB", "CARLOS_REGION", "CARLOS_SOCKET", "SHOP_MODE"}
if got := sortedKeys(env); !slices.Equal(got, wantKeys) {
t.Errorf("launch variables %v, want %v", got, wantKeys)
}
diff --git a/internal/activator/rootfsrelease_test.go b/internal/activator/rootfsrelease_test.go
index 9b05e5f04..3b4d72836 100644
--- a/internal/activator/rootfsrelease_test.go
+++ b/internal/activator/rootfsrelease_test.go
@@ -1951,6 +1951,10 @@ func TestUnprovenReleaseOnAnAwakeIncumbentIsRetried(t *testing.T) {
r.clk.advance(actStopTimeout)
r.a.sweepOnce()
waitFor(t, "the sweep's retry", func() bool { return len(r.rel.unit.stopTimes()) == n+1 })
+ // The count rises when StopAndSettle begins; the attempt ends (no
+ // settle in flight, lastTry stamped) only after it returns. A sweep
+ // before then is skipped, so the next one waits for the end.
+ waitFor(t, "the sweep's retry to end", op.hold.settlingDone)
if !pinned(t, r.a, r.rt.Host, "v2") {
t.Fatal("the pin went with the unit unproven")
}
@@ -2155,6 +2159,9 @@ func TestShutdownDrainsReleaseOps(t *testing.T) {
r.clk.advance(actStopTimeout)
done := shutdownIn(r.a, 10*time.Second)
waitFor(t, "Shutdown's pass to retry the settle", func() bool { return len(r.rel.unit.stopTimes()) > tries })
+ // The retry's lastTry is stamped when it ends; the clock advances
+ // only after that, or Shutdown's passes stay inside the interval.
+ waitFor(t, "Shutdown's retry to end", r.record().hold.settlingDone)
time.Sleep(300 * time.Millisecond)
if returned(done) {
t.Fatal("Shutdown returned with the record unproven inside its budget")
diff --git a/internal/grouproll/roll.go b/internal/grouproll/roll.go
index 919476501..6999a0fd6 100644
--- a/internal/grouproll/roll.go
+++ b/internal/grouproll/roll.go
@@ -1019,7 +1019,7 @@ func (e *Engine) mutation(ctx context.Context) error {
if _, err := e.box(ctx, iid, "revoke", BoxArgs{}); err != nil {
return err
}
- if s, err = e.status(ctx, iid); err != nil {
+ if s, err = e.revokeReadBack(ctx, iid); err != nil {
return err
}
p, _ = s["permit"].(map[string]any)
@@ -1475,7 +1475,7 @@ func (e *Engine) finishReturn(ctx context.Context, ready *readiness) error {
if _, err := e.box(ctx, iid, "revoke", BoxArgs{}); err != nil {
return err
}
- s, err := e.status(ctx, iid)
+ s, err := e.revokeReadBack(ctx, iid)
if err != nil {
return err
}
@@ -1521,6 +1521,22 @@ func (e *Engine) finishReturn(ctx context.Context, ready *readiness) error {
return nil
}
+// revokeReadBack is the status read that proves a revoke (V21, #1255). A
+// read that is Uncertain (a session cut at its bound, a plugin that did
+// not run) is asked once more: status writes nothing on the box, the
+// first session's error stays journaled (with its terminate, when it was
+// cut at its bound with a known session), and the revoke already
+// answered. Any other failure, and a second Uncertain, stops the
+// verb with the transaction open, as before; resume reads it again.
+func (e *Engine) revokeReadBack(ctx context.Context, iid string) (map[string]any, error) {
+ s, err := e.status(ctx, iid)
+ var u Uncertain
+ if err == nil || !errors.As(err, &u) || ctx.Err() != nil {
+ return s, err
+ }
+ return e.status(ctx, iid)
+}
+
// abandon is the script's Operator.abandon. Prepare sessions may stage an
// artifact but change neither the group nor a running binary; any other
// write intent, even an unsent one, blocks closure.
diff --git a/internal/grouproll/roll_test.go b/internal/grouproll/roll_test.go
index 1b2c05814..a214eec7a 100644
--- a/internal/grouproll/roll_test.go
+++ b/internal/grouproll/roll_test.go
@@ -2311,3 +2311,130 @@ func TestRollMutationVerifiesConsumedAction(t *testing.T) {
t.Fatal("consumed action not verified")
}
}
+
+// #1255 (V21): the status read that proves a revoke is asked once more
+// when it is Uncertain. One cut read: the roll finishes. Two: the verb
+// stops with the transaction open, as before, and a resume closes it.
+func TestRollRevokeReadBackIsAskedOnceMore(t *testing.T) {
+ for _, c := range []struct {
+ name string
+ cuts int
+ }{{"one cut read finishes", 1}, {"two cut reads stop", 2}} {
+ t.Run(c.name, func(t *testing.T) {
+ h := newHarness(t, 2)
+ h.f.sessions = func(iid, verb string) []string {
+ if verb == "status" {
+ return []string{"status-session"}
+ }
+ return nil
+ }
+ revoked, cut, afterRevoke := false, 0, 0
+ h.f.wrap = func(op string, args map[string]any, r any, err error) (any, error) {
+ if op != "session" || err != nil {
+ return r, err
+ }
+ switch args["verb"] {
+ case "revoke":
+ revoked = true
+ case "status":
+ if revoked {
+ afterRevoke++
+ if cut < c.cuts {
+ cut++
+ return nil, Uncertain{Key: "remote", Timeout: true}
+ }
+ }
+ }
+ return r, err
+ }
+ err := h.runRoll()
+ tx := h.onlyTx()
+ j := h.txJournal(tx)
+ errs := 0
+ for _, row := range j.Rows() {
+ if row["kind"] == "error" && row["op"] == "session" {
+ errs++
+ }
+ }
+ if errs != c.cuts {
+ t.Fatalf("%d session error rows, want %d", errs, c.cuts)
+ }
+ if n := countOf(h.f.ops(), "terminate_session"); n != c.cuts {
+ t.Fatalf("%d terminate_session calls, want %d: %v", n, c.cuts, h.f.ops())
+ }
+ if c.cuts == 1 {
+ if err != nil {
+ t.Fatalf("roll = %v", err)
+ }
+ if afterRevoke != 2 {
+ t.Fatalf("%d status reads after the revoke, want 2", afterRevoke)
+ }
+ if done, ok := j.Last("done", nil); !ok || done["outcome"] != "returned" {
+ t.Fatalf("done row %v", done)
+ }
+ if h.activeTx() != "" {
+ t.Fatal("the transaction is still open")
+ }
+ mustRetain(t, h)
+ return
+ }
+ if !isUncertain(err) {
+ t.Fatalf("roll = %v, want Uncertain", err)
+ }
+ if afterRevoke != 2 {
+ t.Fatalf("%d status reads after the revoke, want 2 (no third)", afterRevoke)
+ }
+ if _, ok := j.Last("done", nil); ok {
+ t.Fatal("the transaction closed on two cut reads")
+ }
+ if h.activeTx() != tx {
+ t.Fatal("the transaction is not left open")
+ }
+ revokes := countOf(h.f.writes, "revoke")
+ if err := h.resume(); err != nil {
+ t.Fatalf("resume = %v", err)
+ }
+ if countOf(h.f.writes, "revoke") != revokes {
+ t.Fatal("the resume revoked again")
+ }
+ if h.activeTx() != "" {
+ t.Fatal("the resume left the transaction open")
+ }
+ mustRetain(t, h)
+ })
+ }
+}
+
+// #1255 (V21): rollback's revoke of a remaining apply permit is proven by
+// the same read, asked once more when it is cut.
+func TestRollRollbackRevokeReadBackIsAskedOnceMore(t *testing.T) {
+ h := newHarness(t, 2)
+ h.pauseAfterApply()
+ h.f.fault = ""
+ revoked, cut := false, false
+ h.f.wrap = func(op string, args map[string]any, r any, err error) (any, error) {
+ if op != "session" || err != nil {
+ return r, err
+ }
+ switch args["verb"] {
+ case "revoke":
+ revoked = true
+ case "status":
+ if revoked && !cut {
+ cut = true
+ return nil, Uncertain{Key: "remote", Timeout: true}
+ }
+ }
+ return r, err
+ }
+ if err := h.rollbackMember(); err != nil {
+ t.Fatalf("rollback: %v\n%s", err, h.out.String())
+ }
+ if !cut {
+ t.Fatal("no read after the revoke was cut")
+ }
+ if got := h.f.writes[5:9]; !reflect.DeepEqual(got, []string{"revoke", "permit", "rollback", "exit"}) {
+ t.Fatalf("writes %v", h.f.writes)
+ }
+ mustRetain(t, h)
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index f54a44926..3259f9379 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -274,5 +274,7 @@ plan14-root-reads-media-spike-fixes.tsv 194e88ad9cd7413c93b1181c0ac1e962107039ad
plan14-root-reads-media-spike-values.tsv 194e88ad9cd7413c93b1181c0ac1e962107039ad84525e065893a8c14cdb3138
plan14-root-reads-path-routes-across-boxes.tsv f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6
plan14-root-reads-headers-security-allowlist.tsv f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6
-plan14-root-reads-egress-allow-cidr.tsv f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6
-plan14-root-reads-egress-allow-cidr-console.tsv f959a3626e83650aaad1880eecc3feddebdbd78474937f4c619df658eb46a1d6
+plan14-root-reads-stateless-scale-1-memory-env.tsv 47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132
+plan14-root-reads-group-revoke-readback-1255.tsv 47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132
+plan14-root-reads-egress-allow-cidr.tsv 47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132
+plan14-root-reads-egress-allow-cidr-console.tsv 47ebd73418bcbe1bdf9cf34a2b94e3393a1279aea58f9ee0aca3f0cfe42b9132
diff --git a/internal/provision/testdata/plan14-root-reads-group-revoke-readback-1255.tsv b/internal/provision/testdata/plan14-root-reads-group-revoke-readback-1255.tsv
new file mode 100644
index 000000000..019065575
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-group-revoke-readback-1255.tsv
@@ -0,0 +1,3 @@
+# Census overlay group-revoke-readback-1255, written by census-propose (#369). census-ruling-group-revoke-readback-1255, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-group-revoke-readback-1255.md.
+# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@coverage internal/grouproll c0c2c2c5f57d67db0257b88eed8be1901bb7511b2e71ca4385a8dec7a97b250f
diff --git a/internal/provision/testdata/plan14-root-reads-stateless-scale-1-memory-env.tsv b/internal/provision/testdata/plan14-root-reads-stateless-scale-1-memory-env.tsv
new file mode 100644
index 000000000..b5d2faad9
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-stateless-scale-1-memory-env.tsv
@@ -0,0 +1,11 @@
+# Census overlay stateless-scale-1-memory-env, written by census-propose (#369). census-ruling-stateless-scale-1-memory-env, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-stateless-scale-1-memory-env.md.
+# 4 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+@legacy 63b6ae73ae7a5e7fcb94e7e3ccf2e3e3042fc97f8fa6f7cb1617b7c680a741b0 internal/activator/rootfs.go ExecBackend.spawnRootfs legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-route (J1, as spawnUnitFrom, whose shape it has): new (rootfs Plan 2 Tasks 5 and 9): prepareKeyedAt (the instance's own directories, environment and listeners, unchanged), the schema-2 tenant launch file (environment only, CARLOS_SOCKET and CARLOS_DB set by the agent), the caller's exec gate, then StartRootfs over the control socket naming the image and web; root resolves the command from its own staged manifest (C4) and the tenant file may name no command (the trampoline refuses one); the failure handling is spawnUnitFrom's; its sites are the row's host and route; no root decision; final fix I1: root's answers that guarantee no start (ErrStartRefused: 503 not ready or claim-armed, 501 unconfigured, 400, 409, 507), like its 403, are marked a refusal (refuseRootfs), so verdictOf and classifyStep record no failure of the build and no stop is asked; a 502 and a transport failure still may have run; the same nineteen sites, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 fix wave 1 (d35fcb1f, census P1-1): takes the tier root is asked for as an argument; a zero tier means GenTier's (the former body), so a caller that chose a limit has it kept, as spawnChildFrom and spawnUnitFrom keep theirs; the same nineteen sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=sets up.inputs = launchInputs(id.Version, fileEnv): the image version and env this spawn already read, hashed in memory; no new read; read sites unchanged (20); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main launchInputs on rootfs handle from existing staged image version and fileEnv. Keep branch sandbox gate and root identity validation. No new read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedRootfsGen naming the host, the unit and the error already in hand; the +registry:Host site is that argument to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-platform-mail-submission;basis=Task 6: the same warnUndeclaredMailBuild call for a rootfs spawn. Agent, not root.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: the web launch environment also gets CARLOS_MEMORY_MIB, the tier argument's MemoryMax (the limit this call already passes StartRootfs) in MiB, through withMemoryVar (map composition, set after the file environment); no read added, read sites unchanged registry:Host@1457,registry:Host@1630,registry:Host@1930,registry:Host@2049,registry:Host@2796,registry:Host@3133,registry:Host@3360,registry:Host@3487,registry:Host@3812,registry:Host@390,registry:Host@3940,registry:Host@4049,registry:Host@4766,registry:Host@4860,whole:Route@1187,whole:Route@1219,whole:Route@1323,whole:Route@199,whole:Route@2156,whole:Route@3193,whole:Route@4125,whole:Route@502,whole:Route@602,whole:Route@732 9e4314f070f62601e55b55d1a787e3a8a284e23e2ca353cbd75d5d3004333205
+@legacy 8061783955656afc384898b19b87d35bd0309ac2a8472cc5b7ab92984f5450d8 internal/activator/rootfsenv.go ExecBackend.rootfsCmdVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 6: a rootfs cmd's environment is the binary cmdVars composed through rootfsVars (the image's socket and database paths); reads Socket;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: CARLOS_MEMORY_MIB removed from a run's (and so a release's) environment with withoutVars, so a tenant file cannot supply it; map composition only, no read added registry:Socket@226,whole:Route@164,whole:Route@189 e596326646077114dde78cc5e6e2eb6a4cade90f7dcc7c37c8e696e6b0560ccc
+@legacy 898f335260ca9ed7c2e3de28c9dbb6088a77785784efa35fae5bcece12da9f1e internal/activator/rootfsenv.go ExecBackend.rootfsTTYVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: a rootfs session environment: ttyVars over the generation launch environment, then rootfsVars with the row canonical socket and dbPath set after the file environment, as rootfsCmdVars does; map composition only;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: CARLOS_MEMORY_MIB removed from a session's environment with withoutVars; map composition only, no read added registry:Socket@230,whole:Route@166,whole:Route@191 206b1ea4bf3a8d72465400b66350d59be2cd47894a0013ae222ed616a9c7ab78
+@legacy e7d46b1a7d5c307add5b3b7593bc16e38b5d0b1cb8ccc51ecda60d18294f4fdf internal/activator/rootfsenv.go ExecBackend.rootfsWorkerVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, D1: a worker's launch environment is web's launch environment for the generation (the handle's LaunchEnv, the agent-owned variables as web got them), with the generation's control socket only when web's listener bound, then rootfsVars with the row's canonical socket and database path; nothing from a tenant or app is added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: a worker's environment also gets CARLOS_MEMORY_MIB from g.Tier.MemoryMax (the limit LaunchRootfsWorker already passes StartRootfsWorker) in MiB, through withMemoryVar; map composition only, no read added registry:Socket@275,registry:Stateless@145,whole:Route@206,whole:Route@238 0faa3ee9a5266dff34476168d119eb295f8647a7b713f5d59a61f508befe7b05
+internal/activator/rootfs.go ExecBackend.spawnRootfs legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=root-route (J1, as spawnUnitFrom, whose shape it has): new (rootfs Plan 2 Tasks 5 and 9): prepareKeyedAt (the instance's own directories, environment and listeners, unchanged), the schema-2 tenant launch file (environment only, CARLOS_SOCKET and CARLOS_DB set by the agent), the caller's exec gate, then StartRootfs over the control socket naming the image and web; root resolves the command from its own staged manifest (C4) and the tenant file may name no command (the trampoline refuses one); the failure handling is spawnUnitFrom's; its sites are the row's host and route; no root decision; final fix I1: root's answers that guarantee no start (ErrStartRefused: 503 not ready or claim-armed, 501 unconfigured, 400, 409, 507), like its 403, are marked a refusal (refuseRootfs), so verdictOf and classifyStep record no failure of the build and no stop is asked; a 502 and a transport failure still may have run; the same nineteen sites, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 fix wave 1 (d35fcb1f, census P1-1): takes the tier root is asked for as an argument; a zero tier means GenTier's (the former body), so a caller that chose a limit has it kept, as spawnChildFrom and spawnUnitFrom keep theirs; the same nineteen sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-edge-page-cache-1;basis=sets up.inputs = launchInputs(id.Version, fileEnv): the image version and env this spawn already read, hashed in memory; no new read; read sites unchanged (20); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main launchInputs on rootfs handle from existing staged image version and fileEnv. Keep branch sandbox gate and root identity validation. No new read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedRootfsGen naming the host, the unit and the error already in hand; the +registry:Host site is that argument to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-platform-mail-submission;basis=Task 6: the same warnUndeclaredMailBuild call for a rootfs spawn. Agent, not root.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: the web launch environment also gets CARLOS_MEMORY_MIB, the tier argument's MemoryMax (the limit this call already passes StartRootfs) in MiB, through withMemoryVar (map composition, set after the file environment); no read added, read sites unchanged registry:Host@1457,registry:Host@1630,registry:Host@1930,registry:Host@2049,registry:Host@2796,registry:Host@3133,registry:Host@3360,registry:Host@3487,registry:Host@3812,registry:Host@390,registry:Host@3940,registry:Host@4049,registry:Host@4766,registry:Host@4860,whole:Route@1187,whole:Route@1219,whole:Route@1323,whole:Route@199,whole:Route@2156,whole:Route@3193,whole:Route@4125,whole:Route@502,whole:Route@602,whole:Route@732 9e4314f070f62601e55b55d1a787e3a8a284e23e2ca353cbd75d5d3004333205
+internal/activator/rootfsenv.go ExecBackend.rootfsCmdVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 6: a rootfs cmd's environment is the binary cmdVars composed through rootfsVars (the image's socket and database paths); reads Socket;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: CARLOS_MEMORY_MIB removed from a run's (and so a release's) environment with withoutVars, so a tenant file cannot supply it; map composition only, no read added registry:Socket@226,whole:Route@164,whole:Route@189 e596326646077114dde78cc5e6e2eb6a4cade90f7dcc7c37c8e696e6b0560ccc
+internal/activator/rootfsenv.go ExecBackend.rootfsTTYVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: a rootfs session environment: ttyVars over the generation launch environment, then rootfsVars with the row canonical socket and dbPath set after the file environment, as rootfsCmdVars does; map composition only;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: CARLOS_MEMORY_MIB removed from a session's environment with withoutVars; map composition only, no read added registry:Socket@230,whole:Route@166,whole:Route@191 206b1ea4bf3a8d72465400b66350d59be2cd47894a0013ae222ed616a9c7ab78
+internal/activator/rootfsenv.go ExecBackend.rootfsWorkerVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, D1: a worker's launch environment is web's launch environment for the generation (the handle's LaunchEnv, the agent-owned variables as web got them), with the generation's control socket only when web's listener bound, then rootfsVars with the row's canonical socket and database path; nothing from a tenant or app is added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-stateless-scale-1-memory-env;basis=#892 S1: a worker's environment also gets CARLOS_MEMORY_MIB from g.Tier.MemoryMax (the limit LaunchRootfsWorker already passes StartRootfsWorker) in MiB, through withMemoryVar; map composition only, no read added registry:Socket@275,registry:Stateless@145,whole:Route@206,whole:Route@238 0faa3ee9a5266dff34476168d119eb295f8647a7b713f5d59a61f508befe7b05
+@coverage internal/activator c74f1dfead9b83e901b22d87e1a0e39ae04e209ea64968c6c9a2f50ccdb62cad