carlos / platform Public

devbox on macOS (#488): root-read census proposal (devbox-macos)

make census-propose NAME=devbox-macos: one body change
(devbox_cli.go runDevboxServe, its three read sites unchanged) and seven
new units written legacy, accepted-legacy, frozen
(devbox_envfile.go loadDevboxEnvFile, devbox_envfile_unix.go
openDevboxEnvFile, the LaunchDaemon plist, and the four darwin
trampoline .s files of internal/fileacl and internal/launchd).
Envelopes re-pinned: ., infra/devbox, internal/edge, internal/fileacl,
internal/launchd. Seal 43d18241... -> 3f500e35....

The record-write census (9B8) passes unchanged: no new record-write
site, so no overlay.

Awaiting the independent reviewer's verdict on #280.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev b7a4542426e336a30b8511863b27f1a0fcd714d4 parent 5ca6096
3 files changed, +54 −0
  • docs/superpowers/notes/census-proposal-devbox-macos.md +29 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −0
  • internal/provision/testdata/plan14-root-reads-devbox-macos.tsv +24 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>adb6e89c9529fd992</task-id> <tool-use-id>toolu_01NT38XRmE7KGFAmJcbqAdD1</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9b370a04-693c-4bda-b2eb-9a4b08f7626d/tasks/adb6e89c9529fd992.output</output-file> <status>completed</status> <summary>Agent "Build devbox macOS support (#488)" 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: DONE_WITH_CONCERNS. All three review findings are fixed. Nothing is pushed. Commits: - `6faa42f0`: the two P2 fixes and the new `internal/fileacl` package. - Env-file values are kept exactly as written; only the `\r` of a CRLF line ending is removed. - The env file opens nonblocking, so a FIFO is refused at once. - Symlinks are still followed on purpose. - `5ca6096c`: the P1 fix. - On darwin, an env file with an ACL is refused with DBX-C93. - A failure to read the ACL is refused with DBX-C61 plus the system error. - DBX-C93 is now in the deck as approved, the gate covers C1 to C93, and C93 is in `devboxCopyBuilt`. Tests: on linux, the 9 `TestDevboxServeEnvFile*` tests, the copy gate and the `TestDevbox` run on the root package pass, as do the `internal/fileacl`, `internal/launchd` and `internal/devbox` tests. Darwin vet and test compile pass on arm64 and amd64 for `.`, `internal/devbox`, `internal/launchd` and `internal/fileacl`. Windows vet and build pass on amd64 and arm64. Copy rows: DBX-C58 to DBX-C93, all approved and built. Concerns: 1. The darwin tests have not been run anywhere, because they need a Mac: `TestExtendedDarwin`, `TestDevboxServeEnvFileRefusesACL`, `TestLaunchdListenersOutsideLaunchd` and `TestPeerUIDDarwin`. 2. Two libc behaviours come from Apple's docs and are unverified: `acl_get_fd` returning NULL with ENOENT when a file has no ACL, and `acl_get_entry` returning EINVAL for an empty ACL. If the first is wrong, every env file on the Mac would be refused with DBX-C61. That fails closed and the darwin tests would catch it. 3. `GOOS=darwin go vet ./internal/edge` still fails because of `readerConn`. The same failure is on main. Report: /home/paulca/.cache/tmp/devbox-macos-report.md</result> <usage><subagent_tokens>217602</subagent_tokens><tool_uses>3</tool_uses><duration_ms>300115</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b5kiz0u1b</task-id> <tool-use-id>toolu_01LkzruzEaKvANVHKnYkUcwa</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9b370a04-693c-4bda-b2eb-9a4b08f7626d/tasks/b5kiz0u1b.output</output-file> <status>completed</status> <summary>Background command "Run Astra scoped re-review of the #488 fixes" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 203 g CO₂e (9,099,803 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on devbox-macos, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/notes/census-proposal-devbox-macos.md b/docs/superpowers/notes/census-proposal-devbox-macos.md
new file mode 100644
index 000000000..a065ca8cf
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-devbox-macos.md
@@ -0,0 +1,29 @@
+# Census approval: devbox-macos
+
+Ruling `census-ruling-devbox-macos`. The independent reviewer approves or rejects every change below, 7 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `devbox_cli.go` `runDevboxServe` | body | unchanged (3) | devbox on macOS (#488): serve now parses flags; --env-file PATH loads the service user's own env file (loadDevboxEnvFile) before reading the same environment as before; with CARLOS_DEVBOX_LAUNCHD_SOCKET set it takes launchd's listening socket (launchd.Listeners, macOS only; elsewhere it refuses) and holds it to CARLOS_DEVBOX_LISTEN (edge.CheckDevboxListener) before making anything; the socket path comes from devboxSocketPath (CARLOS_DEVBOX_SOCKET, or the OS default). Runs as the unprivileged service user (carlos-devbox on Linux, _carlos-devbox on macOS), never root; no new read beyond the env file named on its own command line |
+
+Envelopes re-pinned: `.`, `infra/devbox`, `internal/edge`, `internal/fileacl`, `internal/launchd`.
+
+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:
+
+- `devbox_cli.go` `runDevboxServe`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: carlos devbox serve, run by the carlos-devbox unit as the unprivileged carlos-devbox user, reads its config from the environment (CARLOS_DEVBOX_LISTEN, CARLOS_DEVBOX_DOMAIN, CARLOS_DATA_DIR, CARLOS_WILDCARD_DOMAINS, CARLOS_DEVBOX_SOCKET) and opens registry.db and links.json under its own StateDirectory. Not root
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `devbox_envfile.go:loadDevboxEnvFile`: reads +file:ReadAll, +file:Stat; written legacy, accepted-legacy, frozen
+- new `devbox_envfile_unix.go:openDevboxEnvFile`: reads +file:OpenFile; written legacy, accepted-legacy, frozen
+- new `infra/devbox/com.carlosframework.devbox.plist:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- new `internal/fileacl/fileacl_darwin_amd64.s:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- new `internal/fileacl/fileacl_darwin_arm64.s:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- new `internal/launchd/activate_darwin_amd64.s:external`: reads +file:external; written legacy, accepted-legacy, frozen
+- new `internal/launchd/activate_darwin_arm64.s:external`: reads +file:external; written legacy, accepted-legacy, frozen
+
+Seal: `43d1824141f0ce7024cc3740ab5feac3f3539322f8afb856c9ca2f10d5095e95` → `3f500e352d0d8d6538959f7b70c41dec643294436622c5ccfe355cadc13cf70d`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-devbox-macos.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 79e107881..eee1c77c3 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -46,3 +46,4 @@ plan14-root-reads-fleet-routes-followups.tsv 1379d066c8dd2335d95d5f6e9c7bce65ff5
plan14-root-reads-tunnel-websockets.tsv 949bc734a293366e6b2700244af5110dd6e84b5432023e991c09e806afd62483
plan14-root-reads-console-protection-tab.tsv eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8
plan14-root-reads-devbox-mode.tsv 43d1824141f0ce7024cc3740ab5feac3f3539322f8afb856c9ca2f10d5095e95
+plan14-root-reads-devbox-macos.tsv 3f500e352d0d8d6538959f7b70c41dec643294436622c5ccfe355cadc13cf70d
diff --git a/internal/provision/testdata/plan14-root-reads-devbox-macos.tsv b/internal/provision/testdata/plan14-root-reads-devbox-macos.tsv
new file mode 100644
index 000000000..04a9b84be
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-devbox-macos.tsv
@@ -0,0 +1,24 @@
+# Census overlay devbox-macos, written by census-propose (#369). census-ruling-devbox-macos, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-devbox-macos.md.
+# 1 body, 0 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 7 new dispositions: 0 reads re-frozen at their disposition with the claim, 7 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy afa5aecc1a5bd5ad74033708636757efaafe3d8f72b679d0064581207161caee devbox_cli.go runDevboxServe legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: carlos devbox serve, run by the carlos-devbox unit as the unprivileged carlos-devbox user, reads its config from the environment (CARLOS_DEVBOX_LISTEN, CARLOS_DEVBOX_DOMAIN, CARLOS_DATA_DIR, CARLOS_WILDCARD_DOMAINS, CARLOS_DEVBOX_SOCKET) and opens registry.db and links.json under its own StateDirectory. Not root;rev3=census-ruling-devbox-macos;basis=devbox on macOS (#488): serve now parses flags; --env-file PATH loads the service user's own env file (loadDevboxEnvFile) before reading the same environment as before; with CARLOS_DEVBOX_LAUNCHD_SOCKET set it takes launchd's listening socket (launchd.Listeners, macOS only; elsewhere it refuses) and holds it to CARLOS_DEVBOX_LISTEN (edge.CheckDevboxListener) before making anything; the socket path comes from devboxSocketPath (CARLOS_DEVBOX_SOCKET, or the OS default). Runs as the unprivileged service user (carlos-devbox on Linux, _carlos-devbox on macOS), never root; no new read beyond the env file named on its own command line data-literal@1086,data-literal@776,file:Open@2328 af97c614709d8403666d632eca5c15d20c905ab21e02064ab18ba2bb7a01cb30
+@legacy b8322b056054fcd65f2b37586ea7cf914add6f2941a653061bd27c00cf0ce77c devbox_envfile.go loadDevboxEnvFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): reads the --env-file named on carlos devbox serve's command line (the unit or plist, written by root at install), as the unprivileged service user. On the opened file: Stat for regular-file, owner == euid, mode & 077 == 0 and (darwin) no extended ACL, then ReadAll bounded to 1 MiB; every line must be KEY=VALUE, a comment or blank, no duplicate keys, nothing set unless all pass. Not root file:ReadAll@1113,file:Stat@274 252ac41ef1929f6859f2eed8aed3442d72c3364f33d91cfdbb6e8160018a5703
+@legacy fb4d89771bc46c1c18fa9cdc1974c91f08ff108cc1b0858e0f92f963d683530d devbox_envfile_unix.go openDevboxEnvFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): os.OpenFile(path, O_RDONLY|O_NONBLOCK) of the env file so a FIFO is refused instead of hanging; symlinks followed, every check is on the opened file. Called only by loadDevboxEnvFile, as the service user. Not root file:OpenFile@64 8a26179df81c92ba09042dd3f4a2bd7bbe05cd595b6ddb2810f9e08ed84711ca
+@legacy 66dc91dbb2550a4501a822dd65059877d338665e911bbeb44f90c3ad0c7d4913 infra/devbox/com.carlosframework.devbox.plist external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): the macOS LaunchDaemon. launchd (root) binds 100.64.0.10:443 (replaced at install with the tailnet IP) as Sockets/Listeners and runs /usr/local/bin/carlos devbox serve --env-file /usr/local/etc/carlos-devbox/env as UserName/GroupName _carlos-devbox. Its only environment is CARLOS_DEVBOX_LAUNCHD_SOCKET=Listeners; no secrets. Installed root:wheel 0644 by the runbook. macOS only; not read by anything on Linux file:external@0 1f1e35b36f33b13c5664bd67137fe38330a43b1c18427a1c5ddda4e0b9c38127
+@legacy b8ab4e084b2dfcd1ed51f5bf8d1add8fbbab8d4dfccda76d573e2f8a714e0b8a internal/fileacl/fileacl_darwin_amd64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/amd64 libSystem trampolines (JMP to acl_get_fd, acl_get_entry, acl_free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1a635ddd767dcea2d62da4b1bcfcb6aadfef5f753d9d26922279830576f814cc
+@legacy 55b0f75e71a953c047b0e0bba18002f46c0d4e43121db019bd9566c4473a84f3 internal/fileacl/fileacl_darwin_arm64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/arm64 libSystem trampolines (JMP to acl_get_fd, acl_get_entry, acl_free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1a635ddd767dcea2d62da4b1bcfcb6aadfef5f753d9d26922279830576f814cc
+@legacy 8e716fc612a5b130c9637d657ed9157058fea8ad3971d033863b94a7b37fc835 internal/launchd/activate_darwin_amd64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/amd64 libSystem trampolines (JMP to launch_activate_socket, free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1027b2b693372a26fc14c404fd9fd31f780ce7727ee948dfc74336a5e181c05d
+@legacy 41d70fc3db920fa8b9000d59bb515e4960d103f7786cf4cc0868227542df0664 internal/launchd/activate_darwin_arm64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/arm64 libSystem trampolines (JMP to launch_activate_socket, free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1027b2b693372a26fc14c404fd9fd31f780ce7727ee948dfc74336a5e181c05d
+devbox_cli.go runDevboxServe legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-mode;basis=new: carlos devbox serve, run by the carlos-devbox unit as the unprivileged carlos-devbox user, reads its config from the environment (CARLOS_DEVBOX_LISTEN, CARLOS_DEVBOX_DOMAIN, CARLOS_DATA_DIR, CARLOS_WILDCARD_DOMAINS, CARLOS_DEVBOX_SOCKET) and opens registry.db and links.json under its own StateDirectory. Not root;rev3=census-ruling-devbox-macos;basis=devbox on macOS (#488): serve now parses flags; --env-file PATH loads the service user's own env file (loadDevboxEnvFile) before reading the same environment as before; with CARLOS_DEVBOX_LAUNCHD_SOCKET set it takes launchd's listening socket (launchd.Listeners, macOS only; elsewhere it refuses) and holds it to CARLOS_DEVBOX_LISTEN (edge.CheckDevboxListener) before making anything; the socket path comes from devboxSocketPath (CARLOS_DEVBOX_SOCKET, or the OS default). Runs as the unprivileged service user (carlos-devbox on Linux, _carlos-devbox on macOS), never root; no new read beyond the env file named on its own command line data-literal@1086,data-literal@776,file:Open@2328 af97c614709d8403666d632eca5c15d20c905ab21e02064ab18ba2bb7a01cb30
+devbox_envfile.go loadDevboxEnvFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): reads the --env-file named on carlos devbox serve's command line (the unit or plist, written by root at install), as the unprivileged service user. On the opened file: Stat for regular-file, owner == euid, mode & 077 == 0 and (darwin) no extended ACL, then ReadAll bounded to 1 MiB; every line must be KEY=VALUE, a comment or blank, no duplicate keys, nothing set unless all pass. Not root file:ReadAll@1113,file:Stat@274 252ac41ef1929f6859f2eed8aed3442d72c3364f33d91cfdbb6e8160018a5703
+devbox_envfile_unix.go openDevboxEnvFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): os.OpenFile(path, O_RDONLY|O_NONBLOCK) of the env file so a FIFO is refused instead of hanging; symlinks followed, every check is on the opened file. Called only by loadDevboxEnvFile, as the service user. Not root file:OpenFile@64 8a26179df81c92ba09042dd3f4a2bd7bbe05cd595b6ddb2810f9e08ed84711ca
+infra/devbox/com.carlosframework.devbox.plist external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): the macOS LaunchDaemon. launchd (root) binds 100.64.0.10:443 (replaced at install with the tailnet IP) as Sockets/Listeners and runs /usr/local/bin/carlos devbox serve --env-file /usr/local/etc/carlos-devbox/env as UserName/GroupName _carlos-devbox. Its only environment is CARLOS_DEVBOX_LAUNCHD_SOCKET=Listeners; no secrets. Installed root:wheel 0644 by the runbook. macOS only; not read by anything on Linux file:external@0 1f1e35b36f33b13c5664bd67137fe38330a43b1c18427a1c5ddda4e0b9c38127
+internal/fileacl/fileacl_darwin_amd64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/amd64 libSystem trampolines (JMP to acl_get_fd, acl_get_entry, acl_free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1a635ddd767dcea2d62da4b1bcfcb6aadfef5f753d9d26922279830576f814cc
+internal/fileacl/fileacl_darwin_arm64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/arm64 libSystem trampolines (JMP to acl_get_fd, acl_get_entry, acl_free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1a635ddd767dcea2d62da4b1bcfcb6aadfef5f753d9d26922279830576f814cc
+internal/launchd/activate_darwin_amd64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/amd64 libSystem trampolines (JMP to launch_activate_socket, free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1027b2b693372a26fc14c404fd9fd31f780ce7727ee948dfc74336a5e181c05d
+internal/launchd/activate_darwin_arm64.s external legacy accepted-legacy accepted-legacy;rev3=census-ruling-devbox-macos;basis=new (#488): darwin/arm64 libSystem trampolines (JMP to launch_activate_socket, free) in x/sys/unix's form; built only for darwin, so absent from the linux root binary file:external@0 1027b2b693372a26fc14c404fd9fd31f780ce7727ee948dfc74336a5e181c05d
+@coverage . 86d00ee4d95647e16f7a8a6cfb8c30b5bdbabcc971653fe21d1238e7220d7a6a
+@coverage infra/devbox 6004d4f104596fc9a9dd70a2f951b555913f5856b84979eb5992cbec39cd592d
+@coverage internal/edge 773df1318f5dfaf97b0c4250c0520109b9d6e9711236133c2e2464f2e0e118af
+@coverage internal/fileacl 0cc8a14e84bee6cb419f4d9b3fa3b644e59c14e58d8fbb94ad4aefb487e7a652
+@coverage internal/launchd 7dc9ec08bd27b46d2913aca093d094480ed434849e56c19998e068bba2346bb2