carlos / platform Public

spec: config receipts (#522) rev 3, Astra round 1 taken

Round 1 findings committed unedited. All 5 P1 and 4 P2 taken: no
rendered-content hashes or audit versions, host-local overrides reported,
conditional writes on both write paths, refusals ordered past DeferAck,
asleep only when carlos hibernated, last_confirmed as history, no stale
verdict, retry conflict branch, fleet ack provenance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev f573bc674e1f31b7f6022b3100a974876122f4a3 parent 93ac6cd
2 files changed, +249 −47
  • docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R1.md +99 −0
  • docs/superpowers/specs/2026-11-02-config-receipts-design.md +150 −47

CI cancelled — superseded by a newer push — run details

Intent

Human

<task-notification> <task-id>b3835gmbd</task-id> <tool-use-id>toolu_015Sh8Ez4SkrxUtQa9xDttKY</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/4c585ebb-d953-40f5-8f58-fbd337832024/tasks/b3835gmbd.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round-1 review to finish" completed (exit code 0)</summary> </task-notification>

diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R1.md
new file mode 100644
index 000000000..dea9818ab
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R1.md
@@ -0,0 +1,99 @@
+Reviewed spec rev 2 at `93ac6cdecefea3c74d060f0949b3f3bfb3230b04` against code base `5394c7f9`. This is round 1.
+
+1. **P1 — §5.3 exposes a plaintext-derived secret hash; §4.6 makes the same confidentiality mistake for audit versions.**
+
+ The proposed `rendered` field contains `renderedIdentity`, which is an unkeyed SHA-256 of the decrypted environment file. `RenderEnv` decrypts secrets and produces deterministic, sorted `KEY=value` lines. An observer who knows the other values can enumerate guesses for one secret without its private key. I confirmed this with a synthetic four-digit PIN.
+
+ Evidence: [spec:481](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:481), [claimsync.go:26](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/claimsync.go:26), [materialize.go:54](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/materialize.go:54).
+
+ Separately, [spec:323](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:323) says an audited version necessarily includes envelopes. Plain-only manifests contain none: their versions permit guessing unknown plain values from audit rows, despite §4.3 restricting their digests to readers allowed those values.
+
+ **Fix:** keep plaintext-derived render hashes out of public delivery responses and ordinary receipts, including nested history and move fields. Use an opaque delivery identifier or an appropriately keyed construction where an externally visible identity is needed. Omit content hashes from audit rows unless their confidentiality is explicitly protected.
+
+ **Fault family:** secret confidentiality across telemetry and audit boundaries.
+
+2. **P1 — §§4.4/5.5/5.6 can report delivery when the process receives an overriding value.**
+
+ The three bucket layers are not the complete process environment. Exec launches merge `<host>.env` **over** `<host>.config.env`, then apply agent-owned variables. For example, stored `AGENT_TEAM=new` can be rendered correctly and followed by a successful restart, while `<host>.env` supplies `AGENT_TEAM=old`. Every proposed delivery check passes, but the process receives `old`.
+
+ Evidence: [spec:560](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:560), [backend_exec.go:2995](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/activator/backend_exec.go:2995), [backend_exec.go:3039](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/activator/backend_exec.go:3039).
+
+ **Fix:** describe Plan 1’s effective view as the stored-layer merge. For Plan 2, capture launch-time shadowing through the actual environment-composition path; report overridden keys and withhold the claim that the process has those stored values. `LaunchLayers` already identifies relevant shadowing.
+
+ **Fault family:** delivered-file evidence versus actual process configuration.
+
+3. **P1 — §4.5’s `applyAt` change does not protect team-owned writes.**
+
+ Team PUTs call `teamApplyEnvironment` → `ApplyEnvironmentOwned`, which performs its own read and CAS without calling `applyAt`. A door-level comparison can see version A, a concurrent writer can produce B, and the owned writer can then read B and successfully write against B’s etag. Adding the expected version only to `applyAt` leaves that request succeeding despite its A precondition.
+
+ Evidence: [spec:286](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:286), [apiconfig.go:875](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/console/apiconfig.go:875), [owned.go:123](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/owned.go:123).
+
+ **Fix:** carry the expected version through both write paths. Ownership, version comparison, mutation and receipt construction must use the same read whose etag guards the write. Preserve ownership refusals before exposing a version. Explicitly account for the additional credential-minting writes on owned-environment creation.
+
+ **Fault family:** conditional-write atomicity and scoped ownership.
+
+4. **P1 — §§5.2–5.5 do not define how blocked acknowledgements escape the rollout delivery gate safely.**
+
+ Today every scheduler-managed acknowledgement passes through `DeferAck`. When revision B has been rendered but A is still active, that function holds the acknowledgement until B activates. If a later pass reports `blocked`, sending that record through the existing callback also holds it—potentially indefinitely if activation fails. Writing it directly instead bypasses the ordered writer and permits an older queued success to overwrite it.
+
+ Evidence: [spec:461](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:461), [host/rollout.go:476](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/host/rollout.go:476), [rollout/config.go:44](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/rollout/config.go:44), [rollout/manager.go:1264](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/rollout/manager.go:1264).
+
+ **Fix:** specify state-aware acknowledgement sequencing. Publish refusals immediately through the same ordered writer, supersede obsolete deferred records, and gate only delivery-success records on activation. Test a pending activation followed by a refusal and delayed acknowledgement completion.
+
+ **Fault family:** acknowledgement ordering and truthful refusal visibility.
+
+5. **P1 — §5.5’s blanket asleep rule conflicts with named-unit restart recovery.**
+
+ The spec says both unit shapes need no restart when inactive and may report `delivered (asleep)`. The stamped-unit path deliberately uses `systemctl restart`, including for inactive units: a previous failed restart can leave the unit inactive while its pending marker still requires recovery. Applying the proposed rule can turn that failure into a settled delivery without starting the service.
+
+ Evidence: [spec:572](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:572), [unitsync.go:61](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/unitsync.go:61), [unitops.go:198](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/host/unitops.go:198).
+
+ **Fix:** distinguish intentional sleep from an inactive unit with an outstanding restart obligation. Preserve the stamped path’s pending-marker and restart semantics; inactivity alone must not establish successful delivery.
+
+ **Fault family:** restart obligations surviving failed delivery.
+
+6. **P2 — §§5.3/5.6 describe `last_delivered` as current process state without current evidence.**
+
+ A historical success does not establish what is running after a failure. A restart can stop A and fail to start B, leaving nothing running. Alternatively, a later automatic start can consume B while the stored history still names A. Nevertheless, the spec promises to describe “what the process is still running.”
+
+ Evidence: [spec:483](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:483), [spec:621](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:621), [unitsync.go:459](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/unitsync.go:459).
+
+ **Fix:** label this as the last *confirmed* delivery, with its original process and time. Claim current configuration only with current process evidence. Relay fallback must preserve that distinction.
+
+ **Fault family:** historical evidence versus current state.
+
+7. **P2 — §5.6 has no source for the latest stored write’s age.**
+
+ The pending/stale distinction requires a timestamp belonging to the exact stored version. `Store.Get` returns only bytes and etag; S3’s implementation discards object metadata. The generation timestamp is app-wide, covers all environments, and can change on a sync request without a config write. Using it would let unrelated activity continually refresh an old mismatch.
+
+ Evidence: [spec:619](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:619), [release/store.go:50](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/release/store.go:50), [generation.go:28](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/generation.go:28).
+
+ **Fix:** define version-associated modification metadata for both stores, including deletion, or explicitly define the grace period from a durable first observation of that mismatch.
+
+ **Fault family:** freshness measurement.
+
+8. **P2 — §4.7 leaves conflicting or partially present new keys unhandled.**
+
+ Suppose the preserved keys remain unchanged, but another writer sets one requested new key to a different value. None of step 4’s branches applies: the new keys neither all match nor are all absent, and no preserved key differs.
+
+ Evidence: [spec:337](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:337).
+
+ **Fix:** add an explicit conflict branch covering partial presence, differing digests and differing kinds. Stop without rebasing or overwriting those keys.
+
+ **Fault family:** complete retry decision procedure.
+
+9. **P2 — §5.8 incorrectly treats the prior acknowledgement as exclusively root-authored.**
+
+ Fleet credentials can write anywhere under their fleet prefix, including another box’s proposed acknowledgement key. A fixed JSON struct does not establish provenance. Also, the prior record is used for `last_delivered`, not solely for deduplication as the census paragraph claims.
+
+ Evidence: [spec:670](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:670), [storedoor.go:644](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/edge/storedoor.go:644).
+
+ **Fix:** document the acknowledgement as agent-writable telemetry, validate its scope and fields, and prohibit using it to select privileged targets or bypass delivery checks. Do not promote carried history into independently verified process evidence.
+
+ **Fault family:** provenance of root-consumed telemetry.
+
+I accept the existing **Operate/Admin** gate rather than requiring Admin-only, provided the new doors exclude team credentials and enforce the specified account/app/host checks. The raw-byte version scheme and stored-layer merge rules are sound in principle. Plan 1’s census characterization is reasonable; Plan 2’s provenance rationale needs the correction above. Reading systemd properties for an already-authorized unit does not itself justify expanding unit authority.
+
+No files were changed or repository test suites run. Amadan access was blocked by the sandbox, so I could not independently verify completeness against discussions #522 and oficina/home #103.
+
+**NOT READY**
\ No newline at end of file
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 b1005c34f..f286fa511 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,13 @@
# Config versions, digests and receipts: proving what a config change touched
-Status: DRAFT rev 2, 2026-11-02 (rev 2: builder check's five Plan 2 gaps settled, see §7 calls 6, 9-12). Discussion: amadan carlos/platform #522
+Status: DRAFT rev 3, 2026-11-03.
+
+Revisions:
+- Rev 1 (148c56d5, eff06f96): first draft.
+- Rev 2 (c3ed3178): builder check's five Plan 2 gaps settled (§7 calls 6, 9-12).
+- Rev 3: Astra round 1 (`docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R1.md`,
+ NOT READY, 5 P1 and 4 P2), every finding taken. Changes are marked
+ **(R1-n)**. 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.
@@ -251,6 +258,12 @@ otherwise). Answer:
layer. An overlay is platform-written; its plain values are shown as they are
in the owner's other reads today (decided by the builder from what
`instances.go` already exposes; if nothing exposes them, digest only).
+- It is the merge of the **stored layers** only **(R1-2)**. On the box, an
+ exec instance's own `<host>.env` is layered over the rendered config file and
+ wins conflicts, and agent-owned control variables go on top of both
+ (`instanceEnv`, `internal/activator/backend_exec.go:2995`). Those are not in
+ the bucket and this view cannot see them; Plan 2 reports them (§5.3,
+ `overridden`).
- Read with the same merge rules boxes render with. `LoadMergedHostVersions`
returns etags, not bytes, and the box sweeps deliberately do not call it (see
its comment in `instances.go`), so Plan 1 adds a loader that returns each
@@ -283,9 +296,19 @@ console already keeps. An `If-Match` header is accepted as a synonym if the
builder finds it cheap; the body field wins if both are sent and differ (400).
(My call.)
-This needs `applyAt` to accept a caller-supplied expected version. The builder
-adds that as a parameter on the internal path, not a second write path, so the
-platform writers in §3.2 keep using the same function.
+The expected version is carried into **both** write paths **(R1-3)**:
+`applyAt` (default bundle, non-owned environments) and `ApplyEnvironmentOwned`
+(`internal/appconfig/owned.go:123`, reached from team PUTs through
+`teamApplyEnvironment`, `apiconfig.go:875`), which does its own read and CAS
+and never calls `applyAt`. In each, the ownership check, the version compare,
+the mutation and the receipt all use the one read whose etag guards the write;
+the door does not compare separately. An ownership refusal still answers
+before any version is revealed. A team write with `if_version: "none"` (create
+the environment) is refused with 400: creating an owned environment also mints
+its platform credentials in further writes (`mintOwnedEnvironment`), which
+cannot share one precondition. A team creates the environment with an
+unconditional write and makes conditional writes afterwards. The platform
+writers in §3.2 keep calling the same functions with no expected version.
### 4.6 Receipts
@@ -320,9 +343,11 @@ Every successful PUT answers (existing fields kept):
`after` differ, somebody wrote the default bundle during this request, and
the caller decides what that means. Instance overlays are not listed; there
is one per host, and `config/effective` is the per-host view.
-- The audit row keeps its rule of counts, never names (`apiconfig.go:570`),
- and adds the two versions. A version is a hash over the whole object, which
- includes envelopes; it reveals nothing a row reader could use. (My call.)
+- The audit row is unchanged: counts and the bundle, never names
+ (`apiconfig.go:570`), and **no versions** **(R1-1)**. A layer holding only
+ plain vars has a version computed from plaintext alone, so an audit reader
+ who cannot read the values could test guesses against it. Versions and
+ digests go only to callers who can read the values they cover.
### 4.7 Retries and the adoption recipe
@@ -342,6 +367,12 @@ The facility is designed so that this procedure is sound:
`if_version` = the version just read.
- any preserved key differs from the baseline, or is gone: stop. Something
else changed what the runner promised to preserve.
+ - preserved keys equal the baseline, but the new keys are only partly
+ present, or one is present with a different digest or a different kind:
+ stop **(R1-8)**. Another writer touched the keys this runner was adding.
+ Do not overwrite them and do not take a new baseline; report the conflict.
+ Exactly one branch applies to any read: the first that matches, in this
+ order (preserved keys first, then the new keys).
The baseline is the per-key digests, not the version, so a write to some
unrelated key between attempts does not force a new baseline, and a change to
@@ -450,9 +481,7 @@ is not:
alone and assumes a stamped route that passes them is delivered, so #516's
case reports nothing.
-Reusable: `renderedIdentity` (`claimsync.go:26`, a hash of the rendered file
-plus which layers were present) is already computed by every writer;
-Plan 1's raw-bytes loader gives every layer's version; `InstanceConfigDelivery`
+Reusable: Plan 1's raw-bytes loader gives every layer's version; `InstanceConfigDelivery`
(`configack.go:164`) already has the delivered / stale / unknown-agent /
not-yet-delivered vocabulary, unused in production.
@@ -461,12 +490,13 @@ not-yet-delivered vocabulary, unused in production.
Every process that delivers config for a route (the root pass for unit and
named-unit routes, the agent for exec routes) writes the route's ack **whenever
its delivery state changes**, including to blocked, and states in it the
-versions of every layer it rendered (Plan 1's `cv1:` form), the rendered
-identity, a fixed-vocabulary state and reason, and what it knows about the
-process that was started on that config. The console reads a route's acks and
-compares them with the versions stored now, answering per route and box:
-`delivered`, `pending`, `blocked` (with a reason), `not-delivered-by-carlos`,
-or `unknown`. Nothing is inferred from silence.
+versions of every layer it rendered (Plan 1's `cv1:` form), a
+fixed-vocabulary state and reason, the names of any stored keys a host-local
+layer overrides, and what it knows about the process that was started on that
+config. The console reads a route's acks and compares them with the versions
+stored now, answering per route and box: `delivered`, `overridden`, `pending`,
+`blocked` (with a reason), `not-delivered-by-carlos`, or `unknown`. Nothing is
+inferred from silence.
### 5.3 The ack, schema 2
@@ -478,16 +508,29 @@ Additive to `ConfigAck`; `ConfigAckSchema` becomes 2. New fields:
| `reason` | for `blocked` and `restart-failed`: a code from a closed list (§5.4) |
| `written` | when the file now on disk was written (the delivery event, not the ack time) |
| `versions` | `{"default": "cv1:…", "environment": "cv1:…", "overlay": "cv1:…"}` for the layers this render read, `"none"` for absent ones, omitted for ones the route does not resolve through (an owned environment has no `default`) |
-| `rendered` | the `renderedIdentity` of the file written |
+| `overridden` | names (never values) of stored keys whose value the process does not get, because a host-local layer overrides them **(R1-2)** |
+| `seq` | per-route sequence number from the writer, for ordering (**R1-4**) |
| `process` | see §5.5; absent when not known |
-| `last_delivered` | when `state` is not `delivered`: the last delivered ack's `versions`, `rendered`, `written`, `process` and `relay_suffixes`, carried forward. Absent if there never was one |
-
-`last_delivered` exists so a block after a success says what the process is
-still running ("blocked: not declared; running the config written 7 September"),
-and so `carlos relay status` (`relayMatchingAck`, `apirelay.go`), which reads
-`RelaySuffixes` from the latest ack, does not go backwards when a later pass is
-refused. Relay status reads `last_delivered.relay_suffixes` when the top-level
-ones are absent.
+| `last_confirmed` | when `state` is not `delivered`: the last delivered ack's `versions`, `written`, `process` and `relay_suffixes`, carried forward. Absent if there never was one **(R1-6)** |
+
+`last_confirmed` is history, not current state **(R1-6)**. It says what was
+last confirmed delivered, when, and to which process. It does not say what is
+running now: a failed restart can leave nothing running, and a later automatic
+start can pick up the newer file. The console words it as "last confirmed
+delivery: written 7 September, process started 7 September", never as "still
+running". `carlos relay status` (`relayMatchingAck`, `apirelay.go`) reads
+`last_confirmed.relay_suffixes` when the top-level ones are absent and labels
+the answer the same way, so it neither goes backwards nor claims more than it
+knows.
+
+**No plaintext-derived hash leaves the box in a reader-visible field (R1-1).**
+`renderedIdentity` (`claimsync.go:26`) is an unkeyed SHA-256 of the decrypted
+file; with the other values known, a short secret can be recovered from it by
+guessing. It is not added to the ack. The ack's existing move fields
+(`FileSHA256`, written by `RenderHeld`) stay where they are for the moves
+code, and the console never returns them, nor any other hash of rendered
+content. Delivery is judged from `versions` (hashes of stored, sealed
+objects), `state` and `process`.
- Versions are computed on the box from the raw bytes it read, with the same
function the console uses (Plan 1 puts it in `internal/appconfig`), so the
@@ -500,7 +543,7 @@ ones are absent.
**When it is written.** On every pass that evaluates the route, the writer
compares the ack it would write with the current one (state, reason,
-versions, rendered, written; not `process` alone and not the timestamp) and
+versions, written, overridden; not `process` alone and not the timestamp) and
writes only if they differ.
- The agent is long-running: it keeps the last ack it wrote per route in
@@ -517,6 +560,25 @@ writes only if they differ.
A wake, a deploy or a crash restart does not rewrite the ack (§5.5), so apps
that sleep cost nothing extra.
+**Ordering with the rollout scheduler (R1-4).** Today every
+scheduler-managed exec ack goes through `DeferAck` (`internal/host/rollout.go:476`),
+which holds it until the revision it names is active
+(`internal/rollout/config.go:44`, `manager.go:1264`). Schema 2 splits by
+state:
+
+- A **success** (`delivered`) is still deferred until its revision activates,
+ as today.
+- A **refusal** (`blocked`, `restart-failed`) is published at once, through
+ the same ordered writer, not around it.
+- Each ack carries the writer's per-route `seq`. When a refusal is published,
+ any deferred success for that route with a lower `seq` is dropped, and the
+ ordered writer never writes a record whose `seq` is below the last one it
+ wrote for the route. A delayed activation therefore cannot overwrite a later
+ refusal.
+
+The root pass has no scheduler; its acks are written in pass order and its
+`seq` is the pass's start time.
+
**Moves.** A route held by a move is skipped by the ordinary sync passes
today and stays skipped: its ack belongs to the move (`RenderHeld`, landing's
check at `movesoffline_land.go:938`, the source's copy-and-delete at
@@ -569,11 +631,19 @@ inequality: the process that will read the config starts after `written`.
`process: {"invocation": "…", "started": "<RFC 3339>"}`. `state: delivered`
requires `started` after `written`. A restart that fails is
`restart-failed`.
-- **Units not running at delivery** (asleep, scaled to zero, stopped): nothing
- to restart, and the next start reads the file just written. `state:
- delivered` with `process: {"asleep": true}`. A later wake does not touch the
- ack: whatever starts after `written` has the config by construction, and the
- root pass cannot see wakes anyway.
+- **Units carlos put to sleep** **(R1-5)**: only a `carlos-app@` unit that the
+ activator hibernated (the ack's existing `Hibernating`), with no pending
+ restart marker outstanding. Nothing to restart; the next start reads the file
+ just written. `state: delivered` with `process: {"asleep": true}`. A later
+ wake does not touch the ack: whatever starts after `written` has the config
+ by construction.
+- **Any other inactive unit** is not asleep. Declared named units keep today's
+ semantics exactly: a marked unit owes a restart even when inactive, and the
+ root pass runs `systemctl restart`, not try-restart
+ (`internal/host/unitops.go:198`, `unitsync.go:61`). `delivered` then needs
+ the process that restart started. If the restart fails, `restart-failed`;
+ the pending marker stays and the next pass tries again, as today. Inactivity
+ alone never counts as delivery.
- **Later restarts** (a deploy, a crash, a wake) start after `written` too, so
they never make a delivered route undelivered and never rewrite the ack.
`restart-pending` is only for a pass that wrote the file and deliberately did
@@ -587,6 +657,13 @@ 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).** 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).
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
@@ -616,9 +693,9 @@ Verdicts:
| `delivered` | ack `delivered`, versions equal stored, and either a process started after `written` or the unit was asleep (shown as `delivered (asleep)`) |
| `delivered (file)` | ack `delivered`, versions equal stored, exec route with no process record (§5.5) |
| `restart-pending` | ack `restart-pending`, versions equal stored: the file is current and the process has not been restarted onto it |
-| `pending` | versions differ and the latest stored write is younger than the grace window (default 2 minutes, the fast loop's convergence plus a restart) |
-| `stale` | versions differ beyond the grace window |
-| `blocked` | ack `blocked` or `restart-failed`, with the reason and, from `last_delivered`, what the process is still running |
+| `overridden` | as `delivered`, but `overridden` names keys whose value the process gets from a host-local layer instead **(R1-2)** |
+| `pending` | versions differ; the answer carries the ack's own time so the reader sees how long the box has been behind **(R1-7)** |
+| `blocked` | ack `blocked` or `restart-failed`, with the reason and, from `last_confirmed`, the last confirmed delivery (§5.3) |
| `file-only` | ack `file-only`, versions equal |
| `not-delivered-by-carlos` | TCP-addr route not opted in |
| `unknown` | no ack, schema below 2, or the box is not reporting |
@@ -630,10 +707,18 @@ read.
The PUT's restart notice keeps its fields and gains nothing in Plan 2. The CLI
gains `--wait` on `env set` / `secrets set`: after the receipt it polls
`config/delivery` for the app's routes until every verdict is settled
-(`delivered` in any form, `blocked`, `file-only`, `not-delivered-by-carlos`),
-or a timeout (default 2 minutes), and prints each route's outcome.
+(`delivered` in any form, `overridden`, `blocked`, `file-only`,
+`not-delivered-by-carlos`), or a timeout (default 2 minutes, measured from the
+write the command itself just made), and prints each route's outcome.
`restart-pending`, `pending` and `unknown` are not settled; at the timeout they
-are printed as they stand and the command exits non-zero. Polling is the console reading acks the boxes already wrote; it adds
+are printed as they stand and the command exits non-zero.
+
+There is no `stale` verdict **(R1-7)**. Telling "pending" from "stale" needs
+the time the stored version was written, and neither store returns it
+(`release.Store.Get` returns bytes and an etag, `internal/release/store.go:50`;
+the generation object is app-wide and moves on a bare sync). Rather than invent
+a clock, `pending` carries the box's last report time and the caller (or
+`--wait`, from its own write) judges. Polling is the console reading acks the boxes already wrote; it adds
no box-side traffic.
### 5.7 Plan 2 tests
@@ -642,14 +727,21 @@ no box-side traffic.
|---|---|
| undelivered: stamped route, no declaration (#516) | `blocked`, reason `not-declared`, visible off-box |
| block after an earlier success | ack moves to `blocked`; verdict not `delivered` |
-| changed default bundle, box not yet converged | `pending`, then `stale` after the window |
+| changed default bundle, box not yet converged | `pending`, with the ack's time |
| changed environment bundle | same; today undetectable |
| wrong storage: ack for another host or box | not matched; that box `unknown` |
| file written, restart failed | `blocked`, `restart-failed` |
| process started before the file write | not `delivered` |
| 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)** |
+| 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)** |
+| retry finds a new key set by someone else to another value | recipe stops with a conflict **(R1-8)** |
+| any console answer or audit row | no rendered-content hash, no `FileSHA256`; no versions in audit rows **(R1-1)** |
| crash restart after delivery | still `delivered`; no ack write |
-| block after success | `blocked` carrying `last_delivered`; relay status unchanged |
+| block after success | `blocked` carrying `last_confirmed`, worded as history; relay status labelled the same way |
| route held by a move | ordinary pass writes nothing; held render's ack carries schema 2 fields |
| fleet box | ack under `fleets/<fleet>/config-ack/`, read by the console |
| unchanged route over many agent passes | no bucket request (counting store) |
@@ -671,8 +763,17 @@ class, to an existing prefix), writes on refusals, reads each unit route's ack
once per pass (its own prior output, parsed into a fixed struct and used only
for the change test), and reads a unit's `InvocationID` and start time from
systemd after restarting it. The ack read is the one new read; it is root's
-own record, under `control/` (or the fleet's prefix), not tenant-written, and
-a malformed one only causes a rewrite. It reads no
+own record under `control/` on platform boxes, which no tenant can write.
+On a fleet box it is under `fleets/<fleet>/`, which **every** credential of
+that fleet can write, so there it is fleet-writable telemetry **(R1-9)**. In
+both cases root treats the prior ack as untrusted input: it is parsed into a
+fixed struct; its `box` and `host` must match its key or it is ignored; it is
+used only to decide whether to write and to carry `last_confirmed` forward;
+it never selects a unit, a path or any other target, and never satisfies or
+skips a delivery check. A forged prior ack on a fleet can at worst cause a
+rewrite or a false `last_confirmed` on that fleet's own routes, which is the
+fleet lying to itself; the console labels a fleet route's history as reported
+by the fleet's boxes. It reads no
new tenant input: reason codes are fixed, unit names come from the declaration
file root already trusts. Run `make census-card`, brief Astra from
`docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, record the verdict on
@@ -699,19 +800,21 @@ next platform release; no roll ordering beyond the usual dev first.
3. "Owner-only" means the existing config read gate, not a new Admin-only
gate; flagged for review (§4.8).
4. Precondition in the JSON body, header as optional synonym (§4.5).
-5. Audit rows gain versions, still never names (§4.6).
+5. Audit rows are unchanged; no versions in them (§4.6, R1-1).
6. Acks are written on state change only. The agent caches the last one in
memory; the root pass reads one ack per unit route per pass rather than
keeping a root-owned cache file (§5.3).
-7. Grace window before `pending` becomes `stale`: 2 minutes (§5.6).
+7. No `stale` verdict; `pending` carries the box's report time and the
+ caller judges (§5.6, R1-7).
8. `--wait` on `env set` / `secrets set` polls the console, not the boxes
(§5.6).
9. Fleet boxes are in scope; their acks go under `fleets/<fleet>/`, which the
store door already allows (§5.3).
10. A process is recorded only when config is delivered; later restarts and
- wakes never rewrite the ack, and a unit asleep at delivery counts as
- delivered (§5.5).
-11. A block after a success keeps a `last_delivered` section, so the owner
- sees what is still running and relay status does not go backwards (§5.3).
+ wakes never rewrite the ack. Only a unit carlos hibernated, with no
+ pending restart, counts as delivered while asleep (§5.5, R1-5).
+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).
12. Routes held by a move keep their ack owned by the move; held renders gain
the schema 2 fields (§5.3).