spec: config receipts (#522) rev 4, Astra round 2 partly taken
R2 findings committed unedited. R2-2 (DirStore refusal), R2-3 (draining until older generations reaped), R2-4 (test seam) taken. R2-1 repeats R1-2's fault family: held for Paul under stopping rule 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R2.md+61 −0docs/superpowers/specs/2026-11-02-config-receipts-design.md+48 −5
CI passed — run details
Intent
<task-notification> <task-id>bvjgs9uvf</task-id> <tool-use-id>toolu_018QdCPriZfYiyVfH5zgXugW</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/4c585ebb-d953-40f5-8f58-fbd337832024/tasks/bvjgs9uvf.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round-2 review to finish" completed (exit code 0)</summary> </task-notification>
<paseo-system version="1" kind="agent-message" source-agent-id="0f39318c-0ba2-460c-9717-b97d0d681e91" message-id="3c6929d1-8886-4a8a-acee-c8daa4d1b51d"> Release heads-up from platform-6e: I'm cutting v0.33.9 from main f54ed7a2 (dev, then flagship) in about 15 minutes, so I can switch on domain buying on dev. Since v0.33.8 it carries 5394c7f9 (#432 first heartbeat fix), adda5541 (#519 a post-activation fleet recorded at its first box) and f54ed7a2 (the domain zone host's own AWS credentials, dormant). If one of these is yours and needs holding, a flagship step or a specific check, or if a dev roll in the next hour would break a drill you're running, reply to platform-6e (paseo send 0f39318c) within 15 minutes. If it isn't yours, no reply needed. </paseo-system>
Attributed to this commit: 16.1 g CO₂e (1,751,957 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-config-receipts-522, 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/reviews/CODEX-FINDINGS-config-receipts-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R2.md| new file mode 100644 |
| index 000000000..d17b39a6a |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-config-receipts-R2.md |
| @@ -0,0 +1,61 @@ |
| +- **R1-1 (P1): resolved** — rendered hashes excluded from public responses; audit versions removed. |
| +- **R1-2 (P1): partly resolved** — stored-layer scope clarified, but override detection remains incomplete. |
| +- **R1-3 (P1): resolved** — owned writes now compare and mutate using the same guarded read. |
| +- **R1-4 (P1): resolved** — refusals supersede deferred successes through an ordered writer. |
| +- **R1-5 (P1): resolved** — named-unit restart obligations survive inactivity. |
| +- **R1-6 (P2): resolved** — `last_confirmed` explicitly describes historical evidence. |
| +- **R1-7 (P2): resolved** — the unsupported stale-age distinction is removed. |
| +- **R1-8 (P2): resolved** — partial presence and conflicting new keys stop the retry. |
| +- **R1-9 (P2): resolved** — fleet acknowledgements are treated as untrusted telemetry with restricted uses. |
| + |
| +Reviewed rev 3 at `ea786db1509edd98765cf816aa51693072df3e1a` against the specified base. |
| + |
| +1. **P1 — §§5.3–5.6: override detection still permits false `delivered` results. Carries R1-2 forward.** |
| + |
| + The spec obtains exec overrides from `LaunchLayers`’ shadowed names and unit overrides from the EnvironmentFile list ([spec:660](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:660)). Neither covers all platform transformations. |
| + |
| + `LaunchLayers` collects only names shared by the two files ([backend_exec.go:3081](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/activator/backend_exec.go:3081)). Separately, `agentOwnedVars` replaces or removes control variables, including `CARLOS_HOST` ([backend_exec.go:2568](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/activator/backend_exec.go:2568)). Unit rendering removes `CARLOS_CONTROL_SOCKET` and replaces `CARLOS_PURGE` inside the managed file itself ([agentvars.go:36](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/appconfig/agentvars.go:36)). |
| + |
| + **Failure:** store `CARLOS_HOST=other.example` for an exec route whose own file omits that key. The shadowed list is empty, versions match, and the new process starts after the write. The verdict is `delivered`, although the process receives its actual hostname. The equivalent unit case needs no unmanaged EnvironmentFile. |
| + |
| + **Fix:** derive override/removal evidence from the complete environment transformation used for that launch, including agent-owned and runtime-specific variables. Bind it to the acknowledged generation or invocation. Cover both replacement and removal in tests. |
| + |
| + **Fault family:** delivered-file evidence versus actual process configuration. |
| + |
| +2. **P1 — §4.5: DirStore cannot provide the promised conditional-write guarantee across writers.** |
| + |
| + The spec relies on the existing store CAS to catch every write after comparison ([spec:285](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:285)). DirStore’s mutex belongs to each store instance ([store.go:406](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/release/store.go:406)); the etag check and replacement are protected only by that mutex ([store.go:496](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/release/store.go:496)). Direct CLI mode constructs its own instance ([cli.go:2346](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/cli.go:2346)). |
| + |
| + **Failure:** console and CLI both read A. Each independently passes the etag check for A. The CLI writes B; the console then replaces B with its A-derived update and returns success. The precondition fails to protect the concurrent change. |
| + |
| + **Fix:** require a shared writer or cross-process atomic CAS covering every supported writer. Until that exists, explicitly refuse `if_version` on DirStore. Test independent store instances/processes sharing one directory. |
| + |
| + **Fault family:** conditional-write atomicity across all writers. |
| + |
| +3. **P1 — §5.5: scheduler activation does not prove older generations have stopped.** |
| + |
| + The spec retains the existing activation gate for delivery success ([spec:569](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:569)). An overlap swap returns `SwapDone` even when the retiring generation’s termination is unproven ([swap.go:817](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/activator/swap.go:817)). That generation remains in the operation set for later reaping ([opset.go:508](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/activator/opset.go:508)). The scheduler nevertheless activates the new config revision on `SwapDone` ([scheduler.go:278](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/rollout/scheduler.go:278)). |
| + |
| + **Failure:** generation A runs old config; B starts with current config. B becomes current, but A cannot be proven stopped. The deferred success is released and the route reads `delivered` while A may still execute with the old values. |
| + |
| + **Fix:** account for live and termination-unproven generations in delivery evidence. Withhold an unqualified route-wide `delivered` verdict until older generations are accounted for; expose the outstanding generation and update the acknowledgement when reaping completes. |
| + |
| + **Fault family:** route-wide delivery proof across overlapping generations. |
| + |
| +4. **P2 — §4.11: the specified test hook cannot exercise the compare-to-Put race.** |
| + |
| + The test names `configPutBeforeApply` as the seam for a concurrent write between comparison and storage ([spec:432](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/docs/superpowers/specs/2026-11-02-config-receipts-design.md:432)). That hook runs before calling the apply function ([apiconfig.go:548](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-config-receipts-522/internal/console/apiconfig.go:548)), whereas the revised design correctly places the comparison inside that function. |
| + |
| + **Failure:** the test exercises an already-stale version, leaving the later CAS-conflict path untested. |
| + |
| + **Fix:** interleave through a store wrapper or internal seam after the guarded read and before `Put`. Assert 412 and preservation of the competing writer’s bytes. |
| + |
| + **Fault family:** conditional-write race validation. |
| + |
| +The existing Operate/Admin gate remains acceptable. The revised census treatment of prior acknowledgements and reads of properties for already-authorized systemd units is acceptable at design level; implementation still needs its census review. |
| + |
| +R1-2’s fault family has recurred in two rounds, triggering stopping rule 2. I recommend one enforced launch-evidence invariant with guard tests; the alternatives are gating unsupported delivery cases or cutting the current-process claim. |
| + |
| +No files were changed or test suites run. Sandbox network restrictions prevented independent verification against #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 f286fa511..637e9e8c2 100644 |
| --- a/docs/superpowers/specs/2026-11-02-config-receipts-design.md |
| +++ b/docs/superpowers/specs/2026-11-02-config-receipts-design.md |
| @@ -7,7 +7,12 @@ Revisions: |
| - 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 |
| + **(R1-n)**. |
| +- 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 |
| (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. |
| @@ -290,6 +295,19 @@ otherwise). Answer: |
| Without `if_version`, behaviour is today's (409 on a CAS conflict), plus the |
| receipt. That keeps every existing caller working. |
| +**Only on a store with an atomic conditional write (R2-2).** The guarantee |
| +rests on the store refusing a write whose etag has moved, whoever wrote in |
| +between. The S3 store does (`PutObject` with `IfMatch` / `IfNoneMatch`, |
| +`internal/release/store.go:990`). DirStore does not across processes: its |
| +etag check and replace are guarded by a mutex inside one store instance |
| +(`store.go:406`, `:496`), and a bucket-mode CLI builds its own instance |
| +(`cli.go:2346`), so two processes can both pass the check. `release.Store` |
| +gains a capability marker that only stores with a cross-process atomic |
| +conditional write implement; a console whose store lacks it refuses |
| +`if_version` with 400 ("conditional writes need a store that supports them") |
| +before reading anything. Production consoles run on S3. Unconditional writes |
| +are unchanged on every store. |
| + |
| Header vs body: the field is in the body because the CLI's door client sends |
| JSON bodies everywhere and a body field shows up in the request log the |
| console already keeps. An `If-Match` header is accepted as a synonym if the |
| @@ -429,7 +447,8 @@ The negative checks #522 lists, each a test through the real doors: |
| | key added to the default bundle shadowed by the environment | `effective` shows `from: environment`, `shadows: [default]` | |
| | key shadowed by a platform overlay | `from: overlay` | |
| | stale `if_version` | 412, layer bytes unchanged | |
| -| concurrent write between compare and put | 412, nothing written (test hook at the existing `configPutBeforeApply` seam) | |
| +| concurrent write between compare and put | 412, nothing written, the competing writer's bytes intact. Driven by a store wrapper that writes competing bytes after the guarded read and before `Put`; `configPutBeforeApply` runs too early to reach this window **(R2-4)** | |
| +| `if_version` on a DirStore-backed console | 400 before any read **(R2-2)** | |
| | `if_version` with `exec_delivery` | 400 | |
| | `if_version: none` on an existing layer | 412 | |
| | wrong instance (`host` of another app or account) | 404, same bytes as unknown app | |
| @@ -504,7 +523,7 @@ Additive to `ConfigAck`; `ConfigAckSchema` becomes 2. New fields: |
| | Field | Meaning | |
| |---|---| |
| -| `state` | `delivered`, `restart-pending`, `restart-failed`, `blocked`, `file-only` | |
| +| `state` | `delivered`, `draining` (**R2-3**), `restart-pending`, `restart-failed`, `blocked`, `file-only` | |
| | `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`) | |
| @@ -579,6 +598,20 @@ state: |
| The root pass has no scheduler; its acks are written in pass order and its |
| `seq` is the pass's start time. |
| +**Older generations (R2-3).** Activation is not enough for a route-wide |
| +`delivered`. An overlap swap reports `SwapDone` even when the retiring |
| +generation's termination is unproven (`internal/activator/swap.go:817`); that |
| +generation stays in the operation set until it is reaped |
| +(`internal/activator/opset.go:508`), and the scheduler activates the new |
| +config revision on `SwapDone` regardless (`internal/rollout/scheduler.go:278`). |
| +So the deferred success is released as `delivered` only when the revision is |
| +active **and** the operation set holds no older live or termination-unproven |
| +generation for the route. Otherwise it is published at activation as |
| +`state: draining` with `outstanding` (the count of older generations, no |
| +identifiers beyond the generation ids the ack already uses), and rewritten to |
| +`delivered` when the reaper accounts for the last of them. The builder adds |
| +that notification from the reaper to the rollout manager. |
| + |
| **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 |
| @@ -657,7 +690,15 @@ 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 |
| +- **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 |
| @@ -695,6 +736,7 @@ Verdicts: |
| | `restart-pending` | ack `restart-pending`, versions equal stored: the file is current and the process has not been restarted onto it | |
| | `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)** | |
| +| `draining` | the current config is running, but an older generation on the old config is not yet proven stopped; carries `outstanding` **(R2-3)** | |
| | `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 | |
| @@ -710,7 +752,7 @@ gains `--wait` on `env set` / `secrets set`: after the receipt it polls |
| (`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 |
| +`restart-pending`, `pending`, `draining` and `unknown` are not settled; at the timeout they |
| are printed as they stand and the command exits non-zero. |
| There is no `stale` verdict **(R1-7)**. Telling "pending" from "stale" needs |
| @@ -738,6 +780,7 @@ no box-side traffic. |
| | 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)** | |
| +| overlap swap with the retiring generation's termination unproven | `draining`, then `delivered` once reaped; never `delivered` while it may run **(R2-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 | |