carlos / platform Public

spec: config receipts (#522) rev 5, Paul's choice for R2-1

Launch-owned names refused at write, one list, one guard test; host-local
<host>.env overrides reported by name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 7f2bc06bc43e08e49c32946626244e39d82abc00 parent 3ac115c
1 file changed, +59 −18
  • docs/superpowers/specs/2026-11-02-config-receipts-design.md +59 −18
diff --git a/docs/superpowers/specs/2026-11-02-config-receipts-design.md b/docs/superpowers/specs/2026-11-02-config-receipts-design.md
index 637e9e8c2..f06c67573 100644
--- a/docs/superpowers/specs/2026-11-02-config-receipts-design.md
+++ b/docs/superpowers/specs/2026-11-02-config-receipts-design.md
@@ -1,6 +1,6 @@
# Config versions, digests and receipts: proving what a config change touched
-Status: DRAFT rev 3, 2026-11-03.
+Status: DRAFT rev 5, 2026-11-03.
Revisions:
- Rev 1 (148c56d5, eff06f96): first draft.
@@ -11,8 +11,11 @@ Revisions:
- Rev 4: Astra round 2 (`CODEX-FINDINGS-config-receipts-R2.md`, NOT READY,
3 P1 and 1 P2; R1-1 and R1-3 to R1-9 resolved, R1-2 partly). R2-2, R2-3 and
R2-4 taken, marked **(R2-n)**. R2-1 is R1-2's fault family a second time, so
- under AGENTS.md stopping rule 2 it goes to Paul as a choice, not a third fix
- (§5.5, "Overrides"). Discussion: amadan carlos/platform #522
+ under AGENTS.md stopping rule 2 it went to Paul as a choice, not a third fix.
+ Paul chose (2026-11-03) to refuse the names carlos sets at launch, keep them
+ in one list pinned by one guard test, and report `<host>.env` overrides by
+ name (§5.5, "Overrides").
+- Rev 5: Paul's choice for R2-1 written into §5.5 "Overrides". Discussion: amadan carlos/platform #522
(filed by the Oficina Home agent; its consumer is oficina/home #103).
Branch `design-config-receipts-522`, cut from main `5394c7f9`. Every
file:line below is on that commit.
@@ -690,21 +693,53 @@ inequality: the process that will read the config starts after `written`.
table knows it; otherwise `process` is absent and the console says
`delivered (file)` rather than `delivered`.
- `file-only`: never a process.
-- **Overrides (R1-2; R2-1 awaiting Paul's choice under stopping rule 2).**
- Round 2 showed the list below is incomplete: carlos itself sets or removes
- `CARLOS_CONTROL_SOCKET`, `CARLOS_PURGE`, `CARLOS_REGION` and `CARLOS_HOST`
- at every exec launch (`agentOwnedVars`, `backend_exec.go:2568`), and unit
- rendering drops `CARLOS_CONTROL_SOCKET` and rewrites `CARLOS_PURGE` inside
- the managed file (`applyAgentVars`, `agentvars.go:36`). A stored
- `CARLOS_HOST` is never what the process gets, yet nothing below reports it.
- The text that follows is rev 3's and will be replaced by Paul's choice.
- Whoever composes the process's environment reports
- which stored keys a host-local layer overrides: for exec routes the agent,
- from `LaunchLayers` (`backend_exec.go:3076`), which already returns the
- shadowed names; for unit routes the root pass, from the unit's own
- EnvironmentFile list (an unmanaged file is already a refusal,
- `unmanaged-env-file`). Names only. A route with any overridden key never
- reads plain `delivered` (§5.6).
+- **Overrides (R1-2, R2-1): refused up front, one list, one guard test.**
+ Paul's choice, 2026-11-03, under stopping rule 2 (R1-2 and R2-1 are one
+ fault family: "delivered" while the process gets another value). Three parts:
+
+ 1. **One list.** `appconfig.LaunchOwnedNames` is every name any carlos launch
+ path sets or removes, whatever the stored config says. Today that is the
+ union of the existing per-path lists: `agentOwnedNames`
+ (`backend_exec.go:2559`: `CARLOS_CONTROL_SOCKET`, `CARLOS_PURGE`,
+ `CARLOS_REGION`, `CARLOS_HOST`), `rootfsOwnedNames` (`rootfs.go:78`:
+ `CARLOS_SOCKET`, `CARLOS_DB`), the run variables `cmdunit.go` sets
+ (`CARLOS_RUN_ID`, `CARLOS_RUN_DIR`), `CARLOS_SESSION_ID`, and what
+ `applyAgentVars` rewrites in a unit's managed file (`agentvars.go:36`).
+ The per-path lists stay where they are and are pinned as subsets of it.
+ 2. **Refused at write.** `applyAt` and `ApplyEnvironmentOwned` refuse to set
+ a name on the list, for every writer (owner, team, platform, bucket-mode
+ CLI on a new binary), and the PUT door refuses it first with a 400 naming
+ the key ("CARLOS_HOST is set by carlos when the app starts; it cannot be
+ configured"). Unset stays allowed, so an owner can clear one already
+ stored. A bundle that already holds one is reported, never rewritten:
+ those keys appear in the route's `overridden` list, and `env list` marks
+ them.
+ 3. **One guard test.** For every launch composition function
+ (`agentOwnedVars`, `storageVars`, `seedVars`, the rootfs and command-unit
+ composers, `applyAgentVars`), the test feeds an environment holding a
+ sentinel value for every stored name plus every listed name, and asserts
+ that each name whose value changed or vanished is on the list. A new
+ launch variable that is not added to the list fails CI.
+
+ What remains is the host-local layer, which is the box's, not the bucket's:
+ - **Exec routes:** the instance's own `<host>.env` wins over the rendered
+ config (`instanceEnv`, `backend_exec.go:2995`). The agent records the names
+ `LaunchLayers` (`backend_exec.go:3076`) reports as shadowed, which are
+ exactly the names present in both files.
+ - **Unit routes:** a declared named unit with an unmanaged EnvironmentFile is
+ already refused (`unmanaged-env-file`), and systemd lets EnvironmentFile
+ values override `Environment=` lines, so the managed file wins. For
+ `carlos-app@` units carlos writes the unit itself; the builder confirms in
+ the plan that its template loads no other environment file after the
+ managed one.
+
+ So for a route, `overridden` = (stored names on `LaunchOwnedNames`) plus (for
+ exec routes) the `<host>.env` shadowed names. Names only. A route with any
+ overridden key reads `overridden`, never plain `delivered` (§5.6).
+
+ The claim stops at the environment carlos hands the process. What an
+ `ExecStart` wrapper or the program itself does with it afterwards is the
+ app's, and the docs say so.
Liveness of the box itself is not this record's job. The console already reads
box heartbeats (`freshHeartbeats`, `apiplacements.go:294`); an ack from a box whose heartbeat is stale is reported as
@@ -777,6 +812,9 @@ no box-side traffic.
| unit asleep at delivery, woken later | `delivered (asleep)`, then still delivered; no ack write on wake |
| named unit inactive with a pending marker, restart fails | `restart-failed`, never `delivered (asleep)`; marker kept **(R1-5)** |
| `<host>.env` sets a stored key (exec route) | `overridden`, naming the key, no value **(R1-2)** |
+| PUT setting `CARLOS_HOST` (or any listed name), any writer | 400 naming the key; nothing written **(R2-1)** |
+| bundle already holding `CARLOS_HOST` | route reads `overridden` naming it; unset allowed **(R2-1)** |
+| guard: each launch composer only changes listed names | fails if a composer sets or removes an unlisted name **(R2-1)** |
| scheduler holds success for revision B, then a pass is refused, then B activates | refusal published at once; the held success is dropped; final ack is the refusal **(R1-4)** |
| team PUT with a stale `if_version` racing another team write | 412, nothing written **(R1-3)** |
| team PUT with `if_version: none` | 400 **(R1-3)** |
@@ -859,5 +897,8 @@ next platform release; no roll ordering beyond the usual dev first.
11. A block after a success keeps a `last_confirmed` section, worded as
history, never as what is running now (§5.3, R1-6).
13. Team conditional writes cannot create an environment (§4.5, R1-3).
+14. Writes refuse every name carlos sets at launch; unset of one stays
+ allowed; stored ones are reported, not rewritten (§5.5, R2-1, Paul's
+ choice of approach).
12. Routes held by a move keep their ack owned by the move; held renders gain
the schema 2 fields (§5.3).