carlos / platform Public

review: Astra round 2 findings (unedited)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 7d30482c1d9a0bef4ac8241b8ba276a4b31f4e23 parent 29c7707
1 file changed, +74 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-named-unit-delivery-114-r2.md +74 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-named-unit-delivery-114-r2.md b/docs/superpowers/reviews/CODEX-FINDINGS-named-unit-delivery-114-r2.md
new file mode 100644
index 000000000..1b6ce825f
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-named-unit-delivery-114-r2.md
@@ -0,0 +1,74 @@
+Reviewed `6748f4b816d890504de98697665c62602fedeac8` against `origin/main`, using merge base `9bcbab0f`, as specified. Round 2 of 3.
+
+- **R1 P1-1 — Partly resolved:** binding now gates delivery, but local evidence permits a different account/app, and rejected re-stamps still remove the old drop-in.
+- **R1 P1-2 — Partly resolved:** carriage returns are refused after all config layers merge; the replacement parser still disagrees with systemd.
+- **R1 P1-3 — Resolved as a missing-overlay finding:** the overlay, chain entry and proposal are present. Their independent census verdict is excluded from this review by the brief.
+- **R1 P2-4 — Resolved:** blocked notices and duplicate detection now use `stampedForDelivery`.
+- **R1 P2-5 — Resolved:** owned-environment reachability is checked before emitting blocked notices.
+- **R1 P2-6 — Resolved:** stamped routes now report instance-overlay loading failures as `Unresolved`.
+- **R1 P2-7 — Resolved:** the stale-file warning requires checking consumers before deletion.
+
+1. **P1 — Binding: local evidence authenticates the unit but not the config owner.**
+
+ [unitops.go:55](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/host/unitops.go:55) compares only the resolved unit name. The resolver explicitly skips `sameProofCandidate` when `b.Local` is true ([proofbinding.go:144](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/host/proofbinding.go:144)). Both the named-unit declaration and console guard produce local evidence ([proofnamed.go:153](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/host/proofnamed.go:153)).
+
+ A box agent can retain a legitimately declared host and unit while changing the registry row’s account/app to an attacker-controlled bundle. Binding succeeds against the original trusted executable, but config resolution uses the modified row’s account/app ([sync.go:171](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/sync.go:171)). Root delivers that bundle into the unrelated service and restarts it.
+
+ **Fix:** require config-owner identity to match trusted evidence for every evidence source, including local declarations and the console guard. Add a production-resolver witness that changes only the registry account/app and proves refusal. The release resolver itself is unchanged; its local-evidence exception is insufficient for this new caller.
+
+ **Fault family:** agent-controlled registry data granting root authority over another owner’s unit.
+
+2. **P1 — Reaping: a rejected re-stamp deletes the previously valid drop-in.**
+
+ [sync.go:350](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/sync.go:350) invokes reaping regardless of binding failures. [unitsync.go:279](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/unitsync.go:279) builds retention solely from current registry unit names, then removes every marked drop-in absent from that set.
+
+ After successful delivery to `a.service`, change only the registry stamp to unproven `b.service`. Planning refuses `b.service`, but reaping removes `a.service`’s drop-in and `applyStamped` reloads systemd. The original service loses its managed environment files on its next start, although trusted evidence still binds it to the host. Nil or erroring `Bind` does not protect this path.
+
+ The new test explicitly says the old drop-in survives, but checks only that the new one was not created ([unitsync_test.go:600](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/unitsync_test.go:600)).
+
+ **Fix:** require trusted evidence authorizing removal or replacement before reaping; preserve the prior association when replacement binding fails. Extend the re-stamp witness to assert that the old file survives and no reload occurs.
+
+ **Fault family:** agent-controlled registry data granting root authority over systemd configuration.
+
+3. **P1 — §4.1: the replacement parser still permits a base-variable override.**
+
+ [baseenv.go:152](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/baseenv.go:152) treats the line after a backslash-ended comment as another comment. Systemd 254 onward ends the comment at that newline. A base file containing these bytes therefore assigns `CONSOLE_DB` in systemd but yields no such name to the guard:
+
+ ```text
+ # comment\
+ CONSOLE_DB=/data/base.db
+ ```
+
+ A bundle setting `CONSOLE_DB=/data/other.db` passes the overlap check and overrides the base-owned variable. I verified systemd’s result using the installed systemd 257 library in memory; it agrees with the [upstream parser](https://github.com/systemd/systemd/blob/v257/src/basic/env-file.c).
+
+ There are additional mismatches in the same parser: closing quotes transition to `value` instead of `preValue` ([baseenv.go:134](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/baseenv.go:134)), inventing assignment names inside subsequent quoted segments. NUL and invalid UTF-8 produce systemd loading errors, while this parser cannot return an error.
+
+ **Fix:** enforce systemd-compatible parsing and error handling, with differential witnesses covering comment endings, concatenated quoted segments and invalid input. Replace the test that currently asserts the incorrect comment-continuation behavior.
+
+ **Fault family:** one owner per variable requires identical assignment interpretation by the guard and systemd.
+
+4. **P2 — Request budget: unchanged passes perform an additional deployment-wide binding scan.**
+
+ Binding runs before config-change detection ([unitsync.go:126](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/unitsync.go:126)). Its first lookup initializes `IndexRecords` ([proofnamed.go:173](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/host/proofnamed.go:173)), which enumerates accounts and instance records across apps ([rootrecord.go:15](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/provision/rootrecord.go:15)). Account enumeration also fetches account manifests.
+
+ Consequently, an unchanged config-only pass with a stamped route and no pending recovery performs reads main’s equivalent does not. This happens even for a locally declared unit, because record lookup precedes local fallback. The builder’s overlay count is correct for `instanceOverlayLoader`, but omits these binding reads.
+
+ **Fix:** avoid rebuilding the deployment-wide binding inventory on unchanged config passes; reuse trusted observations with explicit invalidation, while preserving authorization before mutations. Add request-count witnesses around the production binding path.
+
+ **Fault family:** unchanged convergence must not introduce unbudgeted bucket reads. The existing generation-poll change-index gate remains intact.
+
+5. **P2 — Notices: explicit `exec_delivery` still hides a required default-bundle failure.**
+
+ [syncexec.go:1260](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/syncexec.go:1260) uses `resolveExecDelivery` to check stamped-route bundles. That function returns immediately when the named environment explicitly sets `exec_delivery`, without loading the default bundle ([syncexec.go:1024](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/syncexec.go:1024)).
+
+ For a stamped route on an ordinary named environment with `exec_delivery: file`, a corrupt default bundle and a readable instance overlay produce an empty notice. Root delivery instead reads the default and refuses the route ([sync.go:175](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/named-unit-delivery-114/internal/appconfig/sync.go:175)).
+
+ **Fix:** check stamped-route config resolution independently of the exec-delivery opt-in. Report failures in every layer required by delivery as `Unresolved`.
+
+ **Fault family:** notices must account for every config layer the delivery pass requires.
+
+No files changed or subagents were used. Targeted Go tests could not start because the read-only sandbox refused Go’s work-directory creation; `GOCACHE` remained unset. No full suites ran.
+
+The authority and parser-equivalence fault families have now recurred in rounds 1 and 2. Stopping rule 2 applies: choose an upfront refusal, cut the affected behavior, or enforce each invariant centrally with guard tests. I recommend the central-invariant option before further fixes.
+
+**NOT READY**
\ No newline at end of file