oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Enable execution: controller report
2
3The installer accepts the starter set's certified policies alongside its 15
4uncertified policies. `make release` now builds the linux/amd64 runner first,
5checks its bundled downloads, then embeds them in the linux/arm64 app. An unset
6`EQUIPO_RUNNER_RELEASE_DIR` selects that bundle. A configured directory still
7wins and fails closed if invalid. Uncertified dispatch remains denied.
8
9No provider was launched, deployed configuration changed, runner enrolled, or
10application deployed during this task. No copy-review server was started. This
11is the controller's requested operational report, not new app copy; README and
12runtime strings are unchanged.
13
14## Implementation and checks
15
16- The bootstrap keeps its version, target, copy, certification and digest
17 assertions. It requires a direct policy with a matching certificate that is
18 not also listed as uncertified. The downloaded runner still validates the
19 complete installation manifest before installation.
20- `scripts/build-instance-release.sh` stages only the installation manifest,
21 runner, tool proxy and bootstrap script. It refuses an existing staging
22 directory and removes its own staging directory on success or failure.
23 `runnerassets` is a release-only build tag: normal app and runner builds do
24 not contain the bundle, preventing recursive runner embedding.
25- Before building the app, `TestBundledInstallAssets` checks the version,
26 namespace policy, release-manifest equality, runner SHA-256 and tool-proxy
27 SHA-256 through `InstallAssets`. It serves and compares all four HTTP bodies.
28 The bootstrap script has no separate digest field in the existing manifest;
29 its bytes are copied from the same clean commit. Runner and tool-proxy
30 digests retain their existing manifest locations.
31- Embedded assets reuse the directory handler's validation, path allowlist,
32 range support and cache headers. Immutable embedded files are hashed once.
33 Directory files retain their metadata and replacement checks.
34- No startup behavior needed changing. The new CARLOS layout test opens and
35 reopens execution with a private witness subdirectory, no release-directory
36 override and `AlwaysOn=false`. Enrolment remains available. The existing
37 authenticated runner HTTP tests also pass with `AlwaysOn=false`.
38
39Initial red tests:
40
41```sh
42CGO_ENABLED=0 go test ./internal/release \
43 -run 'TestBootstrapPartialRelease|TestEmbeddedInstallAssets' -count=1
44CGO_ENABLED=0 go test ./internal/equipotest \
45 -run '^TestDirectReleaseRequiresCertification/release/clean$' -count=1
46```
47
48The first command rejected the partial manifest and could not serve the
49embedded fixture. The second failed because the app build had no staged runner
50manifest. Both pass after implementation. The first compile attempt also
51failed because the bundle interface did not yet exist.
52
53Targeted verification passed:
54
55```sh
56CGO_ENABLED=0 go test ./internal/release ./internal/equipotest \
57 -run 'TestBootstrapPartialRelease|TestEmbeddedInstallAssets|TestOnboardingInstallPackaging|TestExecutionCarlosMarkerLayout|TestExecutionStartupClosed|TestExecutionHibernateWitness|TestRunnerAppCSRF|TestReleaseStampContract|TestRunnerReleaseContractPackaging|TestDirectReleaseRequiresCertification' \
58 -count=1
59```
60
61Mutation checks used disposable Go overlays under on-disk `$TMPDIR`; the
62bootstrap mutation was restored in a `finally` block. Each command exited 1
63with the named assertion failing; the restored targeted command above passed.
64
65| Behavior deliberately broken | Command after `CGO_ENABLED=0` | Observed failure |
66| --- | --- | --- |
67| Ignore binary digest differences | `go test -overlay=<scratch>/digest.json ./internal/release -run '^TestEmbeddedInstallAssets$' -count=1` | Tampered runner and proxy accepted |
68| Ignore release-manifest equality | `go test -overlay=<scratch>/manifest.json ./internal/release -run '^TestEmbeddedInstallAssets$' -count=1` | Mismatched instance target accepted |
69| Prefer embedded files over an explicit directory | `go test -overlay=<scratch>/override.json ./internal/release -run '^TestEmbeddedInstallAssets$' -count=1` | Invalid explicit override accepted |
70| Ignore execution-enabled environment value | `go test -overlay=<scratch>/execution-env.json ./internal/equipotest -run '^TestExecutionCarlosMarkerLayout$' -count=1` | Execution configuration stayed disabled |
71| Remove disabled-execution guard | `go test -overlay=<scratch>/execution-off.json ./internal/equipotest -run '^TestExecutionStartupClosed$' -count=1` | Disabled execution opened |
72| Remove database-directory separation | `go test -overlay=<scratch>/marker-separation.json ./internal/equipotest -run '^TestExecutionStartupClosed$' -count=1` | Witness shared database directory |
73| Remove the app build's `runnerassets` tag | `go test ./internal/equipotest -run '^TestReleaseStampContract/defaults$' -count=1` | Release missing embedded assets |
74| Skip bootstrap certificate matching | `go test ./internal/release -run '^TestBootstrapPartialRelease$' -count=1` | Unmatched and explicitly uncertified policies accepted |
75
76The initial manifest mutation survived because its fixture changed the Claude
77version, which failed certification before reaching the equality check. The
78fixture now changes the instance target, and the equality mutation fails.
79The override mutation must change both opening and cache selection to model an
80unsafe fallback; changing opening alone still failed closed at file identity.
81
82One full `make -k ci` ran and exited 2. Build, vet, formatting, staticcheck,
83govulncheck, gitleaks, size budgets, adapter tests, namespace tests, migration
84checks and performance passed. Cold boot median was 116 ms against 500 ms.
85The reference scan and test target failed for these reasons:
86
871. The brief and new runner asset references needed exact inventory entries.
88 Added those entries, including this report; the scanner now passes.
892. `TestOnboardingInstallShell/Linux/x86_64` supplied empty certificate objects.
90 Added the fixture's matching provider, action and policy hash. The full
91 `internal/release` package now passes.
923. `TestReviewExpiredAccountSignsIn/claude` returned `provider_account_busy`.
93 Its isolated rerun passed without account-code changes. The same failure
94 and passing isolated rerun are recorded in
95 `CONTROLLER-REPORT-fewer-prompts.md`; this change does not alter that path.
96
97The full test run executed 27 packages, with no cached results. Local advisory
98time overruns were runner 370.872/330 seconds, provider 21.891/15, Claude
9958.215/45 and Codex 46.821/35. No budgets were raised. These timings would fail
100when CI timing enforcement is enabled.
101
102The affected checks passed on this focused rerun:
103
104```sh
105CGO_ENABLED=0 go test ./internal/release ./internal/equipotest ./internal/tryequipo \
106 -run '^TestOnboardingInstallShell$|^TestDirectDeadReferencesRepository$|^TestReviewExpiredAccountSignsIn$|^TestReleaseStampContract$' \
107 -count=1
108CGO_ENABLED=0 go test ./internal/release -count=1
109CGO_ENABLED=0 go test ./internal/equipotest \
110 -run '^TestReleaseStampContract$|^TestDirectDeadReferencesRepository$' -count=1
111```
112
113No second full CI run was used. The full run remains recorded as failed;
114the focused fixes and reruns do not turn it into a claimed full green run.
115
116A dry `make release` passed in a clean disposable snapshot under on-disk
117`$TMPDIR`, stamped `4d1cb1f`. It used only the five executable-path variables
118read from the existing `runner.env`, with `EQUIPO_CLAUDE_PATH` overridden to
119`/home/paulca/.local/share/claude/versions/2.1.312`. No provider process was
120launched. This scratch commit is evidence of the build, not a version to deploy.
121
122The release ran these checks before compiling the ARM64 instance:
123
124```sh
125EQUIPO_BUNDLE_VERSION=4d1cb1f CGO_ENABLED=0 go test -tags runnerassets \
126 ./internal/release -run '^TestBundledInstallAssets$' -count=1
127```
128
129All four embedded downloads were served through the HTTP handler and matched
130the staged bytes. Both executable digests matched the installation manifest.
131The built AMD64 runner also passed `verify-install-manifest` on that manifest,
132and its `version` command reported `4d1cb1f`. No app server was started.
133
134| Artifact | Bytes | MiB |
135| --- | ---: | ---: |
136| ARM64 app including runner bundle | 41,484,450 | 39.56 |
137| AMD64 runner | 18,116,770 | 17.28 |
138| AMD64 tool proxy | 2,646,178 | 2.52 |
139
140`file` confirmed a stripped, statically linked ARM64 app and stripped,
141statically linked AMD64 runner and helper. The generated bundle directory was
142removed by the build script, and the scratch checkout remained clean. Final
143`make runner-dead-references fmt-check` and `git diff --check` passed.
144
145## CARLOS configuration for the controller
146
147Choose this absolute marker path:
148
149```text
150/data/instances/equipo.bds.oncarlos.com/execution/witness
151```
152
153The platform's `internal/provision/provision.go` defines the persistent nested
154instance directory and database path. For this hostname, the database is
155`/data/instances/equipo.bds.oncarlos.com/equipo.bds.oncarlos.com.db` in the
156nested layout. The older flat layout uses `/data/equipo.bds.oncarlos.com.db`.
157The chosen witness directory is separate in either layout. The isolated
158instance unit binds and permits writes to its own `/data/instances/<host>`
159directory. `OpenExecution` creates `execution` with mode 0700.
160
161Sources read locally under `~/amadan.net/carlos/platform`:
162`internal/provision/provision.go` (`InstanceDir`, `NestedDBPath`, `DefaultDBPath`),
163`internal/host/units/carlos-instance@.service` (`BindPaths`, `ReadWritePaths`),
164`internal/activator/backend_exec.go` (`agentOwnedVars`, `childEnv`, replication),
165`docs/site/cli.md` (configuration bundles), and `carlos help` / `carlos env set -h`.
166`CARLOS_DATA_DIR` configures the platform process; it is not an injected app
167storage variable. App launch supplies `--db`; injected platform variables such
168as `CARLOS_CONTROL_SOCKET` and `CARLOS_REGION` do not identify persistent app
169storage. This selection comes from the checked-in platform contract; no live
170instance filesystem was inspected.
171
172Preserve this witness independently when restoring the SQLite database.
173Database replication does not replicate this extra file. Hibernation on the
174same disk can reopen it. If a host move, disk loss or restore loses or rolls
175back the witness, execution must quarantine until a person follows recovery.
176Do not copy an old witness together with an old database to bypass that check.
177
178Leave `EQUIPO_ALWAYS_ON` unset. It enables browser live updates and related
179in-process scheduling in `internal/equipo/app.go`; it does not control CARLOS
180hibernation or register runner routes. Runners use outbound authenticated HTTP,
18125-second long polls and heartbeats. Requests wake the app through CARLOS, and
182execution resumes from its database and witness. No always-on platform change
183is needed for connectivity.
184
185After review and human merge, build from a clean checkout of the commit to be
186deployed. Export the executable paths from the existing local runner setup and
187pin Claude to the certified version before running the release gate. These
188commands are for the controller to run later; none were run against CARLOS:
189
190```sh
191set -a
192. "$HOME/.local/share/equipo-runner/runner.env"
193set +a
194export EQUIPO_CLAUDE_PATH="$HOME/.local/share/claude/versions/2.1.312"
195make release
196EQUIPO_RELEASE_VERSION=$(git rev-parse --short HEAD)
197read -r -p 'Paste the flagship console address linked below: ' EQUIPO_CONSOLE
198carlos deploy --console "$EQUIPO_CONSOLE" --app equipo --account oficina \
199 --channel edge --timeout 5m \
200 "./releases/equipo-linux-arm64-$EQUIPO_RELEASE_VERSION"
201carlos env set --console "$EQUIPO_CONSOLE" --app equipo --account oficina \
202 --no-prompt EQUIPO_EXECUTION_ENABLED=1 \
203 EQUIPO_EXECUTION_MARKER_PATH=/data/instances/equipo.bds.oncarlos.com/execution/witness
204```
205
206Flagship console:
207[https://console.carloku.com](https://console.carloku.com).
208The command uses the repository's `edge` deployment target. Confirm the route's channel before promotion if
209it has changed since this brief. The stated current env has no named bundle;
210the command writes the default bundle. If the controller discovers a named
211bundle overriding these values, apply them to that bundle with `--environment`.
212Do not set `EQUIPO_RUNNER_RELEASE_DIR`; the app serves its matching bundle.
213
214## Install and enrol docs-t1 as paulca
215
216Open [https://equipo.bds.oncarlos.com](https://equipo.bds.oncarlos.com), sign in,
217and open [https://equipo.bds.oncarlos.com/onboarding](https://equipo.bds.oncarlos.com/onboarding).
218The page's installer command supplies the deployed version and instance ID.
219Check its instance argument against `EQUIPO_INSTANCE_ID` in the saved
220`runner.env`. If using the navigation instead, choose **Connections**, then
221**Enrol a runner** to reach the machine enrolment page.
222
223For a fresh installation, the page's bootstrap command runs the installer,
224asks for the machine label and asks you to type `yes`. It then prints a
225one-time device code and the approval URL. The code is generated at enrolment;
226there is no reusable code to put in this report.
227
228On this machine, use the manual installation below. The existing
229`~/.local/share/equipo-runner/runner.env` is mode 0600 and has no installer
230ownership attribute. `SaveServiceEnvironment` refuses to overwrite it. Even
231an installer-owned replacement would select `accounts.json` and new work and
232scratch defaults instead of the live gate's `bindings.json` and existing
233paths. Passing the existing variables to the bootstrap does not fix those
234hardcoded defaults. The commands below preserve the saved configuration and
235bindings, changing only Claude's executable pin and the installed tool-proxy
236path. They do not repeat provider sign-in or copy credentials.
237
238The user service manager is available and `loginctl` reported `Linger=yes`.
239All five installed executable hashes match the manifest when Claude is pinned
240to 2.1.312. No executable was launched to check those hashes.
241At inspection, there was no runner user service, `state/credentials.json`, or
242`state/enrolment.json`. The two bindings both use Claude and existing dedicated
243homes under `~/.local/share/equipo/accounts/`. Keep those homes and binding
244records intact. The commands deliberately stop if a service or target release
245has appeared since this inspection; reconcile that newer installation first.
246
247Run this in Bash on docs-t1 as `paulca`, after the new app is deployed:
248
249```bash
250set -euo pipefail
251umask 077
252EQUIPO_INSTALL_ROOT="$HOME/.local/share/equipo-runner"
253test "$(id -un)" = paulca
254test ! -e "$HOME/.config/systemd/user/equipo-runner.service"
255test ! -L "$HOME/.config/systemd/user/equipo-runner.service"
256test ! -e "$EQUIPO_INSTALL_ROOT/equipo-runner.service"
257test ! -L "$EQUIPO_INSTALL_ROOT/equipo-runner.service"
258systemctl --user show-environment >/dev/null
259loginctl show-user "$(id -u)" --property=Linger --value
260set -a
261. "$EQUIPO_INSTALL_ROOT/runner.env"
262set +a
263export EQUIPO_CLAUDE_PATH="$HOME/.local/share/claude/versions/2.1.312"
264test -x "$EQUIPO_CLAUDE_PATH"
265test "$EQUIPO_ACCOUNT_BINDINGS_PATH" = "$EQUIPO_INSTALL_ROOT/bindings.json"
266mkdir -p "$HOME/.cache/equipo-install"
267export TMPDIR="$HOME/.cache/equipo-install"
268EQUIPO_DOWNLOAD=$(mktemp -d "$TMPDIR/download-XXXXXXXX")
269trap 'rm -rf "$EQUIPO_DOWNLOAD"' EXIT
270EQUIPO_INSTALL_VERSION=$(curl --fail --silent --show-error \
271 --proto '=https' --tlsv1.2 "$EQUIPO_ORIGIN/api/version")
272export EQUIPO_INSTALL_VERSION EQUIPO_DOWNLOAD
273python3 - <<'PY'
274import os, re
275v = os.environ['EQUIPO_INSTALL_VERSION']
276assert re.fullmatch(r'[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}', v)
277assert v not in ('dev', 'latest')
278PY
279for asset in install-manifest.json equipo-runner equipo-tool-proxy; do
280 curl --fail --silent --show-error --proto '=https' --tlsv1.2 \
281 "$EQUIPO_ORIGIN/releases/$EQUIPO_INSTALL_VERSION/$asset" \
282 -o "$EQUIPO_DOWNLOAD/$asset"
283done
284python3 - <<'PY'
285import hashlib, json, os, pathlib
286root = pathlib.Path(os.environ['EQUIPO_DOWNLOAD'])
287m = json.loads((root / 'install-manifest.json').read_text())
288assert m['version'] == os.environ['EQUIPO_INSTALL_VERSION']
289assert m['target'] == 'linux/amd64'
290def digest(path):
291 with pathlib.Path(path).open('rb') as f:
292 return hashlib.file_digest(f, 'sha256').hexdigest()
293assert digest(root / 'equipo-runner') == m['runner_sha256']
294paths = {'claude': os.environ['EQUIPO_CLAUDE_PATH'],
295 'codex': os.environ['EQUIPO_CODEX_PATH'],
296 'codex-code-mode-host': os.environ['EQUIPO_CODEX_CODE_MODE_HOST_PATH'],
297 'bwrap': os.environ['EQUIPO_BWRAP_PATH'],
298 'equipo-tool-proxy': root / 'equipo-tool-proxy'}
299assert len(m['release']['binaries']) == len(paths)
300for b in m['release']['binaries']:
301 assert digest(paths[b['name']]) == b['sha256'], b['name']
302PY
303chmod 700 "$EQUIPO_DOWNLOAD/equipo-runner"
304"$EQUIPO_DOWNLOAD/equipo-runner" verify-install-manifest \
305 "$EQUIPO_DOWNLOAD/install-manifest.json" >/dev/null
306EQUIPO_INSTALL_RELEASE="$EQUIPO_INSTALL_ROOT/releases/$EQUIPO_INSTALL_VERSION"
307mkdir -p "$EQUIPO_INSTALL_ROOT/releases"
308mkdir "$EQUIPO_INSTALL_RELEASE"
309install -m 700 "$EQUIPO_DOWNLOAD/equipo-runner" "$EQUIPO_INSTALL_RELEASE/"
310install -m 700 "$EQUIPO_DOWNLOAD/equipo-tool-proxy" "$EQUIPO_INSTALL_RELEASE/"
311install -m 600 "$EQUIPO_DOWNLOAD/install-manifest.json" "$EQUIPO_INSTALL_RELEASE/"
312export EQUIPO_TOOL_PROXY_PATH="$EQUIPO_INSTALL_RELEASE/equipo-tool-proxy"
313export EQUIPO_INSTALL_ROOT
314python3 - <<'PY'
315import json, os, pathlib
316root = pathlib.Path(os.environ['EQUIPO_INSTALL_ROOT'])
317p = root / 'runner.env'
318original = p.read_bytes()
319with (root / 'runner.env.before-enable-execution').open('xb') as backup:
320 backup.write(original)
321updates = {k: os.environ[k] for k in ('EQUIPO_CLAUDE_PATH', 'EQUIPO_TOOL_PROXY_PATH')}
322lines = original.decode().splitlines()
323assert all(sum(line.startswith(k + '=') for line in lines) == 1 for k in updates)
324p.write_text('\n'.join(k + '=' + json.dumps(updates[k]) if k in updates else line
325 for line in lines for k in [line.partition('=')[0]]) + '\n')
326p.chmod(0o600)
327PY
328export EQUIPO_MACHINE_LABEL=docs-t1
329"$EQUIPO_INSTALL_RELEASE/equipo-runner" enrol
330```
331
332While `enrol` waits, open
333[https://equipo.bds.oncarlos.com/runners/enrol](https://equipo.bds.oncarlos.com/runners/enrol).
334Enter the terminal's one-time code in **Code from your machine**, click
335**Check machine**, check the `docs-t1` label, key fingerprint and request time,
336compare the fingerprint before clicking **Approve machine**. Run this in a
337second terminal while enrolment waits; it prints only the hash of the public key:
338
339```bash
340python3 - <<'PYCODE'
341import base64, hashlib, json, pathlib
342p = pathlib.Path.home() / '.local/share/equipo-runner/state/machine-key.json'
343s = json.loads(p.read_text())
344key = base64.urlsafe_b64decode(s + '=' * (-len(s) % 4))
345assert len(key) == 64
346print(hashlib.sha256(key[32:]).hexdigest())
347PYCODE
348```
349
350Click **Approve machine** once those details match. The code expires after ten
351minutes. Wait for `enrol` to exit successfully. A retry
352reuses a still-valid pending code; an already enrolled matching state returns
353success without another code. Never delete existing state to force enrolment.
354
355Then install and start the user service, still in the same shell:
356
357```bash
358mkdir -p "$HOME/.config/systemd/user"
359cat > "$EQUIPO_INSTALL_ROOT/equipo-runner.service" <<UNIT
360[Unit]
361Description=equipo-runner
362[Service]
363Type=simple
364EnvironmentFile=$EQUIPO_INSTALL_ROOT/runner.env
365ExecStart=$EQUIPO_INSTALL_RELEASE/equipo-runner run
366Restart=on-failure
367RestartSec=5
368TimeoutStopSec=45
369KillMode=control-group
370UMask=0077
371NoNewPrivileges=yes
372[Install]
373WantedBy=default.target
374UNIT
375chmod 600 "$EQUIPO_INSTALL_ROOT/equipo-runner.service"
376systemctl --user link "$EQUIPO_INSTALL_ROOT/equipo-runner.service"
377systemctl --user daemon-reload
378systemctl --user enable --now equipo-runner.service
379systemctl --user status equipo-runner.service --no-pager
380rm -rf "$EQUIPO_DOWNLOAD"
381trap - EXIT
382```
383
384If the earlier `Linger` result was `no`, the user service stops after logout.
385Keep the user session open; no root or lingering change is part of this task.
386Starting the service is the point at which real work can begin. The manual
387route uses the same certified binaries and existing live-gate containment
388setup, but does not run the installer's containment probe; do not use it on a
389machine whose bubblewrap/user-namespace prerequisites have changed. The runner
390still enforces its runtime checks. In **Connections**, confirm that the
391existing accounts are reported before requesting a task. The runner will
392continue to refuse any route without a matching policy certificate.
393
394## Handoff
395
396Implementation and controller instructions are ready on `enable-execution`.
397Human review, merge and versioned deployment remain with the controller; Paul
398then approves docs-t1's device code. The local full CI result and focused
399reruns are recorded above, including the pre-existing intermittent account test
400and advisory timing overruns. Task scratch, release binaries and logs were
401removed. No server or background process from this task remains.
402