activator: no GOMEMLIMIT default for a flat child left uncapped
Astra #991 round 1, P2-1 and P2-3. A flat start falls back to a plain start when its cgroup cannot be made, and runs on when its memory.max write fails, yet the child still got the default. The env is now built inside the spawn's build closure, which the cgroup manager calls after writing the limits, and the default is added only when the new cgroup.Manager.Capped reads memory.max back as the tier asked for. Containment itself is unchanged. Tests: the flat start with a cgroup that cannot be made and with a memory.max write that fails sets no default; a Tier provider answering a different size on each call shows the flat and nested launches read the live tier once, and a tier supplied at generation 0 is what root is asked for, each with GOMEMLIMIT matching that cap. Census overlay re-proposed with a claim for Manager.Capped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-claims-instance-gomemlimit-991.tsv+2 −1docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md+7 −3internal/activator/backend_exec.go+11 −10internal/activator/gomemlimit_test.go+151 −4internal/cgroup/cgroup.go+20 −0internal/cgroup/cgroup_test.go+38 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-instance-gomemlimit-991.tsv+7 −4
Intent
<task-notification> <task-id>b6w8pdcv3</task-id> <tool-use-id>toolu_01U5wYYNgQFJuNCTtq8CXpyr</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/b6w8pdcv3.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of #991 branch" completed (exit code 0)</summary> </task-notification>
<task-notification> <task-id>bjat0dexg</task-id> <tool-use-id>toolu_014AfMAiSsMj5Mpd73nrABng</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/bjat0dexg.output</output-file> <status>completed</status> <summary>Background command "Run Luna copy gate on the guide" completed (exit code 0)</summary> </task-notification>
diff --git a/docs/superpowers/notes/census-claims-instance-gomemlimit-991.tsv b/docs/superpowers/notes/census-claims-instance-gomemlimit-991.tsv| index 58dba7a09..ff89abddd 100644 |
| --- a/docs/superpowers/notes/census-claims-instance-gomemlimit-991.tsv |
| +++ b/docs/superpowers/notes/census-claims-instance-gomemlimit-991.tsv |
| @@ -1,3 +1,4 @@ |
| internal/activator/backend_exec.go:ExecBackend.spawnUnitFrom #991: the agent as carlos (nested start): resolves the zero tier once (b.tier(rt), the existing live-tier read), adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the launch file env unless the app's fileEnv already names it (withGoMemLimit; skipped under gVisor, where root supplies its own and drops any launch value), passes that same tier to startRole, and logs it. No new read source; root still validates memory_max against the size table; read sites unchanged. |
| -internal/activator/backend_exec.go:ExecBackend.spawnChildFrom #991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself; adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env unless the app's fileEnv names it, and none when b.Cgroups is nil (uncapped). No new file, registry or store read; no gate moved or weakened. |
| +internal/activator/backend_exec.go:ExecBackend.spawnChildFrom #991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself. Inside the build closure (which the cgroup manager calls after writing the limits) it asks cgroup.Manager.Capped(host, child, tier), a read of memory.max in the agent's own delegated cgroup subtree, and only when that reads back as the tier adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env, unless the app's fileEnv names it. No delegation, a cgroup that could not be made, or a failed memory.max write gives no default (Astra R1 P2-1). Containment behaviour unchanged; no gate moved or weakened; no registry, /data, release or store read added. |
| internal/activator/containment.go:ExecBackend.startRole #991: the zero-tier default (b.tier(rt)) is applied once at the top instead of in each branch, and generation 0 with no exe now honours a non-zero tier its caller already read (spawnUnitFrom) instead of re-reading the live tier; every caller with exe nil passed a zero tier before, so the value root is asked for is unchanged. The -whole:Route x2 sites are the two folded b.tier(rt) calls. Claim refusal and sandbox gate unchanged. |
| +internal/cgroup/cgroup.go:Manager.Capped #991 (Astra R1 P2-1): new, the agent as carlos: reads <root>/carlos-exec@<host>[/<child>]/memory.max in the agent's own delegated cgroup subtree and compares it with the limit a start asked for; nil manager, zero limit, a child name isChildName refuses, or an unreadable or unparsable file answer false. Read only: it writes nothing, starts nothing, and changes no start; its one caller (spawnChildFrom's build closure) uses it only to decide whether to add the GOMEMLIMIT default to the child env. |
diff --git a/docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md b/docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md| index 4ab0483df..8de0c5af8 100644 |
| --- a/docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md |
| +++ b/docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md |
| @@ -1,11 +1,11 @@ |
| # Census approval: instance-gomemlimit-991 |
| -Ruling `census-ruling-instance-gomemlimit-991`. 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). |
| +Ruling `census-ruling-instance-gomemlimit-991`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| | `internal/activator/backend_exec.go` `ExecBackend.spawnUnitFrom` | body | unchanged (31) | #991: the agent as carlos (nested start): resolves the zero tier once (b.tier(rt), the existing live-tier read), adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the launch file env unless the app's fileEnv already names it (withGoMemLimit; skipped under gVisor, where root supplies its own and drops any launch value), passes that same tier to startRole, and logs it. No new read source; root still validates memory_max against the size table; read sites unchanged. | |
| -| `internal/activator/backend_exec.go` `ExecBackend.spawnChildFrom` | sites | +whole:Route | #991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself; adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env unless the app's fileEnv names it, and none when b.Cgroups is nil (uncapped). No new file, registry or store read; no gate moved or weakened. | |
| +| `internal/activator/backend_exec.go` `ExecBackend.spawnChildFrom` | sites | +whole:Route | #991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself. Inside the build closure (which the cgroup manager calls after writing the limits) it asks cgroup.Manager.Capped(host, child, tier), a read of memory.max in the agent's own delegated cgroup subtree, and only when that reads back as the tier adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env, unless the app's fileEnv names it. No delegation, a cgroup that could not be made, or a failed memory.max write gives no default (Astra R1 P2-1). Containment behaviour unchanged; no gate moved or weakened; no registry, /data, release or store read added. | |
| | `internal/activator/containment.go` `ExecBackend.startRole` | sites | -whole:Route ×2 | #991: the zero-tier default (b.tier(rt)) is applied once at the top instead of in each branch, and generation 0 with no exe now honours a non-zero tier its caller already read (spawnUnitFrom) instead of re-reading the live tier; every caller with exe nil passed a zero tier before, so the value root is asked for is unchanged. The -whole:Route x2 sites are the two folded b.tier(rt) calls. Claim refusal and sandbox gate unchanged. | |
| Envelopes re-pinned: `internal/activator`, `internal/cgroup`. |
| @@ -18,6 +18,10 @@ Recorded dispositions, which each change must still satisfy: |
| - `internal/activator/backend_exec.go` `ExecBackend.spawnChildFrom`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;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=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;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 build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source. |
| - `internal/activator/containment.go` `ExecBackend.startRole`: authority, task E2. Basis: E40: claim-enabled raw backend refuses unsupported direct, placed and legacy-control launches before spawn. Claims-off body unchanged. TestPlan14GenerationBackendDirectBoundary, TestPlan14GenerationBackendControlBoundary, TestPlan14GenerationBackendAuxiliaryBoundary; each guard has an independent behavioral mutation. Agent-side refusal is not root reservation or containment evidence.;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. |
| -Seal: `07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063` → `1759d3095fd47b42af04973ce74613c9ed91bfbf92b905e8dc69d833f5c0ddfe`. |
| +New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| + |
| +- new `internal/cgroup/cgroup.go:Manager.Capped`: reads +file:ReadFile; written legacy, accepted-legacy, frozen |
| + |
| +Seal: `07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063` → `19c9f395547d998f4b5e87e89c0dfa3b5f012d177a87eb5010a8c4defac305dc`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-instance-gomemlimit-991.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/activator/backend_exec.go b/internal/activator/backend_exec.go| index 10db3c295..7e03b62bd 100644 |
| --- a/internal/activator/backend_exec.go |
| +++ b/internal/activator/backend_exec.go |
| @@ -2598,18 +2598,15 @@ func (b *ExecBackend) spawnChildFrom(ctx context.Context, rt registry.Route, soc |
| // (spec §10.3). |
| childVars := b.agentOwnedVars(rt, controlSocket, fileEnv, ctl != nil) |
| // The limit this spawn's cgroup takes, read once (b.tier reads the live |
| - // build's manifest) and handed to the spawn below, so GOMEMLIMIT is |
| - // derived from the very memory.max the child runs under (#991). With |
| - // no cgroup manager (no delegation) the child runs uncapped, and gets |
| - // no default. |
| + // build's manifest) and handed to the spawn below. GOMEMLIMIT follows |
| + // it only when the cap was applied (#991): build runs after the cgroup |
| + // manager has written the limits, and Capped reads back the child's |
| + // memory.max. No delegation, a cgroup that could not be made, or a |
| + // memory.max write that failed leaves the child uncapped, with no |
| + // default. |
| if tier == (cgroup.Limit{}) { |
| tier = b.tier(rt) |
| } |
| - capped := tier |
| - if b.Cgroups == nil { |
| - capped = cgroup.Limit{} |
| - } |
| - childVars = withGoMemLimit(childVars, fileEnv, capped) |
| // Record the build we're about to exec — read the symlink immediately before |
| // the start so it names the version the kernel will resolve. Reading it here, |
| // rather than back in wake() after the health wait, closes a real window: a |
| @@ -2695,7 +2692,11 @@ func (b *ExecBackend) spawnChildFrom(ctx context.Context, rt registry.Route, soc |
| argv = b.statelessArgv(rt, bin, sock) |
| } |
| cmd := exec.Command(argv[0], argv[1:]...) |
| - cmd.Env = childEnv(childVars) |
| + vars := childVars |
| + if b.Cgroups.Capped(host, child, tier) { |
| + vars = withGoMemLimit(childVars, fileEnv, tier) |
| + } |
| + cmd.Env = childEnv(vars) |
| // The child logs through the agent's own stderr/stdout (journald |
| // under systemd); there's no per-instance unit to own a log stream |
| // anymore. With Logs set the same bytes are ALSO teed line-wise |
diff --git a/internal/activator/gomemlimit_test.go b/internal/activator/gomemlimit_test.go| index 1078aec74..a42f10bbc 100644 |
| --- a/internal/activator/gomemlimit_test.go |
| +++ b/internal/activator/gomemlimit_test.go |
| @@ -7,6 +7,7 @@ import ( |
| "path/filepath" |
| "strconv" |
| "strings" |
| + "sync" |
| "testing" |
| "time" |
| @@ -78,20 +79,40 @@ func childEnvFile(t *testing.T, path string) map[string]string { |
| // A flat instance's exec child carries GOMEMLIMIT at 80 percent of the |
| // memory.max its own cgroup was given, for the row's size; an app-set |
| -// value (here an empty one) runs instead, verbatim; and a box with no |
| -// cgroup delegation, whose child runs uncapped, sets none. |
| +// value (here an empty one) runs instead, verbatim; and a child that runs |
| +// uncapped sets none: no cgroup delegation, a host cgroup that could not |
| +// be made (the manager's plain start), or a memory.max write that failed |
| +// (Astra #991 R1 P2-1). |
| func TestFlatStartSetsGoMemLimitFromTheChildsCgroup(t *testing.T) { |
| withoutAgentGoMemLimit(t) |
| + host := "gomem.example.com" |
| for _, tc := range []struct { |
| name, size, appEnv string |
| delegated bool |
| - want string // "-": unset; "cgroup": GoMemLimitOf(memory.max) |
| + // breakCgroup, when set, makes the start's cgroup fail under the |
| + // fake cgroupfs root before Start. |
| + breakCgroup func(t *testing.T, root string) |
| + want string // "-": unset; "cgroup": GoMemLimitOf(memory.max) |
| }{ |
| {name: "small", size: "small", delegated: true, want: "cgroup"}, |
| {name: "large", size: "large", delegated: true, want: "cgroup"}, |
| {name: "app sets it empty", size: "large", appEnv: "GOMEMLIMIT=\n", delegated: true, want: ""}, |
| {name: "app sets its own", size: "small", appEnv: "GOMEMLIMIT=100MiB\n", delegated: true, want: "100MiB"}, |
| {name: "uncapped", size: "large", want: "-"}, |
| + {name: "cgroup cannot be made", size: "large", delegated: true, want: "-", breakCgroup: func(t *testing.T, root string) { |
| + // A file where the host's cgroup goes: MkdirAll fails, and the |
| + // flat start falls back to a plain, uncapped start. |
| + if err := os.WriteFile(filepath.Join(root, cgroup.ExecName(host)), nil, 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + }}, |
| + {name: "memory.max write fails", size: "large", delegated: true, want: "-", breakCgroup: func(t *testing.T, root string) { |
| + // A directory where memory.max goes: the write fails, and the |
| + // flat start runs the child uncapped. |
| + if err := os.MkdirAll(filepath.Join(root, cgroup.ExecName(host), "memory.max"), 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + }}, |
| } { |
| t.Run(tc.name, func(t *testing.T) { |
| b := testExecBackend(t) |
| @@ -108,7 +129,9 @@ func TestFlatStartSetsGoMemLimitFromTheChildsCgroup(t *testing.T) { |
| } |
| b.Cgroups = m |
| } |
| - host := "gomem.example.com" |
| + if tc.breakCgroup != nil { |
| + tc.breakCgroup(t, root) |
| + } |
| _, envPath := stageRecordingLiveFullEnv(t, b, host, "v1") |
| if tc.appEnv != "" { |
| if err := os.WriteFile(filepath.Join(b.DataDir, host+".config.env"), []byte(tc.appEnv), 0o600); err != nil { |
| @@ -262,3 +285,127 @@ func TestNestedGVisorStartLeavesGoMemLimitToRoot(t *testing.T) { |
| t.Fatalf("gVisor launch carries GOMEMLIMIT=%q, want none (root's own)", got) |
| } |
| } |
| + |
| +// tierSequence is a Tier provider answering each size in turn, smallest |
| +// first: a launch that read the live tier twice would hand its env one |
| +// size and its cgroup another (Astra #991 R1 P2-3). calls counts reads. |
| +type tierSequence struct { |
| + mu sync.Mutex |
| + calls int |
| +} |
| + |
| +func (s *tierSequence) tier(registry.Route) cgroup.Limit { |
| + s.mu.Lock() |
| + defer s.mu.Unlock() |
| + l := cgroup.Sizes[s.calls%len(cgroup.Sizes)].Limit |
| + s.calls++ |
| + return l |
| +} |
| + |
| +func (s *tierSequence) reads() int { |
| + s.mu.Lock() |
| + defer s.mu.Unlock() |
| + return s.calls |
| +} |
| + |
| +// A flat start reads the live tier once: the cgroup's memory.max and the |
| +// child's GOMEMLIMIT come from that one read. |
| +func TestFlatStartReadsTheLiveTierOnce(t *testing.T) { |
| + withoutAgentGoMemLimit(t) |
| + b := testExecBackend(t) |
| + root := t.TempDir() |
| + for _, f := range []string{"cgroup.procs", "cgroup.subtree_control"} { |
| + if err := os.WriteFile(filepath.Join(root, f), nil, 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + m, err := cgroup.SetupAt(root, t.Logf) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + b.Cgroups = m |
| + seq := &tierSequence{} |
| + b.Tier = seq.tier |
| + host := "gomem-once.example.com" |
| + _, envPath := stageRecordingLiveFullEnv(t, b, host, "v1") |
| + rt := registry.Route{Host: host, Kind: "instance", Socket: filepath.Join(t.TempDir(), "instance.sock")} |
| + ctx, cancel := recordedCtx(2*time.Second, envPath) |
| + defer cancel() |
| + proc, _, _ := b.Start(ctx, rt) // the fake binary never binds; a health-wait error is expected |
| + if proc != nil { |
| + defer proc.Stop(context.Background()) |
| + } |
| + got := childEnvFile(t, envPath)[goMemLimitVar] |
| + raw, err := os.ReadFile(filepath.Join(root, cgroup.ExecName(host), "memory.max")) |
| + if err != nil { |
| + t.Fatalf("memory.max not written: %v", err) |
| + } |
| + small, _ := cgroup.SizeByName("small") |
| + if string(raw) != strconv.FormatInt(small.Limit.MemoryMax, 10) { |
| + t.Fatalf("memory.max = %s, want the first read's %d", raw, small.Limit.MemoryMax) |
| + } |
| + if want := strconv.FormatInt(cgroup.GoMemLimitOf(small.Limit.MemoryMax), 10); got != want { |
| + t.Fatalf("child GOMEMLIMIT = %q, want %q (from memory.max)", got, want) |
| + } |
| + if n := seq.reads(); n != 1 { |
| + t.Fatalf("the live tier was read %d times, want 1", n) |
| + } |
| +} |
| + |
| +// startNested starts rt's generation-0 run unit through spawnUnitFrom with |
| +// tier, and stops it at the test's end. |
| +func startNested(t *testing.T, b *ExecBackend, ctl *fakeControl, unit *fakeUnit, rt registry.Route, tier cgroup.Limit) { |
| + t.Helper() |
| + unit.set("active", "inv1", true, true) |
| + p, _, err := b.spawnUnitFrom(context.Background(), rt, rt.Socket, 0, nil, tier) |
| + if err != nil { |
| + t.Fatalf("spawnUnitFrom: %v", err) |
| + } |
| + t.Cleanup(func() { |
| + unit.set("inactive", "inv1", false, false) |
| + ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
| + defer cancel() |
| + _ = p.Stop(ctx) |
| + }) |
| +} |
| + |
| +// A nested start reads the live tier once (zero tier), and a tier its |
| +// caller supplies at generation 0 is the one root is asked for, with no |
| +// live read at all: either way the launch file's GOMEMLIMIT matches the |
| +// memory_max root was asked to apply. |
| +func TestNestedStartUsesOneTier(t *testing.T) { |
| + withoutAgentGoMemLimit(t) |
| + large, _ := cgroup.SizeByName("large") |
| + small, _ := cgroup.SizeByName("small") |
| + for _, tc := range []struct { |
| + name string |
| + supplied cgroup.Limit |
| + wantMax int64 |
| + wantReads int |
| + }{ |
| + {name: "live tier, read once", wantMax: small.Limit.MemoryMax, wantReads: 1}, |
| + {name: "supplied tier at generation 0", supplied: large.Limit, wantMax: large.Limit.MemoryMax, wantReads: 0}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + ctl := &fakeControl{inv: "inv1"} |
| + unit := &fakeUnit{} |
| + b, rt := nestedBackend(t, ctl, unit) |
| + seq := &tierSequence{} |
| + b.Tier = seq.tier |
| + startNested(t, b, ctl, unit, rt, tc.supplied) |
| + ctl.mu.Lock() |
| + maxes := append([]int64(nil), ctl.startMaxes...) |
| + ctl.mu.Unlock() |
| + if len(maxes) != 1 || maxes[0] != tc.wantMax { |
| + t.Fatalf("root was asked for memory_max %v, want [%d]", maxes, tc.wantMax) |
| + } |
| + want := strconv.FormatInt(cgroup.GoMemLimitOf(maxes[0]), 10) |
| + if got := nestedLaunchEnv(t, b, rt)[goMemLimitVar]; got != want { |
| + t.Fatalf("launch GOMEMLIMIT = %q, want %q (from root's memory_max)", got, want) |
| + } |
| + if n := seq.reads(); n != tc.wantReads { |
| + t.Fatalf("the live tier was read %d times, want %d", n, tc.wantReads) |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/cgroup/cgroup.go b/internal/cgroup/cgroup.go| index 9029013db..9832a4ccf 100644 |
| --- a/internal/cgroup/cgroup.go |
| +++ b/internal/cgroup/cgroup.go |
| @@ -448,6 +448,26 @@ var placeStart = func(m *Manager, dir string, cmd *exec.Cmd, before func() error |
| // a seed's first-boot cost and a sidecar's load ARE that instance's work. |
| func (m *Manager) hostDir(host string) string { return filepath.Join(m.root, ExecName(host)) } |
| +// Capped reports whether host's cgroup (child "" for the host's own, else |
| +// that child) holds memory.max at limit.MemoryMax now: what a start's build |
| +// can ask, since every start calls build after its limits are written, to |
| +// learn whether the cap it asked for was applied (#991). A flat start that |
| +// could not make its cgroup (a plain start) or whose memory.max write |
| +// failed runs uncapped, and answers false, as do a nil manager, a zero |
| +// limit and an unreadable file. It reads; it never writes or changes a |
| +// start. |
| +func (m *Manager) Capped(host, child string, limit Limit) bool { |
| + if m == nil || limit.MemoryMax <= 0 || (child != "" && !isChildName(child)) { |
| + return false |
| + } |
| + raw, err := os.ReadFile(filepath.Join(m.hostDir(host), child, "memory.max")) |
| + if err != nil { |
| + return false |
| + } |
| + n, err := strconv.ParseInt(strings.TrimSpace(string(raw)), 10, 64) |
| + return err == nil && n == limit.MemoryMax |
| +} |
| + |
| // Start runs build() and starts the result inside host's cgroup, with |
| // limit applied to that cgroup first (memory-pressure spec §2.3). Nil-safe: |
| // with no manager (or any accounting failure) the child starts exactly as |
diff --git a/internal/cgroup/cgroup_test.go b/internal/cgroup/cgroup_test.go| index d2340e4cc..a18e14da5 100644 |
| --- a/internal/cgroup/cgroup_test.go |
| +++ b/internal/cgroup/cgroup_test.go |
| @@ -643,3 +643,41 @@ func TestLeftoverAfterAnUnreadableSweep(t *testing.T) { |
| t.Error("a retaining setup reported a host as known clean") |
| } |
| } |
| + |
| +// Capped answers from the memory.max a start's cgroup holds: true only |
| +// when it reads back as the limit asked for (#991). |
| +func TestCappedReadsBackMemoryMax(t *testing.T) { |
| + root := t.TempDir() |
| + m := &Manager{root: root} |
| + host := "h.example.com" |
| + small := Limit{MemoryMax: 256 << 20} |
| + if m.Capped(host, "", small) { |
| + t.Error("no cgroup: capped") |
| + } |
| + dir := filepath.Join(root, ExecName(host)) |
| + if err := os.MkdirAll(filepath.Join(dir, GenChild(3)), 0o755); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := os.WriteFile(filepath.Join(dir, "memory.max"), []byte("268435456\n"), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + if !m.Capped(host, "", small) { |
| + t.Error("memory.max at the limit: not capped") |
| + } |
| + if m.Capped(host, "", Limit{MemoryMax: 512 << 20}) || m.Capped(host, "", Limit{}) { |
| + t.Error("another or a zero limit: capped") |
| + } |
| + if m.Capped(host, GenChild(3), small) || m.Capped(host, "../x", small) { |
| + t.Error("a child with no memory.max, or a bad child name: capped") |
| + } |
| + if err := os.WriteFile(filepath.Join(dir, GenChild(3), "memory.max"), []byte("max\n"), 0o644); err != nil { |
| + t.Fatal(err) |
| + } |
| + if m.Capped(host, GenChild(3), small) { |
| + t.Error("memory.max = max: capped") |
| + } |
| + var none *Manager |
| + if none.Capped(host, "", small) { |
| + t.Error("nil manager: capped") |
| + } |
| +} |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index e54a77928..ae119c290 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -204,4 +204,4 @@ plan14-root-reads-static-site-geo-962.tsv 5e8a72175700a3e60c1e283b133c1ee25e36f2 |
| plan14-root-reads-member-backups-drill-nodb.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063 |
| plan14-root-reads-spread-every-schedule-ticks.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063 |
| plan14-root-reads-member-backups-2b.tsv 07b748a749084fdaf61c5087a6edfca8a79273962822ce551dd4d42b0d20c063 |
| -plan14-root-reads-instance-gomemlimit-991.tsv 1759d3095fd47b42af04973ce74613c9ed91bfbf92b905e8dc69d833f5c0ddfe |
| +plan14-root-reads-instance-gomemlimit-991.tsv 19c9f395547d998f4b5e87e89c0dfa3b5f012d177a87eb5010a8c4defac305dc |
diff --git a/internal/provision/testdata/plan14-root-reads-instance-gomemlimit-991.tsv b/internal/provision/testdata/plan14-root-reads-instance-gomemlimit-991.tsv| index 5649d6fd4..19fb5f653 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-instance-gomemlimit-991.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-instance-gomemlimit-991.tsv |
| @@ -1,9 +1,12 @@ |
| # Census overlay instance-gomemlimit-991, written by census-propose (#369). census-ruling-instance-gomemlimit-991, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md. |
| # 1 body, 2 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| @legacy 5f3bd19d75b0c82c9898b86edd1a5c9e757d2c60a5320e904760695cc9e9974a internal/activator/backend_exec.go ExecBackend.spawnUnitFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; it calls prepareKeyedAt and keeps the launch environment and its key layer on the generation's handle; read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-2;basis=times the launch's steps with time.Now() (build, prepare, launch file, gate, root start) and adds them to its existing "started" journal line; no read added or moved;rev3=census-ruling-rootfs-apps-2;basis=the unit names in its error and log lines go through runUnitName, and newUnitProcFor's new error (a role with no unit to observe) fails the start as markStartUncertain after root started the unit; the binary spawn is otherwise unchanged, a rootfs row never reaches it (nestedGate refuses one); 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=computes the page cache launch inputs once (launchInputs: sha256 over the staged or pinned exe's Version and the fileEnv this spawn already read; "" with no exe, since root binds the movable live link) and keeps them on the unit handle (up.inputs); no new file, registry or bucket read; read sites unchanged (29); 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 computed from the captured file environment and pinned/staged build and store them on the handle, alongside branch sandbox gate, validated root StartResponse Unit/Sandbox/InvocationID and all uncertain-start cleanup. No new direct read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedGen naming the host, the generation unit (runUnitName) and the error already in hand; the +registry:Host sites are those two arguments to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (nested start): resolves the zero tier once (b.tier(rt), the existing live-tier read), adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the launch file env unless the app's fileEnv already names it (withGoMemLimit; skipped under gVisor, where root supplies its own and drops any launch value), passes that same tier to startRole, and logs it. No new read source; root still validates memory_max against the size table; read sites unchanged. registry:Host@1308,registry:Host@2277,registry:Host@2382,registry:Host@2513,registry:Host@2970,registry:Host@3929,registry:Host@4290,registry:Host@5058,registry:Host@5644,registry:Host@5909,registry:Host@6066,registry:Host@6087,registry:Host@6308,registry:Host@6493,registry:Host@6888,registry:Host@7149,registry:Host@7258,registry:Host@8257,registry:Host@8351,registry:Stateless@2327,whole:Route@1093,whole:Route@1472,whole:Route@1714,whole:Route@197,whole:Route@2127,whole:Route@2367,whole:Route@4165,whole:Route@431,whole:Route@6141,whole:Route@7338,whole:Route@995 c6f98b3f134b6e732113b58b2a2bd6c33a71abd9bce03694489b9e85780cf870 |
| -@legacy 868e2985108e1adc6523d9cc66838948b9e22108383a2b4314c5ce91f7a09565 internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;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=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;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 build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself; adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env unless the app's fileEnv names it, and none when b.Cgroups is nil (uncapped). No new file, registry or store read; no gate moved or weakened. file:Command@11838,registry:Host@13121,registry:Host@13482,registry:Host@13576,registry:Host@258,registry:Host@4214,registry:Host@4269,registry:Host@4349,registry:Host@4563,registry:Stateless@11769,whole:Route@11661,whole:Route@11810,whole:Route@12218,whole:Route@13873,whole:Route@13965,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4447,whole:Route@4757,whole:Route@476,whole:Route@6828,whole:Route@7218,whole:Route@9574 75cf717324d7e151bfd4ba907046d1a0563304b88c37a2cda412fde76fa5d121 |
| +@legacy e0c1838ee006dee536d379245b4a754e6b4186ba80a4ecb358f9641b32f9c5c8 internal/cgroup/cgroup.go Manager.Capped legacy accepted-legacy accepted-legacy;rev3=census-ruling-instance-gomemlimit-991;basis=#991 (Astra R1 P2-1): new, the agent as carlos: reads <root>/carlos-exec@<host>[/<child>]/memory.max in the agent's own delegated cgroup subtree and compares it with the limit a start asked for; nil manager, zero limit, a child name isChildName refuses, or an unreadable or unparsable file answer false. Read only: it writes nothing, starts nothing, and changes no start; its one caller (spawnChildFrom's build closure) uses it only to decide whether to add the GOMEMLIMIT default to the child env. file:ReadFile@175 406153daad7add4505a72b9f3249c4c7e0404f0bce79da9e962654827acf4e65 |
| +@legacy dcf4d3402ef80bc359acc631d23b66ee89fd9bf205d6427574c740eff2d4d70a internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;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=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;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 build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself. Inside the build closure (which the cgroup manager calls after writing the limits) it asks cgroup.Manager.Capped(host, child, tier), a read of memory.max in the agent's own delegated cgroup subtree, and only when that reads back as the tier adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env, unless the app's fileEnv names it. No delegation, a cgroup that could not be made, or a failed memory.max write gives no default (Astra R1 P2-1). Containment behaviour unchanged; no gate moved or weakened; no registry, /data, release or store read added. file:Command@11850,registry:Host@13246,registry:Host@13607,registry:Host@13701,registry:Host@258,registry:Host@4214,registry:Host@4269,registry:Host@4349,registry:Host@4563,registry:Stateless@11781,whole:Route@11673,whole:Route@11822,whole:Route@12343,whole:Route@13998,whole:Route@14090,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4447,whole:Route@4757,whole:Route@476,whole:Route@6828,whole:Route@7354,whole:Route@9586 c5e6834ad262e29560b08ceda9b0982ae2b3ed3d44c1d01513e67f39c0bc4796 |
| internal/activator/backend_exec.go ExecBackend.spawnUnitFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; it calls prepareKeyedAt and keeps the launch environment and its key layer on the generation's handle; read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-2;basis=times the launch's steps with time.Now() (build, prepare, launch file, gate, root start) and adds them to its existing "started" journal line; no read added or moved;rev3=census-ruling-rootfs-apps-2;basis=the unit names in its error and log lines go through runUnitName, and newUnitProcFor's new error (a role with no unit to observe) fails the start as markStartUncertain after root started the unit; the binary spawn is otherwise unchanged, a rootfs row never reaches it (nestedGate refuses one); 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=computes the page cache launch inputs once (launchInputs: sha256 over the staged or pinned exe's Version and the fileEnv this spawn already read; "" with no exe, since root binds the movable live link) and keeps them on the unit handle (up.inputs); no new file, registry or bucket read; read sites unchanged (29); 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 computed from the captured file environment and pinned/staged build and store them on the handle, alongside branch sandbox gate, validated root StartResponse Unit/Sandbox/InvocationID and all uncertain-start cleanup. No new direct read.;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: one log line before killFailedGen naming the host, the generation unit (runUnitName) and the error already in hand; the +registry:Host sites are those two arguments to log.Printf; no new read source, behaviour unchanged;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (nested start): resolves the zero tier once (b.tier(rt), the existing live-tier read), adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the launch file env unless the app's fileEnv already names it (withGoMemLimit; skipped under gVisor, where root supplies its own and drops any launch value), passes that same tier to startRole, and logs it. No new read source; root still validates memory_max against the size table; read sites unchanged. registry:Host@1308,registry:Host@2277,registry:Host@2382,registry:Host@2513,registry:Host@2970,registry:Host@3929,registry:Host@4290,registry:Host@5058,registry:Host@5644,registry:Host@5909,registry:Host@6066,registry:Host@6087,registry:Host@6308,registry:Host@6493,registry:Host@6888,registry:Host@7149,registry:Host@7258,registry:Host@8257,registry:Host@8351,registry:Stateless@2327,whole:Route@1093,whole:Route@1472,whole:Route@1714,whole:Route@197,whole:Route@2127,whole:Route@2367,whole:Route@4165,whole:Route@431,whole:Route@6141,whole:Route@7338,whole:Route@995 c6f98b3f134b6e732113b58b2a2bd6c33a71abd9bce03694489b9e85780cf870 |
| -internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;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=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;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 build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself; adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env unless the app's fileEnv names it, and none when b.Cgroups is nil (uncapped). No new file, registry or store read; no gate moved or weakened. file:Command@11838,registry:Host@13121,registry:Host@13482,registry:Host@13576,registry:Host@258,registry:Host@4214,registry:Host@4269,registry:Host@4349,registry:Host@4563,registry:Stateless@11769,whole:Route@11661,whole:Route@11810,whole:Route@12218,whole:Route@13873,whole:Route@13965,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4447,whole:Route@4757,whole:Route@476,whole:Route@6828,whole:Route@7218,whole:Route@9574 75cf717324d7e151bfd4ba907046d1a0563304b88c37a2cda412fde76fa5d121 |
| +internal/cgroup/cgroup.go Manager.Capped legacy accepted-legacy accepted-legacy;rev3=census-ruling-instance-gomemlimit-991;basis=#991 (Astra R1 P2-1): new, the agent as carlos: reads <root>/carlos-exec@<host>[/<child>]/memory.max in the agent's own delegated cgroup subtree and compares it with the limit a start asked for; nil manager, zero limit, a child name isChildName refuses, or an unreadable or unparsable file answer false. Read only: it writes nothing, starts nothing, and changes no start; its one caller (spawnChildFrom's build closure) uses it only to decide whether to add the GOMEMLIMIT default to the child env. file:ReadFile@175 406153daad7add4505a72b9f3249c4c7e0404f0bce79da9e962654827acf4e65 |
| +internal/activator/backend_exec.go ExecBackend.spawnChildFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr3;basis=Census ruling zddr3: changed legacy row (comment-only change describing the shim placement); the same class as the accepted-legacy Manager.startIn and placementLive under fix1-merge-review (existing agent delegated-cgroup management remains legacy); no root decision; no registry, /data, release or claim reads. Boundary: the agent's own delegated cgroup subtree (including its scratch probe child), /proc/self, and pipes to and from its own parent, running as carlos.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (the flat start body): the same change as seedChild: ensureAdminTokenFor(ctx, rt, paths) for the token (the same flat path), the key's producer carrying the HA mint decision, and launchEnvLayer(ctx, rt) for the env and key layer the replica gate reads; a non-HA host's token, key and env are produced and read as before; +whole:Route; only adds refusals for HA hosts;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=the control listener is now built with the whole route (edge.ListenControl(controlSocket, rt, ...)), the +whole:Route site; it computes the launch inputs once from the build it execs by path (a staged exe's caller-named build, or the gate-resolved pinned version; "" for an unpinned live link) and fileEnv it already read, keeps them on the childProc, and for a live-link spawn publishes them to the in-memory cache (NoteProcessInputs) beside the existing purge; no new file read;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 build parameter, pinned live identity, launchInputs from captured build/environment, and current-process input publication. edge.ListenControl now receives the whole Route as main requires (+whole:Route); no new filesystem or storage input. Branch sandboxLaunch remains before preparation and spawn; existing direct primitive gate unchanged.;rev3=census-ruling-security-review-mitigations;basis=Enforce the unchanged never-served resident refusal once at the shared flat/foreign primary binary spawn sink, before placement, live-link/token/env/control preparation or execution. Covers plain, generation and staged Service wakes; existing served/explicit-flat exemptions and other gates retained. No new filesystem/store source.;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the agent as carlos (flat exec child): resolves the zero tier once with the existing b.tier(rt) live-tier read (the +whole:Route site) and passes it to spawnInCgroupAtTier, which previously made the same read itself. Inside the build closure (which the cgroup manager calls after writing the limits) it asks cgroup.Manager.Capped(host, child, tier), a read of memory.max in the agent's own delegated cgroup subtree, and only when that reads back as the tier adds GOMEMLIMIT=GoMemLimitOf(tier.MemoryMax) to the child env, unless the app's fileEnv names it. No delegation, a cgroup that could not be made, or a failed memory.max write gives no default (Astra R1 P2-1). Containment behaviour unchanged; no gate moved or weakened; no registry, /data, release or store read added. file:Command@11850,registry:Host@13246,registry:Host@13607,registry:Host@13701,registry:Host@258,registry:Host@4214,registry:Host@4269,registry:Host@4349,registry:Host@4563,registry:Stateless@11781,whole:Route@11673,whole:Route@11822,whole:Route@12343,whole:Route@13998,whole:Route@14090,whole:Route@1527,whole:Route@189,whole:Route@1944,whole:Route@2305,whole:Route@287,whole:Route@4447,whole:Route@4757,whole:Route@476,whole:Route@6828,whole:Route@7354,whole:Route@9586 c5e6834ad262e29560b08ceda9b0982ae2b3ed3d44c1d01513e67f39c0bc4796 |
| internal/activator/containment.go ExecBackend.startRole authority E2 E40: claim-enabled raw backend refuses unsupported direct, placed and legacy-control launches before spawn. Claims-off body unchanged. TestPlan14GenerationBackendDirectBoundary, TestPlan14GenerationBackendControlBoundary, TestPlan14GenerationBackendAuxiliaryBoundary; each guard has an independent behavioral mutation. Agent-side refusal is not root reservation or containment evidence.;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.;rev3=census-ruling-instance-gomemlimit-991;basis=#991: the zero-tier default (b.tier(rt)) is applied once at the top instead of in each branch, and generation 0 with no exe now honours a non-zero tier its caller already read (spawnUnitFrom) instead of re-reading the live tier; every caller with exe nil passed a zero tier before, so the value root is asked for is unchanged. The -whole:Route x2 sites are the two folded b.tier(rt) calls. Claim refusal and sandbox gate unchanged. registry:Host@1196,registry:Host@1260,registry:Host@740,registry:Host@906,registry:Host@963,whole:Route@218,whole:Route@669 444a009a2f71825d7173cfce41c28497571047e44896ddfbe77fb9d34e3d0d6a |
| -@coverage internal/activator 11508313a845c44eb0a6e793b2b376887d412f20afe1dd76af390c09d3e51e2b |
| -@coverage internal/cgroup 424f307ffd31dd92cbdc1e6174928983c8bcb3d5bfdd7bee87ab5b458e420ffc |
| +@coverage internal/activator 8050f2d708e38718681512a6998c42bb3dc1f3648747253cd35eb77da92e3f7f |
| +@coverage internal/cgroup ed5ff9fcd52f18ed22aab2ed2eaa55272fad4e9c0c87d403d36ba7f7fd8d63ec |