oficina / equipo Public

feat: certify and package direct provider releases

codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 9cd59105127ca63236c7a2b2822cc7d9a7c7f0be parent 43e54be
16 files changed, +1,858 −126
  • Makefile +20 −11
  • docs/live-gate.md +270 −46
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md +406 −0
  • internal/equipotest/live_gate_test.go +1 −0
  • internal/equipotest/runner_release_test.go +116 −6
  • internal/release/manifest.go +9 −0
  • internal/release/manifest.json +3 −1
  • internal/runner/provider/direct_certification.go +252 −0
  • internal/runner/provider/direct_certification_test.go +113 −0
  • internal/runner/provider/direct_live_config.go +163 −0
  • internal/runner/provider/direct_live_config_test.go +93 −0
  • internal/runner/provider/direct_requirements.json +27 −0
  • internal/runner/provider/live_test.go +137 −0
  • scripts/live-gate.sh +5 −3
  • scripts/runner-reference-allowlist.json +119 −49
  • scripts/runner-release-check.py +124 −10

CI failed — run details

diff --git a/Makefile b/Makefile
index 12008e33..791ed389 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,9 @@ export CGO_ENABLED = 0
# make release RELEASE_GOARCH=amd64
RELEASE_GOOS ?= linux
RELEASE_GOARCH ?= arm64
-RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH)
+RELEASE_VERSION = $(shell git rev-parse --short HEAD)
+RELEASE_BIN = releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH)-$(RELEASE_VERSION)
+RUNNER_RELEASE_DIR = releases/equipo-runner-linux-amd64-$(RELEASE_VERSION)
# One target at a time, even under make -j: the perf lane measures time,
# and a suite running beside it would be measured too.
@@ -37,13 +39,17 @@ build:
# Stamp the clean commit so /api/version identifies the running release.
# Strip debug data to reduce the upload size; keep module build metadata.
-release: copy-release-check
+release: copy-release-check direct-release-check
+ @test -z "$$(git ls-files --others --exclude-standard)"
@git diff --quiet && git diff --cached --quiet || \
{ echo "refusing to build a release from a dirty tree"; exit 1; }
@mkdir -p releases
CGO_ENABLED=0 GOOS=$(RELEASE_GOOS) GOARCH=$(RELEASE_GOARCH) go build -trimpath \
-ldflags "-s -w -X amadan.net/rastrillo/rastrillo.BuildVersion=$$(git rev-parse --short HEAD)" \
-o $(RELEASE_BIN) ./cmd/$(APP)
+ cp internal/release/manifest.json $(RELEASE_BIN).manifest.json
+ cp -R internal/release/evidence $(RELEASE_BIN).evidence
+ @git rev-parse HEAD > $(RELEASE_BIN).COMMIT
@echo "built $(RELEASE_BIN) stamped $$(git rev-parse --short HEAD)"
@echo "deploy it with:"
@echo " carlos deploy --app $(APP) --account oficina --channel edge --timeout 5m ./$(RELEASE_BIN)"
@@ -134,8 +140,8 @@ migration-check:
CGO_ENABLED=0 go test ./internal/equipo -run '^TestMigrationModels$$' -count=1
runner-prerequisites:
- @test "$$(codex --version)" = "codex-cli 0.165.0"
- @test "$$(/usr/bin/bwrap --version)" = "bubblewrap 0.11.0"
+ @test "$$("$${EQUIPO_CODEX_PATH:-codex}" --version)" = "codex-cli 0.165.0"
+ @test "$$("$${EQUIPO_BWRAP_PATH:-/usr/bin/bwrap}" --version)" = "bubblewrap 0.11.0"
runner-namespace-test:
@test "$$(/usr/bin/bwrap --version)" = "bubblewrap 0.11.0"
@@ -156,18 +162,21 @@ runner-dead-references:
# declares manifest resources, also add: rastrillo generate --check
ci: runner-dead-references build vet fmt-check staticcheck govulncheck gitleaks budget test runner-adapter-test runner-namespace-test migration-check perf
-.PHONY: copy-release-check release-runner runner-prerequisites
+.PHONY: copy-release-check direct-release-check release-runner runner-prerequisites
copy-release-check:
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$$' -count=1
-release-runner: copy-release-check
+direct-release-check:
+ python3 scripts/runner-release-check.py
+
+release-runner: copy-release-check direct-release-check
@test -z "$$(git ls-files --others --exclude-standard)"
@git diff --quiet && git diff --cached --quiet || exit 1
@$(MAKE) --no-print-directory runner-prerequisites
- python3 scripts/runner-release-check.py
- @mkdir -p releases/equipo-runner-linux-amd64
+ @mkdir -p $(RUNNER_RELEASE_DIR)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath \
-ldflags "-s -w -X amadan.net/rastrillo/rastrillo.BuildVersion=$$(git rev-parse --short HEAD)" \
- -o releases/equipo-runner-linux-amd64/equipo-runner ./cmd/equipo-runner
- cp packaging/equipo-runner.service internal/release/manifest.json releases/equipo-runner-linux-amd64/
- @git rev-parse HEAD > releases/equipo-runner-linux-amd64/COMMIT
+ -o $(RUNNER_RELEASE_DIR)/equipo-runner ./cmd/equipo-runner
+ cp packaging/equipo-runner.service internal/release/manifest.json $(RUNNER_RELEASE_DIR)/
+ cp -R internal/release/evidence $(RUNNER_RELEASE_DIR)/evidence
+ @git rev-parse HEAD > $(RUNNER_RELEASE_DIR)/COMMIT
diff --git a/docs/live-gate.md b/docs/live-gate.md
index 1f6883dd..0c6fe774 100644
--- a/docs/live-gate.md
+++ b/docs/live-gate.md
@@ -1,48 +1,272 @@
# Direct provider release gate
-Draft. Copy review and Task 11b certification are pending. Offline tests do not
-certify provider access. The production certificate lists remain empty and
-connections remain unavailable until the release gate passes.
-
-Before upgrading, stop the previous runner and reconcile every unfinished
-attempt. Migration 0018 revokes old consents, invalidates connection reports and
-fences unfinished assignments. It retains evidence, charges and pending
-containment. Restarting does not prove an old process has stopped.
-
-Use the outbound user service in `packaging/equipo-runner.service`. The service
-runs under the operator's existing account. Each provider uses an explicitly
-configured, separately verified account home. An interactive account home is
-not eligible. Do not create or sign in to these homes during offline checks.
-
-Install and pin Claude 2.1.312, Codex 0.165.0, the matching Codex code-mode helper,
-and bubblewrap 0.11.0. Record their exact SHA-256 digests in manifest version 2.
-The namespace helper is part of the runner binary. Provider binaries are
-installed separately and are not bundled in the runner package.
-
-The runner configuration requires absolute paths for `EQUIPO_CLAUDE_PATH`,
-`EQUIPO_CODEX_PATH`, `EQUIPO_CODEX_CODE_MODE_HOST_PATH`, `EQUIPO_BWRAP_PATH`,
-`EQUIPO_AMADAN_PATH`, `EQUIPO_GIT_PATH`, `EQUIPO_GO_ROOT`, `EQUIPO_GO_BINARY`,
-`EQUIPO_RUNNER_EXECUTABLE`, `EQUIPO_RUNNER_STATE_DIR`,
-`EQUIPO_ACCOUNT_BINDINGS_PATH`, `EQUIPO_AMADAN_CREDENTIAL_PATH`,
-`EQUIPO_WORKSPACE_ROOT` and `EQUIPO_SCRATCH_ROOT`. Retain `EQUIPO_ORIGIN` and
-`EQUIPO_INSTANCE_ID`. Execution stays off unless `EQUIPO_EXECUTION_ENABLED=1`.
-The Go module cache may be configured with `EQUIPO_GO_MODULE_CACHE`; host Go
-caches keep their defaults.
-
-Task 11b needs explicit authorization for a bounded run, disposable repository,
-funding limit, sentinel locations, enrolled connections, origin and machine
-fingerprint. `scripts/live-gate.sh` retains both typed confirmations and refuses
-to run until the certification harness is installed. Do not replace that refusal
-with a test command that can succeed without running any tests.
-
-Certify both providers with their inner sandboxes enabled, the outer private
-network namespace, and only the provider-specific HTTPS relay. Test native,
-image, MCP and shell readers, protected-path aliases, credential refresh,
-account changes, resume, cancellation and runner death. Record the exact
-provider, launcher, policy and bubblewrap tuple. Refresh hosts remain absent
-until separately certified. A failed or changed policy makes the connection
-unavailable.
-
-Before a release, review pending copy, run the shared CI gate, then complete the
-bounded live certification. Keep the certified manifest and evidence with the
-versioned release. Deployment remains a human action.
+DRAFT. Copy review pending. Production tuple eligibility is off.
+
+This offline change supplies explicit-input checks, an evidence verifier and
+packaging refusals. It does **not** supply a live exercise driver. The four
+`direct_live` tests inspect operator-collected observations; they do not launch
+providers or generate those observations. Do not treat a passing fixture, the
+nesting probe, or the earlier Claude recording as release certification.
+
+Before using this runbook, the controller must resolve the runner digest cycle:
+the policy includes the runner executable digest, but adding certificates to its
+embedded manifest changes that executable. It must also provide the live
+exercise driver and wire certified refresh hosts into production. Today the
+production network contracts contain no refresh host. Keep the manifest empty
+until these prerequisites and every observation below are complete.
+
+## Prepare the accounts and bounded inputs
+
+1. Review the branch and pending copy with Paul. Before upgrading an existing
+ instance, stop its runner and reconcile every unfinished attempt. Migration
+ 0018 retains evidence and charges while fencing unfinished work. Restarting
+ does not prove old processes have stopped.
+
+2. Install the pinned dependencies: Claude 2.1.312, Codex 0.165.0, the matching
+ `codex-code-mode-host`, and bubblewrap 0.11.0. The Go namespace helper is part
+ of the runner. Provider binaries are installed separately. Use their absolute
+ paths throughout. Packaging checks the provider/helper digests pinned in the
+ adapters and the configured bubblewrap executable's version and digest.
+
+3. Create new credential homes yourself. Use one home per provider account and
+ never copy an interactive or shared ZeroSub login into it. For example:
+
+ ```sh
+ umask 077
+ mkdir -p "$HOME/.local/share/equipo/accounts/claude-paul" "$HOME/.local/share/equipo/accounts/codex-paul"
+ chmod 700 "$HOME/.local/share/equipo/accounts/claude-paul" "$HOME/.local/share/equipo/accounts/codex-paul"
+ ```
+
+ Sign in once per provider account in those homes, with the pinned binaries:
+
+ ```sh
+ CLAUDE_CONFIG_DIR="$HOME/.local/share/equipo/accounts/claude-paul" CLAUDE_SECURESTORAGE_CONFIG_DIR="$HOME/.local/share/equipo/accounts/claude-paul" "$EQUIPO_CLAUDE_PATH" auth login
+ CODEX_HOME="$HOME/.local/share/equipo/accounts/codex-paul" "$EQUIPO_CODEX_PATH" login
+ ```
+
+ These are scoped environment assignments. Do not export these homes as your
+ interactive `CODEX_HOME` or `CLAUDE_CONFIG_DIR`: the gate refuses interactive
+ homes, including environment overrides, aliases and shared-home mounts.
+
+4. Confirm the account identity through each provider's status/readback path.
+ For Claude, explicitly confirm the observed email/account identity yourself.
+ This is trust on first use, not remote identity attestation. Give each home a
+ distinct local `home_id`. Save its confirmed identity, version and home ID in
+ `equipo-identity.json` inside that home, mode 0600:
+
+ ```json
+ {"account_id":"CONFIRMED_ACCOUNT","home_id":"UNIQUE_HOME_ID","provider_version":"2.1.312"}
+ ```
+
+ Use `0.165.0` for Codex. Keep the native credential files private. Never put
+ credential contents, hashes, sign-in links or bearer tokens into evidence.
+
+5. Configure the runner environment file at
+ `$HOME/.config/equipo-runner/runner.env`, mode 0600. Set every value to the
+ intended instance and an absolute path on docs-t1:
+
+ ```text
+ EQUIPO_ORIGIN=https://YOUR_INSTANCE
+ EQUIPO_INSTANCE_ID=YOUR_INSTANCE_ID
+ EQUIPO_CLAUDE_PATH=/ABSOLUTE/PATH/TO/claude
+ EQUIPO_CODEX_PATH=/ABSOLUTE/PATH/TO/codex
+ EQUIPO_CODEX_CODE_MODE_HOST_PATH=/ABSOLUTE/PATH/TO/codex-code-mode-host
+ EQUIPO_BWRAP_PATH=/ABSOLUTE/PATH/TO/bwrap
+ EQUIPO_AMADAN_PATH=/ABSOLUTE/PATH/TO/amadan
+ EQUIPO_GIT_PATH=/usr/bin/git
+ EQUIPO_GO_ROOT=/ABSOLUTE/PATH/TO/go-root
+ EQUIPO_GO_BINARY=/ABSOLUTE/PATH/TO/go-root/bin/go
+ EQUIPO_RUNNER_EXECUTABLE=/ABSOLUTE/PATH/TO/equipo-runner
+ EQUIPO_RUNNER_STATE_DIR=/ABSOLUTE/PRIVATE/STATE
+ EQUIPO_ACCOUNT_BINDINGS_PATH=/ABSOLUTE/PRIVATE/bindings.json
+ EQUIPO_AMADAN_CREDENTIAL_PATH=/ABSOLUTE/PRIVATE/amadan-credential.json
+ EQUIPO_WORKSPACE_ROOT=/ABSOLUTE/WORKSPACES
+ EQUIPO_SCRATCH_ROOT=/ABSOLUTE/ON-DISK/SCRATCH
+ ```
+
+ `EQUIPO_GO_MODULE_CACHE` is optional. Leave host Go caches at their defaults.
+ The runner holds the Amadan credential; model tools do not. On the instance,
+ retain `EQUIPO_ORIGIN`, `EQUIPO_INSTANCE_KEY` and the SMTP requirements. Enable
+ execution with `EQUIPO_EXECUTION_ENABLED=1` only at the human release step.
+
+ Write `bindings.json` as a JSON array, mode 0600. Add one entry per selected
+ account/model. For example, the Claude entry has this shape:
+
+ ```json
+ {"id":"claude-paul","local_id":"claude-paul","person_id":"YOUR_PERSON_ID","provider":"claude","family":"claude","model":"EXACT_MODEL","account_id":"CONFIRMED_ACCOUNT","provider_home":"/ABSOLUTE/DEDICATED/HOME","kind":"subscription","expected_identity":{"account_id":"CONFIRMED_ACCOUNT","home_id":"UNIQUE_HOME_ID","provider_version":"2.1.312"}}
+ ```
+
+ For Codex use provider `codex`, family `gpt` and version `0.165.0`. Bindings do
+ not grant home authority. The runner verifies each home again before use.
+
+6. Choose a disposable Git repository with a local `.git` directory and no
+ valuable changes. Create nonsecret sentinel files in each dedicated home, a
+ separate disposable other-home directory, a separate disposable runner-state
+ directory, and the repository. Use nonempty random markers. Record their
+ absolute paths. The live exercises must also cover the actual protected
+ runtime paths, including `/egress`, `/tool/equipo.sock`, `/proc/*/root`,
+ `/proc/*/fd`, `/dev/fd` and symlink aliases.
+
+7. Authorize the calibration separately. Record a maximum call count, complete
+ input/output token budgets and duration. Also record job funding and the
+ remaining project and team period headroom. The verifier computes each
+ family's reservations as twice its maximum measured input and output, rounded
+ up to 1,000, with overflow checks. A job needs at least 23 reservations in
+ each dimension. If this exceeds your configured limits, stop and decide
+ yourself whether to change them. Never silently raise them. Unknown usage
+ stays unknown. Subscription usage is not a hard currency cap.
+
+8. Write a private `DirectLiveConfig` JSON file. Use this shape, replacing every
+ placeholder and zero with an explicitly authorized value. The gate refuses
+ this unfilled example:
+
+ ```json
+ {
+ "run_id":"UNIQUE_CERTIFICATION_RUN",
+ "repository":"/ABSOLUTE/DISPOSABLE/REPOSITORY",
+ "disposable":true,
+ "evidence_dir":"/ABSOLUTE/PRIVATE/EVIDENCE",
+ "origin":"https://YOUR_INSTANCE",
+ "machine_fingerprint":"CONFIRMED_DOCS_T1_FINGERPRINT",
+ "bindings":[
+ {"binding":{"ID":"claude-paul","Provider":"claude","AccountID":"CONFIRMED_CLAUDE_ACCOUNT","Home":"/ABSOLUTE/CLAUDE/HOME","Expected":{"account_id":"CONFIRMED_CLAUDE_ACCOUNT","home_id":"CLAUDE_HOME_ID","provider_version":"2.1.312"}},"model":"EXACT_CLAUDE_MODEL","auth_host":"EXACT_CERTIFIED_CLAUDE_AUTH_HOST","claude_tofu_confirmed":true},
+ {"binding":{"ID":"codex-paul","Provider":"codex","AccountID":"CONFIRMED_CODEX_ACCOUNT","Home":"/ABSOLUTE/CODEX/HOME","Expected":{"account_id":"CONFIRMED_CODEX_ACCOUNT","home_id":"CODEX_HOME_ID","provider_version":"0.165.0"}},"model":"EXACT_CODEX_MODEL","auth_host":"EXACT_CERTIFIED_CODEX_AUTH_HOST","claude_tofu_confirmed":false}
+ ],
+ "sentinels":{"claude":"/ABSOLUTE/CLAUDE/HOME/sentinel","codex":"/ABSOLUTE/CODEX/HOME/sentinel","other":"/ABSOLUTE/OTHER/HOME/sentinel","state":"/ABSOLUTE/TEST/STATE/sentinel","repo":"/ABSOLUTE/DISPOSABLE/REPOSITORY/sentinel"},
+ "funding":{"Calls":0,"InputTokens":0,"OutputTokens":0,"Seconds":0,"JobInput":0,"JobOutput":0,"ProjectInputHeadroom":0,"ProjectOutputHeadroom":0,"TeamInputHeadroom":0,"TeamOutputHeadroom":0}
+ }
+ ```
+
+ Auth hosts have no guessed defaults. Pin only the exact provider auth hosts
+ whose refresh paths you exercise. Refresh must remain limited to those hosts
+ and the selected dedicated homes.
+
+## Record and verify the certification
+
+The following recording step needs the missing live exercise driver mentioned
+above. Do not replace it with hand-written success records. The evidence schema
+is `DirectEvidence` in `internal/runner/provider/direct_certification.go`; the
+required assertion names are in `direct_requirements.json` beside it.
+
+9. Exercise every configured provider/model/policy through the real adapters,
+ durable journal, broker and namespace manager. Keep both inner sandboxes
+ enabled. For Codex verify the deny profile together with
+ `approvalPolicy:"on-request"`, `approvalsReviewer:"user"` and `--strict-config`.
+ Verify account/version and effective-policy readback. Test immutable settings,
+ scoped Equipo MCP authority, a broker-validated Equipo approval answered by
+ the runner, non-Equipo approvals sent to a person, real questions, stale and
+ invalid broker requests, and denied policy escalation. For native Codex
+ permissions, a person may choose **Allow once**. Retain the
+ **approved beyond profile** label in the evidence when applicable. It does
+ not certify a broader sandbox or authorize a hidden turn.
+
+10. Exercise actual exposed native, shell, search, image and MCP tools against
+ every protected path and alias. Require a successful workspace positive
+ control. Record missing tools with reasons. An exposed reader without a
+ tested denial blocks certification. Claude Engineering must expose exactly
+ `Bash,Read,Write,Edit,Glob,Grep`; Review and Product must expose exactly
+ `Read,Glob,Grep,Bash`, plus only the registered Equipo MCP tools for that
+ policy. Do not enable forbidden tools to test them. Capture each specialist
+ policy separately, including Engineering reproduction and implementation.
+
+11. Exercise successful refresh through each pinned auth host, failed refresh,
+ and same-identity credential-generation change between turns. Require fresh
+ preflight and binding before continued availability. A changed identity
+ must stop the step. Exercise clean-session resume, intentional mid-turn
+ runner death, durable replay without redispatch, and active cancellation.
+ Verify Go helper PID 1 ownership, its pidfd exit, no surviving detached
+ descendants, confinement after a cgroup move, and no reachable host services.
+
+12. Measure complete per-family input/output usage through separately bounded
+ calibration admission. Preserve unknown observations, even though an unknown
+ sample cannot establish a reservation. Retain the configured funding limits.
+ Use the calculated reservations and 23-reservation job floor to check both
+ project and team period headroom.
+
+13. Store sanitized capture artifacts and one `certification.json` per exact
+ policy under the evidence directory. Each check/probe references its artifact
+ by relative path and SHA-256, with a result and an explanation. Include the
+ exact configuration-file hash, installed executable hashes, account/model,
+ policy tuple, tool inventory, usage and funding. `index.json` is an array of
+ relative paths to those certification files. The verifier requires Claude
+ Engineering/Review/Product and Codex Engineering/Review coverage. It checks
+ evidence integrity and completeness; a trusted human still reviews whether
+ the captured observations establish the stated results.
+
+14. With explicit live authorization and those bounded inputs, run:
+
+ ```sh
+ export EQUIPO_LIVE_DIRECT=1
+ export EQUIPO_LIVE_CONFIG=/ABSOLUTE/PRIVATE/direct-live.json
+ CGO_ENABLED=0 go test -tags direct_live ./internal/runner/provider -run '^TestDirectLive(Contract|Isolation|Recovery|Calibration)$' -count=1
+ ```
+
+ Or use `scripts/live-gate.sh`, which retains both typed confirmations:
+ `LIVE DISPOSABLE ONLY` and `RUN LIVE GATE`. Missing opt-in, inputs or evidence
+ fail the tests. No test skips into success. This command currently verifies
+ recordings only. It does not perform steps 9 through 12 for you.
+
+## Package and perform the first job
+
+15. After all observations pass and a human reviews them, copy the sanitized
+ evidence into `internal/release/evidence/`. Update the single shared
+ `internal/release/manifest.json`: installed binary digests, `direct_policies`,
+ matching `verified_isolation_tuples`, and `certifications` references. Each
+ reference has `provider`, `policy_hash`, repository-relative `path` and
+ `sha256`. Paths must stay under `internal/release/evidence/`. Never add a
+ policy without all required passing evidence. Review pending runtime and
+ live-gate copy, then set `live_gate_copy_reviewed` to true. The current
+ manifest intentionally has no certificates or eligible tuples.
+
+16. Let the controller run the shared CI gate and review the clean branch. After
+ resolving the prerequisites at the top of this document, build both artifacts
+ from that same reviewed commit:
+
+ ```sh
+ make release
+ make release-runner
+ ```
+
+ Both commands refuse uncertified evidence and pending copy. Artifacts include
+ the short commit in their names and a full `COMMIT` stamp. The runner package
+ contains the runner, user unit, manifest and evidence; it contains no provider
+ binaries. Keep the instance's matching manifest/evidence sidecars with its
+ binary. Only a human deploys the versioned instance release.
+
+17. On docs-t1, install the reviewed runner package and user unit yourself. Set
+ `RUNNER_PACKAGE` to that exact versioned package directory:
+
+ ```sh
+ mkdir -p "$HOME/.local/lib/equipo-runner" "$HOME/.config/systemd/user"
+ cp -R "$RUNNER_PACKAGE/." "$HOME/.local/lib/equipo-runner/"
+ cp "$RUNNER_PACKAGE/equipo-runner.service" "$HOME/.config/systemd/user/equipo-runner.service"
+ systemctl --user daemon-reload
+ systemctl --user enable equipo-runner.service
+ ```
+
+ Export the reviewed `EQUIPO_*` configuration for the enrolment command, then:
+
+ ```sh
+ "$HOME/.local/lib/equipo-runner/equipo-runner" enrol
+ ```
+
+ Follow the device approval in Equipo. Confirm docs-t1's fingerprint and
+ approve that machine yourself. Start the user service after enrolment:
+
+ ```sh
+ systemctl --user start equipo-runner.service
+ ```
+
+18. Select your dedicated Claude and Codex connections on the same approved
+ machine. Confirm independent provider families for Engineering and Review,
+ enable execution on the instance, and request the first bounded bug fix in
+ the disposable project. Answer real questions and permissions yourself.
+ Inspect the frozen base-fail/candidate-pass evidence, exact candidate checks,
+ usage, containment proof and independent review. Verify the exact Amadan
+ review branch and commit. Try cancellation during an active attempt and
+ confirm the recorded stop before retrying. Merge the reviewed branch
+ yourself. Equipo must not merge, deploy or push the default branch.
+
+Stop certification processes and remove only scratch you created. Retain reviewed
+sanitized evidence. The service you explicitly installed is the only process
+intended to persist. No sudo is needed.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md
index 4ddd706d..ddf5a1f2 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md
@@ -23485,3 +23485,409 @@ Final reference receipt: reference scan: 495 text files, 958 matches, 0 failures
- 28 matches: Retained executable, service or command path; not an operating-system account requirement.
- 9 matches: Retained historical storage or decoding field; it confers no launch authority.
- 5 matches: Seeded historical consent is rendered read-only; no enabling API or action exists.
+
+
+---
+
+## Task 11b: Offline certification and packaging gates
+
+Status: NEEDS_CONTEXT. The offline input/evidence/packaging guards are implemented and tested, but the requested executable live exercise harness is not complete. The four tagged tests verify operator-collected observations; they do not perform the live exercises. Do not treat this as completed Task 11b certification or a release-ready runbook.
+
+Branch: `plan-2b`. Base: `43e54be`. Commit subject: `feat: certify and package direct provider releases`. Author: `codex <codex~paul@keymail.dev>`.
+All repository work stayed in `/home/paulca/amadan.net/oficina/equipo-plan-2b`.
+
+## What was built
+
+- `DirectLiveConfig`, explicit opt-in and file loading, with dedicated provider/account/model bindings, confirmed Claude trust-on-first-use identity, explicit auth hosts, disposable Git target, nonempty sentinel paths, evidence destination, origin, machine fingerprint and positive bounded funding. Shared or interactive homes, aliases, overlapping homes/repository/evidence and missing inputs fail before any provider command. No account discovery or credential-file read occurs in this gate.
+- `DirectEvidence` verification with a shared inventory of Contract, Isolation, Recovery and Calibration assertions. Every required assertion needs a passing, nonempty, SHA-256-bound artifact. Every exposed native/shell/search/image/MCP tool needs denial observations for selected/other homes, runner state, /egress, /tool/equipo.sock, symlinks, /proc/*/root, /proc/*/fd and /dev/fd. Missing tools need explicit reasons. Claude inventories are checked per specialist and only named Equipo MCP tools are allowed. Codex requires on-request, user review, strict config and the deny profile together.
+- Calibration computes twice the maximum complete input and output, rounded up to 1,000, checks overflow including multiplication by 23, requires 23 reservations per job and project/team headroom, and rejects unknown samples or evidence exceeding the configured calibration budget. This verifies recorded admission and usage; it is not a new runtime spending-cap implementation.
+- `live_test.go`, behind `direct_live`, defines all four exact test names. Each refuses absent opt-in or config, checks installed provider/helper pins and bubblewrap 0.11.0, binds recordings to the exact config/account/model/auth-host/funding/executable digests, verifies each assertion group and requires both families and specialist coverage. The sole subprocess in this verifier is bubblewrap --version. No provider is launched. This is the material shortfall from the requested exercise harness.
+- Both versioned release targets now check certification references, exact policy/instance tuple correspondence, provider/helper source pins, actual installed binary digests, bubblewrap 0.11.0, complete evidence, calibration funding and reviewed live-gate copy. The existing runtime-copy gate remains. Builds use commit-qualified output names and carry the shared manifest, evidence and full commit stamp. Provider binaries remain separate.
+- `scripts/live-gate.sh` retains both bounded-input typed confirmations and calls the four exact tagged tests only with explicit opt-in/config. `docs/live-gate.md` is a DRAFT operator sequence covering dedicated-home creation/sign-in, Claude identity confirmation, all binding/path settings including EQUIPO_AMADAN_PATH, bounded inputs, certification requirements, manifest updates, both release commands, user-service installation/enabling, docs-t1 enrolment and machine approval, connection selection, a bounded first bug fix, evidence/Amadan review branch inspection, active cancellation and human merge. It explicitly states the missing driver and other prerequisites.
+- Production `direct_policies`, `verified_isolation_tuples`, binary digests and certifications remain empty. `live_gate_copy_reviewed` is false. No production tuple was enabled.
+
+## Interpretations and unresolved concerns
+
+1. The requested live suite must actually exercise providers, not merely count test names or accept fixture transcripts. The implemented suite verifies an explicit evidence bundle and checks every required assertion, but does **not** collect those observations. A trusted operator must inspect the captured artifacts. Hashes establish integrity, not truthful execution. The missing real exercise driver remains required work; the draft documents the gap rather than pretending the command performs it. This task is therefore reported NEEDS_CONTEXT, not DONE.
+2. There is a concrete release-policy digest cycle in the current code. `Runtime.constructDirect` mounts the runner executable as `/opt/equipo-tool-proxy`; `BuildPolicy` hashes that file and `policyTemplate` retains it. The runner embeds manifest.json. Adding a certified policy hash changes the executable whose digest participates in that same policy hash. The commit version stamped by packaging can change that digest too. A final certificate cannot simply be copied from an earlier runner build. A controller-approved stable launcher identity or separately authenticated manifest design is needed. I did not normalize away this security input or add an eligibility bypass.
+3. Production `openRuntime` and `constructDirect` still construct network contracts without AuthHost. This safely prevents uncertified refresh. Actual refresh certification and production wiring of the resulting exact host must be completed together. The live config never guesses a production auth host.
+4. The source and artifact verifier trust the reviewed repository and the operator's sanitized evidence. They are not remote attestation. The positive packaging test deliberately rewrites only its temporary copy of trusted adapter pin constants to synthetic binary digests; the `fake_cli` rejection leaves production constants intact. No test-only environment bypass exists in production.
+5. The requirement to review prose is superseded for this run by the explicit instruction to leave draft/pending copy and never start a copy-review server or invoke that skill. No drafting provider, reviewer agent or browser review was used.
+6. The task named changes in copy.go only if new runtime strings were needed. None were needed, so copy.go is unchanged. New test diagnostics are not app runtime copy.
+
+## Files
+
+- `internal/runner/provider/direct_live_config.go`, `direct_live_config_test.go`
+- `internal/runner/provider/direct_certification.go`, `direct_certification_test.go`, `direct_requirements.json`, `live_test.go`
+- `internal/release/manifest.go`, `manifest.json`
+- `internal/equipotest/runner_release_test.go`, `live_gate_test.go`
+- `scripts/runner-release-check.py`, `live-gate.sh`, `runner-reference-allowlist.json`
+- `Makefile`, `docs/live-gate.md`
+- Appended controller section and this ignored local task report.
+
+## RED evidence
+
+All Go commands ran from the authorized worktree with CGO_ENABLED=0 and default Go caches.
+
+```sh
+CGO_ENABLED=0 go test ./internal/runner/provider ./internal/equipotest -run 'TestDirectLiveGate|TestDirectReleaseRequiresCertification|TestRunnerReleaseContractPackaging' -count=1
+```
+
+The first invocation failed to compile because DirectLiveConfig and its types did not exist. A minimal type/stub declaration was then added and the same command was rerun, producing compiled behavioral failures before implementing the gate:
+
+```text
+--- FAIL: TestDirectLiveGateRequiresExplicitInputs (0.00s)
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/opt_in (0.00s)
+ direct_live_config_test.go:57: explicit input gate: opt_in: <nil>
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/truthy_is_not_opt_in (0.00s)
+ direct_live_config_test.go:57: explicit input gate: truthy_is_not_opt_in: <nil>
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/dedicated_homes (0.00s)
+ direct_live_config_test.go:57: explicit input gate: dedicated_homes: <nil>
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/budget (0.00s)
+ direct_live_config_test.go:57: explicit input gate: budget: <nil>
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/time (0.00s)
+ direct_live_config_test.go:57: explicit input gate: time: <nil>
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/period_headroom (0.00s)
+ direct_live_config_test.go:57: explicit input gate: period_headroom: <nil>
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/disposable (0.00s)
+ direct_live_config_test.go:57: explicit input gate: disposable: <nil>
+ runner_release_test.go:125: unsafe release accepted missing_certification: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ runner_release_test.go:125: unsafe release accepted changed_policy: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ runner_release_test.go:125: unsafe release accepted fake_evidence: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ runner_release_test.go:125: unsafe release accepted bwrap: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+```
+Exit 1. Missing opt-in, homes, budget, disposable target, sentinels and shared-home refusals all failed. Missing certification and bubblewrap checks failed in packaging. The initial packaging-green fixture still passed at this stage.
+
+A separate calibration test was written before implementing DirectReservations:
+
+```sh
+CGO_ENABLED=0 go test ./internal/runner/provider -run 'TestDirectLiveGate' -count=1
+```
+Exit 1: undefined DirectReservations and LiveUsage. After implementation, its positive/unknown/overflow assertions passed. Evidence-matrix regressions were added with the validator and then mutation-tested; no separate preimplementation behavioral red is claimed for every matrix entry.
+
+## GREEN evidence
+
+```sh
+CGO_ENABLED=0 go test ./internal/runner/provider ./internal/equipotest -run 'TestDirectLiveGate|TestDirectReleaseRequiresCertification|TestRunnerReleaseContractPackaging|TestLiveGateConfirmation' -count=1
+```
+
+Final restored output, exit 0:
+
+```text
+ok amadan.net/oficina/equipo/internal/runner/provider 0.028s
+ok amadan.net/oficina/equipo/internal/equipotest 1.272s
+```
+
+The packaging tests invoke Make only in disposable fixture repositories with fake build executables. No real release target was run against the working checkout and no real release artifact was built.
+
+Tagged compilation and offline gate coverage only:
+
+```sh
+CGO_ENABLED=0 go test -tags direct_live ./internal/runner/provider -run '^TestDirectLiveGate' -count=1
+```
+
+```text
+ok amadan.net/oficina/equipo/internal/runner/provider 0.032s
+```
+Exit 0. None of TestDirectLiveContract, TestDirectLiveIsolation, TestDirectLiveRecovery or TestDirectLiveCalibration ran. There was no live certification.
+
+## Mutations
+
+Each mutation was applied independently, compiled, produced a named test failure, and was restored in a finally block before the next mutation. Final green above ran after all restorations. The first missing-certification mutation did not penetrate the fixture's JSON null iteration error, so it was not counted. The missing-certification fixture was corrected to an empty array, and the effective mutation then failed the named tests for both release targets.
+
+### certification
+
+Changed guard:
+
+```text
+scripts/runner-release-check.py
+- require(len(manifest["certifications"]) == len(manifest["direct_policies"]))
++ pass # mutation: omit certification cardinality
+
+scripts/runner-release-check.py
+- require(len(refs) == 1)
+ evidence(manifest, certificate, refs[0], installed)
++ if refs:
+ evidence(manifest, certificate, refs[0], installed)
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/equipotest -run ^TestDirectReleaseRequiresCertification$/^release(-runner)?$/^missing_certification$ -count=1
+--- FAIL: TestDirectReleaseRequiresCertification (0.09s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release (0.04s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release/missing_certification (0.04s)
+ runner_release_test.go:132: unsafe release accepted missing_certification: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner (0.05s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner/missing_certification (0.05s)
+ runner_release_test.go:132: unsafe release accepted missing_certification: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+FAIL
+FAIL amadan.net/oficina/equipo/internal/equipotest 0.131s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### bwrap
+
+Changed guard:
+
+```text
+scripts/runner-release-check.py
+- .decode().strip() == "bubblewrap 0.11.0"
++ .decode().strip() in ("bubblewrap 0.11.0", "bubblewrap 0.10.0")
+
+Makefile
+- @test "$$("$${EQUIPO_BWRAP_PATH:-/usr/bin/bwrap}" --version)" = "bubblewrap 0.11.0"
++ @test "$$("$${EQUIPO_BWRAP_PATH:-/usr/bin/bwrap}" --version)" = "bubblewrap 0.10.0"
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/equipotest -run ^TestDirectReleaseRequiresCertification$/^release(-runner)?$/^bwrap$ -count=1
+--- FAIL: TestDirectReleaseRequiresCertification (0.12s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release (0.06s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release/bwrap (0.06s)
+ runner_release_test.go:132: unsafe release accepted bwrap: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner (0.06s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner/bwrap (0.06s)
+ runner_release_test.go:132: unsafe release accepted bwrap: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+FAIL
+FAIL amadan.net/oficina/equipo/internal/equipotest 0.160s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### shared-home
+
+Changed guard:
+
+```text
+internal/runner/provider/direct_live_config.go
+- return !rules.RefusesPath(path) && !rules.refusedInode(info) && !refusedMountAlias(path, rules)
++ return true
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/runner/provider -run ^TestDirectLiveGateRequiresExplicitInputs$/^interactive_home$ -count=1
+--- FAIL: TestDirectLiveGateRequiresExplicitInputs (0.00s)
+ --- FAIL: TestDirectLiveGateRequiresExplicitInputs/interactive_home (0.00s)
+ direct_live_config_test.go:79: interactive home accepted
+FAIL
+FAIL amadan.net/oficina/equipo/internal/runner/provider 0.003s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### fake-cli
+
+Changed guard:
+
+```text
+scripts/runner-release-check.py
+- require(pin and installed[name] == pin[1])
++ require(pin)
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/equipotest -run ^TestDirectReleaseRequiresCertification$/^release(-runner)?$/^fake_cli$ -count=1
+--- FAIL: TestDirectReleaseRequiresCertification (0.12s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release (0.06s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release/fake_cli (0.06s)
+ runner_release_test.go:132: unsafe release accepted fake_cli: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner (0.06s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner/fake_cli (0.06s)
+ runner_release_test.go:132: unsafe release accepted fake_cli: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+FAIL
+FAIL amadan.net/oficina/equipo/internal/equipotest 0.161s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### live-copy
+
+Changed guard:
+
+```text
+scripts/runner-release-check.py
+- manifest["schema"] == 2 and manifest["live_gate_copy_reviewed"] is True
++ manifest["schema"] == 2
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/equipotest -run ^TestDirectReleaseRequiresCertification$/^release(-runner)?$/^pending_live_copy$ -count=1
+--- FAIL: TestDirectReleaseRequiresCertification (0.13s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release (0.06s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release/pending_live_copy (0.06s)
+ runner_release_test.go:132: unsafe release accepted pending_live_copy: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner (0.07s)
+ --- FAIL: TestDirectReleaseRequiresCertification/release-runner/pending_live_copy (0.07s)
+ runner_release_test.go:132: unsafe release accepted pending_live_copy: EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
+FAIL
+FAIL amadan.net/oficina/equipo/internal/equipotest 0.180s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### evidence-assertions
+
+Changed guard:
+
+```text
+internal/runner/provider/direct_certification.go
+- if VerifyDirectObservation(root, e.Checks[name], "pass") != nil {
++ _ = name
+ if false {
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/runner/provider -run ^TestDirectLiveGateEvidence$/^(Contract|Isolation|Recovery|Calibration)$ -count=1
+--- FAIL: TestDirectLiveGateEvidence (0.01s)
+ --- FAIL: TestDirectLiveGateEvidence/Contract (0.00s)
+ --- FAIL: TestDirectLiveGateEvidence/Contract/account-version-readback (0.00s)
+ direct_certification_test.go:65: missing assertion accepted
+ --- FAIL: TestDirectLiveGateEvidence/Contract/effective-policy-readback (0.00s)
+ direct_certification_test.go:65: missing assertion accepted
+ --- FAIL: TestDirectLiveGateEvidence/Contract/inner-sandbox-enabled (0.00s)
+ direct_certification_test.go:65: missing assertion accepted
+ --- FAIL: TestDirectLiveGateEvidence/Contract/immutable-settings (0.00s)
+ direct_certification_test.go:65: missing assertion accepted
+ --- FAIL: TestDirectLiveGateEvidence/Contract/strict-mcp (0.00s)
+ direct_certification_test.go:65: missing assertion accepted
+ --- FAIL: TestDirectLiveGateEvidence/Contract/exact-tool-inventory (0.00s)
+ direct_certification_test.go:65: missing assertion accepted
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### native-approval
+
+Changed guard:
+
+```text
+internal/runner/provider/direct_certification.go
+- p.ApprovalPolicy != "on-request"
++ false
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/runner/provider -run ^TestDirectLiveGateEvidence$/^approval$ -count=1
+--- FAIL: TestDirectLiveGateEvidence (0.00s)
+ --- FAIL: TestDirectLiveGateEvidence/approval (0.00s)
+ direct_certification_test.go:100: invalid evidence accepted
+FAIL
+FAIL amadan.net/oficina/equipo/internal/runner/provider 0.003s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### protected-alias
+
+Changed guard:
+
+```text
+internal/runner/provider/direct_certification.go
+- if VerifyDirectObservation(root, tool.Probes[path], "denied") != nil {
++ _ = path
+ if false {
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/runner/provider -run ^TestDirectLiveGateEvidence$/^untested_reader$ -count=1
+--- FAIL: TestDirectLiveGateEvidence (0.00s)
+ --- FAIL: TestDirectLiveGateEvidence/untested_reader (0.00s)
+ direct_certification_test.go:100: invalid evidence accepted
+FAIL
+FAIL amadan.net/oficina/equipo/internal/runner/provider 0.002s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+### calibration
+
+Changed guard:
+
+```text
+internal/runner/provider/direct_certification.go
+- n = ((n*2 + 999) / 1000) * 1000
++ n = ((n + 999) / 1000) * 1000
+```
+
+Command and result:
+
+```text
+$ CGO_ENABLED=0 go test ./internal/runner/provider -run ^TestDirectLiveGateCalibration$ -count=1
+--- FAIL: TestDirectLiveGateCalibration (0.00s)
+ direct_certification_test.go:15: reservation: 1000 1000 <nil>
+FAIL
+FAIL amadan.net/oficina/equipo/internal/runner/provider 0.002s
+FAIL
+exit 1
+```
+Exit 1; test failure, not a compile failure. Restored.
+
+## Final gates
+
+```sh
+CGO_ENABLED=0 go vet ./...
+make budget
+sh -n scripts/live-gate.sh
+git diff --check
+```
+
+Vet, shell syntax and whitespace checks exited 0 with no output. Budget exited 0:
+
+```text
+go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size
+budget size: 19 directories within budget
+```
+
+The reference scanner initially rejected changed command-path lines, the shared-home negative fixture and the lexical `node` substring in refusedInode. Its exact inventory is refreshed only for task-owned changed lines, preserving existing reasons elsewhere. The final scanner result is recorded in the controller addendum below. No make ci, full Go suite, migration suite, release build, provider prompt, sign-in, credential home creation, enrolment, deployment, merge, push, subagent, server or .claude/HANDOFF.md was performed. Empty temporary directories in unit fixtures represent homes; they contain no real credentials.
+
+## User-facing strings
+
+No new app-owned runtime strings. No new copy.go entries, pending or otherwise; existing individually pending entries remain unchanged.
+
+The entire rewritten `docs/live-gate.md` is DRAFT, copy review pending. The script's existing confirmation strings are unchanged and remain DRAFT:
+
+- Read docs/live-gate.md. Confirm bounded calibration funding and a disposable repository.
+- Type LIVE DISPOSABLE ONLY:
+- Confirm the enrolled connections, origin, machine fingerprint and disposable sentinel locations.
+- Type RUN LIVE GATE:
+
+The documentation references the existing labels `approved beyond profile` and `Allow once`; neither label was added or edited. No HTML/CSS was touched. README prose and vendored assets are unchanged.
+
+## Handoff
+
+The controller should review the offline changes and resolve the final-binary certification identity before adding the actual bounded live exercise driver. Keep production eligibility off. Paul still owns all live authorization, sign-in, actual recordings, copy approval, release creation, installation, enrolment, first bounded job, cancellation and merge. No background process is intended to persist. Scratch logs are removed after copying their evidence into this report and the controller report.
+
+
+### Controller addendum: final reference gate
+
+```sh
+python3 scripts/runner-dead-references.py
+```
+
+```text
+reference scan: 501 text files, 969 matches, 0 failures
+```
+Exit 0. Task-owned exact inventory entries were updated after reviewing each changed line. No blanket exceptions were introduced.
diff --git a/internal/equipotest/live_gate_test.go b/internal/equipotest/live_gate_test.go
index abccc93c..e955af87 100644
--- a/internal/equipotest/live_gate_test.go
+++ b/internal/equipotest/live_gate_test.go
@@ -9,6 +9,7 @@ import (
func TestLiveGateConfirmation(t *testing.T) {
for _, input := range []string{"", "no\n", "LIVE DISPOSABLE ONLY\nno\n", "LIVE DISPOSABLE ONLY\nRUN LIVE GATE\n"} {
cmd := exec.Command("/bin/sh", "../../scripts/live-gate.sh")
+ cmd.Env = []string{"PATH=/usr/bin:/bin"}
cmd.Stdin = strings.NewReader(input)
if out, err := cmd.CombinedOutput(); err == nil {
t.Fatalf("uncertified live harness succeeded: %s", out)
diff --git a/internal/equipotest/runner_release_test.go b/internal/equipotest/runner_release_test.go
index 1ef6976c..675528ba 100644
--- a/internal/equipotest/runner_release_test.go
+++ b/internal/equipotest/runner_release_test.go
@@ -12,7 +12,9 @@ import (
"testing"
"amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/equipo/team"
"amadan.net/oficina/equipo/internal/release"
+ "amadan.net/oficina/equipo/internal/runner/provider"
)
func TestRunnerReleaseContract(t *testing.T) {
@@ -50,12 +52,24 @@ func TestRunnerReleaseContract(t *testing.T) {
}
func TestRunnerReleaseContractPackaging(t *testing.T) {
- for _, scenario := range []string{"clean", "dirty", "untracked", "codex", "copy", "helper", "digest"} {
+ runnerPackagingScenarios(t, "release-runner", []string{"clean", "dirty", "untracked", "codex", "copy", "helper", "digest"})
+}
+
+func TestDirectReleaseRequiresCertification(t *testing.T) {
+ for _, target := range []string{"release", "release-runner"} {
+ t.Run(target, func(t *testing.T) {
+ runnerPackagingScenarios(t, target, []string{"clean", "missing_certification", "changed_policy", "fake_evidence", "fake_cli", "bwrap", "copy", "changed_tuple", "missing_assertion", "pending_live_copy", "tampered_capture", "codex_policy", "tool_inventory", "underfunded"})
+ })
+ }
+}
+
+func runnerPackagingScenarios(t *testing.T, target string, scenarios []string) {
+ for _, scenario := range scenarios {
t.Run(scenario, func(t *testing.T) {
root := t.TempDir()
bin := filepath.Join(root, "bin")
executionMust(t, os.Mkdir(bin, 0700))
- for _, name := range []string{"Makefile", "packaging/equipo-runner.service", "internal/release/manifest.json", "scripts/runner-release-check.py"} {
+ for _, name := range []string{"Makefile", "packaging/equipo-runner.service", "internal/release/manifest.json", "scripts/runner-release-check.py", "internal/runner/provider/direct_requirements.json", "internal/runner/provider/claude/launcher.go", "internal/runner/provider/codex/launcher.go"} {
raw, err := os.ReadFile("../../" + name)
executionMust(t, err)
executionMust(t, os.MkdirAll(filepath.Dir(filepath.Join(root, name)), 0700))
@@ -65,6 +79,7 @@ func TestRunnerReleaseContractPackaging(t *testing.T) {
"git": "#!/bin/sh\ncase \"$1\" in diff) [ \"$SCENARIO\" != dirty ];; rev-parse) echo abc1234;; ls-files) if [ \"$SCENARIO\" = untracked ]; then echo unsafe.go; fi;; esac\n",
"go": "#!/bin/sh\ncase \"$1\" in test) [ \"$SCENARIO\" != copy ];; build) printf '%s\\n' \"$GOOS/$GOARCH\" \"$@\" > \"$CAPTURE\"; while [ $# -gt 0 ]; do if [ \"$1\" = -o ]; then shift; touch \"$1\"; fi; shift; done;; esac\n",
"codex": "#!/bin/sh\n[ \"$SCENARIO\" != codex ] && echo 'codex-cli 0.165.0'\n",
+ "bwrap": "#!/bin/sh\nif [ \"$SCENARIO\" = bwrap ]; then echo 'bubblewrap 0.10.0'; else echo 'bubblewrap 0.11.0'; fi\n",
"systemctl": "#!/bin/sh\nexit 98\n",
"carlos": "#!/bin/sh\nexit 99\n",
}
@@ -79,7 +94,7 @@ func TestRunnerReleaseContractPackaging(t *testing.T) {
var installed []string
for name, version := range map[string]string{"claude": fixture.Claude, "codex": fixture.Codex, "codex-code-mode-host": fixture.Codex, "bwrap": fixture.BwrapVersion} {
path := filepath.Join(bin, name)
- if name != "codex" {
+ if name != "codex" && name != "bwrap" {
executionMust(t, os.WriteFile(path, []byte("#!/bin/sh\nexit 0\n"), 0700))
}
raw, err := os.ReadFile(path)
@@ -96,6 +111,7 @@ func TestRunnerReleaseContractPackaging(t *testing.T) {
}
fixture.DirectPolicies = append(fixture.DirectPolicies, release.PolicyCertificate{Provider: name, ProviderVersion: version, LauncherVersion: fixture.LauncherVersion, BwrapVersion: fixture.BwrapVersion, PolicyHash: strings.Repeat("a", 64)})
}
+ installCertificationFixture(t, root, &fixture, scenario)
bytes, err := json.Marshal(fixture)
executionMust(t, err)
executionMust(t, os.WriteFile(filepath.Join(root, "internal/release/manifest.json"), bytes, 0600))
@@ -106,7 +122,7 @@ func TestRunnerReleaseContractPackaging(t *testing.T) {
executionMust(t, os.WriteFile(filepath.Join(bin, "claude"), []byte("changed"), 0700))
}
capture := filepath.Join(root, "build.args")
- cmd := exec.Command("make", "--no-print-directory", "release-runner")
+ cmd := exec.Command("make", "--no-print-directory", target)
cmd.Dir = root
cmd.Env = []string{"PATH=" + bin + ":/usr/bin:/bin", "SCENARIO=" + scenario, "CAPTURE=" + capture}
cmd.Env = append(cmd.Env, installed...)
@@ -125,10 +141,16 @@ func TestRunnerReleaseContractPackaging(t *testing.T) {
}
raw, err := os.ReadFile(capture)
executionMust(t, err)
- if !strings.Contains(string(raw), "linux/amd64") || !strings.Contains(string(raw), "BuildVersion=abc1234") {
+ wantTarget := "linux/amd64"
+ manifestPath := "releases/equipo-runner-linux-amd64-abc1234/manifest.json"
+ if target == "release" {
+ wantTarget = "linux/arm64"
+ manifestPath = "releases/equipo-linux-arm64-abc1234.manifest.json"
+ }
+ if !strings.Contains(string(raw), wantTarget) || !strings.Contains(string(raw), "BuildVersion=abc1234") {
t.Fatalf("wrong stamped build: %s", raw)
}
- shipped, err := os.ReadFile(filepath.Join(root, "releases/equipo-runner-linux-amd64/manifest.json"))
+ shipped, err := os.ReadFile(filepath.Join(root, manifestPath))
executionMust(t, err)
source, err := os.ReadFile(filepath.Join(root, "internal/release/manifest.json"))
executionMust(t, err)
@@ -155,3 +177,91 @@ func TestRunnerReleaseContractUnlistedReport(t *testing.T) {
f.choice(t, "")
f.denied(t, "engineering", "")
}
+
+// The positive packaging fixture has its own synthetic pin sources. Production
+// pins are left intact in fake_cli, which must reject the same executable files.
+func installCertificationFixture(t *testing.T, root string, m *release.Manifest, scenario string) {
+ t.Helper()
+ m.LiveGateCopyReviewed = scenario != "pending_live_copy"
+ binaryHashes := map[string]string{"runner": strings.Repeat("b", 64)}
+ for _, b := range m.Binaries {
+ binaryHashes[b.Name] = b.SHA256
+ }
+ if scenario != "fake_cli" {
+ for _, name := range []string{"claude", "codex"} {
+ path := filepath.Join(root, "internal/runner/provider", name, "launcher.go")
+ data, err := os.ReadFile(path)
+ executionMust(t, err)
+ lines := strings.Split(string(data), "\n")
+ for i, line := range lines {
+ if strings.HasPrefix(line, "const ExecutableSHA256 =") {
+ lines[i] = fmt.Sprintf("const ExecutableSHA256 = %q", binaryHashes[name])
+ }
+ if strings.HasPrefix(line, "const CodeModeHostSHA256 =") {
+ lines[i] = fmt.Sprintf("const CodeModeHostSHA256 = %q", binaryHashes["codex-code-mode-host"])
+ }
+ }
+ executionMust(t, os.WriteFile(path, []byte(strings.Join(lines, "\n")), 0600))
+ }
+ }
+ for _, c := range m.DirectPolicies {
+ dir := filepath.Join(root, "internal/release/evidence", c.Provider)
+ executionMust(t, os.MkdirAll(dir, 0700))
+ artifact := []byte("synthetic observation for packaging tests only\n")
+ executionMust(t, os.WriteFile(filepath.Join(dir, "capture.json"), artifact, 0600))
+ o := provider.LiveObservation{Status: "pass", Artifact: "capture.json", SHA256: fmt.Sprintf("%x", sha256.Sum256(artifact)), Detail: "synthetic fixture"}
+ e := provider.DirectEvidence{Schema: 1, Source: "direct-live", RunID: "fixture", Provider: c.Provider, ProviderVersion: c.ProviderVersion, LauncherVersion: c.LauncherVersion, BwrapVersion: c.BwrapVersion, PolicyVersion: m.PolicyVersion, PolicyHash: c.PolicyHash, AccountID: "fixture", HomeID: "fixture", Model: "fixture", Specialist: "Engineering", AuthHost: "auth.example.com", ConfigSHA256: strings.Repeat("c", 64), Binaries: binaryHashes, Checks: map[string]provider.LiveObservation{}, Usage: []provider.LiveUsage{{Input: 1, Output: 1, Complete: true}}, Funding: provider.LiveFunding{Calls: 1, InputTokens: 1000, OutputTokens: 1000, Seconds: 60, JobInput: 23000, JobOutput: 23000, ProjectInputHeadroom: 23000, ProjectOutputHeadroom: 23000, TeamInputHeadroom: 23000, TeamOutputHeadroom: 23000}}
+ for _, group := range []string{"Contract", "Isolation", "Recovery", "Calibration"} {
+ for _, name := range provider.DirectRequirements(group) {
+ e.Checks[name] = o
+ }
+ }
+ tools := map[string]string{"Read": "native", "Write": "native", "Edit": "native", "Glob": "search", "Grep": "search", "Bash": "shell", "mcp__equipo__permission": "mcp", "mcp__equipo__ask_person": "mcp", "mcp__equipo__submit_candidate": "mcp"}
+ for name, surface := range tools {
+ tool := provider.LiveTool{Name: name, Surface: surface, Exposed: true, Probes: map[string]provider.LiveObservation{}}
+ for _, path := range []string{"selected-home", "other-home", "runner-state", "/egress", "/tool/equipo.sock", "symlink", "/proc/*/root", "/proc/*/fd", "/dev/fd"} {
+ denied := o
+ denied.Status = "denied"
+ tool.Probes[path] = denied
+ }
+ e.Tools = append(e.Tools, tool)
+ }
+ e.Tools = append(e.Tools, provider.LiveTool{Name: "image", Surface: "image", MissingReason: "not exposed in fixture", Probes: map[string]provider.LiveObservation{}})
+ if c.Provider == "codex" {
+ e.CodexPolicy = &provider.LiveCodexPolicy{ApprovalPolicy: "on-request", ApprovalsReviewer: "user", StrictConfig: true, DenyProfile: true}
+ }
+ switch scenario {
+ case "fake_evidence":
+ e.Source = "fake-cli"
+ case "missing_assertion":
+ delete(e.Checks, "mid-turn-runner-kill")
+ case "codex_policy":
+ if e.CodexPolicy != nil {
+ e.CodexPolicy.ApprovalPolicy = "never"
+ }
+ case "tool_inventory":
+ e.Tools = append(e.Tools, provider.LiveTool{Name: "WebFetch", Surface: "native", Exposed: true, Probes: e.Tools[0].Probes})
+ case "underfunded":
+ e.Funding.JobInput = 1
+ }
+ raw, err := json.Marshal(e)
+ executionMust(t, err)
+ path := filepath.Join(dir, "certification.json")
+ executionMust(t, os.WriteFile(path, raw, 0600))
+ rel, err := filepath.Rel(root, path)
+ executionMust(t, err)
+ m.Certifications = append(m.Certifications, release.Certification{Provider: c.Provider, PolicyHash: c.PolicyHash, Path: rel, SHA256: fmt.Sprintf("%x", sha256.Sum256(raw))})
+ m.VerifiedIsolationTuples = append(m.VerifiedIsolationTuples, team.IsolationTuple{Provider: c.Provider, ProviderVersion: c.ProviderVersion, LauncherVersion: c.LauncherVersion, BwrapVersion: c.BwrapVersion, PolicyVersion: m.PolicyVersion, IsolationConfigHash: c.PolicyHash})
+ if scenario == "tampered_capture" {
+ executionMust(t, os.WriteFile(filepath.Join(dir, "capture.json"), []byte("changed"), 0600))
+ }
+ }
+ switch scenario {
+ case "missing_certification":
+ m.Certifications = []release.Certification{}
+ case "changed_policy":
+ m.DirectPolicies[0].PolicyHash = strings.Repeat("d", 64)
+ case "changed_tuple":
+ m.VerifiedIsolationTuples[0].PolicyVersion = "changed"
+ }
+}
diff --git a/internal/release/manifest.go b/internal/release/manifest.go
index 7fe8506a..23a0142e 100644
--- a/internal/release/manifest.go
+++ b/internal/release/manifest.go
@@ -32,7 +32,16 @@ type BinaryDigest struct {
SHA256 string `json:"sha256"`
}
+type Certification struct {
+ Provider string `json:"provider"`
+ PolicyHash string `json:"policy_hash"`
+ Path string `json:"path"`
+ SHA256 string `json:"sha256"`
+}
+
type Manifest struct {
+ Certifications []Certification `json:"certifications"`
+ LiveGateCopyReviewed bool `json:"live_gate_copy_reviewed"`
Binaries []BinaryDigest `json:"binaries"`
DirectPolicies []PolicyCertificate `json:"direct_policies,omitempty"`
LauncherVersion string `json:"launcher_version,omitempty"`
diff --git a/internal/release/manifest.json b/internal/release/manifest.json
index 8fbc1c2e..cd31623b 100644
--- a/internal/release/manifest.json
+++ b/internal/release/manifest.json
@@ -11,5 +11,7 @@
"bwrap_version": "0.11.0",
"policy_version": "direct-v1",
"direct_policies": [],
- "binaries": []
+ "binaries": [],
+ "certifications": [],
+ "live_gate_copy_reviewed": false
}
diff --git a/internal/runner/provider/direct_certification.go b/internal/runner/provider/direct_certification.go
new file mode 100644
index 00000000..dab82a53
--- /dev/null
+++ b/internal/runner/provider/direct_certification.go
@@ -0,0 +1,252 @@
+package provider
+
+import (
+ "crypto/sha256"
+ _ "embed"
+ "encoding/hex"
+ "encoding/json"
+ "math"
+ "os"
+ "path/filepath"
+ "slices"
+)
+
+//go:embed direct_requirements.json
+var directRequirements []byte
+
+// DirectEvidence indexes captured live observations. These are reviewed evidence,
+// not remote attestation: a trusted operator must inspect the referenced files.
+// Synthetic unit-test observations never become production certificates.
+type DirectEvidence struct {
+ Schema int `json:"schema"`
+ Source string `json:"source"`
+ RunID string `json:"run_id"`
+ Provider string `json:"provider"`
+ ProviderVersion string `json:"provider_version"`
+ LauncherVersion string `json:"launcher_version"`
+ BwrapVersion string `json:"bwrap_version"`
+ PolicyVersion string `json:"policy_version"`
+ PolicyHash string `json:"policy_hash"`
+ AccountID string `json:"account_id"`
+ HomeID string `json:"home_id"`
+ Model string `json:"model"`
+ Specialist string `json:"specialist"`
+ AuthHost string `json:"auth_host"`
+ ConfigSHA256 string `json:"config_sha256"`
+ Binaries map[string]string `json:"binaries"`
+ Checks map[string]LiveObservation `json:"checks"`
+ Tools []LiveTool `json:"tools"`
+ Usage []LiveUsage `json:"usage"`
+ Funding LiveFunding `json:"funding"`
+ CodexPolicy *LiveCodexPolicy `json:"codex_policy,omitempty"`
+}
+type LiveCodexPolicy struct {
+ ApprovalPolicy string `json:"approvalPolicy"`
+ ApprovalsReviewer string `json:"approvalsReviewer"`
+ StrictConfig bool `json:"strict_config"`
+ DenyProfile bool `json:"deny_profile"`
+}
+type LiveObservation struct {
+ Status string `json:"status"`
+ Artifact string `json:"artifact"`
+ SHA256 string `json:"sha256"`
+ Detail string `json:"detail"`
+}
+type LiveTool struct {
+ Name string `json:"name"`
+ Surface string `json:"surface"`
+ Exposed bool `json:"exposed"`
+ MissingReason string `json:"missing_reason,omitempty"`
+ Probes map[string]LiveObservation `json:"probes"`
+}
+type LiveUsage struct {
+ Input int64 `json:"input"`
+ Output int64 `json:"output"`
+ Complete bool `json:"complete"`
+}
+
+func DirectRequirements(group string) []string {
+ var groups map[string][]string
+ if json.Unmarshal(directRequirements, &groups) != nil {
+ panic("invalid certification requirements")
+ }
+ return groups[group]
+}
+
+func DirectReservations(samples []LiveUsage) (int64, int64, error) {
+ if len(samples) == 0 {
+ return 0, 0, ErrPolicy
+ }
+ var input, output int64
+ for _, s := range samples {
+ if !s.Complete || s.Input < 0 || s.Output < 0 {
+ return 0, 0, ErrPolicy
+ }
+ input = max(input, s.Input)
+ output = max(output, s.Output)
+ }
+ round := func(n int64) (int64, error) {
+ if n <= 0 || n > (math.MaxInt64-999)/2 {
+ return 0, ErrPolicy
+ }
+ n = ((n*2 + 999) / 1000) * 1000
+ if n > math.MaxInt64/23 {
+ return 0, ErrPolicy
+ }
+ return n, nil
+ }
+ in, err := round(input)
+ if err != nil {
+ return 0, 0, err
+ }
+ out, err := round(output)
+ return in, out, err
+}
+
+// VerifyDirectObservation requires a nonempty artifact under the evidence root.
+// Hashes cover sanitized observations, never credential files or their contents.
+func VerifyDirectObservation(root string, o LiveObservation, status string) error {
+ if o.Status != status || o.Detail == "" || !filepath.IsLocal(o.Artifact) || o.Artifact == "." {
+ return ErrPolicy
+ }
+ path := filepath.Join(root, o.Artifact)
+ real, err := filepath.EvalSymlinks(path)
+ if err != nil || real != path {
+ return ErrPolicy
+ }
+ info, err := os.Lstat(path)
+ if err != nil || !info.Mode().IsRegular() || info.Size() == 0 || info.Size() > 16<<20 {
+ return ErrPolicy
+ }
+ raw, err := os.ReadFile(path)
+ if err != nil || DigestDirectEvidence(raw) != o.SHA256 {
+ return ErrPolicy
+ }
+ return nil
+}
+func DigestDirectEvidence(raw []byte) string {
+ s := sha256.Sum256(raw)
+ return hex.EncodeToString(s[:])
+}
+
+func (e DirectEvidence) ValidateGroup(root, group string) error {
+ required := DirectRequirements(group)
+ if len(required) == 0 || e.Schema != 1 || e.Source != "direct-live" || e.RunID == "" || e.LauncherVersion != "direct-v2" || e.BwrapVersion != "0.11.0" || e.PolicyVersion != PolicyVersion || !liveDigest(e.PolicyHash) || !liveDigest(e.ConfigSHA256) || e.AccountID == "" || e.HomeID == "" || e.Model == "" || !liveAuthHost(e.AuthHost) {
+ return ErrPolicy
+ }
+ version := map[string]string{"claude": "2.1.312", "codex": "0.165.0"}[e.Provider]
+ if version == "" || version != e.ProviderVersion {
+ return ErrPolicy
+ }
+ for _, name := range []string{"claude", "codex", "codex-code-mode-host", "bwrap", "runner"} {
+ if !liveDigest(e.Binaries[name]) {
+ return ErrPolicy
+ }
+ }
+ for _, name := range required {
+ if VerifyDirectObservation(root, e.Checks[name], "pass") != nil {
+ return ErrPolicy
+ }
+ }
+ if e.Provider == "codex" {
+ p := e.CodexPolicy
+ if p == nil || p.ApprovalPolicy != "on-request" || p.ApprovalsReviewer != "user" || !p.StrictConfig || !p.DenyProfile {
+ return ErrPolicy
+ }
+ }
+ if group == "Contract" || group == "Isolation" {
+ return e.validateTools(root, group == "Isolation")
+ }
+ if group == "Calibration" {
+ return e.validateFunding()
+ }
+ return nil
+}
+func (e DirectEvidence) validateFunding() error {
+ in, out, err := DirectReservations(e.Usage)
+ if err != nil {
+ return err
+ }
+ f := e.Funding
+ if f.Calls < int64(len(e.Usage)) || f.Seconds <= 0 || f.JobInput < 23*in || f.JobOutput < 23*out || f.ProjectInputHeadroom < f.JobInput || f.ProjectOutputHeadroom < f.JobOutput || f.TeamInputHeadroom < f.JobInput || f.TeamOutputHeadroom < f.JobOutput {
+ return ErrPolicy
+ }
+ var totalIn, totalOut int64
+ for _, u := range e.Usage {
+ if u.Input > f.InputTokens-totalIn || u.Output > f.OutputTokens-totalOut {
+ return ErrPolicy
+ }
+ totalIn += u.Input
+ totalOut += u.Output
+ }
+ return nil
+}
+func liveDigest(s string) bool { b, e := hex.DecodeString(s); return e == nil && len(b) == 32 }
+
+func (e DirectEvidence) validateTools(root string, probes bool) error {
+ seen := map[string]bool{}
+ surfaces := map[string]bool{}
+ exposed := []string{}
+ for _, tool := range e.Tools {
+ if tool.Name == "" || seen[tool.Name] || !slices.Contains([]string{"native", "shell", "search", "image", "mcp"}, tool.Surface) {
+ return ErrPolicy
+ }
+ seen[tool.Name] = true
+ surfaces[tool.Surface] = true
+ if !tool.Exposed {
+ if tool.MissingReason == "" || len(tool.Probes) != 0 {
+ return ErrPolicy
+ }
+ continue
+ }
+ exposed = append(exposed, tool.Name)
+ if tool.MissingReason != "" {
+ return ErrPolicy
+ }
+ if probes {
+ for _, path := range []string{"selected-home", "other-home", "runner-state", "/egress", "/tool/equipo.sock", "symlink", "/proc/*/root", "/proc/*/fd", "/dev/fd"} {
+ if VerifyDirectObservation(root, tool.Probes[path], "denied") != nil {
+ return ErrPolicy
+ }
+ }
+ }
+ }
+ for _, surface := range []string{"native", "shell", "search", "image", "mcp"} {
+ if !surfaces[surface] {
+ return ErrPolicy
+ }
+ }
+ if e.Provider == "claude" {
+ expected := []string{"Read", "Glob", "Grep", "Bash"}
+ switch e.Specialist {
+ case "Engineering":
+ expected = append(expected, "Write", "Edit")
+ case "Review", "Product":
+ default:
+ return ErrPolicy
+ }
+ expected = append(expected, "mcp__equipo__permission", "mcp__equipo__ask_person")
+ stepTool := map[string]string{"Engineering": "mcp__equipo__submit_candidate", "Review": "mcp__equipo__submit_review", "Product": "mcp__equipo__submit_reproduction"}[e.Specialist]
+ expected = append(expected, stepTool)
+ // Engineering's reproduction policy has a distinct hash and tool inventory.
+ if slices.Contains(exposed, "mcp__equipo__submit_reproduction") && e.Specialist == "Engineering" {
+ expected[len(expected)-1] = "mcp__equipo__submit_reproduction"
+ }
+ slices.Sort(expected)
+ slices.Sort(exposed)
+ if !slices.Equal(expected, exposed) {
+ return ErrPolicy
+ }
+ } else {
+ for _, surface := range []string{"native", "shell", "search", "mcp"} {
+ found := false
+ for _, tool := range e.Tools {
+ found = found || tool.Exposed && tool.Surface == surface
+ }
+ if !found {
+ return ErrPolicy
+ }
+ }
+ }
+ return nil
+}
diff --git a/internal/runner/provider/direct_certification_test.go b/internal/runner/provider/direct_certification_test.go
new file mode 100644
index 00000000..174f8951
--- /dev/null
+++ b/internal/runner/provider/direct_certification_test.go
@@ -0,0 +1,113 @@
+package provider
+
+import (
+ "math"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestDirectLiveGateCalibration(t *testing.T) {
+ for _, tc := range []struct{ in, out, wantIn, wantOut int64 }{{1, 1, 1000, 1000}, {500, 501, 1000, 2000}, {1001, 2000, 3000, 4000}} {
+ in, out, err := DirectReservations([]LiveUsage{{Input: tc.in, Output: tc.out, Complete: true}})
+ if err != nil || in != tc.wantIn || out != tc.wantOut {
+ t.Fatalf("reservation: %d %d %v", in, out, err)
+ }
+ }
+ for _, rows := range [][]LiveUsage{nil, {{Input: 1, Output: 1}}, {{Input: -1, Output: 1, Complete: true}}, {{Input: math.MaxInt64, Output: 1, Complete: true}}, {{Input: math.MaxInt64 / 46, Output: 1, Complete: true}}} {
+ if _, _, err := DirectReservations(rows); err == nil {
+ t.Fatal("unknown or overflowing calibration accepted")
+ }
+ }
+}
+
+func directEvidenceFixture(t *testing.T) (DirectEvidence, string) {
+ t.Helper()
+ root := t.TempDir()
+ raw := []byte("synthetic captured observation\n")
+ if err := os.WriteFile(filepath.Join(root, "capture.json"), raw, 0600); err != nil {
+ t.Fatal(err)
+ }
+ observation := LiveObservation{Status: "pass", Artifact: "capture.json", SHA256: DigestDirectEvidence(raw), Detail: "synthetic unit-test fixture"}
+ e := DirectEvidence{Schema: 1, Source: "direct-live", RunID: "fixture", Provider: "codex", ProviderVersion: "0.165.0", LauncherVersion: "direct-v2", BwrapVersion: "0.11.0", PolicyVersion: PolicyVersion, PolicyHash: strings.Repeat("a", 64), AccountID: "fixture", HomeID: "fixture", Model: "fixture", AuthHost: "auth.example.com", ConfigSHA256: strings.Repeat("b", 64), Binaries: map[string]string{}, Checks: map[string]LiveObservation{}, Usage: []LiveUsage{{Input: 1, Output: 1, Complete: true}}, Funding: LiveFunding{Calls: 1, InputTokens: 1000, OutputTokens: 1000, Seconds: 60, JobInput: 23000, JobOutput: 23000, ProjectInputHeadroom: 23000, ProjectOutputHeadroom: 23000, TeamInputHeadroom: 23000, TeamOutputHeadroom: 23000}, CodexPolicy: &LiveCodexPolicy{ApprovalPolicy: "on-request", ApprovalsReviewer: "user", StrictConfig: true, DenyProfile: true}}
+ for _, name := range []string{"claude", "codex", "codex-code-mode-host", "bwrap", "runner"} {
+ e.Binaries[name] = strings.Repeat("c", 64)
+ }
+ for _, group := range []string{"Contract", "Isolation", "Recovery", "Calibration"} {
+ for _, key := range DirectRequirements(group) {
+ e.Checks[key] = observation
+ }
+ }
+ for _, surface := range []string{"native", "shell", "search", "image", "mcp"} {
+ tool := LiveTool{Name: surface, Surface: surface, Exposed: true, Probes: map[string]LiveObservation{}}
+ for _, path := range []string{"selected-home", "other-home", "runner-state", "/egress", "/tool/equipo.sock", "symlink", "/proc/*/root", "/proc/*/fd", "/dev/fd"} {
+ o := observation
+ o.Status = "denied"
+ tool.Probes[path] = o
+ }
+ e.Tools = append(e.Tools, tool)
+ }
+ return e, root
+}
+func TestDirectLiveGateEvidence(t *testing.T) {
+ for _, group := range []string{"Contract", "Isolation", "Recovery", "Calibration"} {
+ t.Run(group, func(t *testing.T) {
+ e, root := directEvidenceFixture(t)
+ if err := e.ValidateGroup(root, group); err != nil {
+ t.Fatal(err)
+ }
+ for _, assertion := range DirectRequirements(group) {
+ t.Run(assertion, func(t *testing.T) {
+ saved := e.Checks[assertion]
+ delete(e.Checks, assertion)
+ if e.ValidateGroup(root, group) == nil {
+ t.Fatal("missing assertion accepted")
+ }
+ bad := saved
+ bad.Status = "fail"
+ e.Checks[assertion] = bad
+ if e.ValidateGroup(root, group) == nil {
+ t.Fatal("failed assertion accepted")
+ }
+ e.Checks[assertion] = saved
+ })
+ }
+ })
+ }
+ for _, tc := range []struct {
+ name, group string
+ edit func(*DirectEvidence)
+ }{
+ {"fake", "Contract", func(e *DirectEvidence) { e.Source = "fake-cli" }},
+ {"deny_profile", "Contract", func(e *DirectEvidence) { e.CodexPolicy.DenyProfile = false }},
+ {"approval", "Contract", func(e *DirectEvidence) { e.CodexPolicy.ApprovalPolicy = "never" }},
+ {"reviewer", "Contract", func(e *DirectEvidence) { e.CodexPolicy.ApprovalsReviewer = "auto" }},
+ {"strict_config", "Contract", func(e *DirectEvidence) { e.CodexPolicy.StrictConfig = false }},
+ {"missing_surface", "Isolation", func(e *DirectEvidence) { e.Tools = e.Tools[1:] }},
+ {"untested_reader", "Isolation", func(e *DirectEvidence) { delete(e.Tools[0].Probes, "/proc/*/fd") }},
+ {"unknown_tools", "Isolation", func(e *DirectEvidence) { e.Tools[0].Exposed = false; e.Tools[0].Probes = nil }},
+ {"funding", "Calibration", func(e *DirectEvidence) { e.Funding.JobInput = 22999 }},
+ {"team_headroom", "Calibration", func(e *DirectEvidence) { e.Funding.TeamInputHeadroom = 1 }},
+ {"project_headroom", "Calibration", func(e *DirectEvidence) { e.Funding.ProjectOutputHeadroom = 1 }},
+ {"usage_unknown", "Calibration", func(e *DirectEvidence) { e.Usage[0].Complete = false }},
+ {"calibration_budget", "Calibration", func(e *DirectEvidence) { e.Funding.InputTokens = 0 }},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ e, root := directEvidenceFixture(t)
+ tc.edit(&e)
+ if e.ValidateGroup(root, tc.group) == nil {
+ t.Fatal("invalid evidence accepted")
+ }
+ })
+ }
+ t.Run("tamper", func(t *testing.T) {
+ e, root := directEvidenceFixture(t)
+ if err := os.WriteFile(filepath.Join(root, "capture.json"), []byte("changed"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ if e.ValidateGroup(root, "Contract") == nil {
+ t.Fatal("changed evidence accepted")
+ }
+ })
+}
diff --git a/internal/runner/provider/direct_live_config.go b/internal/runner/provider/direct_live_config.go
new file mode 100644
index 00000000..acb34e24
--- /dev/null
+++ b/internal/runner/provider/direct_live_config.go
@@ -0,0 +1,163 @@
+package provider
+
+import (
+ "encoding/json"
+ "io"
+ "net/url"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+// DirectLiveConfig is an explicit, operator-owned input to certification. It is
+// never populated by discovering logins or by reading interactive CLI config.
+type DirectLiveConfig struct {
+ RunID string `json:"run_id"`
+ Repository string `json:"repository"`
+ Disposable bool `json:"disposable"`
+ EvidenceDir string `json:"evidence_dir"`
+ Origin string `json:"origin"`
+ MachineFingerprint string `json:"machine_fingerprint"`
+ Bindings []DirectLiveBinding `json:"bindings"`
+ Sentinels map[string]string `json:"sentinels"`
+ Funding LiveFunding `json:"funding"`
+}
+type DirectLiveBinding struct {
+ Binding Binding `json:"binding"`
+ Model string `json:"model"`
+ AuthHost string `json:"auth_host"`
+ ClaudeTOFUConfirmed bool `json:"claude_tofu_confirmed"`
+}
+type LiveFunding struct {
+ Calls, InputTokens, OutputTokens, Seconds int64
+ JobInput, JobOutput int64
+ ProjectInputHeadroom, ProjectOutputHeadroom int64
+ TeamInputHeadroom, TeamOutputHeadroom int64
+}
+
+// LoadDirectLiveConfig checks opt-in before opening any configuration file.
+func LoadDirectLiveConfig(getenv func(string) string) (DirectLiveConfig, error) {
+ var c DirectLiveConfig
+ if getenv("EQUIPO_LIVE_DIRECT") != "1" {
+ return c, ErrPolicy
+ }
+ path := getenv("EQUIPO_LIVE_CONFIG")
+ if !cleanPath(path) {
+ return c, ErrPolicy
+ }
+ f, err := os.Open(path)
+ if err != nil {
+ return c, ErrPolicy
+ }
+ defer f.Close()
+ d := json.NewDecoder(io.LimitReader(f, 1<<20))
+ d.DisallowUnknownFields()
+ if d.Decode(&c) != nil {
+ return DirectLiveConfig{}, ErrPolicy
+ }
+ var extra any
+ if d.Decode(&extra) != io.EOF {
+ return DirectLiveConfig{}, ErrPolicy
+ }
+ return c, c.Validate(getenv("EQUIPO_LIVE_DIRECT"))
+}
+
+func (c DirectLiveConfig) Validate(enabled string) error {
+ if enabled != "1" || !c.Disposable || c.RunID == "" || c.MachineFingerprint == "" || len(c.Bindings) != 2 {
+ return ErrPolicy
+ }
+ u, err := url.Parse(c.Origin)
+ if err != nil || u.Host == "" || u.User != nil || u.Path != "" || u.RawQuery != "" || u.Fragment != "" || (u.Scheme != "https" && !(u.Scheme == "http" && u.Hostname() == "127.0.0.1")) {
+ return ErrPolicy
+ }
+ for _, n := range []int64{c.Funding.Calls, c.Funding.InputTokens, c.Funding.OutputTokens, c.Funding.Seconds, c.Funding.JobInput, c.Funding.JobOutput, c.Funding.ProjectInputHeadroom, c.Funding.ProjectOutputHeadroom, c.Funding.TeamInputHeadroom, c.Funding.TeamOutputHeadroom} {
+ if n <= 0 {
+ return ErrPolicy
+ }
+ }
+ roots := []string{c.Repository, c.EvidenceDir}
+ for _, path := range append(append([]string{}, roots...), filepath.Join(c.Repository, ".git")) {
+ f, err := pinDirectory(path)
+ if err != nil {
+ return ErrPolicy
+ }
+ f.Close()
+ }
+ seen := map[string]bool{}
+ rules := DefaultHomeRules()
+ for _, entry := range c.Bindings {
+ b := entry.Binding
+ version := map[string]string{"claude": "2.1.312", "codex": "0.165.0"}[b.Provider]
+ if version == "" || seen[b.Provider] || b.ID == "" || b.AccountID == "" || b.Expected.AccountID != b.AccountID || b.Expected.HomeID == "" || b.Expected.ProviderVersion != version || entry.Model == "" || !liveAuthHost(entry.AuthHost) || (b.Provider == "claude" && !entry.ClaudeTOFUConfirmed) {
+ return ErrIdentity
+ }
+ seen[b.Provider] = true
+ f, err := pinDirectory(b.Home)
+ if err != nil {
+ return ErrPolicy
+ }
+ info, err := f.Stat()
+ private := privateDirectory(f)
+ f.Close()
+ if err != nil || !private || !liveHomeAllowed(b.Home, info, rules) {
+ return ErrPolicy
+ }
+ roots = append(roots, b.Home)
+ if !withinPath(c.Sentinels[b.Provider], b.Home) {
+ return ErrPolicy
+ }
+ }
+ for i, a := range roots {
+ for _, b := range roots[i+1:] {
+ if withinPath(a, b) || withinPath(b, a) {
+ return ErrPolicy
+ }
+ }
+ }
+ if !withinPath(c.Sentinels["repo"], c.Repository) {
+ return ErrPolicy
+ }
+ paths := map[string]bool{}
+ for _, name := range []string{"claude", "codex", "other", "state", "repo"} {
+ path := c.Sentinels[name]
+ if !cleanPath(path) || paths[path] {
+ return ErrPolicy
+ }
+ paths[path] = true
+ real, err := filepath.EvalSymlinks(path)
+ if err != nil || real != path {
+ return ErrPolicy
+ }
+ info, err := os.Lstat(path)
+ if err != nil || !info.Mode().IsRegular() || info.Size() == 0 {
+ return ErrPolicy
+ }
+ if name == "other" || name == "state" {
+ for _, root := range roots {
+ if withinPath(path, root) {
+ return ErrPolicy
+ }
+ }
+ }
+ }
+ return nil
+}
+func liveHomeAllowed(path string, info os.FileInfo, rules HomeRules) bool {
+ return !rules.RefusesPath(path) && !rules.refusedInode(info) && !refusedMountAlias(path, rules)
+}
+func liveAuthHost(host string) bool {
+ if !strings.Contains(host, ".") || strings.ContainsAny(host, "/:@* \t\n") || host != strings.ToLower(host) {
+ return false
+ }
+ for _, label := range strings.Split(host, ".") {
+ if label == "" || strings.HasPrefix(label, "-") || strings.HasSuffix(label, "-") {
+ return false
+ }
+ for _, r := range label {
+ if !(r >= 'a' && r <= 'z' || r >= '0' && r <= '9' || r == '-') {
+ return false
+ }
+ }
+ }
+ return true
+}
diff --git a/internal/runner/provider/direct_live_config_test.go b/internal/runner/provider/direct_live_config_test.go
new file mode 100644
index 00000000..af4393e9
--- /dev/null
+++ b/internal/runner/provider/direct_live_config_test.go
@@ -0,0 +1,93 @@
+package provider
+
+import (
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "testing"
+)
+
+func liveConfigFixture(t *testing.T) DirectLiveConfig {
+ t.Helper()
+ root := t.TempDir()
+ dirs := map[string]string{}
+ for _, name := range []string{"repo", "claude", "codex", "other", "state", "evidence"} {
+ dirs[name] = filepath.Join(root, name)
+ if err := os.Mkdir(dirs[name], 0700); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := os.Mkdir(filepath.Join(dirs["repo"], ".git"), 0700); err != nil {
+ t.Fatal(err)
+ }
+ c := DirectLiveConfig{Repository: dirs["repo"], Disposable: true, EvidenceDir: dirs["evidence"], RunID: "offline-fixture", Origin: "http://127.0.0.1:1234", MachineFingerprint: "fixture-machine", Funding: LiveFunding{Calls: 32, InputTokens: 100000, OutputTokens: 100000, Seconds: 120, JobInput: 23000, JobOutput: 23000, ProjectInputHeadroom: 23000, ProjectOutputHeadroom: 23000, TeamInputHeadroom: 23000, TeamOutputHeadroom: 23000}, Sentinels: map[string]string{}}
+ for _, p := range []string{"claude", "codex"} {
+ c.Bindings = append(c.Bindings, DirectLiveBinding{Binding: Binding{ID: p, Provider: p, AccountID: p + "-account", Home: dirs[p], Expected: Identity{AccountID: p + "-account", HomeID: p + "-home", ProviderVersion: map[string]string{"claude": "2.1.312", "codex": "0.165.0"}[p]}}, Model: p + "-model", AuthHost: map[string]string{"claude": "platform.claude.com", "codex": "auth.openai.com"}[p], ClaudeTOFUConfirmed: p == "claude"})
+ }
+ for _, name := range []string{"claude", "codex", "other", "state", "repo"} {
+ path := filepath.Join(dirs[name], "sentinel.txt")
+ if err := os.WriteFile(path, []byte("synthetic sentinel"), 0600); err != nil {
+ t.Fatal(err)
+ }
+ c.Sentinels[name] = path
+ }
+ return c
+}
+
+func TestDirectLiveGateRequiresExplicitInputs(t *testing.T) {
+ valid := liveConfigFixture(t)
+ for _, tc := range []struct {
+ name string
+ edit func(*DirectLiveConfig)
+ enabled string
+ }{
+ {"valid", func(*DirectLiveConfig) {}, "1"},
+ {"opt_in", func(*DirectLiveConfig) {}, ""},
+ {"truthy_is_not_opt_in", func(*DirectLiveConfig) {}, "true"},
+ {"dedicated_homes", func(c *DirectLiveConfig) { c.Bindings = nil }, "1"},
+ {"budget", func(c *DirectLiveConfig) { c.Funding.Calls = 0 }, "1"},
+ {"time", func(c *DirectLiveConfig) { c.Funding.Seconds = 0 }, "1"},
+ {"period_headroom", func(c *DirectLiveConfig) { c.Funding.TeamInputHeadroom = 0 }, "1"},
+ {"disposable", func(c *DirectLiveConfig) { c.Disposable = false }, "1"},
+ {"repository", func(c *DirectLiveConfig) { c.Repository = "" }, "1"},
+ {"sentinel", func(c *DirectLiveConfig) { delete(c.Sentinels, "other") }, "1"},
+ {"sentinel_location", func(c *DirectLiveConfig) { c.Sentinels["claude"] = c.Sentinels["repo"] }, "1"},
+ {"claude_tofu", func(c *DirectLiveConfig) { c.Bindings[0].ClaudeTOFUConfirmed = false }, "1"},
+ {"account", func(c *DirectLiveConfig) { c.Bindings[0].Binding.Expected.AccountID = "different" }, "1"},
+ {"shared_home", func(c *DirectLiveConfig) {
+ c.Bindings[0].Binding.Home = filepath.Join(t.TempDir(), ".paseo/zerosub/homes/account")
+ }, "1"},
+ {"same_home", func(c *DirectLiveConfig) { c.Bindings[1].Binding.Home = c.Bindings[0].Binding.Home }, "1"},
+ {"auth_host", func(c *DirectLiveConfig) { c.Bindings[1].AuthHost = "https://example.com/path" }, "1"},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ raw, _ := json.Marshal(valid)
+ var c DirectLiveConfig
+ if err := json.Unmarshal(raw, &c); err != nil {
+ t.Fatal(err)
+ }
+ tc.edit(&c)
+ err := c.Validate(tc.enabled)
+ if (err == nil) != (tc.name == "valid") {
+ t.Fatalf("explicit input gate: %s: %v", tc.name, err)
+ }
+ })
+ }
+ t.Run("interactive_home", func(t *testing.T) {
+ t.Setenv("CODEX_HOME", valid.Bindings[1].Binding.Home)
+ if valid.Validate("1") == nil {
+ t.Fatal("interactive home accepted")
+ }
+ })
+ t.Run("symlink", func(t *testing.T) {
+ c := liveConfigFixture(t)
+ link := filepath.Join(t.TempDir(), "alias")
+ if err := os.Symlink(c.Bindings[0].Binding.Home, link); err != nil {
+ t.Fatal(err)
+ }
+ c.Bindings[0].Binding.Home = link
+ if c.Validate("1") == nil {
+ t.Fatal("home alias accepted")
+ }
+ })
+}
diff --git a/internal/runner/provider/direct_requirements.json b/internal/runner/provider/direct_requirements.json
new file mode 100644
index 00000000..b8cdf739
--- /dev/null
+++ b/internal/runner/provider/direct_requirements.json
@@ -0,0 +1,27 @@
+{
+ "Contract": [
+ "account-version-readback", "effective-policy-readback", "inner-sandbox-enabled",
+ "immutable-settings", "strict-mcp", "exact-tool-inventory", "no-hooks-plugins",
+ "equipo-broker-approval", "person-native-approval", "real-question-answer",
+ "stale-broker-denied", "invalid-broker-denied", "policy-escalation-denied",
+ "refresh-success-pinned-host", "refresh-failure-unavailable",
+ "same-identity-generation-fresh-preflight-bind", "same-identity-continued-availability",
+ "changed-identity-stops-step", "refresh-dedicated-home-only"
+ ],
+ "Isolation": [
+ "workspace-positive-control", "private-network", "host-loopback-denied",
+ "host-control-sockets-denied", "host-services-absent", "settings-write-denied",
+ "mcp-authority", "tool-inventory-complete", "missing-tools-recorded"
+ ],
+ "Recovery": [
+ "clean-session-resume", "mid-turn-runner-kill", "durable-replay",
+ "no-redispatch", "unknown-usage-retained", "pid1-go-helper-owner",
+ "pidfd-exit", "detached-descendants-absent", "cgroup-move-contained",
+ "active-cancellation", "host-services-absent-after-exit"
+ ],
+ "Calibration": [
+ "separate-bounded-admission", "complete-input-output", "usage-unknowns-recorded",
+ "twice-max-rounded-1000", "23-reservations-per-job", "project-period-headroom",
+ "team-period-headroom", "configured-limits-unchanged", "no-subscription-currency-cap"
+ ]
+}
diff --git a/internal/runner/provider/live_test.go b/internal/runner/provider/live_test.go
new file mode 100644
index 00000000..e594b5a6
--- /dev/null
+++ b/internal/runner/provider/live_test.go
@@ -0,0 +1,137 @@
+//go:build direct_live
+
+package provider_test
+
+import (
+ "encoding/json"
+ "io"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/runner/provider"
+ "amadan.net/oficina/equipo/internal/runner/provider/claude"
+ "amadan.net/oficina/equipo/internal/runner/provider/codex"
+)
+
+// These gates verify operator-collected, sanitized production observations.
+// They do not manufacture observations, prompt providers, or grant eligibility.
+// A recording driver is deliberately not substituted with a fake CLI here.
+func TestDirectLiveContract(t *testing.T) { verifyDirectLiveGroup(t, "Contract") }
+func TestDirectLiveIsolation(t *testing.T) { verifyDirectLiveGroup(t, "Isolation") }
+func TestDirectLiveRecovery(t *testing.T) { verifyDirectLiveGroup(t, "Recovery") }
+func TestDirectLiveCalibration(t *testing.T) { verifyDirectLiveGroup(t, "Calibration") }
+
+func verifyDirectLiveGroup(t *testing.T, group string) {
+ t.Helper()
+ cfg, err := provider.LoadDirectLiveConfig(os.Getenv)
+ if err != nil {
+ t.Fatal("direct live certification requires EQUIPO_LIVE_DIRECT=1 and valid EQUIPO_LIVE_CONFIG inputs")
+ }
+ configRaw, err := os.ReadFile(os.Getenv("EQUIPO_LIVE_CONFIG"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ pins := map[string]string{"claude": claude.ExecutableSHA256, "codex": codex.ExecutableSHA256, "codex-code-mode-host": codex.CodeModeHostSHA256}
+ digests := map[string]string{}
+ for name, variable := range map[string]string{"claude": "EQUIPO_CLAUDE_PATH", "codex": "EQUIPO_CODEX_PATH", "codex-code-mode-host": "EQUIPO_CODEX_CODE_MODE_HOST_PATH", "bwrap": "EQUIPO_BWRAP_PATH", "runner": "EQUIPO_RUNNER_EXECUTABLE"} {
+ path := os.Getenv(variable)
+ if !filepath.IsAbs(path) {
+ t.Fatalf("explicit executable required: %s", variable)
+ }
+ f, err := os.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ info, err := f.Stat()
+ if err != nil || !info.Mode().IsRegular() || info.Mode().Perm()&0111 == 0 {
+ f.Close()
+ t.Fatalf("invalid executable: %s", variable)
+ }
+ raw, err := io.ReadAll(io.LimitReader(f, 1<<30))
+ f.Close()
+ if err != nil || int64(len(raw)) != info.Size() {
+ t.Fatalf("cannot hash executable: %s", variable)
+ }
+ hash := provider.DigestDirectEvidence(raw)
+ if pin := pins[name]; pin != "" && hash != pin {
+ t.Fatalf("uncertified executable: %s", variable)
+ }
+ digests[name] = hash
+ }
+ // --version is the only subprocess invoked by this evidence verifier.
+ out, err := exec.Command(os.Getenv("EQUIPO_BWRAP_PATH"), "--version").Output()
+ if err != nil || strings.TrimSpace(string(out)) != "bubblewrap 0.11.0" {
+ t.Fatal("bubblewrap 0.11.0 is required")
+ }
+ var index []string
+ readLiveJSON(t, filepath.Join(cfg.EvidenceDir, "index.json"), &index)
+ if len(index) == 0 || len(index) > 256 {
+ t.Fatal("missing or oversized live evidence index")
+ }
+ seen := map[string]bool{}
+ coverage := map[string]bool{}
+ for _, name := range index {
+ if !filepath.IsLocal(name) {
+ t.Fatal("evidence path must stay inside evidence_dir")
+ }
+ path := filepath.Join(cfg.EvidenceDir, name)
+ var e provider.DirectEvidence
+ readLiveJSON(t, path, &e)
+ if seen[e.Provider+"/"+e.PolicyHash] {
+ t.Fatal("duplicate certified policy")
+ }
+ seen[e.Provider+"/"+e.PolicyHash] = true
+ t.Run(e.Provider+"/"+e.Specialist+"/"+e.PolicyHash, func(t *testing.T) {
+ if e.ConfigSHA256 != provider.DigestDirectEvidence(configRaw) || e.RunID != cfg.RunID || e.Funding != cfg.Funding {
+ t.Fatal("evidence changed the authorized inputs or funding")
+ }
+ found := false
+ for _, b := range cfg.Bindings {
+ if b.Binding.Provider == e.Provider && b.Binding.Expected.AccountID == e.AccountID && b.Binding.Expected.HomeID == e.HomeID && b.Model == e.Model && b.AuthHost == e.AuthHost {
+ found = true
+ }
+ }
+ if !found {
+ t.Fatal("evidence belongs to an unselected account, model or auth host")
+ }
+ for binary, digest := range digests {
+ if e.Binaries[binary] != digest {
+ t.Fatalf("changed executable: %s", binary)
+ }
+ }
+ if err := e.ValidateGroup(filepath.Dir(path), group); err != nil {
+ t.Fatalf("incomplete %s certification: %v", group, err)
+ }
+ })
+ coverage[e.Provider+"/"+e.Specialist] = true
+ }
+ for _, key := range []string{"claude/Engineering", "claude/Review", "claude/Product", "codex/Engineering", "codex/Review"} {
+ if !coverage[key] {
+ t.Errorf("missing policy coverage: %s", key)
+ }
+ }
+}
+func readLiveJSON(t *testing.T, path string, out any) {
+ t.Helper()
+ real, err := filepath.EvalSymlinks(path)
+ if err != nil || real != path {
+ t.Fatal("missing or aliased evidence file")
+ }
+ f, err := os.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+ d := json.NewDecoder(io.LimitReader(f, 16<<20))
+ d.DisallowUnknownFields()
+ if err = d.Decode(out); err != nil {
+ t.Fatal(err)
+ }
+ var extra any
+ if d.Decode(&extra) != io.EOF {
+ t.Fatal("trailing evidence data")
+ }
+}
diff --git a/scripts/live-gate.sh b/scripts/live-gate.sh
index 2c48be3d..f49cb5a8 100755
--- a/scripts/live-gate.sh
+++ b/scripts/live-gate.sh
@@ -10,6 +10,8 @@ printf '%s\n' 'Confirm the enrolled connections, origin, machine fingerprint and
printf '%s' 'Type RUN LIVE GATE: '
IFS= read -r answer
[ "$answer" = 'RUN LIVE GATE' ] || exit 1
-# Task 11b must install a reviewed certification harness. Never let an absent
-# test name produce a successful release gate.
-exit 1
+# Opt-in must come from the caller. This script never discovers credentials.
+[ "${EQUIPO_LIVE_DIRECT:-}" = 1 ] || exit 1
+[ -n "${EQUIPO_LIVE_CONFIG:-}" ] || exit 1
+# The four named tests fail, rather than skip, on absent inputs or evidence.
+CGO_ENABLED=0 go test -tags direct_live ./internal/runner/provider -run '^TestDirectLive(Contract|Isolation|Recovery|Calibration)$' -count=1
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index 5f3fc0f0..89146422 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -1,39 +1,4 @@
[
- {
- "path": "Makefile",
- "line_sha256": "7ba5e579850f46307a8a38221cccccb966ff37b3ff7e1f0830a5c518b4059879",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
- {
- "path": "Makefile",
- "line_sha256": "69a24026d7c14d3ab8de496d03a652e8125479a0622e3837538fc3515056be54",
- "match": "equipo-runner",
- "count": 3,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
- {
- "path": "Makefile",
- "line_sha256": "6b8437f5c7b3a7c2d1aca0dabed016b8143cd5d3ab9164ed959fc5c63980d19a",
- "match": "equipo-runner",
- "count": 2,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
- {
- "path": "Makefile",
- "line_sha256": "0cfd212bcd00295cdff164b9bece4aa427ed0a1cc2bb5a2ba4af95ecca6aab5d",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
- {
- "path": "docs/live-gate.md",
- "line_sha256": "29d7ab31258e4f6be5e3c5f9ccd7c5058cf411e93bbeb6f1a9f71a0796635e65",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
{
"path": "docs/mockups/models.html",
"line_sha256": "b03ef2e13837ea9e91dfc11b109bae368cdf4600888aeb957d89364e260262af",
@@ -5158,20 +5123,6 @@
"count": 3,
"reason": "Retained executable, service or command path; not an operating-system account requirement."
},
- {
- "path": "internal/equipotest/runner_release_test.go",
- "line_sha256": "1cb1b30124d2aa87ecd75f3c85be6fca3313dfaed6acf5d33ba0601258ea948b",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
- {
- "path": "internal/equipotest/runner_release_test.go",
- "line_sha256": "f5511cb9dc24525c35eb2a327fba5448c4089060c8dde4ed7439d22c71014f62",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Retained executable, service or command path; not an operating-system account requirement."
- },
{
"path": "internal/equipotest/specialists_test.go",
"line_sha256": "33a149ae572c0b6024b34fa89ce4b3ee1c53877f170a348d0e15b18eaf3ca8a8",
@@ -5780,5 +5731,124 @@
"match": "trial",
"count": 1,
"reason": "Required rejection pattern used by the reference scanner itself."
+ },
+ {
+ "path": "Makefile",
+ "line_sha256": "e49e7ab801b09b83aa0815b168e4a5fa25417827c3064c17515dad4e40982143",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "Makefile",
+ "line_sha256": "a2275717fddecabc2b48be3b4492311ba22dfa9c7dac49c364a8a9a2ed3158a1",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "Makefile",
+ "line_sha256": "adf2858b672e4f67ca028bdd9faa624c57bc91328dc9aeb6adbec784853eca09",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "488776b6907a5f5ef4c025485dd84cf4d0a29f412893e0f6187650a071a934cd",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "09d7c615c5157cda0690ff846ba01567b9a2b95ac949930ae03ab651d9ad1c2d",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "0a1352b302eb571fa3911b4ab118f94f8eb5bf1d20939615e77cc7cd2fb085ec",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "ee2be43c4a77ca66c5910155019971b86a0a7ba33067341670ab4ed4766741b4",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "d327f8de998efaf796e12d8c9ea974c2f43432c54105093e00b02ae88607e92b",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "5eb49c570b81c4c2e8a8a8c15d78610934dda3eeb6945ec772e5a04c3ae728a5",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "68fc709d54529eece99058c0bfa2ede7e4a068756b6381a921132269a8d18f35",
+ "match": "equipo-runner",
+ "count": 2,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/live-gate.md",
+ "line_sha256": "db1a58a88111420d95c23a0b5e71ea7977631abb34c54d5d3aca8e83dba3360e",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md",
+ "line_sha256": "c3758da3bef2404e80c6ed3b3d4a321b444eda2c9271e9c7cc44c7c29a8f263f",
+ "match": "node",
+ "count": 1,
+ "reason": "Task 11b controller evidence of offline packaging, refusal tests and unresolved release prerequisites; no execution dependency."
+ },
+ {
+ "path": "docs/superpowers/plans/CONTROLLER-REPORT-plan-2b.md",
+ "line_sha256": "f36dfc22adfaa0336e43062c6f3a148b0391f6737d3d7d872dbb56b17392fb2f",
+ "match": "node",
+ "count": 2,
+ "reason": "Task 11b controller evidence of offline packaging, refusal tests and unresolved release prerequisites; no execution dependency."
+ },
+ {
+ "path": "internal/equipotest/runner_release_test.go",
+ "line_sha256": "7505eaaaebad7760bd30565337711651f6f27702a5ac396f0db6f5b34ce75a35",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "internal/equipotest/runner_release_test.go",
+ "line_sha256": "48b4a08ba0a705c90cd2d29589c35de5b1bf3579cf2a0dc8ce4bb41a32b79d82",
+ "match": "equipo-runner",
+ "count": 1,
+ "reason": "Retained runner executable, versioned package or user-service path in Task 11b release tooling, tests or draft operator steps."
+ },
+ {
+ "path": "internal/runner/provider/direct_live_config.go",
+ "line_sha256": "d1b28675f8ad00869e960a20d5cf0620c7164b5a3697728b33ec8b6d8c348b86",
+ "match": "node",
+ "count": 1,
+ "reason": "Lexical substring in refusedInode: checks directory identity to reject shared-home aliases; no JavaScript runtime."
+ },
+ {
+ "path": "internal/runner/provider/direct_live_config_test.go",
+ "line_sha256": "e2f5ce173d1ef47fa92bcd9672c38641c7755c706942426d6b701cd230423021",
+ "match": "paseo",
+ "count": 1,
+ "reason": "Negative fixture for refusing shared provider homes before live certification; not an execution dependency."
}
]
diff --git a/scripts/runner-release-check.py b/scripts/runner-release-check.py
index 66cc3df0..fdc533c8 100644
--- a/scripts/runner-release-check.py
+++ b/scripts/runner-release-check.py
@@ -1,38 +1,152 @@
#!/usr/bin/env python3
-"""Refuse packaging until the installed executables match certified metadata."""
+"""Check reviewed live evidence before either versioned release is built."""
import hashlib
import json
import os
from pathlib import Path
+import re
+import subprocess
import sys
root = Path(__file__).resolve().parent.parent
-manifest = json.loads((root / "internal/release/manifest.json").read_text())
variables = {"claude": "EQUIPO_CLAUDE_PATH", "codex": "EQUIPO_CODEX_PATH",
"codex-code-mode-host": "EQUIPO_CODEX_CODE_MODE_HOST_PATH", "bwrap": "EQUIPO_BWRAP_PATH"}
+
+
def require(condition):
if not condition:
raise ValueError("uncertified release")
+
+def digest(path):
+ with path.open("rb") as source:
+ return hashlib.file_digest(source, "sha256").hexdigest()
+
+
+def sha(value):
+ return isinstance(value, str) and re.fullmatch(r"[a-f0-9]{64}", value) is not None
+
+
+def local_file(base, name):
+ path = base / name
+ require(name and not Path(name).is_absolute() and ".." not in Path(name).parts)
+ require(path.resolve() == path and path.is_file() and not path.is_symlink())
+ require(0 < path.stat().st_size <= 16 * 1024 * 1024)
+ return path
+
+
+def observation(base, value, status):
+ require(value["status"] == status and value["detail"] and sha(value["sha256"]))
+ require(digest(local_file(base, value["artifact"])) == value["sha256"])
+
+
+def evidence(manifest, certificate, reference, installed):
+ require(reference["provider"] == certificate["provider"] and reference["policy_hash"] == certificate["policy_hash"])
+ require(reference["path"].startswith("internal/release/evidence/"))
+ path = local_file(root, reference["path"])
+ require(digest(path) == reference["sha256"])
+ record = json.loads(path.read_text())
+ require(record["schema"] == 1 and record["source"] == "direct-live")
+ for key in ("provider", "provider_version", "launcher_version", "bwrap_version", "policy_hash"):
+ require(record[key] == certificate[key])
+ require(record["policy_version"] == manifest["policy_version"])
+ require(record["run_id"] and record["account_id"] and record["home_id"] and record["model"] and record["auth_host"])
+ require(sha(record["config_sha256"]) and sha(record["binaries"]["runner"]))
+ for name, value in installed.items():
+ require(record["binaries"][name] == value)
+ requirements = json.loads((root / "internal/runner/provider/direct_requirements.json").read_text())
+ for group in requirements.values():
+ for name in group:
+ observation(path.parent, record["checks"][name], "pass")
+ surfaces, names, exposed = set(), set(), set()
+ for tool in record["tools"]:
+ require(tool["name"] and tool["name"] not in names)
+ names.add(tool["name"])
+ require(tool["surface"] in {"native", "shell", "search", "image", "mcp"})
+ surfaces.add(tool["surface"])
+ if not tool["exposed"]:
+ require(tool["missing_reason"] and not tool["probes"])
+ continue
+ exposed.add(tool["name"])
+ require(not tool.get("missing_reason"))
+ for protected in ("selected-home", "other-home", "runner-state", "/egress", "/tool/equipo.sock",
+ "symlink", "/proc/*/root", "/proc/*/fd", "/dev/fd"):
+ observation(path.parent, tool["probes"][protected], "denied")
+ require(surfaces == {"native", "shell", "search", "image", "mcp"})
+ if record["provider"] == "claude":
+ role = record["specialist"]
+ require(role in ("Engineering", "Review", "Product"))
+ expected = {"Read", "Glob", "Grep", "Bash", "mcp__equipo__permission", "mcp__equipo__ask_person"}
+ if role == "Engineering":
+ expected |= {"Write", "Edit"}
+ step = {"Engineering": "submit_candidate", "Review": "submit_review", "Product": "submit_reproduction"}[role]
+ if role == "Engineering" and "mcp__equipo__submit_reproduction" in exposed:
+ step = "submit_reproduction"
+ expected.add("mcp__equipo__" + step)
+ require(exposed == expected)
+ else:
+ require(record["codex_policy"] == {"approvalPolicy": "on-request", "approvalsReviewer": "user",
+ "strict_config": True, "deny_profile": True})
+ for surface in ("native", "shell", "search", "mcp"):
+ require(any(t["exposed"] and t["surface"] == surface for t in record["tools"]))
+ usage, funding = record["usage"], record["funding"]
+ require(usage and all(u["complete"] and type(u["input"]) is int and type(u["output"]) is int
+ and u["input"] >= 0 and u["output"] >= 0 for u in usage))
+ require(all(type(v) is int and 0 < v <= 2**63-1 for v in funding.values()))
+ for key, suffix in (("input", "Input"), ("output", "Output")):
+ maximum = max(u[key] for u in usage)
+ require(0 < maximum <= ((2**63-1)-999)//2)
+ reserve = ((2*maximum + 999)//1000)*1000
+ require(reserve <= (2**63-1)//23)
+ job = funding["Job" + suffix]
+ require(job >= 23*reserve)
+ require(funding["Project" + suffix + "Headroom"] >= job and funding["Team" + suffix + "Headroom"] >= job)
+ require(sum(u[key] for u in usage) <= funding[suffix + "Tokens"])
+ require(funding["Calls"] >= len(usage) and funding["Seconds"] > 0)
+
+
try:
- require(manifest["schema"] == 2)
- require(manifest["launcher_version"] and manifest["policy_version"])
+ manifest = json.loads((root / "internal/release/manifest.json").read_text())
+ require(manifest["schema"] == 2 and manifest["live_gate_copy_reviewed"] is True)
+ require(manifest["launcher_version"] == "direct-v2" and manifest["policy_version"] == "direct-v1")
+ require(manifest["bwrap_version"] == "0.11.0")
+ require(manifest["claude"] == "2.1.312" and manifest["codex"] == "0.165.0")
require({x["provider"] for x in manifest["direct_policies"]} == {"claude", "codex"})
require({x["name"] for x in manifest["binaries"]} == set(variables))
require(len(manifest["binaries"]) == len(variables))
+ installed = {}
for artifact in manifest["binaries"]:
name = artifact["name"]
path = Path(os.environ[variables[name]])
require(path.is_absolute() and path.is_file() and os.access(path, os.X_OK))
version = manifest[{"bwrap": "bwrap_version", "codex-code-mode-host": "codex"}.get(name, name)]
- require(version and artifact["version"] == version)
- with path.open("rb") as source:
- digest = hashlib.file_digest(source, "sha256").hexdigest()
- require(digest == artifact["sha256"])
+ require(artifact["version"] == version)
+ installed[name] = digest(path)
+ require(installed[name] == artifact["sha256"])
+ if name == "bwrap":
+ require(subprocess.check_output([str(path), "--version"], timeout=5).decode().strip() == "bubblewrap 0.11.0")
+ else:
+ family = "codex" if name == "codex-code-mode-host" else name
+ constant = "CodeModeHostSHA256" if name == "codex-code-mode-host" else "ExecutableSHA256"
+ source = (root / f"internal/runner/provider/{family}/launcher.go").read_text()
+ pin = re.search(r'const ' + constant + r' = "([a-f0-9]{64})"', source)
+ require(pin and installed[name] == pin[1])
+ require(len(manifest["certifications"]) == len(manifest["direct_policies"]))
+ require(len(manifest["verified_isolation_tuples"]) == len(manifest["direct_policies"]))
+ seen = set()
for certificate in manifest["direct_policies"]:
require(certificate["provider_version"] == manifest[certificate["provider"]])
require(certificate["launcher_version"] == manifest["launcher_version"])
require(certificate["bwrap_version"] == manifest["bwrap_version"])
- require(len(certificate["policy_hash"]) == 64)
-except (ValueError, KeyError, OSError):
+ require(sha(certificate["policy_hash"]))
+ key = (certificate["provider"], certificate["policy_hash"])
+ require(key not in seen)
+ seen.add(key)
+ refs = [r for r in manifest["certifications"] if (r["provider"], r["policy_hash"]) == key]
+ require(len(refs) == 1)
+ evidence(manifest, certificate, refs[0], installed)
+ expected = {k: v for k, v in certificate.items() if k != "policy_hash"}
+ expected.update(policy_version=manifest["policy_version"], isolation_config_hash=certificate["policy_hash"])
+ require(manifest["verified_isolation_tuples"].count(expected) == 1)
+except (ValueError, KeyError, OSError, TypeError, subprocess.SubprocessError):
sys.exit(1)