spec rev 2: console secrets (Astra round 1)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/specs/2026-11-08-console-secrets-design.md+86 −39docs/superpowers/specs/CODEX-FINDINGS-console-secrets.md+50 −0docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R2.md+43 −0
CI passed — run details
Intent
<task-notification> <task-id>ad351eaa5b7c8ee76</task-id> <tool-use-id>toolu_01SqC5sDYZAWfbWmeahDhVoM</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a1de5273-c148-49b8-8267-3dee9d49c9c1/tasks/ad351eaa5b7c8ee76.output</output-file> <status>completed</status> <summary>Agent "Mockup of console secrets with kit" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>- HTML: /home/paulca/.cache/console-secrets-mockup/settings-secrets.html - 390 px screenshot: /home/paulca/.cache/console-secrets-mockup/settings-secrets-390.png - 1280 px screenshot: /home/paulca/.cache/console-secrets-mockup/settings-secrets-1280.png Couldn't express with existing components: the styleguide has no compact variable table with inline edit, so I used a one-column `.tablewrap` table per environment, with each variable as a `.settings-row` in its cell, so nothing scrolls sideways at 390 px. I added no CSS. I did not run `make console-mockup-kit`. I used the checked-in `shell.html` as it is, and the repo is untouched (`git status` clean). The only change to the shell was the 390 px back link, which now reads "Settings". I didn't check dark mode. I made a dark copy and deleted it without shooting it. The mockup doesn't draw the Replace flow or the other outcomes (not reached, blocked).</result> <usage><subagent_tokens>93456</subagent_tokens><tool_uses>20</tool_uses><duration_ms>96214</duration_ms></usage> </task-notification>
<task-notification> <task-id>b0g4rv4ij</task-id> <tool-use-id>toolu_01TpYX1gUxYz2wbFsQ4Hb7Yz</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/a1de5273-c148-49b8-8267-3dee9d49c9c1/tasks/b0g4rv4ij.output</output-file> <status>completed</status> <summary>Background command "Run Astra spec review for console secrets" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 25.2 g CO₂e (3,186,447 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 d76554f38..2d239458b 100644 |
| --- a/docs/superpowers/specs/2026-11-08-console-secrets-design.md |
| +++ b/docs/superpowers/specs/2026-11-08-console-secrets-design.md |
| @@ -1,6 +1,8 @@ |
| # Settings and secrets in the console (slice 2) |
| -Status: draft for Paul, 2026-11-08. Slice 2 of "agent-first onboarding and |
| +Status: rev 2 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). |
| @@ -38,11 +40,11 @@ read-only view): |
| 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 |
| - environment (the existing `POST .../restart` door's behaviour), so editing |
| - three secrets causes one restart. The page then shows the outcome per |
| + 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. |
| -- Same rules as the CLI: empty values refused, the same name rules and size |
| +- 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. |
| @@ -90,41 +92,86 @@ 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. |
| -## Calls after the builder check (mine, 2026-11-08) |
| - |
| -1. **Outcome, honestly.** Neither restart door reports per-route results |
| - today (`handleAPIRestart`, `writeRestartScope` only write a request). The |
| - page shows the config write's own notice, as the CLI prints it |
| - (`configRestartNotice`: hosts awaiting restart, unresolved, undelivered, |
| - blocked), plus "Restart requested". It never claims "restarted"; the |
| - app's activity view shows completion. No new result reader. |
| -2. **Restart scope = the environment** saved, through `writeRestartScope` |
| - with `RestartScopeEnvironment`, reusing `handleAPIRestartScope`'s |
| - resolution and refusals (not the app-wide restart). An environment no |
| - route uses: save, skip the restart, say "Nothing running uses this |
| - environment yet." Config saved but restart request failed: "Saved, not |
| - restarted", with a Restart button that retries the same scope. |
| -3. **Who may edit: any account member**, as with the CLI doors for a |
| - person token (svcrole.Operate applies to service credentials only). |
| -4. **Envelope version follows the GET door exactly**: v1 or v2 per |
| - `BoundSealing()`, always v2 for a fleet app, with `sealed_to` whenever the |
| - door would require it. No usable deployment key (`errNoDeploymentKey`) |
| - or a keyless fleet (`errFleetNoSecretsKey`): secret entry is disabled with |
| - a plain explanation; ordinary settings still work. |
| -5. **Key delivery:** server-rendered `data-pubkey`, `data-account` (sqid), |
| - `data-app`, `data-sealed-to` from `sealKeyFor` (SQLite and registry, no |
| - S3); the page already reads every bundle via `envCards`. |
| -6. **Handler:** a new cookie-session form POST (CSRF, account membership) |
| - that calls validation extracted from `handleAPIConfigPut` into one shared |
| - function both doors use (`ValidVarName`, `ValidVarValue`, |
| - `CheckEnvelope`, `configCheckSealedTo`, the account lock, CAS), so the |
| - rules cannot drift. Envelopes travel as hidden form fields; the sealing |
| - script is inline (customer pages load no /static assets). |
| -7. **Concurrent change (CAS conflict):** re-render with staged plain values |
| - kept and staged secrets dropped, with "Someone else saved first; re-enter |
| - your secrets." Unsetting a variable that is already gone is a no-op. |
| -8. **The default (unnamed) bundle** is shown first, as "All environments", |
| - then each named environment. |
| +## 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. |
| + |
| +## Concurrency (codex 6) |
| + |
| +The page carries each bundle's version (etag) in the form. Save submits only |
| +the staged mutations and writes conditional on that version; if the bundle |
| +changed since the page was shown, nothing is written and the page re-renders |
| +with staged ordinary values kept and staged secrets dropped ("Someone else |
| +saved first; re-enter your secrets."). Unsetting a variable that is already |
| +gone is a no-op. |
| + |
| +## Browser sealing contract (codex 2, 4, 7) |
| + |
| +- **Plaintext rules before sealing.** The browser applies the same value |
| + predicate the CLI applies to secret plaintext before sealing |
| + (`appconfig_cli.go` ~975; the render-time rule in `materialize.go`), and |
| + refuses an empty secret. Parity: one table of cases (accepted and refused |
| + values, including quotes, backslash, newline, NUL, non-UTF-8, size edges) |
| + checked in by the build; a Go test runs the Go predicate over it and a |
| + test runs the shipped JavaScript predicate over it (in a headless browser |
| + or JS runtime available to the build); both must agree on every row. |
| +- **Version signal.** The page carries an explicit `data-seal-version` |
| + ("1" or "2"), decided exactly as the GET door decides (`secrets_account` |
| + present means v2: `BoundSealing()` or a fleet app), with |
| + `data-account`/`data-app` only for v2 and `data-sealed-to` whenever the |
| + door would require it. |
| +- **Encoding, pinned:** raw uncompressed P-256 ephemeral public key (65 |
| + bytes), ECDH shared secret = X coordinate, HKDF-SHA256 with the same salt |
| + and info strings as `crypto.go`, 12-byte nonce, 16-byte GCM tag, |
| + standard padded base64; v2 prefix "CSB2" and length-prefixed AAD exactly as |
| + `crypto.go` builds it. Interop vectors for BOTH v1 and v2: browser-sealed |
| + envelopes open with Go's `Open`; v2 fails for the wrong account or app. |
| +- **Trust boundary, stated.** Browser sealing keeps the plaintext away from |
| + the console's servers, logs and storage. It does not defend against an |
| + attacker who can alter the page the console serves (they could swap the |
| + key or read the input), the same trust a person already places in the |
| + console session that can change their app. `sealed_to` is a consistency |
| + check, not page authentication. Anyone who won't trust the page uses the |
| + agent or the CLI, which seal on their own machine. |
| + |
| +## Other calls (builder check, still mine) |
| + |
| +- **Who may edit: any account member**, as with the CLI doors for a person |
| + token (svcrole.Operate applies to service credentials only). |
| +- **No usable key** (`errNoDeploymentKey`, keyless fleet): secret entry is |
| + disabled with a plain explanation; ordinary settings still work. |
| +- **Handler:** a cookie-session form POST (CSRF, account membership) that |
| + calls validation extracted from `handleAPIConfigPut` into one shared |
| + function both doors use, so the server-side rules cannot drift. |
| + Envelopes travel as hidden form fields; the sealing script is inline |
| + (customer pages load no /static assets). |
| +- **The default (unnamed) bundle** is shown first, as "All environments". |
| + **Read budget (codex 9):** this costs one extra bundle read per settings |
| + page view, confined to the Environments section, on top of the named |
| + bundles `envCards` already reads. Key selection uses only SQLite and the |
| + registry. |
| ## Left to the builder |
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-console-secrets.md b/docs/superpowers/specs/CODEX-FINDINGS-console-secrets.md| new file mode 100644 |
| index 000000000..c7a2648a3 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-FINDINGS-console-secrets.md |
| @@ -0,0 +1,50 @@ |
| +Reviewed round 1 of 3 at `4a75816688f8c1a2dd1b34b42f83a243aa4afb8e`. The implementation files cited by the brief match `origin/main`. No files changed, subagents used, or tests run. |
| + |
| +1. **P1 — The default bundle cannot use the proposed restart scope.** |
| + Builder call 2 requires `RestartScopeEnvironment`, while call 8 exposes the unnamed bundle. With an empty environment, `resolveRestartScope` returns an app scope, which `writeRestartScope` refuses. Constructing an environment scope with an empty value also fails validation. Consequently, saving default config for a route that needs an explicit restart cannot complete the promised operation. Define a separate default-bundle restart path and its treatment of inheriting environments. |
| + Evidence: [scope resolution](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apirestartscope.go:317), [scope validation](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/release/restartscope.go:200). |
| + **Fault family:** restart scope must cover the saved bundle’s consumers. |
| + |
| +2. **P1 — Shared server validation cannot enforce the CLI’s secret-value rules.** |
| + Builder call 6 relies on extracted `handleAPIConfigPut` validation, but that handler checks `ValidVarValue` only for ordinary settings. The CLI checks secret plaintext **before sealing**. A browser-entered password containing an apostrophe, backslash, quote, newline, or NUL can therefore produce a valid envelope that the server accepts but the host cannot render, blocking config delivery. Require equivalent browser validation before encryption, with parity tests against Go’s predicate. |
| + Evidence: [CLI plaintext validation](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/appconfig_cli.go:975), [server validation](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apiconfig.go:410), [render-time refusal](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/materialize.go:62). |
| + **Fault family:** every accepted secret must be renderable. |
| + |
| +3. **P1 — One save can cause two restarts.** |
| + The proposed config write followed by an environment restart does not satisfy “one restart per save” for routes already restarted by config delivery. Stamped units restart during `SyncUnits`; the root pass subsequently processes explicit restart requests. Its duplicate suppression tracks only explicit restarts, not config-delivery restarts. The same save can therefore cycle a unit twice. Specify how automatic config delivery and explicit restart requests are coordinated, including the retry path. |
| + Evidence: [config-triggered unit restart](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/unitsync.go:459), [pass ordering](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/host/agent.go:5817), [restart deduplication](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/host/restart.go:728). |
| + **Fault family:** one save must not independently schedule duplicate process cycles. |
| + |
| +4. **P2 — The trusted-page boundary is missing from the confidentiality claim.** |
| + Browser sealing protects plaintext only while the delivered HTML and JavaScript are trusted. An attacker able to alter that page can substitute `data-pubkey` or capture input before encryption. `sealed_to` does not authenticate the page or prove which key encrypted an envelope: it is client-supplied metadata checked separately from structural envelope validation. Rejection after submission cannot undo disclosure. State this limitation explicitly and identify the trusted code/key-delivery boundary; if active page tampering must be resisted, an independently trusted client or verification mechanism is required. |
| + Evidence: spec lines 49–63 and 114–122; [fingerprint checks](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apiconfig.go:669). |
| + **Fault family:** integrity of the client receiving secret plaintext. |
| + |
| +5. **P2 — A local empty route list cannot establish that an environment is unused.** |
| + Builder call 2 proposes skipping restart and saying nothing running uses the environment. Both reused helpers inspect only the console’s local registry. An environment used exclusively on another box is refused by scoped resolution, and absent from the notice. Preserve the distinction between **unused**, **not visible here**, and **lookup failed**. A remote-only case must remain “saved, restart not requested” unless authoritative resolution establishes otherwise; retrying the same local lookup cannot repair it. |
| + Evidence: [documented resolution limitation](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apirestartscope.go:45), [notice visibility](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apiconfig.go:737). |
| + **Fault family:** incomplete visibility must not become a claim of absence. |
| + |
| +6. **P2 — Existing CAS does not detect a stale editor.** |
| + Builder call 7 promises a conflict when someone else saved first. Existing `Apply` reads the current bundle during the POST and conditionally writes against that newly read version. If two people load the page, one saves, and the other submits afterward, the second write can succeed and overwrite the first without conflict. Carry the version displayed to the browser through the save operation and enforce it atomically; submit only staged mutations. |
| + Evidence: [request fields](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apiconfig.go:346), [read/write CAS interval](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/store.go:178). |
| + **Fault family:** concurrency protection must cover the editing interval. |
| + |
| +7. **P2 — Specify the browser wire contract and version signal.** |
| + Call 4 requires v1/v2 selection, but call 5 always supplies `data-account` and supplies no version flag. The CLI uses the **presence** of `secrets_account` to select v2. Define an explicit browser version signal and pin the encoding: raw P-256 points, HKDF salt/info, nonce/tag sizes, padded base64, and v2’s length-prefixed AAD. Require interoperability vectors for **both** versions; the proposed test names only v2. |
| + Evidence: [GET version signal](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/apiconfig.go:267), [AAD encoding](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/crypto.go:78), [key derivation](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/crypto.go:363). |
| + **Fault family:** browser/Go envelope compatibility. |
| + |
| +8. **P2 — Empty ordinary settings are valid in the CLI.** |
| + “Empty values refused” at spec line 45 contradicts the promised parity. Go permits empty ordinary values and deliberately refuses empty secrets. Restrict that sentence and the browser validation to empty **secret** values. |
| + Evidence: [ordinary-value predicate](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/materialize.go:23), [explicit empty-value distinction](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/appconfig/crypto.go:354). |
| + **Fault family:** validation parity. |
| + |
| +9. **P2 — The default card adds a bundle read.** |
| + Builder call 5 says `envCards` already reads every bundle. It reads only named environments. Showing the unnamed bundle’s current values requires an additional default-bundle read unless an existing read is deliberately reused. Correct the cost assumption and specify the read budget, keeping it confined to the environments section. Key selection itself does use local database/registry reads as claimed. |
| + Evidence: [current card loader](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-console-secrets/internal/console/appsettings.go:524). |
| + **Fault family:** page-view storage-read budget. |
| + |
| +The any-member permission decision matches the person-token path, and the cited star-handler pattern supplies membership, app ownership, and CSRF checks. I found no role-parity objection. |
| + |
| +**NOT READY** |
| \ No newline at end of file |
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R2.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R2.md| new file mode 100644 |
| index 000000000..7632c40b8 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-console-secrets-R2.md |
| @@ -0,0 +1,43 @@ |
| +# Review brief: spec "Settings and secrets in the console", round 2 of 3 |
| + |
| +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. |