oficina / equipo Public

spec: Equipo release plan (lifecycle, Release specialist, slices)

Plan for approval, nothing built. Verified state of task tkataquuxfrw,
the checks blocker's root cause (offline checks sandbox running a
hosted-CI gate), today's manual release path, and runner updates.
Proposes a Release specialist behind a pure release gate, a release
record, staging-first deploys with smoke checks, runners that follow the
instance, gated production, rollback by migration class, release cards,
and specialists as data with a fixed capability menu.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 339c9e8e5647d518c5d1668d4de808939baae16f parent d4b1414
1 file changed, +403 −0
  • docs/superpowers/specs/2026-11-11-equipo-release.md +403 −0

CI failed — run details

diff --git a/docs/superpowers/specs/2026-11-11-equipo-release.md b/docs/superpowers/specs/2026-11-11-equipo-release.md
new file mode 100644
index 00000000..a667cb66
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-11-equipo-release.md
@@ -0,0 +1,403 @@
+# Equipo release, thin v1: plan for approval
+
+Status: 2026-11-11, plan only, nothing built. Drafted by Claude (Opus 5.5)
+on `release-plan` from main d4b1414. Every security-sensitive slice below
+gets its own spec and Astra review before it is built. Builds on merge
+authority (`2026-11-11-equipo-merge-authority.md`), thin v1 §3 and §8,
+and Mac runners (`2026-11-07-equipo-mac-runners.md`).
+
+Goal: a narrow release path that Equipo runs itself. A change goes
+Written, Checked, Reviewed, Merged, Deployed, Verified, and nothing is
+called shipped until production is verified.
+
+## 1. Current state, verified
+
+Checked 2026-11-11 about 15:10 UTC: three read-only `carlos db query`
+reads of a staging replica copy, `amadan ci status`, the forge branch,
+`/api/version`, `carlos channels`, and the code.
+
+**The rename task, `tkataquuxfrw`.**
+- `in_review`, unchanged since 13:01. Steps: Engineering pushed
+ `812d0b9`; Checks `cannot_run` (`needs_network`); Review (other
+ family) `changes_requested`; Engineering's fix round pushed `4d28994`;
+ Checks on `4d28994` `failed` with reason `runner_restarted`, which is
+ not a result. Review has not seen `4d28994`. Nothing merged or deployed.
+- Hosted amadan CI ran on `4d28994` and failed on its own merits: the
+ compile stage's size budget (1 problem), and `TestHeadless/2_project`
+ and `2_new_work`, twice each. It needs another fix round whatever the
+ sandbox does.
+- 15 files, +407/-17, on `a069080` (45 behind main). It changes the
+ instance (route, `rename_project` tool, template, copy) and the runner
+ (tool list, MCP schema, Claude allowlist); no migration, no protocol
+ change; new UI copy not yet reviewed.
+- Main is red too: hosted CI on d4b1414 fails
+ `TestBrowserDraftStreamsFormatted`. Staging serves 42a31cb.
+
+**Why checks cannot download dependencies.** There are two separate
+failures.
+1. **The Checks step is offline by design**: `--unshare-net`, no egress
+ relay for checks (`containment/egress.go:16`), `GOPROXY=off`,
+ `GOSUMDB=off`, host `~/go/pkg/mod` mounted read-only
+ (`thin/judge.go:434`, `provider/check_policy.go:53`). Equipo's gate
+ starts with `.amadan/ci.d/00-prepare` (`ci-box.py prepare`), whose
+ `boxed()` (`ci-box.py:119`) sees no `codex` on the sandbox `PATH`,
+ decides this is not a runner host, and tries to pull a podman image,
+ Chromium and pinned tools. The step's output contains `ci-box`,
+ `00-prepare`, `podman` and "Temporary failure in name resolution";
+ `judge.go:280` classifies it `needs_network`. Past prepare,
+ govulncheck needs vuln.go.dev and the browser lane needs Chromium. Go
+ modules are not the main problem (docs-t1's cache holds main's modules
+ and the pinned tools): Equipo's gate is a hosted-CI gate and cannot
+ pass offline as written.
+2. **Engineering cannot run Go tests at all.** Its namespace has no Go
+ root and no module cache. Its relay allows only the provider host
+ (`egress/policy.go:35`, which answers 403 to any other host). The
+ branch's `docs/project-rename-delivery.md` records this.
+
+**How releases happen today.** Entirely by hand, by a controller agent
+using Paul's owner login.
+- **Build:** `scripts/release-isolated.sh`: a clone at HEAD, refuses a
+ dirty or moved tree, checks `go version -m` (`vcs.revision`,
+ `vcs.modified` false); `staged-artifacts.py` writes the digests.
+- **Staging:** `scripts/staging-thin.py`: `secrets set` if missing,
+ `db pull` backup, `env set` (six variables),
+ `carlos deploy --swap hold --version <sha>`, wait for `/api/version`;
+ reinstall both runner units; `TestStaging` (up to 90 minutes);
+ `record_running` checks the running `/proc/<pid>/exe` digests.
+- **Production:** the only script is `scripts/cutover-thin.sh`, the
+ one-time move to thin on a fresh database. Agents must not run it with
+ `--execute`.
+- **Production has never been moved.**
+ - `equipo` serves `26ac471` (2026-11-06, before thin), and
+ `equipo-runner.service` runs `releases/26ac471`.
+ - `~/.local/share/equipo-cutover` does not exist.
+ - Paul works on `equipo-staging`, which is also where the rename task
+ lives.
+
+**Runner updates and compatibility today.**
+- **Protocol:** each side speaks the lower of the two (`wire.Spoken`);
+ `wire.Encode` strips unknown fields. `ProtocolCurrent` is 4; automatic
+ merges need 4.
+- **Mac:** `macUpdater` follows `Welcome.Release` (the instance's
+ BuildVersion), fetches the manifest and binary from the instance,
+ checks the SHA-256 from that same manifest (no signature), swaps under
+ `worker.mu` so a running step finishes first, exits 75; launchd
+ restarts it.
+- **Linux:** no updater. Stop, install, `verify-installed` (pins bwrap,
+ claude, codex, codex-code-mode-host, tool proxy), start.
+- **Instance swap:** `Drain`, runners reconnect, the outbox replays,
+ commands land exactly once, turns keep running. Known gap: a merge in
+ flight during a swap (merge authority §10a).
+- **Migrations:** forward-only, at boot. An older binary ignores newer
+ applied migrations (rastrillo `migrate/apply.go:119`), so a binary
+ rollback is safe only when the new migrations are additive.
+- **The rename change across versions:** a new instance with an old
+ runner never offers the tool; an old instance with a new runner
+ refuses it as unknown. Harmless, but the feature needs both new.
+
+## 2. Proposed design
+
+### 2.1 Lifecycle states and where each lives
+
+| State | True when | Lives in |
+|---|---|---|
+| Written | Engineering pushed a candidate SHA | `chat_steps` (engineering, `pushed`) |
+| Checked | checks `passed` on that SHA | `chat_steps.checks` |
+| Reviewed | `approve` on that SHA | `chat_steps.verdict` |
+| Merged | the hub merged it | `chat_tasks.merged_sha`, `chat_merge_audit` |
+| Deployed | a target serves a release that contains the merge, and its `/api/version` says so | `chat_release_targets` (new) |
+| Verified | that target's smoke checks passed and every connected runner reports the version | `chat_release_targets` (new) |
+
+The task stage `done` keeps meaning merged; no new stages. The card shows
+a derived line ("Merged, not released yet", "On staging, verified",
+"Live, verified"). The words "shipped" and "live" come only from a
+verified production target. Copy goes through copy review.
+
+### 2.2 The Release specialist and its authority
+
+One coordinator. Release is a specialist like Checks and Merge: its
+steps are code the runner runs, outside every namespace, after a pure
+instance gate `releasegate.Decide` (the mergegate pattern: code decides,
+no model output can make it deploy, every call writes one audit row).
+Its model (preference: the coordinator's family, low effort) only words
+the release notes and failure reports from the record; it has no tools
+that change anything.
+
+Release may, within its grants: build a SHA that is on main; deploy and
+roll back `equipo-staging`; run staging smoke checks; ask for production.
+It may never: build a task branch; deploy without a passing release
+record; change env, secrets or app settings; deploy production without
+an approval for that release. The deploy credential stays in a 0600 file
+read by the runner process and is never mounted into a namespace.
+Engineering holds no release capability, and no specialist may own both
+a step that writes code and the `release` step.
+
+`releasegate.Decide` inputs: SHA reachable from the forge's main; hosted
+CI `passed` on that exact SHA; every task merged since the target's last
+known-good has a `merged` audit row from `authorizeMerge`; no merge step
+queued or running and no other release in flight for the target (§10a);
+migration class; wire class; grants; approvals. `never` on any missing
+fact; `ask` for production, breaking migrations or a wire change without
+a protocol bump; `act` otherwise.
+
+### 2.3 The release record
+
+Migration, additive: `chat_releases` (id, project, SHA, version, the
+tasks it contains, hosted CI run and result, the merge audit ids, the
+artifact digests from `staged-artifacts.py` (instance, Linux runner,
+tool proxy, Mac runner, manifest), provenance (`vcs.revision`,
+`vcs.modified`), migrations added since last known-good with their
+class, `ProtocolCurrent`, wire class, notes); `chat_release_targets` (release,
+target `staging|production`, state, previous version, restore point,
+runner versions seen, smoke results, timestamps); `chat_release_audit`
+(append only, kinds `decision`, `approval`, `deploy`, `verify`,
+`rollback`, `grant`). Last known-good for a target is its newest
+`verified` release.
+
+Migration class: only `CREATE TABLE`, `CREATE INDEX` and
+`ALTER TABLE ... ADD COLUMN` count as additive; anything else, or a file
+the classifier cannot read, is `breaking`. Wire class: a generated
+`internal/wire/surface.json` (tools, frames, fields), checked in CI;
+changed between last known-good and the SHA without a protocol bump
+means `mixed_window`, stated on the card.
+
+### 2.4 Staging first, with smoke tests
+
+1. A merge lands. Release waits for hosted CI on main's head (the forge
+ reports per branch head, so a newer head supersedes an older one).
+ Red means no release; the card says what failed and that nothing
+ changed.
+2. Build: `release-isolated.sh` as today, from a fresh clone at the SHA;
+ once 1b lands, inside the offline check profile with the prefetched
+ module cache. Digests and provenance go into the record.
+3. Deploy: `carlos deploy --app equipo-staging --target linux-arm64
+ --swap hold --version <v>` with the staging `deploy` credential, no
+ env or secret changes. Staging is where Paul works, so the gate's "no
+ merge or release in flight" holds; turns carry on across the swap.
+ State `deploying`.
+4. Instance check: `/api/version` equals the version, `/healthz` ok,
+ within 2 minutes. State `verifying`.
+5. Smoke: a `smoke` scenario set in `internal/headless` (minutes, not
+ the 90-minute suite) as the suite person, plus any staging scenario
+ the change itself added and Review approved. The rename change adds
+ one (§5).
+6. Runners follow (2.5). Verified when smoke passed and every connected
+ staging runner reports the version.
+7. Failure at 3 or 4 with nothing promoted: `failed`, what serves now is
+ read back and reported. Failure at 4 to 6 after promote: rollback
+ (2.7). No automatic retry of a deploy, ever; Retry is a person's tap.
+
+### 2.5 Instance and runner ordering, protocol
+
+Instance first, then runners, always. Runners follow the instance's
+release (`Welcome.Release`), up and down, so a runner is never newer than
+its instance for long. Linux self-update (the queued item, folded in
+here) is `macUpdater`'s shape plus four things: the runner tells the
+instance it is updating, and the instance stops placing new steps and
+turns on it; it waits for running attempts and turns to end, never
+kills them, and reports "waiting for a step" after 30 minutes; the new
+binary's `verify-installed` must pass before the switch; the unit runs
+`releases/current/equipo-runner` (a symlink swapped atomically), exits 75
+and systemd restarts it. The previous release stays on disk. A runner not
+back at the version within 10 minutes leaves the target at `deployed,
+runners behind`, never `verified`. The release step itself runs on the
+owner's staging runner, which the release updates: the step ends at
+`deployed` before that runner updates, and the instance, not the
+runner, marks `verified` when the runners' hellos report the version.
+
+Protocol stays "lower of the two". A wire change with a protocol bump is
+gated as today (capability named in code); `mixed_window` is allowed only
+when additive (a new tool, an optional field) and the card says the
+feature works once runners update.
+
+Pinned Claude Code and Codex versions (the queued item): an ordinary
+Equipo task bumps the pins in the manifest. Its runner update refuses at
+`verify-installed` until the host has the new CLI, and the card says
+which binary to install where.
+
+### 2.6 Production gating
+
+Target: Carloku app `equipo`, account `oficina`, console
+`console.carloku.com`, channel `edge`, host `equipo.bds.oncarlos.com`;
+runner `equipo-runner.service` on docs-t1, plus the Mac worker when
+connected. Production needs, in order: the thin cutover done (decision
+D1); Paul's approval of the `release.production` capability and the
+production credential; and, in v1, an approval card per release:
+"Release 9f3c1a2 to Equipo production? Verified on staging at 15:40:
+smoke 9 of 9, runners 2 of 2. Contains: Add project rename. Migrations:
+none. [Release] [Not now]". Then the staging steps 2 to 6 against
+production, with production smoke read-only: version, health, runners at
+the version, and, until production has a test person (D5), Paul's one
+tap confirming the behaviour.
+
+### 2.7 Rollback and migrations
+
+- Last known-good is kept per target, and its artifacts stay in the
+ instance's release list and on the runner's disk.
+- Fails after promote, migrations `none` or `additive`: Release promotes
+ the last known-good version explicitly (`carlos promote --app <a> <v>
+ edge`, a `deploy` door), runners follow back, Release checks
+ `/api/version` and runner versions, state `rolled_back`. Once; the
+ failed release is not retried.
+- Migrations `breaking`: the gate asks before deploying and the card says
+ rollback means restoring the database. On failure, no automatic
+ rollback: Paul gets a card. A database restore is the platform's
+ (instance restore #658, inert today; until then `db pull --at` and a
+ restore by hand).
+- Every failure report says what failed, where it stopped, what is
+ serving now and what Equipo did about it. A fix is proposed as a task,
+ never started on its own.
+
+### 2.8 UI states
+
+One release card per release and target in the conversation of each
+task creator it contains, updated by revision, headed with project,
+task and version: "Equipo · Add project rename · release 9f3c1a2 ·
+staging" (the version is main's SHA at the merge, not the task's). States: queued, building, deploying, verifying (n of m),
+deployed (runners k of n), verified, failed, rolled back (to v). Task
+cards carry the lifecycle line of 2.1. The project page gains "Releases":
+last known-good per target and the last five releases with reasons.
+
+### 2.9 Specialists as data
+
+Table `chat_specialists`: name, brief (<= 2 KB), steps it owns (from a
+code list; v1 assignable: `release`), tools (from the code's tool menu),
+model preference, capabilities (from the menu), state `proposed |
+active | retired`, revision, `approved_by`. Engineering, Review and
+Checks stay in code and are shown in the same shape, read only.
+
+Capability menu (code, fixed): `release.build`, `release.staging`
+(deploy and roll back staging), `release.smoke_staging`,
+`release.production` (each use needs an approval), `runner.update`
+(announce a release to runners). Nothing else exists to grant.
+
+Tool `propose_specialist{...}`: the instance validates every field
+against the menus and refuses anything outside them, then posts an
+ask-once card with the capabilities in plain words, "Add a Release
+specialist to Equipo? It may build releases of oficina/equipo from main,
+deploy them to equipo-staging and roll staging back, and must ask you
+before production. [Add] [Not now]". Only an owner's Add makes it active
+and writes `chat_capability_grants` (specialist, capability, scope,
+granted_by, at, revoked_at) with an audit row. The coordinator may
+narrow, never widen (merge policy's rule). Every use of a capability
+writes an audit row. A proposal naming a step the code cannot run is
+refused with a plain reason.
+
+## 3. Permissions
+
+| What | Who holds it | Where | Paul's action |
+|---|---|---|---|
+| Carloku `deploy` credential, `--app equipo-staging --rungs edge` | the release runner (below) | 0600 file under that runner's root, `release/`, never in a namespace | mint: `carlos services create --role deploy --app equipo-staging --account oficina --rungs edge equipo-release-staging` |
+| Carloku `deploy` credential, `--app equipo --rungs edge` | the release runner | same file location, separate file | mint at the first production approval |
+| Forge read of hosted CI status | runner forge credential (existing) | unchanged | none; Release never pushes |
+| Suite person bearer for staging smoke | existing, 0600 under the staging root | unchanged | none |
+| Grant: Release specialist, capabilities as listed | instance, `chat_capability_grants` | staging DB, audited | approve the card |
+| One-time runner unit change (`releases/current`) | Paul | both user units on docs-t1 | run once per unit |
+| Owner backup before each production release | Paul (owner login) | `carlos db pull` | manual until P1 |
+
+The release runner is the runner of the instance Paul works in:
+`equipo-runner-staging.service` today, `equipo-runner.service` after the
+cutover (D1), when production drives releases to staging and then to
+itself. Credentials move with that choice, never to both.
+
+The `deploy` role reaches ship, promote and rollback on its rungs plus
+the reads `carlos deploy` needs; it cannot read logs, set env or secrets,
+pull the database, or touch `stable`. Platform requests, filed as amadan
+discussions on carlos/platform, not worked around:
+- **P1** a `deploy`-role read of replica position (transaction and time,
+ no contents), so a release records its restore point before promote.
+- **P2** instance restore (#658) usable by an owner for a rollback with
+ breaking migrations.
+- **P3** confirm on staging that a `deploy` credential may ship with
+ `--swap hold`; if not, a request (or Paul sets `carlos apps set --swap
+ hold` once per app).
+
+## 4. Slices
+
+Each lands headless first, then UI, then staging. "Full process" means
+its own spec, Astra review (at most three rounds) and Paul's approval.
+
+| Slice | Finish line | Paul approves | Full process |
+|---|---|---|---|
+| 0 Decisions | D1 to D7 answered | yes | no |
+| 1a Hosted checks | for a project with hosted CI, Checks records hosted CI's result on the exact candidate SHA (`checks_sandbox: hosted`); the rename task's next Checks says `failed`, not `cannot_run` | the policy | yes (changes what "passed" means to the merge gate) |
+| 1b Module prefetch | the runner runs `go mod download` from the candidate's go.sum outside any namespace (proxy.golang.org and sum.golang.org only, `-mod=readonly`, sums verified) into a runner-owned cache mounted read-only into Checks, Engineering and the build | no | yes (new fetch, new mounts) |
+| 2 Lifecycle line | task cards and pages show the six states from real rows; "Done" reads "Merged" | copy | no |
+| 3 Specialists as data | Release proposed and approved on staging through the card; grant and audit rows exist; a widening attempt is refused | the card | yes |
+| 4 Release to staging | a green main SHA is built, deployed to staging, smoke-checked and verified by Equipo, with its record, and a forced smoke failure rolls back to last known-good | the staging credential | yes |
+| 5 Linux self-update | after slice 4's deploy both staging runners move to the version on their own, no step interrupted; a refused `verify-installed` leaves the old runner running | the unit change; D6 | yes |
+| 6 Production | the rename release live on `equipo`, `/api/version` and runners at the version, Paul confirms the rename | each release; the credential | yes |
+| 7 CLI pins | an Equipo task bumps the Claude Code pin and the release waits, with a clear card, until the host has it | no | no |
+
+Order: 1a and 2 in parallel, then 3, 4, 5, the staging demo, 6, 7. 1b
+can follow 4; slice 4 builds on the host as today until it lands.
+
+## 5. The demo
+
+The rename task is suitable: small, reviewed once, and it changes both
+the instance and the runner, so it tests ordering. Nobody touches its
+branch by hand; it continues through Equipo.
+
+1. Main is green (it is red today) and slice 1a is on staging.
+2. Paul taps Retry on the task's Checks step. Checks reports hosted CI's
+ real result on `4d28994`: failed, size budget and two headless tests.
+3. Engineering's fix round fixes them and rebases onto main; it also
+ adds a staging scenario: rename a project as the suite owner, read the
+ title back in status and the project list, a stale revision is
+ refused, a repeated call ID makes one event. Copy review runs on its
+ strings.
+4. Checks pass, Review approves, merge authority decides (it touches the
+ runner provider allowlist, so expect an ask card).
+5. Release builds main at the merge, deploys staging, smoke plus the
+ rename scenario pass, both staging runners update, verified. Evidence:
+ the record, digests, `/api/version`, runner versions, smoke report.
+6. After D1, a production approval card; Paul taps Release; live,
+ verified, Paul confirms the rename on production.
+
+If the fix round stalls or the change grows past the merge policy's
+size, the substitute is a one-line copy change merged through the same
+path, so the release path is still proven.
+
+## 6. Still manual or blocked
+
+- **Blocked:** main is red (`TestBrowserDraftStreamsFormatted`), and no
+ release can start until it is green.
+- **Blocked:** production is not on thin. The first live deploy to
+ `equipo` is the cutover (D1), which a person runs.
+- **Manual:**
+ - minting both deploy credentials;
+ - the one-time runner unit change;
+ - installing new Claude Code and Codex binaries on hosts;
+ - the owner backup before a production release (until P1);
+ - any database restore (until P2);
+ - env and secret changes to either app;
+ - Paul's confirmation of behaviour on production (until D5).
+- **Not covered here:** the Mac worker is enrolled but not connected, so
+ its update path is untested live. Checks for projects without hosted CI
+ still need 1b plus a gate that can run offline; Equipo's own gate
+ cannot run offline (podman, Chromium, vuln.go.dev), and that is why 1a
+ comes first.
+
+## 7. Decisions for Paul
+
+- **D1** Run the thin cutover of `equipo` yourself, at a release staging
+ verified, before Equipo deploys there. Recommended. The alternative is
+ to keep staging as the working instance and leave production pre-thin
+ for now.
+- **D2** Make hosted CI the source of checks for projects that have it
+ (oficina/equipo does). Recommended.
+- **D3** Staging releases run on their own after merge once you approve
+ the grant. Production asks for every release in v1. Recommended.
+- **D4** Automatically roll back staging and production to the last
+ known-good when migrations are additive. Breaking migrations never roll
+ back on their own. Recommended.
+- **D5** A production test person for automated smoke checks. That
+ expands access, so the recommendation is to defer it to v2 and confirm
+ behaviour by hand meanwhile.
+- **D6** Linux self-update trusts the instance's digest, as the Mac
+ updater does, or requires a release signature whose key lives on
+ docs-t1 outside every namespace. Recommended: signing before slice 5
+ reaches the production runner. The runner host holds the forge
+ credential and provider accounts.
+- **D7** Approve the capability menu in §2.9 as the complete list for
+ v1.