carlos / platform Public

spec rev 3: console secrets, one delivery classification

Answers Astra round 2 per Paul's ruling: one Save and restart button,
one shared classifier (ClassifyWrite) for the CLI notice and the page,
guard tests per class, no unused outcome, sidecar arm release-gated.
Adds the round 3 review brief.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 8ef4189a55364f7caada5894046e485649e8efea parent b9fe630
2 files changed, +216 −35
  • docs/superpowers/specs/2026-11-08-console-secrets-design.md +149 −35
  • docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R3.md +67 −0

Intent

Human

Looks a bit messy. I think this could be tidier.

Human

<paseo-system version="1" kind="agent-message" source-agent-id="55f1f6a4-252a-4d89-af7b-a8a460b2b81d" message-id="26d24c64-8384-491e-ac67-2853bf47848d"> Coordinator 55f1f6a: Paul&apos;s feedback on the CURRENT mockup at 390 px (dark mode, on his phone): &apos;Looks a bit messy. I think this could be tidier.&apos; Seen: a long intro paragraph; environment names as code chips; a SETTING table header; each variable as a stacked block (name chip, then value field or Sealed pill, then underlined Replace/Remove links), lots of vertical space; the add form stacking NAME, value, Secret and Add on separate lines. Tidy it within existing components (docs/console-styleguide.md; the impeccable skill&apos;s &apos;distill&apos;/&apos;polish&apos; guidance is a good lens): one compact row per variable (name left, value or a quiet &apos;Sealed&apos; right, actions as one small trailing control, e.g. a single &apos;Edit&apos; that reveals Replace/Remove, or btn-sm linkish), no table header, environment names as plain headings with a short muted &apos;Used by shop.example.com&apos; line, the intro cut to one sentence (the sealing explanation can move to a small note by the Secret field), the add form on as few lines as fit at 390 px with the Secret toggle beside the value, one &apos;Save and restart&apos; bar that only appears when there are staged changes. Check light AND dark at 390 and 1280. Do this as part of your step 3 (new filename, e.g. settings-secrets-v2.html) and tell me when it&apos;s up, before the Astra round if that&apos;s quicker. </paseo-system>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="0c43522f-abd7-4e8b-a287-4ece2f0919cf" message-id="867d0f62-3337-4ac5-b3a2-85f081cfdaf9" source-agent-title="Console secrets spec rev 3 + Astra round 3 (design)"> Tidied mockup is up as settings-secrets-v2.html in the companion (Paul&apos;s open tab should refresh): [http://docs-t1.tail5fd3ba.ts.net:58742/?key=d28eea4fe75bcdec318d6a957dd0c5ae4b1eeb55a3a89c49f6228c9f7888b432](http://docs-t1.tail5fd3ba.ts.net:58742/?key=d28eea4fe75bcdec318d6a957dd0c5ae4b1eeb55a3a89c49f6228c9f7888b432). One row per variable (name, value or quiet Sealed, trailing Edit that opens Replace/Remove in place), no table header, plain env headings with &apos;Used by ...&apos;, one-sentence intro, sealing note under the add form, add form on one line at desktop and two at 390, a Save and restart bar that only appears when changes are staged, and After you save showing the four classes (Restarting / Restart it yourself / Asleep / Can&apos;t see). Checked light and dark at 390 and 1280. New CSS is one small style block (row layout, Edit reveal, save bar), flagged in the file. Carrying on with spec rev 3 and the Astra round. </paseo-system>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="582c99b6-8749-428d-83d2-570f0fc95301" message-id="f90a9e3b-57e1-4fe0-a36c-0d237ee570b8" source-agent-title="Agent /start go-live prep: #106 preview + flagship card draft 3"> /start demo agent: steps 6 and 8 DONE on flagship (21:50Z to ~22:06Z under my #421 lock, now released). Report: ~/.cache/start-golive/WINDOW-STEP6-8-RESULT.md. All 4 edges have the demo settings, one restart each (adi last, HA lines unchanged); every G3 check passed after each restart. The *.trycarlos.com A record points at annie with TTL 300. The wildcard certificate (Let&apos;s Encrypt, valid to 2027-02-06) is live on all 4 ingresses. Admission is still OFF, so no demo can be created. Next, each needs Paul&apos;s approval: step 7 seeds floor (irreversible; min_release v0.34.19); step 9 console switch-on, which needs the v0.34.31 demo create alerts turned ON first (they wait on Paul&apos;s copy review, #527) plus platform-f6&apos;s terms + abuse contact published; step 10 witnesses; step 11 the website (#106). </paseo-system>

Attributed to this commit: 62.3 g CO₂e (6,027,967 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-console-secrets, 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/specs/2026-11-08-console-secrets-design.md b/docs/superpowers/specs/2026-11-08-console-secrets-design.md
index 2d239458b..8ba22e306 100644
--- a/docs/superpowers/specs/2026-11-08-console-secrets-design.md
+++ b/docs/superpowers/specs/2026-11-08-console-secrets-design.md
@@ -1,10 +1,13 @@
# Settings and secrets in the console (slice 2)
-Status: rev 2 for Paul, 2026-11-08. Astra round 1:
+Status: rev 3 for Paul, 2026-11-08. Astra round 1:
`CODEX-FINDINGS-console-secrets.md` (NOT READY, P1 x3, P2 x6), all
-accepted, marked **(codex N)**. Slice 2 of "agent-first onboarding and
-console parity" (slice 0 agent login by link, v0.34.27; slice 1 Getting
-started checklist, v0.34.28).
+accepted, marked **(codex N)**. Round 2:
+`CODEX-FINDINGS-console-secrets-R2.md` (NOT READY, P1 x1, P2 x1, both
+recurring families); answered by Paul's ruling (one button, one shared
+delivery classification with guard tests), marked **(codex R2-N)**. Slice 2
+of "agent-first onboarding and console parity" (slice 0 agent login by
+link, v0.34.27; slice 1 Getting started checklist, v0.34.28).
## Why
@@ -39,11 +42,17 @@ read-only view):
when the name looks like a credential (contains KEY, TOKEN, SECRET,
PASSWORD, PASS, PRIVATE, DSN, or the value looks like one).
- Changes are staged on the page and applied together with one **Save and
- restart** button: one config write, then one restart of what reads that
- thing per affected route (see "How Save applies"), so editing three
- secrets causes at most one restart per route. The page then shows the outcome per
- route as the CLI prints it (restarted, asleep, not reached, blocked), in
- plain words.
+ restart** button, in a bar that appears only while something is staged:
+ one config write, then at most one restart request, for only the routes
+ Carloku can actually restart (see "How Save applies"), so no route cycles
+ twice. The page then shows, per route, which of the shared delivery
+ classes it falls in, in plain words **(codex R2-1, R2-2)**.
+- Layout (rev 3, Paul's 390 px review): one compact row per variable (name,
+ then the value or a quiet "Sealed", then one trailing Edit that opens
+ Replace and Remove in place); no table header; environment names as plain
+ headings with a muted "Used by <host>" line; a one-sentence intro; the
+ sealing note sits under the add form, which is one line on a desktop and
+ two at 390 px with the Secret box beside the value.
- Same rules as the CLI: an empty SECRET is refused (an empty ordinary setting is allowed, as in Go) **(codex 8)**, the same name rules and size
limits, an app on a fleet sealed to the fleet's key, the same refusals for
stamped or unreachable routes, worded for a person.
@@ -69,7 +78,9 @@ opens with the Go `Open` (v2 bound) and fails for the wrong app.
- Everything `carlos env set|unset` and `carlos secrets set|unset` can do
for an app's environments can be done here, with the same refusals.
- The console still never handles a secret's plaintext.
-- One restart per save, with an honest per-route outcome.
+- At most one restart per route per save, requested only where Carloku can
+ perform it, with an honest per-route outcome that never claims a restart
+ it can't perform or an absence it can't establish **(codex R2-1, R2-2)**.
- Existing console components only (docs/console-styleguide.md; mockups
with docs/console-mockup-kit); checked at 390 px.
@@ -92,31 +103,134 @@ CSRF on every mutation (the star handler pattern), the same role gates as
the CLI doors, copy through the Luna pass (house rules), census and Astra
reviews as usual, console-only release through the agent manager.
-## How Save applies (rev 2; replaces builder calls 1 and 2)
-
-One rule covers the default bundle and named environments alike
-**(codex 1, 3, 5)**:
-
-1. Save writes the staged mutations as one config write, conditional on the
- bundle version the page displayed (see "Concurrency").
-2. The write's own result already says, per route the console can see,
- whether delivery restarts it by itself (stamped units restart in
- `SyncUnits`) or it is awaiting an explicit restart (`configRestartNotice`:
- awaiting restart, unresolved, undelivered, blocked).
-3. Save then requests a **host-scoped** restart (`writeRestartScope` with
- the host scope the CLI uses) for exactly the routes listed as awaiting an
- explicit restart, and nothing else. Routes that delivery restarts by
- itself are not restarted again, so no route cycles twice.
-4. The page reports, per route: "restarting with the new settings" (either
- way), "asleep: picks up the change when it next wakes", "blocked:
- <reason>", and, separately, three different absences, never merged:
- **unused** (no route anywhere reads this bundle, per authoritative
- resolution), **not visible from here** (routes on other boxes the console
- can't resolve: "saved; those copies pick it up on their next restart, or
- run `carlos restart` for them"), and **lookup failed** ("saved; couldn't
- check what uses it", with a Retry). It never claims "restarted".
-5. Config saved but a restart request failed: "Saved, not restarted", with a
- Restart button that requests the same host scopes again.
+## How Save applies (rev 3; replaces rev 2's section) **(codex R2-1, R2-2)**
+
+Paul's ruling after round 2: keep ONE "Save and restart" button, and sort
+every route the write reaches with ONE shared classification, guarded by
+tests. Rev 2's rule ("request a host-scoped restart for whatever
+`configRestartNotice.Hosts` lists") is withdrawn: those hosts are exactly the
+routes CARLOS cannot restart.
+
+### What delivery does today, per route shape (the authorities)
+
+| Shape (predicate) | Delivered by | Restarted by | Source |
+|---|---|---|---|
+| carlos-app@ unit (`Backing == BackingUnit`) | root `Sync` | `Sync`, on a content change | `sync.go`, `unitDelivered` |
+| Stamped named unit (`stampedForDelivery`) | root pass | root pass (`applyStamped`), unless the rails block it | `stamped.go`, `BlockedStamps` |
+| Socket exec (`execSyncable`) | agent `SyncExec` | `SyncExec`'s bounce (or the scheduler's config attempt when `Managed`); a no-op on a sleeping instance, which execs fresh on wake | `syncexec.go` inScope |
+| Sidecar (`execSidecarCandidate`) | agent `SyncExec` | nobody on delivery (bounce without a wake would strand it). Only the APP-WIDE restart cycles it (`cycleWorkers`, stop then wake, never waking a sleeper); the narrowed restart reaches no sidecar (`scopedHosts` gates on `release.Adoptable`) | `restart.go` ~886 |
+| TCP addr, opted in (`execAddrCandidate` + `exec_delivery: file`) | agent `SyncExec`, as a file | nobody: CARLOS neither spawns nor owns the process; the agent's bounce has no child for it and the root fallback tries `carlos-app@<host>`, not the app's supervisor | `awaitingrestart_test.go:25`, `restartscope.go:419`, `rootrestart.go:551` |
+| TCP addr, not opted in | nobody | nobody | `AwaitingRestart` Undelivered |
+
+### The classifier
+
+One function in `internal/appconfig`, `ClassifyWrite(ctx, store, routes,
+facts, acct, app, envName, keys) WriteReach`, built from the predicates in the
+table (it calls `unitDelivered`, `stampedForDelivery`, `execSyncable`,
+`execSidecarCandidate`, `execAddrCandidate`, `BlockedStamps`,
+`resolveExecDelivery` and the shadowing test; it restates none of them).
+`AwaitingRestart` becomes a projection of it, so the CLI notice and the
+console page are the same computation. Every route the write reaches lands in
+exactly one bucket:
+
+1. **Updates itself** (unit, stamped and not blocked, socket exec). Delivery
+ restarts it; nothing is requested. Reported as an expectation ("restarts
+ with the new settings by itself"), never as an observed restart.
+2. **Restarted by Carloku** (sidecars only, see below). Save requests a
+ restart for exactly these hosts and nothing else.
+3. **Needs restarting by you** (opted-in TCP addr). The settings file is
+ delivered; the page says so and says CARLOS can't restart it: "restart it
+ the way you started it". Save requests nothing for it, and the page shows
+ no Restart button for it, because none would work.
+4. **Picks it up when it starts** (asleep or not running). Only when a
+ source establishes it: the box status report for that host (the
+ `appFacts.host` join the Running page uses: tenant known, same account
+ and app, newer than the record) says asleep, or the route's registry
+ status is not ready. A route with no qualifying report is NOT guessed
+ asleep; it stays in its shape's bucket, whose wording already covers
+ sleep ("by itself, or on its next wake").
+5. **Can't be seen from here.** The console's registry is its own box's
+ only. Every provision record of the app whose host is not a route in that
+ registry is listed here by name: unknown, never unused. The page also
+ always says, whatever the lists hold, that routes on other boxes may not
+ be listed. There is no "unused" outcome any more: absence is never
+ claimed, because no source here can establish it.
+
+Exceptions, from the same function, reported beside the buckets: **blocked**
+(stamped, the rail's fixed reason), **couldn't check** (bundle or overlay
+would not read: "saved; couldn't check what uses it", with Retry), and
+**doesn't get these settings** (TCP addr not opted in; the CLI's existing
+Undelivered sentence). A shadowed route (every touched key is overridden
+above the written bundle) is not reported at all, as today.
+
+Sources and their limits, stated in the code beside the function: registry
+(this box only), provision records (one listing per app at Save time,
+fleet-wide, no route shape), box status reports (`pageBoxReports`, possibly
+incomplete or stale; incomplete means unknown, never asleep). All three are
+read at Save time only; a settings page view reads none of them beyond what
+it reads today (the "Used by" line uses the routes the page already has).
+
+### The sidecar arm (a box change, flagged for Paul)
+
+Bucket 2 needs one box change: the narrowed restart gains a sidecar arm that
+is `cycleWorkers`' rule with the scope applied (stop then wake as one
+operation, never wake a sleeper), selected by a new `scopedHosts` keep
+function rather than by widening `release.Adoptable`. Release gate: the
+console starts putting sidecars in bucket 2 only in a release after every box
+runs the arm (roll order: boxes first). Until then, and on any console that
+cannot tell, sidecars are classified in bucket 3 with the wording "restart
+the app from the Running page to pick this up" (the app-wide restart is the
+one path that cycles a sidecar today). **Alternative if Paul prefers no box
+change in this slice:** keep sidecars in that bucket-3 wording permanently
+and bucket 2 is empty; nothing else in this section changes.
+
+### Save, step by step
+
+1. One config write, conditional on the displayed bundle version.
+2. `ClassifyWrite` over the write's touched keys.
+3. One narrowed restart request (`writeRestartScope`, host scopes) naming
+ bucket 2's hosts, if any. No other restart is requested, so no route
+ cycles twice: buckets 1 restart on delivery, 3 and 5 can't be restarted
+ from here, 4 picks it up on start.
+4. The page renders the buckets as the mockup's "After you save" shows:
+ Updates itself, Restart requested, Restart it yourself, Asleep / Not
+ running, Can't see from here, plus the exceptions. Every word is an
+ expectation from the classification; observed state is the Running
+ page's, linked.
+5. Config saved but the bucket 2 request failed: "Saved, restart not
+ requested", with a Restart button that sends the same host scopes again.
+ It never appears for bucket 3.
+
+### The CLI uses the same result
+
+The config door's `restart` object gains additive fields (`self`,
+`requested`, `yours`, `starting`, `unseen`), each omitted when empty, filled
+from `ClassifyWrite`; the existing fields keep their meaning as projections,
+so older CLIs read exactly what they read today. The CLI's notice prints the
+new buckets when present. The CLI write itself requests no restart (as
+today); its notice names bucket 2 hosts with "run `carlos restart --host`".
+
+### Guard tests
+
+- **One table, every shape.** A table of route shapes (each row of the
+ table above, times environment bound/unbound, owned environment, shadowed
+ or not, ready or not, asleep or awake or unreported, local or record-only)
+ asserting the bucket for each. Exactly one bucket or exception per reached
+ route (a property test over generated combinations, not examples alone).
+- **Bucket 1 matches delivery.** For every row, bucket 1 holds iff the
+ delivery code would restart it: asserted by calling the same predicates the
+ passes use and by a `SyncExec`/`Sync` fake run that records bounces.
+- **Bucket 2 matches the box.** The hosts bucket 2 names equal the hosts the
+ narrowed restart's sidecar arm cycles for the same routes (shared keep
+ function), and bucket 2 never holds a route `execBounceable` and the root
+ arm cannot reach.
+- **Bucket 3 is never restarted.** Save's restart request never names a
+ bucket 3 host; the page shows no Restart button for it.
+- **No absence claims.** With an empty local registry and records present,
+ every record lands in bucket 5; with neither, the page says "nothing on
+ this box uses it" plus the other-boxes line, never "unused".
+- **CLI and page agree.** The CLI's rendered notice and the page's buckets
+ come from one `WriteReach` value in a test that renders both.
## Concurrency (codex 6)
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R3.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R3.md
new file mode 100644
index 000000000..7c00a4cfc
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R3.md
@@ -0,0 +1,67 @@
+# Review brief: spec "Settings and secrets in the console", round 3 of 3 (the last)
+
+Repo carlos/platform, branch `design-console-secrets`, commit: the commit
+that adds this file. Under review:
+`docs/superpowers/specs/2026-11-08-console-secrets-design.md`.
+Authorities: main's code (internal/console apiconfig.go, apirestartscope.go,
+apicli.go restart, browserrestart.go, appsettings.go, sealkey.go,
+templates/app_settings.html; internal/appconfig/crypto.go; the CLI's
+appconfig_cli.go).
+
+Fixed, do not re-argue: Paul's decisions (one section in app settings;
+immediate apply on save). The "secrets sealed in the browser" choice and
+the builder-check calls are the author's: challenge them on correctness and
+safety, not taste.
+
+Check:
+1. Secret confidentiality: can any path put a secret's plaintext on the
+ console, in a log, or back on the page? Is browser sealing (WebCrypto
+ ECDH P-256 + HKDF-SHA256 + AES-256-GCM, v1/v2 per the GET door, AAD
+ binding, sealed_to) specified tightly enough to be byte-compatible with
+ Go's Open, and safe against a tampered page (key substitution: where does
+ the public key come from, and can an attacker who can't read secrets
+ swap it)?
+2. Parity: does the shared-validation call really give the browser door the
+ same refusals as the CLI door, including size limits, name rules, fleet
+ keys, bound sealing, CAS?
+3. Restart: is environment-scoped restart via writeRestartScope correct for
+ every route kind, including asleep, remote and stamped routes; the
+ "saved, not restarted" path; no-route environments.
+4. Auth: CSRF, membership, role parity with the CLI person-token path.
+5. Anything that would not work or would add S3 reads per page view.
+
+Severity P1/P2/P3; end with exactly one verdict: READY, READY AFTER FIXES,
+NOT READY. Do not edit files. No subagents. No full test suites.
+
+## Round 2
+
+Round 1: `CODEX-FINDINGS-console-secrets.md` (P1 x3, P2 x6), all accepted.
+The two restart P1s (default-bundle scope, double restart) and P2 5 are
+answered by one rule ("How Save applies": host-scoped restarts only for the
+routes the config write reports as awaiting an explicit restart). First one
+line per round-1 finding: resolved, partly, or not; then new findings. Name
+the fault family for each; if a family recurs from round 1, say so.
+
+## Round 3
+
+Round 2: `CODEX-FINDINGS-console-secrets-R2.md` (P1 x1, P2 x1, both
+recurring families; stopping rule 2). Paul ruled: keep ONE "Save and
+restart" button and build ONE shared delivery/restart classification with
+guard tests (your recommendation). Rev 3 replaces "How Save applies" with
+it: a per-shape authority table, `ClassifyWrite` (five buckets plus three
+exceptions, `AwaitingRestart` becomes its projection, the CLI notice and
+the page render one value), a sidecar arm for the narrowed restart (box
+change, release-gated, with a no-box-change alternative), and guard tests.
+"Unused" is removed as an outcome. New authorities to check: internal/host
+restart.go (cycleWorkers, ~886), restartscope.go (scopedHosts,
+execBounceable), rootrestart.go, internal/appconfig sync.go, stamped.go,
+syncexec.go (inScope, execRouteBase), internal/console remoteinstances.go
+(appFacts.host, pageBoxReports).
+
+First one line per round-2 finding: resolved, partly, or not. Then say
+explicitly whether the two recurring families ("restart scope must cover
+the saved bundle's consumers"; "incomplete visibility must not become a
+claim of absence") are closed. Then new findings, naming the family. This
+is the last round: if NOT READY, say whether the P1s share one cause and
+whether refusing up front or cutting (for example bucket 2 empty, sidecars
+always "restart the app from the Running page") would remove them.