carlos / platform Public

docs-hub-guide-994

No handoff yet. An agent working here writes one with amadan branch handoff, so that whoever picks the branch up next — a person, or another agent on another machine — can start without reading the whole history.

Recently

Human

<task-notification> <task-id>aa936e2e07e762637</task-id> <tool-use-id>toolu_01JGgNhvxieBCXzXugP9LLHf</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/aa936e2e07e762637.output</output-file> <status>completed</status> <summary>Agent "Implement #991 GOMEMLIMIT for instances" 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>I fixed all three findings, committed on top of 3a28687a and pushed: 3a28687a..e529ff40. **Commits** - f8475c7c `activator: no GOMEMLIMIT default for a flat child left uncapped`. This covers findings 1 and 2. - The flat child's env is now built inside the spawn's build closure, which the cgroup manager runs after writing the limits. The default is added only if the new `cgroup.Manager.Capped` reads `memory.max` back as the tier asked for. Containment itself is unchanged. - e529ff40 `docs: narrow the GOMEMLIMIT sentence to capped binary instances`. **Tests** (sandbox off, `TMPDIR=/tmp/g`, GOCACHE unset), all passing: - `go test ./internal/activator/ -run 'GoMemLimit|TestFlatStartReadsTheLiveTierOnce|TestNestedStartUsesOneTier|…|Plan14Generation|BinaryLaunch|Swap|Size|Tier|StartGen|Identity|Strict|Containment' -count=1` - `go test ./internal/cgroup/ -run 'Capped|SizeTable|ApplyLimit|Start' -count=1` - `go test ./internal/docsite/ -count=1` - `gofmt -l`, `go vet` on the two packages, `go build ./...`, and the darwin and windows builds are clean. New tests: - The flat test has two new cases, "cgroup cannot be made" and "memory.max write fails"; neither sets the default. - `TestFlatStartReadsTheLiveTierOnce` and `TestNestedStartUsesOneTier` use a Tier provider that answers a different size each call. The nested test includes a tier supplied at generation 0. - `TestCappedReadsBackMemoryMax`. **Mutation check:** I put back `b.tier(rt).MemoryMax` at the generation-0 branch in containment.go and swapped the `Capped` gate for `b.Cgroups != nil`. Both nested single-tier cases and both uncapped fallback cases failed. I then restored the code. **Census:** I re-proposed the census with the same NAME, adding a claim for the new unit `Manager.Capped`. The new seal is `19c9f395…`, and `TestPlan14RootReadCensus` and `TestCensusScopeIsTheRootBinary` pass. Astra's approval covered the old tip, so `Manager.Capped` and the changed `spawnChildFrom` need a reviewer verdict. Your untracked `review-991.sh` and `review-991.log` in the worktree root were adding a `.` envelope to the proposal. I moved them aside only while proposing and put them back. They and the findings file are still uncommitted. **Docs text** (docs/site/cli.md line 1216): &gt; A binary instance whose memory cap was applied also gets `GOMEMLIMIT`, set to 80% of its memory size, unless your app's config or `&lt;host&gt;.env` sets its own. Seeds, `carlos run` commands, rootfs apps and instances run under gVisor don't get it. One gap remains: in the flat PID-move fallback, if the move itself fails after start, the child keeps the default.</result> <usage><subagent_tokens>263050</subagent_tokens><tool_uses>27</tool_uses><duration_ms>531549</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b58yp8gc4</task-id> <tool-use-id>toolu_01KiA6Dzb7fKhV3WNCbJsxzQ</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/b58yp8gc4.output</output-file> <status>completed</status> <summary>Background command "Rerun Luna copy gate with stdin closed" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>ade6c61052e7d7173</task-id> <tool-use-id>toolu_01CLLn9hyaoTdZpuYQACvoXv</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/ade6c61052e7d7173.output</output-file> <status>completed</status> <summary>Agent "Recon for #992 instance-to-fleet move" 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>I couldn't find any way to place a single instance today: placement is one setting per app, and moves only work between platform regions. The one thing I couldn't find is an offline-move refusal at the console door that rejects nested rows. The only one is on the landing box. All paths are relative to `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/docs-hub-guide-994` (origin/main 7e0c953e). **1. Placement model: stored on both the app and each instance** - **App level:** the store's placement column, `""` or `fleet/&lt;name&gt;`, read by `appPlacement` (`internal/console/fleets.go:700-737`). Instance create lets it override whatever region the request sends, and does so before region validation runs (`internal/console/apiinstances.go:1907-1917`). - **Instance level:** `provision.Record.Region` holds a region code or `fleet/&lt;name&gt;`. The record also carries `Pool`, `FleetBox`/`FleetBoxAt`/`FleetBoxMoved`, `HA`, `Move`/`LastMove` and `RegionChangedAt` (`internal/provision/provision.go:44-112`). `Pool` is copied from the app manifest (`provision.go:377`, `apiinstances.go:2218`). - **`placeAppTarget`** re-stamps every record of the app with `SetRecordRegion`. Its own comment calls the per-record copy a "tripwire" (`fleets.go:781-809`). It is refused for good with S3, "An app's placement can't be changed once it exists", once the hostname history is active or invalidated (`hostsused.go:52`, `fleets.go:826-835`). It is also refused for rootfs apps. - **Mixing placements in one app:** - Different platform regions: yes. Region is per record, limited by the manifest's `Regions` list. - Pooled vs fleet in one app: not supported. A fleet-placed app forces every instance onto the fleet. - Replicas: separate records with `Role`, each with its own region. - HA: the `HA` flag is stamped per record at create, and never cleared. **2. Moves** - **What changes:** the region only. The target is a region code checked by `provision.ValidRegion` against `^[a-z0-9-]{0,16}$` (`provision.go:904-906`). A `/` can't pass, so a fleet can't be named as a target. Live doors: `apiinstancemove.go:36-40, 442-449, 614-630`. Offline: `apiinstancemove_offline.go:526-533`. - **Live moves exclude fleets:** `moveGate` refuses them with "fleet-placed instances keep state-does-not-follow semantics" (`apiinstancemove.go:45-49, 95-98, 127, 146`). - The rule is D6 (`docs/superpowers/specs/2026-08-28-instance-move-design.md:177-178`). A fleet's data lives in the fleet's own bucket, and placement changes where an app serves, not where its data is (commit 03ff0013). - Pooled instances are refused too, because their data is on the pool's own box (`apiinstancemove.go:99-102`). - The Phase 1 spec also refuses records with `FleetBox`, `Pool` or `Tunnel` set (`move-any-app-design.md:1082-1083, 2093`). - **Offline moves refuse nested rows** on the landing box: "the row's paths are nested, and an offline move lands flat rows only" (`internal/host/movesoffline_land.go:476, 486-487`). The comment says the row must be held `landing` by this move "at flat paths". The Phase 1 spec says the same: "Phase 1 lands flat" (`move-any-app-design.md:2088`). - **Other offline rules:** exactly one box in the target region (`apiinstancemove_offline.go:399-405`), and off while host claims or Phase 1 moves are on (`:104-107`). Docs: `docs/site/cli.md:3325-3389`. - **Move specs:** - `2026-08-28-instance-move-design.md`: two-phase, data-following moves (#331); fleets refused. - `2026-10-02-move-any-app-design.md`: Phase 1 safe single-instance move between non-fleet placements; rev 7.24 adds moves into home (#236). - `2026-10-21-self-serve-offline-moves-design.md`: a tenant's customer moves their own instance offline, behind `CARLOS_SELF_SERVE_MOVES`. - `CODEX-FINDINGS-MOVES-R1.md` and `-R2.md`: review findings on the Phase 1 spec. **3. Boxes within a managed fleet** - **Pinning to a box:** not found. At create the console picks the ready box holding the fewest records (`chooseDestination`, `fleetbox.go:148-160`; `apiinstances.go:2511-2530`). It only does this behind the activation gate: two or more boxes, no sidecars, every box at `FleetBoxLabelFloor` v0.33.0 (`fleetbox.go:22-45`, `internal/release/layoutintent.go:267`). - **Moving between boxes:** only as a side effect. The relabel worker moves records off a box that is draining, lost or gone, and `carlos fleets drain` moves everything on one box (`fleetrelabel.go:20-56, 412`). Only `movable` records qualify, which excludes HA and addr-backed ones (`fleetbox.go:171-190`). There is no command to move one chosen instance. **4. Hostname** - **No link to placement:** the hostname is `slug + "." + manifest.Domain` (`apiinstances.go:2212-2215`). - **Platform regions:** every box publishes `control/edges/&lt;box&gt;.json`. Any other edge backhauls a request to the home box (`instancesplacement.go:18-24`). - **Fleets:** the hub (the console's box) mints a `forward` row for each fleet-placed record and serves it down that fleet's tunnel. The fleet box dials out to `/register` (`fleet-public-routes-design.md` §3.3, §4.1). DNS is unchanged: "No DNS change is needed for a fleet app" (§3.7, §4.10). - **What a move would need:** no DNS change. The ingress change is automatic, but there is a gap between the two passes where the host can't be reached (§4.6 row 5, §4.7). One risk: if a host is named by both a platform and a fleet record, neither gets a row (commit 65fd8060). **5. Closest existing pieces** - `carlos apps place`: whole app only, and permanently cut once the hostname history is active. - Live and offline moves: region codes only. - Moves into home (#236): delivered (`move-any-app-design.md:6356`). - Self-serve offline moves: built, off by default. - Fleet drain and relabel: between boxes within one fleet only. - `carlos instances import` (`apiinstanceimport.go:1-20`): loads a snapshot into a new record. - `--from` seeding: starts a database from a sibling's replica, also a new record. - `carlos adopt` is release adoption and unrelated. - "Member moves" exists only as a reference to a design (`appregionset.go:22`). I didn't find a member-move door.</result> <usage><subagent_tokens>108614</subagent_tokens><tool_uses>41</tool_uses><duration_ms>244572</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>aa936e2e07e762637</task-id> <tool-use-id>toolu_01WXgeYr1oemP6QDPZPJ2vxK</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/aa936e2e07e762637.output</output-file> <status>completed</status> <summary>Agent "Implement #991 GOMEMLIMIT for instances" 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>I've added the GOMEMLIMIT default for binary instances. The new tests and the census tests pass. The branch is three commits; nothing is pushed, merged or posted. **One number differs from the brief.** I used your formula, `max/10*8`, the same style as `HighOf`. For small that gives **214748360**, not the 214748364 in your example (that one is `max*8/10`). The others are standard 429496728, large 858993456 and xlarge 1717986912. **Launch paths:** - **Flat exec child** (`spawnChildFrom`, backend_exec.go:2601-2613): now sets it. This covers Start, StartGen, StartGenExe and StartStaged. The tier is read once and the same value goes to the cgroup spawn. With no cgroup delegation the child runs uncapped and gets nothing. - **Nested unit** (`spawnUnitFrom`, backend_exec.go:2905-2915): now sets it. The value comes from the tier passed to `startRole`, which is the memory_max root applies. `startRole` (containment.go:366-371) now takes a tier its caller already read at generation 0, instead of reading the live tier a second time. - **gVisor:** writes nothing. Root's `gvisorLauncher` already removes any launch value and puts in its fixed 241591905, so that behaviour is unchanged. - **Unchanged:** rootfs (`rootfsenv.go` not touched), co-spawned sidecars (they share the instance's cgroup), sidecar members, seeds, `carlos run` commands and unit-backed rows. - **Move env pins:** `LaunchLayers` leaves the default out on purpose. Otherwise every move between a box that sets it and one whose agent predates it would be refused. An app-set value is still included. - **App wins:** if the app's config or `&lt;host&gt;.env` names GOMEMLIMIT at all, its value is kept as written, including empty. **Tests added:** - `TestWithGoMemLimit` - `TestFlatStartSetsGoMemLimitFromTheChildsCgroup` (compares against `memory.max` in a fake cgroupfs) - `TestNestedStartSetsGoMemLimitFromTheTierRootApplies` (compares against the memory_max root was asked for) - `TestNestedGVisorStartLeavesGoMemLimitToRoot` - `TestSizeTableIsTheSpecsBytes` (existing, extended to the new values) Commands, all passing: - `TMPDIR=/tmp/g go test ./internal/activator/ -run 'TestWithGoMemLimit|TestFlatStart…|TestNestedStart…|TestNestedGVisor…|Swap|Size|Tier|StartGen|Identity|Plan14Generation|TestSandbox|…' -count=1` - `go test ./internal/cgroup/ -run 'TestSizeTable|TestSizesTableIsLiteral' -count=1` - `go test ./internal/provision/ -run 'TestPlan14RootReadCensus|TestCensusScopeIsTheRootBinary' -count=1` - `go test ./internal/docsite/ -count=1` `go build ./...`, `go vet`, `gofmt -l` and the darwin and windows builds are clean. **Mutation check:** with the app-override check, the gVisor guard and the no-cgroup guard all removed, the matching tests failed (app-set flat and nested cases, uncapped, gVisor). I then put the guards back. **Census:** overlay `plan14-root-reads-instance-gomemlimit-991.tsv` covers `spawnChildFrom`, `spawnUnitFrom` and `startRole`, and re-pins the activator and cgroup envelopes. The card is `docs/superpowers/notes/census-proposal-instance-gomemlimit-991.md`. It needs the reviewer's verdict on #280. **Docs sentence** (docs/site/cli.md, after the table in "What an instance is started with"): &gt; The box also sets `GOMEMLIMIT` to 80% of the instance's memory size, unless your app's config or `&lt;host&gt;.env` sets its own. **Commits:** b96db100 (code and tests), c058ec65 (census), 75e0c87f (docs). **Open questions:** - The same docs section says seeds and `carlos run` get "the same environment", but they don't get GOMEMLIMIT. Copy review may want to say so. - Sidecar members (`StartWorkerStaged`, `startHAWorker`) run alone in their own cgroup with a known tier, so they could take the same default as a follow-up. - If a flat best-effort `memory.max` write fails, the child still gets the default; that is harmless. Files are in /home/paulca/amadan.net/carlos/platform/.claude/worktrees/instance-gomemlimit-991: - internal/activator/gomemlimit.go - internal/activator/gomemlimit_test.go - internal/cgroup/cgroup.go</result> <usage><subagent_tokens>222581</subagent_tokens><tool_uses>86</tool_uses><duration_ms>808752</duration_ms></usage> </task-notification>