Merge remote-tracking branch 'origin/main' into chat-ui
# Conflicts: # scripts/runner-reference-allowlist.json
40 files changed,
+2,211
−79
.gitignore+2 −0Makefile+3 −5README.md+5 −0docs/live-gate.md+43 −0docs/superpowers/plans/CODEX-BRIEF-enable-execution.md+51 −0docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md+46 −0docs/superpowers/plans/CODEX-BRIEF-runner-start.md+38 −0docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md+401 −0docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md+201 −0docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md+213 −0internal/equipo/team/publication_forge_test.go+1 −1internal/equipotest/release_test.go+11 −1internal/equipotest/runner_flow_test.go+1 −1internal/equipotest/runner_release_test.go+1 −1internal/equipotest/runner_startup_test.go+42 −0internal/release/embedded_bundle.go+19 −0internal/release/embedded_default.go+7 −0internal/release/embedded_install_test.go+168 −0internal/release/install_assets.go+29 −4internal/release/install_script_test.go+1 −1internal/runner/config_test.go+6 −5internal/runner/direct_graph_test.go+1 −1internal/runner/forge/credential_file.go+67 −0internal/runner/forge/credential_file_test.go+76 −0internal/runner/forge/description_test.go+4 −4internal/runner/forge/git.go+2 −1internal/runner/forge/publisher.go+6 −2internal/runner/forge/publisher_test.go+12 −7internal/runner/http.go+15 −6internal/runner/journal_test.go+6 −6internal/runner/runtime_workflow.go+2 −25internal/runner/transporttest/budget_test.go+10 −0internal/runner/transporttest/http_start_test.go+124 −0internal/runner/workspace/git_auth_test.go+142 −0internal/runner/workspace/workspace.go+16 −5internal/runner/workspace/workspace_test.go+1 −1internal/runnerproto/event_io.go+1 −1packaging/install/install-v1.sh+4 −1scripts/build-instance-release.sh+20 −0scripts/runner-reference-allowlist.json+413 −0
CI failed — run details
diff --git a/.gitignore b/.gitignore| index 6c3a0a20..908d4507 100644 |
| --- a/.gitignore |
| +++ b/.gitignore |
| @@ -12,3 +12,5 @@ |
| /.env.local |
| /.local/ |
| + |
| +/internal/release/bundled/ |
diff --git a/Makefile b/Makefile| index 861aae25..27d79751 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -39,14 +39,12 @@ 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 direct-release-check |
| +release: release-runner |
| @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) |
| + @mkdir -p $(dir $(RELEASE_BIN)) |
| + scripts/build-instance-release.sh $(RUNNER_RELEASE_DIR) $(RELEASE_BIN) $(RELEASE_GOOS) $(RELEASE_GOARCH) "$$(git rev-parse --short HEAD)" |
| cp internal/release/manifest.json $(RELEASE_BIN).manifest.json |
| cp -R internal/release/evidence $(RELEASE_BIN).evidence |
| @git rev-parse HEAD > $(RELEASE_BIN).COMMIT |
diff --git a/README.md b/README.md| index eaa1f92e..52f304c3 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -72,6 +72,11 @@ default arm64 build: |
| carlos deploy --app equipo --account oficina --channel edge --timeout 5m ./releases/equipo-linux-arm64 |
| ``` |
| +With `EQUIPO_EXECUTION_ENABLED=1`, add `--swap hold` (before the binary path). Only one |
| +process may own execution, so the old build must stop before the new one starts; |
| +without it the new build exits with "This record changed" and the rollout stops. |
| + |
| + |
| Keep the flags before the binary path. After deployment, poll `GET /api/version` |
| on the deployed origin until the process reports the stamped commit. The |
| router's `X-Carlos-Version` header does not confirm the running process version. |
diff --git a/docs/live-gate.md b/docs/live-gate.md| index 00b6e647..f5bdfd64 100644 |
| --- a/docs/live-gate.md |
| +++ b/docs/live-gate.md |
| @@ -105,3 +105,46 @@ unavailable at dispatch with `provider_policy_uncertified`. Deployment |
| and enabling execution remain human actions. Before upgrading an existing |
| instance, stop its old runner and all its children, then resolve any task waiting |
| for **Old runner stopped**. |
| + |
| +## Amadan credentials for the runner |
| + |
| +The runner needs an API bearer and a separate personal access token (PAT) for |
| +Git. Both belong to the disclosed agent account. As the agent's operator, mint |
| +its API bearer with `amadan agent token create equipo` (replace `equipo` with |
| +your registered agent name). In the agent's private Amadan home, save that bearer |
| +in `credentials` as `{"https://amadan.net":"<api bearer>"}`, with mode `0600`. |
| +Keep the home at mode `0700`. Then mint the Git PAT as that agent: |
| + |
| +```sh |
| +AMADAN_HOME="$HOME/.local/share/equipo-runner/amadan-agent-home" \ |
| + amadan tokens create -label equipo-runner-git |
| +``` |
| + |
| +These commands show the new credentials once. Use a private terminal without |
| +session recording. Save only the PAT value, without the command's explanatory |
| +text, in `~/.local/share/equipo-runner/amadan-agent-home/git-pat`, mode `0600`. |
| + |
| +Set `EQUIPO_AMADAN_CREDENTIAL_PATH` to a regular file with mode `0600` containing: |
| + |
| +```json |
| +{ |
| + "agent": "equipo~operator@example.com", |
| + "repositories": { |
| + "amadan.net/oficina/equipo": { |
| + "api": "<agent API bearer>", |
| + "git": "<agent Git PAT>" |
| + } |
| + } |
| +} |
| +``` |
| + |
| +Use your agent's full disclosed identity and an entry for each repository it |
| +will work on. API requests use Bearer auth. Git fetch and push use Basic auth |
| +with username `x` and the PAT as the password, supplied only through the Git |
| +process environment. Neither credential is copied into provider workspaces. |
| +The credential file remains a protected path for provider and check sandboxes. |
| + |
| +An old string entry is still read as an API bearer. Git refuses it with |
| +`configure a repository git password (PAT) in EQUIPO_AMADAN_CREDENTIAL_PATH` |
| +until you add the PAT. The controller's atomic conversion procedure is in |
| +[the forge git auth report](superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md). |
diff --git a/docs/superpowers/plans/CODEX-BRIEF-enable-execution.md b/docs/superpowers/plans/CODEX-BRIEF-enable-execution.md| new file mode 100644 |
| index 00000000..3498c714 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-BRIEF-enable-execution.md |
| @@ -0,0 +1,51 @@ |
| +# Brief: make the deployed starter set runnable (execution on CARLOS + runner install) |
| + |
| +Branch `enable-execution` from main 0cb576b, which is DEPLOYED to |
| +https://equipo.bds.oncarlos.com (CARLOS app `equipo`, account `oficina`, |
| +flagship; arm64 instance; env today: EQUIPO_ORIGIN, EQUIPO_OWNERS, |
| +CARLOS_SMTP_*; secret EQUIPO_INSTANCE_KEY). Paul approved enabling |
| +execution and enrolling docs-t1 (2026-11-05). Gaps found: |
| + |
| +1. scripts/install path: packaging/install/install-v1.sh asserts |
| + `not r.get('uncertified_policies')`; the starter-set manifest has 15 |
| + uncertified policies, so install refuses. Partial releases must |
| + install; dispatch already refuses uncertified routes |
| + (`provider_policy_uncertified`). Keep every other assertion; require |
| + at least one certified direct policy. |
| +2. Runner assets: the installer downloads |
| + `$origin/releases/<version>/{install-manifest.json,equipo-runner, |
| + equipo-tool-proxy,install-v1.sh}` served by InstallAssets from |
| + EQUIPO_RUNNER_RELEASE_DIR on the instance, but a CARLOS instance only |
| + receives the app binary. Decision: `make release` embeds the matching |
| + runner release assets (built for linux/amd64 by release-runner) into |
| + the instance binary (go:embed or an equivalent generated package, |
| + with digests checked against the install manifest), and InstallAssets |
| + serves the embedded copy when EQUIPO_RUNNER_RELEASE_DIR is unset. |
| + `make release` must build release-runner first (or depend on it) so |
| + a release can't ship mismatched assets. Keep binary size sane; |
| + report it. |
| +3. Execution on CARLOS: EQUIPO_EXECUTION_ENABLED=1 also requires |
| + EQUIPO_EXECUTION_MARKER_PATH (absolute, not in the DB's directory; |
| + see internal/equipo/execution_startup.go). Find how a CARLOS app gets |
| + a persistent writable directory (read the platform docs at |
| + ~/amadan.net/carlos/platform, e.g. `carlos help`, docs/ on app data |
| + dirs, CARLOS_* env the platform injects) and choose the marker path; |
| + decide whether EQUIPO_ALWAYS_ON is needed for runner connectivity and |
| + say why. Do NOT run `carlos env set` or deploy: write the exact |
| + commands in the report for the controller. |
| +4. Enrolment: document the exact steps to install and enrol a runner on |
| + docs-t1 as user paulca, no root, from the deployed instance (what |
| + Paul must click in the app, what one-time code if any, and the |
| + command(s)), including EQUIPO_CLAUDE_PATH pinning to |
| + ~/.local/share/claude/versions/2.1.312 (Claude auto-updated to |
| + 2.1.318) and reuse of the existing dedicated homes and bindings from |
| + the live gate (~/.local/share/equipo-runner/{runner.env,bindings.json}). |
| + If the installer would overwrite or conflict with those, say how to |
| + reconcile. |
| +Tests for 1-3; ONE full `make -k ci` (rerun at most twice); a dry |
| +`make release` into scratch proving embedded assets are served with |
| +correct digests. Commit subject < 80, body |
| +`Co-Authored-By: Astra <noreply@openai.com>`, push. |
| +CONTROLLER-REPORT-enable-execution.md with the commands. OFFLINE: no |
| +provider launches, no deploys, no env changes. Scratch removed; no |
| +copy-review server. Print a five-line summary. |
diff --git a/docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md b/docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md| new file mode 100644 |
| index 00000000..c1763d90 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md |
| @@ -0,0 +1,46 @@ |
| +# Brief: amadan git transport needs a PAT via Basic auth, not the agent bearer |
| + |
| +Branch `forge-git-auth` from main e99d178 (deployed). Observed on |
| +amadan.net today: |
| +- Agent bearer token (minted by `amadan agent token create`) works for |
| + the hub API with `Authorization: Bearer` (GET |
| + /api/v1/repos/oficina/equipo/branches/main/description → 200). |
| +- Git smart HTTP (`https://amadan.net/oficina/equipo`) rejects |
| + `Authorization: Bearer <agent token>` (git asks for a username) and |
| + rejects Basic with the agent token as password ("Authentication |
| + failed"). It ACCEPTS Basic with a PAT as password, any username |
| + (`amadan tokens create`, run as the agent via AMADAN_HOME, says |
| + "Use it as your git password ... username is ignored"). |
| +Equipo's runner sends `http.extraHeader=Authorization: Bearer <token>` |
| +for git fetch/push (internal/runner/workspace/workspace.go ~250, |
| +internal/runner/forge/publisher.go), so every real task would fail at |
| +fetch. |
| + |
| +Fix: |
| +- Credential file (EQUIPO_AMADAN_CREDENTIAL_PATH, forgeCredentialFile |
| + in internal/runner/runtime_workflow.go): add a per-repository git |
| + password (PAT) alongside the API bearer, e.g. |
| + {"agent": "...", "repositories": {"amadan.net/ns/repo": {"api": "<bearer>", |
| + "git": "<pat>"}}}; keep reading the old string form as API-only and |
| + refuse git without a PAT with a clear config issue. |
| +- Git transport uses `Authorization: Basic base64("x:"+pat)` via the |
| + same GIT_CONFIG_* env mechanism (never on the command line, never |
| + logged); API calls keep Bearer. Update forge.Credential/workspace.Remote |
| + types, validation, tests (including no leak into argv, logs, journal, |
| + provider sandboxes; the credential file stays a protected path). |
| +- Docs: how to mint both for an agent (agent token create; then |
| + AMADAN_HOME=<agent home> amadan tokens create) in docs/live-gate.md or |
| + README runner section (copy accepted for now; plain). |
| +Live check allowed: read-only `git ls-remote`/fetch of |
| +amadan.net/oficina/equipo through the runner's workspace code path using |
| +the existing file on docs-t1 after the controller converts it (do NOT |
| +read or print token values; the controller will convert the file). Write |
| +the exact conversion steps for the controller (a python snippet that |
| +reads ~/.local/share/equipo-runner/amadan.json and |
| +~/.local/share/equipo-runner/amadan-agent-home/git-pat and writes the new |
| +format atomically, 0600, printing nothing secret). Targeted tests, ONE |
| +full `make -k ci` (rerun at most twice). Commit subject < 80, body |
| +`Co-Authored-By: Astra <noreply@openai.com>`, push. |
| +CONTROLLER-REPORT-forge-git-auth.md. No deploys, no pushes to other |
| +repos, no provider launches. Scratch removed; no copy-review server. |
| +Print a five-line summary. |
diff --git a/docs/superpowers/plans/CODEX-BRIEF-runner-start.md b/docs/superpowers/plans/CODEX-BRIEF-runner-start.md| new file mode 100644 |
| index 00000000..53267fdb |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-BRIEF-runner-start.md |
| @@ -0,0 +1,38 @@ |
| +# Brief: enrolled runner exits with runner.contract on start |
| + |
| +Branch `runner-start` from main 9f616f3 (deployed; execution enabled). |
| +docs-t1 runner was installed manually per CONTROLLER-REPORT-enable- |
| +execution.md ("Install and enrol docs-t1 as paulca"): release at |
| +~/.local/share/equipo-runner/releases/9f616f3/, runner.env updated |
| +(backup runner.env.before-enable-execution), `equipo-runner enrol` |
| +SUCCEEDED (state/credentials.json now exists). User unit |
| +~/.local/share/equipo-runner/equipo-runner.service (linked into |
| +~/.config/systemd/user, EnvironmentFile=runner.env, ExecStart= |
| +.../9f616f3/equipo-runner run). On start: journal shows |
| +"Runner error runner.contract at -." then exit 1. The controller has |
| +STOPPED the unit (systemctl --user stop equipo-runner.service). |
| + |
| +Do: |
| +1. Find the exact failing check (ErrContract has many sources: |
| + internal/runner/config.go config issues, http.go, coordinator_service |
| + .go, runnerproto/retry.go, account_login.go...). Reproduce by running |
| + `equipo-runner run` in the foreground with the same EnvironmentFile |
| + (env -i + runner.env), briefly, and stop it; no jobs exist, so no |
| + provider work will start; if it reaches the job loop, stop it within |
| + a minute. You may read runner.env and bindings.json (not credential |
| + files, not account homes). |
| +2. Fix the cause: if it's local configuration (a missing/obsolete |
| + variable, path, bindings path), give the exact minimal edit to |
| + runner.env and apply it ONLY after recording the before/after in the |
| + report (keep the backup). If it's a code defect, fix it on this branch |
| + with a test. |
| +3. Make the error diagnostic: `runner.contract at -` must name the field |
| + or check (like config issues do) without secrets. |
| +4. Report the exact commands for the controller to restart the unit and |
| + to confirm in the app that the runner is online and the two Claude |
| + accounts are reported. Do not start the systemd unit yourself. |
| +Targeted tests; if code changed, ONE full `make -k ci` (rerun at most |
| +twice), commit subject < 80, body `Co-Authored-By: Astra |
| +<noreply@openai.com>`, push. CONTROLLER-REPORT-runner-start.md. No |
| +copy-review server; scratch removed; nothing left running. Print a |
| +five-line summary. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md b/docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md| new file mode 100644 |
| index 00000000..338e12c9 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md |
| @@ -0,0 +1,401 @@ |
| +# Enable execution: controller report |
| + |
| +The installer accepts the starter set's certified policies alongside its 15 |
| +uncertified policies. `make release` now builds the linux/amd64 runner first, |
| +checks its bundled downloads, then embeds them in the linux/arm64 app. An unset |
| +`EQUIPO_RUNNER_RELEASE_DIR` selects that bundle. A configured directory still |
| +wins and fails closed if invalid. Uncertified dispatch remains denied. |
| + |
| +No provider was launched, deployed configuration changed, runner enrolled, or |
| +application deployed during this task. No copy-review server was started. This |
| +is the controller's requested operational report, not new app copy; README and |
| +runtime strings are unchanged. |
| + |
| +## Implementation and checks |
| + |
| +- The bootstrap keeps its version, target, copy, certification and digest |
| + assertions. It requires a direct policy with a matching certificate that is |
| + not also listed as uncertified. The downloaded runner still validates the |
| + complete installation manifest before installation. |
| +- `scripts/build-instance-release.sh` stages only the installation manifest, |
| + runner, tool proxy and bootstrap script. It refuses an existing staging |
| + directory and removes its own staging directory on success or failure. |
| + `runnerassets` is a release-only build tag: normal app and runner builds do |
| + not contain the bundle, preventing recursive runner embedding. |
| +- Before building the app, `TestBundledInstallAssets` checks the version, |
| + namespace policy, release-manifest equality, runner SHA-256 and tool-proxy |
| + SHA-256 through `InstallAssets`. It serves and compares all four HTTP bodies. |
| + The bootstrap script has no separate digest field in the existing manifest; |
| + its bytes are copied from the same clean commit. Runner and tool-proxy |
| + digests retain their existing manifest locations. |
| +- Embedded assets reuse the directory handler's validation, path allowlist, |
| + range support and cache headers. Immutable embedded files are hashed once. |
| + Directory files retain their metadata and replacement checks. |
| +- No startup behavior needed changing. The new CARLOS layout test opens and |
| + reopens execution with a private witness subdirectory, no release-directory |
| + override and `AlwaysOn=false`. Enrolment remains available. The existing |
| + authenticated runner HTTP tests also pass with `AlwaysOn=false`. |
| + |
| +Initial red tests: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/release \ |
| + -run 'TestBootstrapPartialRelease|TestEmbeddedInstallAssets' -count=1 |
| +CGO_ENABLED=0 go test ./internal/equipotest \ |
| + -run '^TestDirectReleaseRequiresCertification/release/clean$' -count=1 |
| +``` |
| + |
| +The first command rejected the partial manifest and could not serve the |
| +embedded fixture. The second failed because the app build had no staged runner |
| +manifest. Both pass after implementation. The first compile attempt also |
| +failed because the bundle interface did not yet exist. |
| + |
| +Targeted verification passed: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/release ./internal/equipotest \ |
| + -run 'TestBootstrapPartialRelease|TestEmbeddedInstallAssets|TestOnboardingInstallPackaging|TestExecutionCarlosMarkerLayout|TestExecutionStartupClosed|TestExecutionHibernateWitness|TestRunnerAppCSRF|TestReleaseStampContract|TestRunnerReleaseContractPackaging|TestDirectReleaseRequiresCertification' \ |
| + -count=1 |
| +``` |
| + |
| +Mutation checks used disposable Go overlays under on-disk `$TMPDIR`; the |
| +bootstrap mutation was restored in a `finally` block. Each command exited 1 |
| +with the named assertion failing; the restored targeted command above passed. |
| + |
| +| Behavior deliberately broken | Command after `CGO_ENABLED=0` | Observed failure | |
| +| --- | --- | --- | |
| +| Ignore binary digest differences | `go test -overlay=<scratch>/digest.json ./internal/release -run '^TestEmbeddedInstallAssets$' -count=1` | Tampered runner and proxy accepted | |
| +| Ignore release-manifest equality | `go test -overlay=<scratch>/manifest.json ./internal/release -run '^TestEmbeddedInstallAssets$' -count=1` | Mismatched instance target accepted | |
| +| Prefer embedded files over an explicit directory | `go test -overlay=<scratch>/override.json ./internal/release -run '^TestEmbeddedInstallAssets$' -count=1` | Invalid explicit override accepted | |
| +| Ignore execution-enabled environment value | `go test -overlay=<scratch>/execution-env.json ./internal/equipotest -run '^TestExecutionCarlosMarkerLayout$' -count=1` | Execution configuration stayed disabled | |
| +| Remove disabled-execution guard | `go test -overlay=<scratch>/execution-off.json ./internal/equipotest -run '^TestExecutionStartupClosed$' -count=1` | Disabled execution opened | |
| +| Remove database-directory separation | `go test -overlay=<scratch>/marker-separation.json ./internal/equipotest -run '^TestExecutionStartupClosed$' -count=1` | Witness shared database directory | |
| +| Remove the app build's `runnerassets` tag | `go test ./internal/equipotest -run '^TestReleaseStampContract/defaults$' -count=1` | Release missing embedded assets | |
| +| Skip bootstrap certificate matching | `go test ./internal/release -run '^TestBootstrapPartialRelease$' -count=1` | Unmatched and explicitly uncertified policies accepted | |
| + |
| +The initial manifest mutation survived because its fixture changed the Claude |
| +version, which failed certification before reaching the equality check. The |
| +fixture now changes the instance target, and the equality mutation fails. |
| +The override mutation must change both opening and cache selection to model an |
| +unsafe fallback; changing opening alone still failed closed at file identity. |
| + |
| +One full `make -k ci` ran and exited 2. Build, vet, formatting, staticcheck, |
| +govulncheck, gitleaks, size budgets, adapter tests, namespace tests, migration |
| +checks and performance passed. Cold boot median was 116 ms against 500 ms. |
| +The reference scan and test target failed for these reasons: |
| + |
| +1. The brief and new runner asset references needed exact inventory entries. |
| + Added those entries, including this report; the scanner now passes. |
| +2. `TestOnboardingInstallShell/Linux/x86_64` supplied empty certificate objects. |
| + Added the fixture's matching provider, action and policy hash. The full |
| + `internal/release` package now passes. |
| +3. `TestReviewExpiredAccountSignsIn/claude` returned `provider_account_busy`. |
| + Its isolated rerun passed without account-code changes. The same failure |
| + and passing isolated rerun are recorded in |
| + `CONTROLLER-REPORT-fewer-prompts.md`; this change does not alter that path. |
| + |
| +The full test run executed 27 packages, with no cached results. Local advisory |
| +time overruns were runner 370.872/330 seconds, provider 21.891/15, Claude |
| +58.215/45 and Codex 46.821/35. No budgets were raised. These timings would fail |
| +when CI timing enforcement is enabled. |
| + |
| +The affected checks passed on this focused rerun: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/release ./internal/equipotest ./internal/tryequipo \ |
| + -run '^TestOnboardingInstallShell$|^TestDirectDeadReferencesRepository$|^TestReviewExpiredAccountSignsIn$|^TestReleaseStampContract$' \ |
| + -count=1 |
| +CGO_ENABLED=0 go test ./internal/release -count=1 |
| +CGO_ENABLED=0 go test ./internal/equipotest \ |
| + -run '^TestReleaseStampContract$|^TestDirectDeadReferencesRepository$' -count=1 |
| +``` |
| + |
| +No second full CI run was used. The full run remains recorded as failed; |
| +the focused fixes and reruns do not turn it into a claimed full green run. |
| + |
| +A dry `make release` passed in a clean disposable snapshot under on-disk |
| +`$TMPDIR`, stamped `4d1cb1f`. It used only the five executable-path variables |
| +read from the existing `runner.env`, with `EQUIPO_CLAUDE_PATH` overridden to |
| +`/home/paulca/.local/share/claude/versions/2.1.312`. No provider process was |
| +launched. This scratch commit is evidence of the build, not a version to deploy. |
| + |
| +The release ran these checks before compiling the ARM64 instance: |
| + |
| +```sh |
| +EQUIPO_BUNDLE_VERSION=4d1cb1f CGO_ENABLED=0 go test -tags runnerassets \ |
| + ./internal/release -run '^TestBundledInstallAssets$' -count=1 |
| +``` |
| + |
| +All four embedded downloads were served through the HTTP handler and matched |
| +the staged bytes. Both executable digests matched the installation manifest. |
| +The built AMD64 runner also passed `verify-install-manifest` on that manifest, |
| +and its `version` command reported `4d1cb1f`. No app server was started. |
| + |
| +| Artifact | Bytes | MiB | |
| +| --- | ---: | ---: | |
| +| ARM64 app including runner bundle | 41,484,450 | 39.56 | |
| +| AMD64 runner | 18,116,770 | 17.28 | |
| +| AMD64 tool proxy | 2,646,178 | 2.52 | |
| + |
| +`file` confirmed a stripped, statically linked ARM64 app and stripped, |
| +statically linked AMD64 runner and helper. The generated bundle directory was |
| +removed by the build script, and the scratch checkout remained clean. Final |
| +`make runner-dead-references fmt-check` and `git diff --check` passed. |
| + |
| +## CARLOS configuration for the controller |
| + |
| +Choose this absolute marker path: |
| + |
| +```text |
| +/data/instances/equipo.bds.oncarlos.com/execution/witness |
| +``` |
| + |
| +The platform's `internal/provision/provision.go` defines the persistent nested |
| +instance directory and database path. For this hostname, the database is |
| +`/data/instances/equipo.bds.oncarlos.com/equipo.bds.oncarlos.com.db` in the |
| +nested layout. The older flat layout uses `/data/equipo.bds.oncarlos.com.db`. |
| +The chosen witness directory is separate in either layout. The isolated |
| +instance unit binds and permits writes to its own `/data/instances/<host>` |
| +directory. `OpenExecution` creates `execution` with mode 0700. |
| + |
| +Sources read locally under `~/amadan.net/carlos/platform`: |
| +`internal/provision/provision.go` (`InstanceDir`, `NestedDBPath`, `DefaultDBPath`), |
| +`internal/host/units/carlos-instance@.service` (`BindPaths`, `ReadWritePaths`), |
| +`internal/activator/backend_exec.go` (`agentOwnedVars`, `childEnv`, replication), |
| +`docs/site/cli.md` (configuration bundles), and `carlos help` / `carlos env set -h`. |
| +`CARLOS_DATA_DIR` configures the platform process; it is not an injected app |
| +storage variable. App launch supplies `--db`; injected platform variables such |
| +as `CARLOS_CONTROL_SOCKET` and `CARLOS_REGION` do not identify persistent app |
| +storage. This selection comes from the checked-in platform contract; no live |
| +instance filesystem was inspected. |
| + |
| +Preserve this witness independently when restoring the SQLite database. |
| +Database replication does not replicate this extra file. Hibernation on the |
| +same disk can reopen it. If a host move, disk loss or restore loses or rolls |
| +back the witness, execution must quarantine until a person follows recovery. |
| +Do not copy an old witness together with an old database to bypass that check. |
| + |
| +Leave `EQUIPO_ALWAYS_ON` unset. It enables browser live updates and related |
| +in-process scheduling in `internal/equipo/app.go`; it does not control CARLOS |
| +hibernation or register runner routes. Runners use outbound authenticated HTTP, |
| +25-second long polls and heartbeats. Requests wake the app through CARLOS, and |
| +execution resumes from its database and witness. No always-on platform change |
| +is needed for connectivity. |
| + |
| +After review and human merge, build from a clean checkout of the commit to be |
| +deployed. Export the executable paths from the existing local runner setup and |
| +pin Claude to the certified version before running the release gate. These |
| +commands are for the controller to run later; none were run against CARLOS: |
| + |
| +```sh |
| +set -a |
| +. "$HOME/.local/share/equipo-runner/runner.env" |
| +set +a |
| +export EQUIPO_CLAUDE_PATH="$HOME/.local/share/claude/versions/2.1.312" |
| +make release |
| +EQUIPO_RELEASE_VERSION=$(git rev-parse --short HEAD) |
| +read -r -p 'Paste the flagship console address linked below: ' EQUIPO_CONSOLE |
| +carlos deploy --console "$EQUIPO_CONSOLE" --app equipo --account oficina \ |
| + --channel edge --timeout 5m \ |
| + "./releases/equipo-linux-arm64-$EQUIPO_RELEASE_VERSION" |
| +carlos env set --console "$EQUIPO_CONSOLE" --app equipo --account oficina \ |
| + --no-prompt EQUIPO_EXECUTION_ENABLED=1 \ |
| + EQUIPO_EXECUTION_MARKER_PATH=/data/instances/equipo.bds.oncarlos.com/execution/witness |
| +``` |
| + |
| +Flagship console: |
| +[https://console.carloku.com](https://console.carloku.com). |
| +The command uses the repository's `edge` deployment target. Confirm the route's channel before promotion if |
| +it has changed since this brief. The stated current env has no named bundle; |
| +the command writes the default bundle. If the controller discovers a named |
| +bundle overriding these values, apply them to that bundle with `--environment`. |
| +Do not set `EQUIPO_RUNNER_RELEASE_DIR`; the app serves its matching bundle. |
| + |
| +## Install and enrol docs-t1 as paulca |
| + |
| +Open [https://equipo.bds.oncarlos.com](https://equipo.bds.oncarlos.com), sign in, |
| +and open [https://equipo.bds.oncarlos.com/onboarding](https://equipo.bds.oncarlos.com/onboarding). |
| +The page's installer command supplies the deployed version and instance ID. |
| +Check its instance argument against `EQUIPO_INSTANCE_ID` in the saved |
| +`runner.env`. If using the navigation instead, choose **Connections**, then |
| +**Enrol a runner** to reach the machine enrolment page. |
| + |
| +For a fresh installation, the page's bootstrap command runs the installer, |
| +asks for the machine label and asks you to type `yes`. It then prints a |
| +one-time device code and the approval URL. The code is generated at enrolment; |
| +there is no reusable code to put in this report. |
| + |
| +On this machine, use the manual installation below. The existing |
| +`~/.local/share/equipo-runner/runner.env` is mode 0600 and has no installer |
| +ownership attribute. `SaveServiceEnvironment` refuses to overwrite it. Even |
| +an installer-owned replacement would select `accounts.json` and new work and |
| +scratch defaults instead of the live gate's `bindings.json` and existing |
| +paths. Passing the existing variables to the bootstrap does not fix those |
| +hardcoded defaults. The commands below preserve the saved configuration and |
| +bindings, changing only Claude's executable pin and the installed tool-proxy |
| +path. They do not repeat provider sign-in or copy credentials. |
| + |
| +The user service manager is available and `loginctl` reported `Linger=yes`. |
| +All five installed executable hashes match the manifest when Claude is pinned |
| +to 2.1.312. No executable was launched to check those hashes. |
| +At inspection, there was no runner user service, `state/credentials.json`, or |
| +`state/enrolment.json`. The two bindings both use Claude and existing dedicated |
| +homes under `~/.local/share/equipo/accounts/`. Keep those homes and binding |
| +records intact. The commands deliberately stop if a service or target release |
| +has appeared since this inspection; reconcile that newer installation first. |
| + |
| +Run this in Bash on docs-t1 as `paulca`, after the new app is deployed: |
| + |
| +```bash |
| +set -euo pipefail |
| +umask 077 |
| +EQUIPO_INSTALL_ROOT="$HOME/.local/share/equipo-runner" |
| +test "$(id -un)" = paulca |
| +test ! -e "$HOME/.config/systemd/user/equipo-runner.service" |
| +test ! -L "$HOME/.config/systemd/user/equipo-runner.service" |
| +test ! -e "$EQUIPO_INSTALL_ROOT/equipo-runner.service" |
| +test ! -L "$EQUIPO_INSTALL_ROOT/equipo-runner.service" |
| +systemctl --user show-environment >/dev/null |
| +loginctl show-user "$(id -u)" --property=Linger --value |
| +set -a |
| +. "$EQUIPO_INSTALL_ROOT/runner.env" |
| +set +a |
| +export EQUIPO_CLAUDE_PATH="$HOME/.local/share/claude/versions/2.1.312" |
| +test -x "$EQUIPO_CLAUDE_PATH" |
| +test "$EQUIPO_ACCOUNT_BINDINGS_PATH" = "$EQUIPO_INSTALL_ROOT/bindings.json" |
| +mkdir -p "$HOME/.cache/equipo-install" |
| +export TMPDIR="$HOME/.cache/equipo-install" |
| +EQUIPO_DOWNLOAD=$(mktemp -d "$TMPDIR/download-XXXXXXXX") |
| +trap 'rm -rf "$EQUIPO_DOWNLOAD"' EXIT |
| +EQUIPO_INSTALL_VERSION=$(curl --fail --silent --show-error \ |
| + --proto '=https' --tlsv1.2 "$EQUIPO_ORIGIN/api/version") |
| +export EQUIPO_INSTALL_VERSION EQUIPO_DOWNLOAD |
| +python3 - <<'PY' |
| +import os, re |
| +v = os.environ['EQUIPO_INSTALL_VERSION'] |
| +assert re.fullmatch(r'[a-zA-Z0-9][a-zA-Z0-9._-]{0,79}', v) |
| +assert v not in ('dev', 'latest') |
| +PY |
| +for asset in install-manifest.json equipo-runner equipo-tool-proxy; do |
| + curl --fail --silent --show-error --proto '=https' --tlsv1.2 \ |
| + "$EQUIPO_ORIGIN/releases/$EQUIPO_INSTALL_VERSION/$asset" \ |
| + -o "$EQUIPO_DOWNLOAD/$asset" |
| +done |
| +python3 - <<'PY' |
| +import hashlib, json, os, pathlib |
| +root = pathlib.Path(os.environ['EQUIPO_DOWNLOAD']) |
| +m = json.loads((root / 'install-manifest.json').read_text()) |
| +assert m['version'] == os.environ['EQUIPO_INSTALL_VERSION'] |
| +assert m['target'] == 'linux/amd64' |
| +def digest(path): |
| + with pathlib.Path(path).open('rb') as f: |
| + return hashlib.file_digest(f, 'sha256').hexdigest() |
| +assert digest(root / 'equipo-runner') == m['runner_sha256'] |
| +paths = {'claude': os.environ['EQUIPO_CLAUDE_PATH'], |
| + 'codex': os.environ['EQUIPO_CODEX_PATH'], |
| + 'codex-code-mode-host': os.environ['EQUIPO_CODEX_CODE_MODE_HOST_PATH'], |
| + 'bwrap': os.environ['EQUIPO_BWRAP_PATH'], |
| + 'equipo-tool-proxy': root / 'equipo-tool-proxy'} |
| +assert len(m['release']['binaries']) == len(paths) |
| +for b in m['release']['binaries']: |
| + assert digest(paths[b['name']]) == b['sha256'], b['name'] |
| +PY |
| +chmod 700 "$EQUIPO_DOWNLOAD/equipo-runner" |
| +"$EQUIPO_DOWNLOAD/equipo-runner" verify-install-manifest \ |
| + "$EQUIPO_DOWNLOAD/install-manifest.json" >/dev/null |
| +EQUIPO_INSTALL_RELEASE="$EQUIPO_INSTALL_ROOT/releases/$EQUIPO_INSTALL_VERSION" |
| +mkdir -p "$EQUIPO_INSTALL_ROOT/releases" |
| +mkdir "$EQUIPO_INSTALL_RELEASE" |
| +install -m 700 "$EQUIPO_DOWNLOAD/equipo-runner" "$EQUIPO_INSTALL_RELEASE/" |
| +install -m 700 "$EQUIPO_DOWNLOAD/equipo-tool-proxy" "$EQUIPO_INSTALL_RELEASE/" |
| +install -m 600 "$EQUIPO_DOWNLOAD/install-manifest.json" "$EQUIPO_INSTALL_RELEASE/" |
| +export EQUIPO_TOOL_PROXY_PATH="$EQUIPO_INSTALL_RELEASE/equipo-tool-proxy" |
| +export EQUIPO_INSTALL_ROOT |
| +python3 - <<'PY' |
| +import json, os, pathlib |
| +root = pathlib.Path(os.environ['EQUIPO_INSTALL_ROOT']) |
| +p = root / 'runner.env' |
| +original = p.read_bytes() |
| +with (root / 'runner.env.before-enable-execution').open('xb') as backup: |
| + backup.write(original) |
| +updates = {k: os.environ[k] for k in ('EQUIPO_CLAUDE_PATH', 'EQUIPO_TOOL_PROXY_PATH')} |
| +lines = original.decode().splitlines() |
| +assert all(sum(line.startswith(k + '=') for line in lines) == 1 for k in updates) |
| +p.write_text('\n'.join(k + '=' + json.dumps(updates[k]) if k in updates else line |
| + for line in lines for k in [line.partition('=')[0]]) + '\n') |
| +p.chmod(0o600) |
| +PY |
| +export EQUIPO_MACHINE_LABEL=docs-t1 |
| +"$EQUIPO_INSTALL_RELEASE/equipo-runner" enrol |
| +``` |
| + |
| +While `enrol` waits, open |
| +[https://equipo.bds.oncarlos.com/runners/enrol](https://equipo.bds.oncarlos.com/runners/enrol). |
| +Enter the terminal's one-time code in **Code from your machine**, click |
| +**Check machine**, check the `docs-t1` label, key fingerprint and request time, |
| +compare the fingerprint before clicking **Approve machine**. Run this in a |
| +second terminal while enrolment waits; it prints only the hash of the public key: |
| + |
| +```bash |
| +python3 - <<'PYCODE' |
| +import base64, hashlib, json, pathlib |
| +p = pathlib.Path.home() / '.local/share/equipo-runner/state/machine-key.json' |
| +s = json.loads(p.read_text()) |
| +key = base64.urlsafe_b64decode(s + '=' * (-len(s) % 4)) |
| +assert len(key) == 64 |
| +print(hashlib.sha256(key[32:]).hexdigest()) |
| +PYCODE |
| +``` |
| + |
| +Click **Approve machine** once those details match. The code expires after ten |
| +minutes. Wait for `enrol` to exit successfully. A retry |
| +reuses a still-valid pending code; an already enrolled matching state returns |
| +success without another code. Never delete existing state to force enrolment. |
| + |
| +Then install and start the user service, still in the same shell: |
| + |
| +```bash |
| +mkdir -p "$HOME/.config/systemd/user" |
| +cat > "$EQUIPO_INSTALL_ROOT/equipo-runner.service" <<UNIT |
| +[Unit] |
| +Description=equipo-runner |
| +[Service] |
| +Type=simple |
| +EnvironmentFile=$EQUIPO_INSTALL_ROOT/runner.env |
| +ExecStart=$EQUIPO_INSTALL_RELEASE/equipo-runner run |
| +Restart=on-failure |
| +RestartSec=5 |
| +TimeoutStopSec=45 |
| +KillMode=control-group |
| +UMask=0077 |
| +NoNewPrivileges=yes |
| +[Install] |
| +WantedBy=default.target |
| +UNIT |
| +chmod 600 "$EQUIPO_INSTALL_ROOT/equipo-runner.service" |
| +systemctl --user link "$EQUIPO_INSTALL_ROOT/equipo-runner.service" |
| +systemctl --user daemon-reload |
| +systemctl --user enable --now equipo-runner.service |
| +systemctl --user status equipo-runner.service --no-pager |
| +rm -rf "$EQUIPO_DOWNLOAD" |
| +trap - EXIT |
| +``` |
| + |
| +If the earlier `Linger` result was `no`, the user service stops after logout. |
| +Keep the user session open; no root or lingering change is part of this task. |
| +Starting the service is the point at which real work can begin. The manual |
| +route uses the same certified binaries and existing live-gate containment |
| +setup, but does not run the installer's containment probe; do not use it on a |
| +machine whose bubblewrap/user-namespace prerequisites have changed. The runner |
| +still enforces its runtime checks. In **Connections**, confirm that the |
| +existing accounts are reported before requesting a task. The runner will |
| +continue to refuse any route without a matching policy certificate. |
| + |
| +## Handoff |
| + |
| +Implementation and controller instructions are ready on `enable-execution`. |
| +Human review, merge and versioned deployment remain with the controller; Paul |
| +then approves docs-t1's device code. The local full CI result and focused |
| +reruns are recorded above, including the pre-existing intermittent account test |
| +and advisory timing overruns. Task scratch, release binaries and logs were |
| +removed. No server or background process from this task remains. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md b/docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md| new file mode 100644 |
| index 00000000..4162cd90 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md |
| @@ -0,0 +1,201 @@ |
| +# Forge git authentication |
| + |
| +Implemented on `forge-git-auth`, from brief commit `4940731` above deployed |
| +base `e99d178`. Copy accepted for now under the task brief. |
| + |
| +Credential-file handling now lives in `internal/runner/forge/credential_file.go`, |
| +so its tests fit the existing package budgets. Runtime wiring uses that reader |
| +for fetch and publication. The file accepts per-repository `api` and `git` values. Legacy |
| +string entries remain API-only. Fetch and publication require a Git PAT and |
| +use `Authorization: Basic base64("x:" + pat)` in `GIT_CONFIG_*`. API readback |
| +and the Amadan description command retain the bearer. Missing PATs produce a |
| +configuration error before fetch. Basic auth values are now redacted from |
| +journal text and downloaded logs. |
| + |
| +## Controller conversion |
| + |
| +No production credentials were opened or changed during implementation. The |
| +controller owns this conversion. First mint the agent's API bearer with |
| +`amadan agent token create equipo` if it does not already exist. Configure the |
| +agent's private Amadan home with that bearer, then run |
| +`AMADAN_HOME="$HOME/.local/share/equipo-runner/amadan-agent-home" amadan tokens create -label equipo-runner-git`. |
| +The setup and file formats are described in [the live guide](../../live-gate.md#amadan-credentials-for-the-runner). |
| + |
| +Save just the PAT value at |
| +`~/.local/share/equipo-runner/amadan-agent-home/git-pat`, mode `0600`. Keep the |
| +agent home private (`0700`). Run this snippet as the owner of the existing |
| +runner files on docs-t1. It preserves the API bearer, agent identity and other |
| +repository entries, replaces only the Equipo repository entry, and writes the |
| +new file atomically with mode `0600`. It prints no credentials and makes no |
| +network requests. It also accepts an already converted entry. |
| + |
| +```python |
| +import json |
| +import os |
| +from pathlib import Path |
| +import stat |
| +import tempfile |
| + |
| +root = Path.home() / ".local/share/equipo-runner" |
| +path = root / "amadan.json" |
| +pat_path = root / "amadan-agent-home/git-pat" |
| +repo = "amadan.net/oficina/equipo" |
| +temporary = None |
| + |
| + |
| +def read_private(source): |
| + fd = os.open(source, os.O_RDONLY | os.O_NOFOLLOW) |
| + with os.fdopen(fd, "r", encoding="utf-8") as stream: |
| + info = os.fstat(stream.fileno()) |
| + if (not stat.S_ISREG(info.st_mode) |
| + or stat.S_IMODE(info.st_mode) != 0o600 |
| + or info.st_uid != os.getuid() |
| + or info.st_size > 1024 * 1024): |
| + raise ValueError("Expected a private credential file") |
| + return stream.read() |
| + |
| + |
| +def valid_secret(value): |
| + return (isinstance(value, str) and bool(value) |
| + and not any(c.isspace() or c == "\0" for c in value)) |
| + |
| + |
| +try: |
| + data = json.loads(read_private(path)) |
| + pat = read_private(pat_path).strip() |
| + entry = data["repositories"][repo] |
| + api = entry if isinstance(entry, str) else entry["api"] |
| + if not valid_secret(api) or not valid_secret(pat): |
| + raise ValueError("Expected credential values") |
| + if not isinstance(data["agent"], str) or not data["agent"]: |
| + raise ValueError("Expected agent identity") |
| + data["repositories"][repo] = {"api": api, "git": pat} |
| + fd, temporary = tempfile.mkstemp(prefix=".amadan-", dir=root) |
| + with os.fdopen(fd, "w", encoding="utf-8") as stream: |
| + os.fchmod(stream.fileno(), 0o600) |
| + json.dump(data, stream, indent=2) |
| + stream.write("\n") |
| + stream.flush() |
| + os.fsync(stream.fileno()) |
| + os.replace(temporary, path) |
| + temporary = None |
| + directory = os.open(root, os.O_RDONLY | os.O_DIRECTORY) |
| + try: |
| + os.fsync(directory) |
| + finally: |
| + os.close(directory) |
| +except Exception: |
| + raise SystemExit("Credential conversion failed; check the private files") from None |
| +finally: |
| + if temporary is not None: |
| + os.unlink(temporary) |
| +``` |
| + |
| +The live read-only fetch is allowed only after the controller converts the |
| +file. It has not been run in this session. No deployment or live provider session |
| +was launched. |
| + |
| +## Regression evidence |
| + |
| +Tests were written before the implementation. This command failed on the old |
| +code: the new object entries were unreadable, legacy entries were accepted for |
| +git, Basic auth leaked into the journal, and publication still used Bearer: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/runner ./internal/runner/forge -run 'TestForgeCredentialsSplitAndLegacy|TestForgeBasicCredentialsAbsentFromJournalAndLog|TestPublishCredentialIsolationHTTPS' -count=1 |
| +``` |
| + |
| +`CGO_ENABLED=0 go test ./internal/runner/workspace -run 'TestWorkspaceGit' -count=1` |
| +also failed before implementation: fetch did not use Basic, and a missing PAT |
| +reached git without a configuration diagnostic. |
| + |
| +After implementation and the package move, the following targeted run passed: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/runner ./internal/runner/forge ./internal/runner/workspace -run 'TestForge|TestRunnerConfig$|TestRunnerJournalSecrets|TestPublish|TestAmadan|TestWorkspace' -count=1 |
| +``` |
| + |
| +The changed protocol redactor is exercised by the runner journal and log tests. |
| +Publication and fetch |
| +use instrumented git commands against disposable local repositories. The tests |
| +check the exact Basic value, absence from arguments and local git commands, |
| +provider environments, saved workspace files and publication state. API tests |
| +carry distinct bearer and PAT values and require the bearer for both HTTP and |
| +the description command. Tests also cover malformed entries, repository |
| +boundaries, missing PATs, control characters, public files and symlinks. |
| + |
| +Each guard below was deliberately broken, tested, and restored. Every command |
| +exited 1 with the corresponding test assertion failure, not a compilation |
| +failure. The final mutation runs followed the package move. The journal and log |
| +assertions both failed when Basic redaction was removed. |
| + |
| +| Broken behavior | Command that caught it | |
| +| --- | --- | |
| +| fetch auth scheme | `CGO_ENABLED=0 go test ./internal/runner/workspace -run ^TestWorkspaceGitBasicIsolation -count=1` | |
| +| publish auth scheme | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestPublishCredentialIsolationHTTPS -count=1` | |
| +| API retains bearer | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestAmadanDescriptionReadback/valid$ -count=1` | |
| +| legacy refuses git | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestForgeCredentialsSplitAndLegacy/legacy -count=1` | |
| +| fetch requires PAT | `CGO_ENABLED=0 go test ./internal/runner/workspace -run ^TestWorkspaceGitRequiresPassword -count=1` | |
| +| publish requires PAT | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestPublishEvidenceAndCredentialGuards/git_missing -count=1` | |
| +| publish validates PAT | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestPublishEvidenceAndCredentialGuards/git_header -count=1` | |
| +| journal and log redaction | `CGO_ENABLED=0 go test ./internal/runner -run ^TestRunnerJournalSecretsAndLog -count=1` | |
| +| protected credential path | `CGO_ENABLED=0 go test ./internal/runner -run ^TestRunnerConfig$ -count=1` | |
| +| provider environment | `CGO_ENABLED=0 go test ./internal/runner/workspace -run ^TestWorkspaceGitBasicIsolation -count=1` | |
| +| publish persisted state | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestPublishCredentialIsolation$ -count=1` | |
| +| fetch credentials in argv | `CGO_ENABLED=0 go test ./internal/runner/workspace -run ^TestWorkspaceGitBasicIsolation -count=1` | |
| +| fetch validates PAT | `CGO_ENABLED=0 go test ./internal/runner/workspace -run ^TestWorkspaceGitPasswordValidation -count=1` | |
| +| local fetch forbids PAT | `CGO_ENABLED=0 go test ./internal/runner/workspace -run ^TestWorkspaceGitPasswordValidation/local -count=1` | |
| +| configuration validates PAT | `CGO_ENABLED=0 go test ./internal/runner/forge -run ^TestForgeCredentialInvalidEntries -count=1` | |
| + |
| +The exact conversion snippet above was extracted and run with disposable fake |
| +homes. Legacy conversion and a second conversion passed without output; |
| +identity and unrelated repository entries stayed unchanged. Mode `0600` was |
| +preserved. Empty values, copied CLI output, public PAT files and symlinks were |
| +refused without altering the credential file or leaving temporary files. |
| + |
| + |
| +## Full gate |
| + |
| +The first `make -k ci` exited 2. Its reference scan found unclassified paths in |
| +the new guide and the supplied brief, and the new tests exceeded the runner |
| +package's existing line budget. Both checks now pass: the exact references |
| +have reasoned inventory entries, and the credential reader and its tests live |
| +in forge. The budget limits were not raised. |
| + |
| +The first full tests also found two external publication fixtures without |
| +PATs. Those now use distinct test passwords. Release-copy tests encountered a |
| +missing test file because the package move happened while that run read the |
| +checkout. The moved files are staged together for the final run. Build, vet, |
| +formatting, staticcheck, govulncheck, gitleaks, adapter checks, namespace checks, |
| +migrations and performance passed in the first run. The vulnerability scan |
| +found no reachable vulnerabilities; gitleaks found no secrets. |
| + |
| +After updating the external fixtures, this combined targeted command passed |
| +(team 0.969s, app integration 34.896s, runner 0.113s, forge 11.664s, |
| +workspace 1.332s): |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/equipo/team ./internal/equipotest ./internal/runner ./internal/runner/forge ./internal/runner/workspace -run 'TestPublishCoreAuthorizationContract$|TestRunnerDirectEndToEnd$|TestForge|TestRunnerConfig$|TestRunnerJournalSecrets|TestPublish|TestAmadan|TestWorkspace' -count=1 |
| +``` |
| + |
| +The second `make -k ci` exited 0. This was the only full rerun. All lanes passed: |
| +reference inventory, build, vet, formatting, staticcheck, govulncheck, gitleaks, |
| +size budgets, full tests, adapter checks, namespace checks, migrations and |
| +performance. The required sandbox tests include the protected Amadan path. |
| +Cold boot had a 110ms median against the 500ms budget. No budget exceptions |
| +were changed. |
| + |
| +The final checkout was held unchanged throughout that run. Scratch scripts, |
| +logs and conversion fixtures were removed after recording these results. |
| +Production credentials remain untouched. The controller still needs to run the |
| +conversion before any live read-only fetch. No deployment, default-branch push, |
| +push to another repository, live provider session or copy-review server was |
| +started. |
| + |
| +## Push status |
| + |
| +`git push -u origin HEAD:refs/heads/forge-git-auth` failed because this checkout |
| +has no HTTPS Git authentication (`could not read Username`). The implementation |
| +is committed locally. The controller must enable Git authentication here or |
| +push the branch. No production credential file was read to work around this. |
| +The committed history passed a second secret scan before the push attempt. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md b/docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md| new file mode 100644 |
| index 00000000..6c30fc62 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md |
| @@ -0,0 +1,213 @@ |
| +# Runner start: heartbeat report encoding |
| + |
| +The runner exits because its first heartbeat contains account reports encoded |
| +with Go field names (`LocalID`, `Routing`, `AccountID`). The heartbeat handler |
| +uses the strict protocol decoder, which requires `local_id`, `routing` and |
| +`account_id`. The exact failing check is `runnerproto.DecodeLimit` on |
| +`q.Reports` in `Handler.runnerConnections`, before `ReportConnections` runs. |
| +The instance returns HTTP 422 with `form.invalid`; the client unwraps that |
| +refusal as `provider.ErrContract` and previously discarded its location. |
| + |
| +This is a code defect, not a local configuration error. No edit to |
| +`runner.env`, bindings, installed releases or the service was made. The |
| +existing `runner.env.before-enable-execution` backup remains in place. |
| +No credential files or account homes were inspected by investigation commands. |
| +The explicitly authorized foreground runner uses its own normal credential and |
| +account discovery paths. No account login or model task was requested. |
| + |
| +## Reproduction and change |
| + |
| +The service was inactive before and after the investigation. The initial |
| +literal empty-environment run exited 1 with `runner.policy at EQUIPO_CODEX_PATH`: |
| +without `HOME`, the protected home paths are relative. Systemd supplies `HOME` |
| +to the actual user service. Adding only that standard variable reproduced the |
| +journal's `runner.contract at -`, exit 1: |
| + |
| +```sh |
| +timeout --signal=TERM --kill-after=5s 40s env -i HOME=/home/paulca \ |
| + /bin/bash --noprofile --norc -c ' |
| + set -a |
| + . /home/paulca/.local/share/equipo-runner/runner.env |
| + set +a |
| + exec /home/paulca/.local/share/equipo-runner/releases/9f616f3/equipo-runner run |
| + ' |
| +``` |
| + |
| +A disposable Go overlay added safe stage/status diagnostics. With the same |
| +environment, it returned `runner.contract at http.heartbeat.status_422.form.invalid`. |
| +No request body, response prose, token or account-home content was logged. |
| + |
| +`HTTPInstance.Heartbeat` now uses `runnerproto.Marshal` for its nested reports. |
| +The outer protocol encoder preserves `json.RawMessage`, so it cannot repair |
| +ordinary JSON inside that field. Persisted report JSON remains unchanged. |
| +HTTP contract failures now identify status, envelope decoding, version or |
| +result decoding. Refusals retain their typed status/reason and `errors.Is` / |
| +`errors.As` behavior. Unknown remote reasons become the existing fixed |
| +`form.invalid` code. The original failure now prints: |
| + |
| +```text |
| +Runner error runner.contract at http.response.status_422.form.invalid. |
| +``` |
| + |
| +No app copy was added or changed. The existing diagnostic format is reused; |
| +new diagnostic locations are protocol check identifiers. No copy-review server |
| +was started, as instructed. |
| + |
| +## Verification |
| + |
| +The new tests ran in the runner package before implementation: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/runner \ |
| + -run '^TestRunnerHeartbeatWireReports$|^TestRunnerHTTPContractDiagnostics$' -count=1 |
| +``` |
| + |
| +Exit 1: the two-account heartbeat failed against the real protocol HTTP handler, |
| +and all six diagnostic cases failed. The heartbeat test also covers empty and |
| +nil account lists. The diagnostic test checks safe refusal codes, redirect |
| +rejection, invalid JSON, wrong protocol version and invalid result shape. |
| + |
| +After implementation, this targeted command passed. The new tests now live in |
| +`internal/runner/transporttest`, using the public client against loopback HTTP |
| +servers and the real heartbeat handler: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test ./internal/runner/transporttest ./internal/runner ./internal/equipotest \ |
| + -run '^TestRunnerHeartbeatWireReports$|^TestRunnerHTTPContractDiagnostics$|^TestRunnerHTTPClient|^TestDirectBugRuntimeRenewHeartbeat$|^TestDirectClaimRevalidates$|^TestRunnerHeartbeatAndValidatedReceipt$|^TestRunnerAppCSRF$' \ |
| + -count=1 |
| +``` |
| + |
| +Seven independent mutations used disposable overlays in |
| +`/home/paulca/.cache/tmp/equipo-runner-start`. For each name below: |
| + |
| +```sh |
| +CGO_ENABLED=0 go test -overlay=/home/paulca/.cache/tmp/equipo-runner-start/NAME.json \ |
| + ./internal/runner/transporttest \ |
| + -run '^TestRunnerHeartbeatWireReports$|^TestRunnerHTTPContractDiagnostics$' -count=1 |
| +``` |
| + |
| +| NAME | Deliberately broken behavior | Result | |
| +| --- | --- | --- | |
| +| wire | Restore ordinary JSON for reports | Exit 1, two-account heartbeat rejected | |
| +| refusal | Remove refusal location | Exit 1, refusal diagnostic assertions | |
| +| status | Remove unexpected-status location | Exit 1, redirect diagnostic assertion | |
| +| envelope | Remove envelope location | Exit 1, malformed-envelope assertion | |
| +| version | Remove version location | Exit 1, wrong-version assertion | |
| +| result | Remove result location | Exit 1, wrong-result assertion | |
| +| redaction | Use the raw remote error code | Exit 1, untrusted reason exposed | |
| + |
| +The unchanged working sources passed the targeted command again after the |
| +mutations. No mutation was applied to the working source files. |
| + |
| +A second temporary overlay only printed successful heartbeat/report counts |
| +and poll/assignment counts. Built with `CGO_ENABLED=0 go build -overlay=...` |
| +and run with the same environment under a 35-second timeout, it recorded: |
| + |
| +```text |
| +probe: heartbeat accepted, reports=2 |
| +probe: poll accepted, assignments=0 |
| +probe: heartbeat accepted, reports=2 |
| +``` |
| + |
| +SIGTERM stopped the foreground process at the deadline; `timeout` returned 124. |
| +Two `runner.poll_retry` lines appeared as cancellation interrupted polling. |
| +The runner reached the job loop and reported both configured accounts. This |
| +proves report acceptance, not that both accounts passed provider preflight. |
| +No authenticated browser session was used to inspect the app. |
| + |
| +One full `make -k ci` completed with exit 2. Its only failing target was |
| +`budget`: the initial test file took `internal/runner` from 8798 to 8902 test |
| +lines against its existing 8800 ceiling. The tests were moved into |
| +`internal/runner/transporttest`, using the public client and loopback HTTP |
| +servers. `make budget` then passed with all 40 directories within budget. |
| +No budget was raised. The final tests and all seven mutations passed in their |
| +new package. There was no second full CI run; the original full gate remains |
| +recorded as failed, with its size failure corrected by the focused rerun. |
| + |
| +The full test step ran 30 packages, none cached, with zero failures. Build, |
| +vet, formatting, staticcheck, govulncheck, gitleaks, reference inventory, |
| +adapter checks, namespace checks, migrations and performance all passed. |
| +Cold boot median was 250 ms against the 500 ms limit. After moving the tests, |
| +`make budget vet staticcheck fmt-check runner-dead-references` passed again. |
| + |
| +Local timing overruns were advisory; these timings would fail under CI timing |
| +enforcement. No time allowance was changed: |
| + |
| +| Package | Measured seconds | Budget seconds | |
| +| --- | ---: | ---: | |
| +| directlive | 518.394 | 360 | |
| +| equipotest | 336.270 | 300 | |
| +| runner | 539.301 | 330 | |
| +| runner/forge | 15.751 | 15 | |
| +| runner/provider | 23.431 | 15 | |
| +| runner/provider/claude | 51.572 | 45 | |
| +| runner/provider/codex | 43.410 | 35 | |
| + |
| +## Controller: install the reviewed runner, then restart |
| + |
| +Restarting the installed `9f616f3` runner alone will repeat the failure. After |
| +review and human merge, use a clean checkout of the chosen version on docs-t1. |
| +Build a versioned runner release with the existing certified executable paths: |
| + |
| +```bash |
| +set -euo pipefail |
| +umask 077 |
| +set -a |
| +. "$HOME/.local/share/equipo-runner/runner.env" |
| +set +a |
| +make release-runner |
| +EQUIPO_START_VERSION=$(git rev-parse --short HEAD) |
| +EQUIPO_START_ROOT="$HOME/.local/share/equipo-runner" |
| +EQUIPO_START_RELEASE="$EQUIPO_START_ROOT/releases/$EQUIPO_START_VERSION" |
| +EQUIPO_START_SOURCE="$PWD/releases/equipo-runner-linux-amd64-$EQUIPO_START_VERSION" |
| +mkdir "$EQUIPO_START_RELEASE" |
| +install -m 700 "$EQUIPO_START_SOURCE/equipo-runner" "$EQUIPO_START_RELEASE/" |
| +install -m 700 "$EQUIPO_START_SOURCE/equipo-tool-proxy" "$EQUIPO_START_RELEASE/" |
| +install -m 600 "$EQUIPO_START_SOURCE/install-manifest.json" "$EQUIPO_START_RELEASE/" |
| +"$EQUIPO_START_RELEASE/equipo-runner" verify-install-manifest \ |
| + "$EQUIPO_START_RELEASE/install-manifest.json" >/dev/null |
| +export EQUIPO_START_ROOT EQUIPO_START_RELEASE EQUIPO_START_VERSION |
| +python3 - <<'PY' |
| +import os, pathlib |
| +root = pathlib.Path(os.environ['EQUIPO_START_ROOT']) |
| +service = root / 'equipo-runner.service' |
| +old = service.read_bytes() |
| +before = b'ExecStart=' + bytes(str(root / 'releases/9f616f3/equipo-runner'), 'utf-8') + b' run' |
| +after = b'ExecStart=' + bytes(os.environ['EQUIPO_START_RELEASE'] + '/equipo-runner', 'utf-8') + b' run' |
| +assert old.count(before) == 1, 'Service changed; reconcile its current release first' |
| +backup = root / ('equipo-runner.service.before-' + os.environ['EQUIPO_START_VERSION']) |
| +with backup.open('xb') as f: |
| + f.write(old) |
| +service.write_bytes(old.replace(before, after)) |
| +service.chmod(0o600) |
| +PY |
| +systemctl --user daemon-reload |
| +systemctl --user restart equipo-runner.service |
| +systemctl --user is-active equipo-runner.service |
| +systemctl --user status equipo-runner.service --no-pager |
| +journalctl --user -u equipo-runner.service --since '2 minutes ago' --no-pager |
| +``` |
| + |
| +The existing tool-proxy path can stay in `runner.env`: that binary is unchanged |
| +and the release gate verifies its certified hash. The new runner uses |
| +`os.Executable()`, so the old `EQUIPO_RUNNER_EXECUTABLE` value is ignored and |
| +needs no edit. No re-enrolment is needed. These are controller commands; this |
| +session did not install a release, start the unit, merge or deploy. |
| + |
| +Sign in at |
| +[https://equipo.bds.oncarlos.com/connections](https://equipo.bds.oncarlos.com/connections). |
| +Refresh after startup and confirm cards for `claude-a` and `claude-b`, both |
| +showing Claude `2.1.312`. Neither should show the preflight-unavailable or |
| +sign-in-again message when ready. Connection availability expires after 90 |
| +seconds without a report, so refresh again after that interval with the unit |
| +still active to confirm continuing heartbeats. The enrolled-machine page at |
| +[https://equipo.bds.oncarlos.com/runners/enrol](https://equipo.bds.oncarlos.com/runners/enrol) |
| +should list `docs-t1`, but that page has no online badge and enrolment alone |
| +does not prove liveness. Use the active unit plus fresh, available connection |
| +cards. If a card remains unavailable, report its state before requesting work; |
| +accepted heartbeat reports can correctly describe an unavailable account. |
| + |
| +Task scratch, temporary overlay binaries and logs were removed. The foreground |
| +runner and all task test servers exited; the systemd unit remains inactive. |
| +The change is committed on `runner-start` for push to `origin/runner-start`. |
| +Human review, versioned installation and restart remain with the controller. |
diff --git a/internal/equipo/team/publication_forge_test.go b/internal/equipo/team/publication_forge_test.go| index b1c6f3ca..92169af8 100644 |
| --- a/internal/equipo/team/publication_forge_test.go |
| +++ b/internal/equipo/team/publication_forge_test.go |
| @@ -35,7 +35,7 @@ func TestPublishCoreAuthorizationContract(t *testing.T) { |
| t.Run(agent, func(t *testing.T) { |
| exported := false |
| p, err := forge.New(forge.Config{Root: filepath.Join(t.TempDir(), "private"), GitPath: "/usr/bin/git", Runner: a.Ticket.Handle.Runner, Incarnation: a.Ticket.Incarnation, Clock: func() time.Time { return now }, Authorize: func(context.Context, team.Dispatch) (forge.Authorization, error) { return a, nil }, Revalidate: func(context.Context, forge.Authorization) error { return nil }, Credential: func(context.Context, string) (forge.Credential, error) { |
| - return forge.Credential{Remote: "https://" + a.Target.Repository, Agent: agent, Bearer: "offline-fixture"}, nil |
| + return forge.Credential{Remote: "https://" + a.Target.Repository, Agent: agent, Bearer: "offline-fixture", GitPassword: "git-offline-fixture"}, nil |
| }, Export: func(context.Context, team.GitCandidate, string) error { exported = true; return team.ErrNotDispatched }, Description: noDescription{t}}) |
| if err != nil { |
| t.Fatal(err) |
diff --git a/internal/equipotest/release_test.go b/internal/equipotest/release_test.go| index 868cdd2d..a29dfb09 100644 |
| --- a/internal/equipotest/release_test.go |
| +++ b/internal/equipotest/release_test.go |
| @@ -42,6 +42,10 @@ func TestReleaseStampContract(t *testing.T) { |
| set -eu |
| if [ "$1" = test ]; then exit 0; fi |
| printf '%s\n' "CGO_ENABLED=$CGO_ENABLED" "GOOS=$GOOS" "GOARCH=$GOARCH" "$@" > "$RELEASE_CAPTURE" |
| +while [ $# -gt 0 ]; do |
| + if [ "$1" = -o ]; then shift; cp "$EQUIPO_TOOL_PROXY_PATH" "$1"; fi |
| + shift |
| +done |
| `) |
| // Catch an accidental deployment without invoking the real CLI. |
| writeBin("carlos", "#!/bin/sh\ntouch \"$RELEASE_DEPLOYED\"\nexit 1\n") |
| @@ -109,9 +113,12 @@ printf '%s\n' "CGO_ENABLED=$CGO_ENABLED" "GOOS=$GOOS" "GOARCH=$GOARCH" "$@" > "$ |
| t.Fatalf("build environment and command = %q, want prefix %q", args, wantEnv) |
| } |
| var trimpath bool |
| - var ldflags, output, source string |
| + var ldflags, output, source, tags string |
| for i := len(wantEnv); i < len(args); i++ { |
| switch arg := args[i]; { |
| + case arg == "-tags" && i+1 < len(args): |
| + i++ |
| + tags = args[i] |
| case arg == "-trimpath": |
| trimpath = true |
| case (arg == "-ldflags" || arg == "-o") && i+1 < len(args): |
| @@ -127,6 +134,9 @@ printf '%s\n' "CGO_ENABLED=$CGO_ENABLED" "GOOS=$GOOS" "GOARCH=$GOARCH" "$@" > "$ |
| source = arg |
| } |
| } |
| + if tags != "runnerassets" { |
| + t.Errorf("release is missing embedded runner assets: tags %q", tags) |
| + } |
| if !trimpath { |
| t.Error("release is missing -trimpath") |
| } |
diff --git a/internal/equipotest/runner_flow_test.go b/internal/equipotest/runner_flow_test.go| index 3fd9672b..6b77cb65 100644 |
| --- a/internal/equipotest/runner_flow_test.go |
| +++ b/internal/equipotest/runner_flow_test.go |
| @@ -168,7 +168,7 @@ func TestRunnerDirectEndToEnd(t *testing.T) { |
| return forge.New(forge.Config{Root: pubroot, GitPath: gitSpy, Runner: active.Handle.Runner, Incarnation: auth.Ticket.Incarnation, Clock: time.Now, Authorize: w.PublicationAuthorization, Revalidate: func(ctx context.Context, a forge.Authorization) error { |
| return api.Call(ctx, "validate", flowRequest(active, "publication-check"), nil) |
| }, Export: manager.ExportCandidate, Credential: func(context.Context, string) (forge.Credential, error) { |
| - return forge.Credential{Remote: "https://" + f.project.Repository, Agent: "test~person@example.test", Bearer: "fixture-only"}, nil |
| + return forge.Credential{Remote: "https://" + f.project.Repository, Agent: "test~person@example.test", Bearer: "fixture-only", GitPassword: "git-fixture-only"}, nil |
| }, Description: description}) |
| } |
| workflow, err := runner.NewBugWorkflow(runner.BugWorkflowConfig{Namespaces: namespaces, Launchers: registry, Launch: launch, PublisherFor: publisherFor, Workspaces: manager, Witness: w, Policy: func(context.Context, provider.Selection) (provider.ReadPolicy, error) { return policy, nil }, Executor: executor, StateDir: state, Executable: "/bin/false", InstanceID: "fixture", Copy: runner.ToolCopy{Accepted: "accepted", Rejected: "rejected"}}) |
diff --git a/internal/equipotest/runner_release_test.go b/internal/equipotest/runner_release_test.go| index c1bc8f50..b1c63d2f 100644 |
| --- a/internal/equipotest/runner_release_test.go |
| +++ b/internal/equipotest/runner_release_test.go |
| @@ -68,7 +68,7 @@ func runnerPackagingScenarios(t *testing.T, target string, scenarios []string) { |
| copyReleaseTrackedTree(t, root) |
| scripts := map[string]string{ |
| "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; cp \"$EQUIPO_TOOL_PROXY_PATH\" \"$1\"; fi; shift; done;; esac\n", |
| + "go": "#!/bin/sh\ncase \"$1\" in test) [ \"$SCENARIO\" != copy ];; build) if [ \"$GOARCH\" = arm64 ]; then test -f internal/release/bundled/install-manifest.json || exit 97; fi; printf '%s\\n' \"$GOOS/$GOARCH\" \"$@\" > \"$CAPTURE\"; while [ $# -gt 0 ]; do if [ \"$1\" = -o ]; then shift; cp \"$EQUIPO_TOOL_PROXY_PATH\" \"$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", |
diff --git a/internal/equipotest/runner_startup_test.go b/internal/equipotest/runner_startup_test.go| index 1c4bc2fd..76820171 100644 |
| --- a/internal/equipotest/runner_startup_test.go |
| +++ b/internal/equipotest/runner_startup_test.go |
| @@ -2,6 +2,7 @@ package equipotest |
| import ( |
| "context" |
| + "net/http/httptest" |
| "os" |
| "path/filepath" |
| "strings" |
| @@ -158,3 +159,44 @@ func TestExecutionStartupReconciliation(t *testing.T) { |
| t.Fatal("owner release was not revalidated") |
| } |
| } |
| + |
| +func TestExecutionCarlosMarkerLayout(t *testing.T) { |
| + d, path := executionDB(t) |
| + marker := filepath.Join(filepath.Dir(path), "execution", "witness") |
| + values := map[string]string{ |
| + "EQUIPO_ORIGIN": "https://equipo.bds.oncarlos.com", |
| + "EQUIPO_INSTANCE_KEY": "fixture-instance-key", |
| + "EQUIPO_OWNERS": ownerAddress, |
| + "CARLOS_SMTP_HOST": "smtp.example.test", |
| + "CARLOS_SMTP_FROM": "equipo@example.test", |
| + "EQUIPO_EXECUTION_ENABLED": "1", |
| + "EQUIPO_EXECUTION_MARKER_PATH": marker, |
| + } |
| + cfg, err := equipo.LoadConfig(func(k string) string { return values[k] }) |
| + executionMust(t, err) |
| + if !cfg.ExecutionEnabled || cfg.ExecutionMarkerPath != marker || cfg.AlwaysOn || cfg.RunnerReleaseDir != "" { |
| + t.Fatal("CARLOS execution configuration", cfg.ExecutionEnabled, cfg.AlwaysOn) |
| + } |
| + for range 2 { |
| + x, err := equipo.OpenExecution(context.Background(), d, path, cfg, equipo.NewStore(d)) |
| + executionMust(t, err) |
| + status, err := x.Core.Status(context.Background()) |
| + executionMust(t, err) |
| + if status.Quarantine || status.AdmissionPaused { |
| + t.Fatal("persistent marker did not resume") |
| + } |
| + app, err := equipo.AppWithExecution(d, cfg, &capturingMailer{}, nil, x) |
| + executionMust(t, err) |
| + w := httptest.NewRecorder() |
| + equipo.Mux(app).ServeHTTP(w, httptest.NewRequest("POST", "/api/enrolments", strings.NewReader("{"))) |
| + if w.Code != 422 { |
| + t.Fatal("enrolment route requires always-on", w.Code) |
| + } |
| + executionMust(t, x.Close()) |
| + } |
| + info, err := os.Stat(filepath.Dir(marker)) |
| + executionMust(t, err) |
| + if info.Mode().Perm() != 0700 { |
| + t.Fatal("marker directory permissions", info.Mode()) |
| + } |
| +} |
diff --git a/internal/release/embedded_bundle.go b/internal/release/embedded_bundle.go| new file mode 100644 |
| index 00000000..26ef0660 |
| --- /dev/null |
| +++ b/internal/release/embedded_bundle.go |
| @@ -0,0 +1,19 @@ |
| +//go:build runnerassets |
| + |
| +package release |
| + |
| +import ( |
| + "embed" |
| + "io/fs" |
| +) |
| + |
| +//go:embed bundled/* |
| +var bundled embed.FS |
| + |
| +func embeddedInstallFiles() fs.FS { |
| + files, err := fs.Sub(bundled, "bundled") |
| + if err != nil { |
| + panic(err) |
| + } |
| + return files |
| +} |
diff --git a/internal/release/embedded_default.go b/internal/release/embedded_default.go| new file mode 100644 |
| index 00000000..1868759d |
| --- /dev/null |
| +++ b/internal/release/embedded_default.go |
| @@ -0,0 +1,7 @@ |
| +//go:build !runnerassets |
| + |
| +package release |
| + |
| +import "io/fs" |
| + |
| +func embeddedInstallFiles() fs.FS { return nil } |
diff --git a/internal/release/embedded_install_test.go b/internal/release/embedded_install_test.go| new file mode 100644 |
| index 00000000..d08f9f72 |
| --- /dev/null |
| +++ b/internal/release/embedded_install_test.go |
| @@ -0,0 +1,168 @@ |
| +package release |
| + |
| +import ( |
| + "crypto/sha256" |
| + "encoding/json" |
| + "fmt" |
| + "io/fs" |
| + "net/http/httptest" |
| + "os" |
| + "os/exec" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| + "testing/fstest" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/provider" |
| +) |
| + |
| +func TestBootstrapPartialRelease(t *testing.T) { |
| + script, err := os.ReadFile("../../packaging/install/install-v1.sh") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + validation := strings.Split(strings.Split(string(script), "<<'PY'\n")[1], "\nPY\n")[0] |
| + for _, scenario := range []string{"partial", "no_policies", "no_certificates", "unmatched_certificate", "only_uncertified", "unreviewed", "wrong_target", "wrong_version", "bad_digest"} { |
| + t.Run(scenario, func(t *testing.T) { |
| + m := InstallManifest{Version: "fixture-16", Target: "linux/amd64", RunnerSHA256: strings.Repeat("a", 64), Release: BuildManifest()} |
| + switch scenario { |
| + case "no_policies": |
| + m.Release.DirectPolicies = nil |
| + case "no_certificates": |
| + m.Release.Certifications = nil |
| + case "unmatched_certificate": |
| + for i := range m.Release.Certifications { |
| + m.Release.Certifications[i].PolicyHash = strings.Repeat("0", 64) |
| + } |
| + case "only_uncertified": |
| + for _, p := range m.Release.DirectPolicies { |
| + m.Release.UncertifiedPolicies = append(m.Release.UncertifiedPolicies, UncertifiedPolicy{Provider: p.Provider, Action: p.Action}) |
| + } |
| + case "unreviewed": |
| + m.Release.LiveGateCopyReviewed = false |
| + case "wrong_target": |
| + m.Target = "linux/arm64" |
| + case "wrong_version": |
| + m.Version = "other" |
| + case "bad_digest": |
| + m.RunnerSHA256 = "bad" |
| + } |
| + raw, _ := json.Marshal(m) |
| + path := filepath.Join(t.TempDir(), "manifest.json") |
| + if err := os.WriteFile(path, raw, 0600); err != nil { |
| + t.Fatal(err) |
| + } |
| + cmd := exec.Command("python3", "-c", validation, path, "fixture-16") |
| + out, err := cmd.CombinedOutput() |
| + if (err == nil) != (scenario == "partial") { |
| + t.Fatalf("bootstrap %s: %v %s", scenario, err, out) |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func embeddedFixture(t *testing.T) (fstest.MapFS, Manifest) { |
| + t.Helper() |
| + m := BuildManifest() |
| + runner, proxy := []byte("fixture runner"), []byte("fixture proxy") |
| + for i := range m.Binaries { |
| + if m.Binaries[i].Name == "equipo-tool-proxy" { |
| + m.Binaries[i].SHA256 = fmt.Sprintf("%x", sha256.Sum256(proxy)) |
| + } |
| + } |
| + manifest := InstallManifest{Version: "fixture-16", Target: "linux/amd64", RunnerSHA256: fmt.Sprintf("%x", sha256.Sum256(runner)), NamespaceArgs: provider.NamespaceArguments(), Release: m} |
| + raw, err := json.Marshal(manifest) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return fstest.MapFS{"install-manifest.json": {Data: raw}, "equipo-runner": {Data: runner}, "equipo-tool-proxy": {Data: proxy}, "install-v1.sh": {Data: []byte("fixture installer")}}, m |
| +} |
| + |
| +func TestEmbeddedInstallAssets(t *testing.T) { |
| + for _, scenario := range []string{"valid", "runner_digest", "proxy_digest", "missing", "version", "manifest", "trailing", "override"} { |
| + t.Run(scenario, func(t *testing.T) { |
| + files, m := embeddedFixture(t) |
| + a := &InstallAssets{Version: "fixture-16", Manifest: m, embedded: files} |
| + switch scenario { |
| + case "runner_digest": |
| + files["equipo-runner"].Data = []byte("tampered") |
| + case "proxy_digest": |
| + files["equipo-tool-proxy"].Data = []byte("tampered") |
| + case "missing": |
| + delete(files, "install-v1.sh") |
| + case "version": |
| + a.Version = "other" |
| + case "manifest": |
| + a.Manifest.InstanceTarget = "other" |
| + case "trailing": |
| + files["install-manifest.json"].Data = append(files["install-manifest.json"].Data, []byte("{}")...) |
| + case "override": |
| + a.Root = t.TempDir() |
| + } |
| + valid := scenario == "valid" |
| + if a.Available() != valid || a.CachedAvailable() != valid { |
| + t.Fatal("availability", scenario) |
| + } |
| + for _, name := range installAssetNames { |
| + w := httptest.NewRecorder() |
| + a.ServeHTTP(w, httptest.NewRequest("GET", "/releases/"+a.Version+"/"+name, nil)) |
| + if valid { |
| + if w.Code != 200 || w.Body.String() != string(files[name].Data) { |
| + t.Fatal("asset", name, w.Code) |
| + } |
| + } else if w.Code != 503 { |
| + t.Fatal("invalid bundle served", name, w.Code) |
| + } |
| + } |
| + if valid { |
| + for _, path := range []string{"/releases/other/equipo-runner", "/releases/fixture-16/../equipo-runner", "/releases/fixture-16/manifest.json"} { |
| + w := httptest.NewRecorder() |
| + a.ServeHTTP(w, httptest.NewRequest("GET", path, nil)) |
| + if w.Code != 404 { |
| + t.Fatal("unexpected path served", path) |
| + } |
| + } |
| + w := httptest.NewRecorder() |
| + req := httptest.NewRequest("GET", "/releases/fixture-16/equipo-runner", nil) |
| + req.Header.Set("Range", "bytes=0-6") |
| + a.ServeHTTP(w, req) |
| + if w.Code != 206 || w.Body.String() != "fixture" { |
| + t.Fatal("range", w.Code, w.Body.String()) |
| + } |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestBundledInstallAssets(t *testing.T) { |
| + files := embeddedInstallFiles() |
| + if files == nil { |
| + if os.Getenv("EQUIPO_BUNDLE_VERSION") != "" { |
| + t.Fatal("release bundle missing") |
| + } |
| + t.Skip("release build only") |
| + } |
| + raw, err := fs.ReadFile(files, "install-manifest.json") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + var m InstallManifest |
| + if err = json.Unmarshal(raw, &m); err != nil { |
| + t.Fatal(err) |
| + } |
| + if want := os.Getenv("EQUIPO_BUNDLE_VERSION"); want != "" && m.Version != want { |
| + t.Fatal("bundle version", m.Version, want) |
| + } |
| + a := NewInstallAssets("", m.Version, BuildManifest()) |
| + if !a.CachedAvailable() { |
| + t.Fatal("bundled release unavailable") |
| + } |
| + for _, name := range installAssetNames { |
| + w := httptest.NewRecorder() |
| + a.ServeHTTP(w, httptest.NewRequest("GET", "/releases/"+m.Version+"/"+name, nil)) |
| + want, e := fs.ReadFile(files, name) |
| + if e != nil || w.Code != 200 || w.Body.String() != string(want) { |
| + t.Fatal("bundled HTTP asset", name, w.Code, e) |
| + } |
| + } |
| +} |
diff --git a/internal/release/install_assets.go b/internal/release/install_assets.go| index faae403b..d1479921 100644 |
| --- a/internal/release/install_assets.go |
| +++ b/internal/release/install_assets.go |
| @@ -5,6 +5,7 @@ import ( |
| "encoding/hex" |
| "encoding/json" |
| "io" |
| + "io/fs" |
| "net/http" |
| "os" |
| "path/filepath" |
| @@ -20,18 +21,39 @@ type InstallAssets struct { |
| mu sync.Mutex |
| files map[string]os.FileInfo |
| available bool |
| + embedded fs.FS |
| digest func(io.Reader) (string, error) |
| } |
| func NewInstallAssets(root, version string, manifest Manifest) *InstallAssets { |
| - a := &InstallAssets{Root: root, Version: version, Manifest: manifest} |
| + a := &InstallAssets{Root: root, Version: version, Manifest: manifest, embedded: embeddedInstallFiles()} |
| a.Available() |
| return a |
| } |
| var installAssetNames = []string{"install-manifest.json", "equipo-runner", "equipo-tool-proxy", "install-v1.sh"} |
| -func (a *InstallAssets) open(name string) (*os.File, error) { |
| +type installFile interface { |
| + fs.File |
| + io.ReadSeeker |
| +} |
| + |
| +func (a *InstallAssets) open(name string) (installFile, error) { |
| + if a.Root == "" { |
| + if a.embedded == nil { |
| + return nil, errManifest |
| + } |
| + f, err := a.embedded.Open(name) |
| + if err != nil { |
| + return nil, err |
| + } |
| + seekable, ok := f.(installFile) |
| + if !ok { |
| + f.Close() |
| + return nil, errManifest |
| + } |
| + return seekable, nil |
| + } |
| if !filepath.IsAbs(a.Root) || filepath.Clean(a.Root) != a.Root { |
| return nil, errManifest |
| } |
| @@ -59,6 +81,9 @@ func sameInstallFile(a, b os.FileInfo) bool { |
| return a != nil && b != nil && os.SameFile(a, b) && a.Size() == b.Size() && a.ModTime() == b.ModTime() && a.Mode() == b.Mode() |
| } |
| func (a *InstallAssets) unchanged() bool { |
| + if a.Root == "" { |
| + return a.files != nil |
| + } |
| for _, name := range installAssetNames { |
| f, e := a.open(name) |
| if e != nil { |
| @@ -89,7 +114,7 @@ func (a *InstallAssets) Available() bool { |
| return a.available |
| } |
| a.available = false |
| - files := map[string]*os.File{} |
| + files := map[string]installFile{} |
| infos := map[string]os.FileInfo{} |
| defer func() { |
| for _, f := range files { |
| @@ -159,7 +184,7 @@ func (a *InstallAssets) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| defer f.Close() |
| i, e := f.Stat() |
| a.mu.Lock() |
| - valid := e == nil && a.available && sameInstallFile(a.files[name], i) |
| + valid := e == nil && a.available && (a.Root == "" || sameInstallFile(a.files[name], i)) |
| a.mu.Unlock() |
| if !valid { |
| w.WriteHeader(http.StatusServiceUnavailable) |
diff --git a/internal/release/install_script_test.go b/internal/release/install_script_test.go| index b8444fbd..849f0e6d 100644 |
| --- a/internal/release/install_script_test.go |
| +++ b/internal/release/install_script_test.go |
| @@ -28,7 +28,7 @@ func TestOnboardingInstallShell(t *testing.T) { |
| echo download >> "$TMPDIR/downloads" |
| while [ "$1" != "-o" ]; do shift; done |
| case "$2" in |
| -*/manifest.json) printf '%s' '{"version":"fixture-16","target":"linux/amd64","runner_sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","release":{"live_gate_copy_reviewed":true,"direct_policies":[{}],"certifications":[{}]}}' > "$2" ;; |
| +*/manifest.json) printf '%s' '{"version":"fixture-16","target":"linux/amd64","runner_sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","release":{"live_gate_copy_reviewed":true,"direct_policies":[{"provider":"codex","action":"implement","policy_hash":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}],"certifications":[{"provider":"codex","policy_hash":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}]}}' > "$2" ;; |
| *) printf '#!/bin/sh\nexit 99\n' > "$2" ;; |
| esac |
| `) |
diff --git a/internal/runner/config_test.go b/internal/runner/config_test.go| index a6b50034..24aa92ee 100644 |
| --- a/internal/runner/config_test.go |
| +++ b/internal/runner/config_test.go |
| @@ -8,6 +8,7 @@ import ( |
| "net/http" |
| "os" |
| "path/filepath" |
| + "slices" |
| "strings" |
| "testing" |
| "time" |
| @@ -21,15 +22,15 @@ func configFixture(t *testing.T) Config { |
| t.Helper() |
| root := t.TempDir() |
| amadan := filepath.Join(root, "amadan") |
| - if err := os.WriteFile(amadan, []byte("#!/bin/sh\nexit 0\n"), 0700); err != nil { |
| - t.Fatal(err) |
| - } |
| + mustJournal(t, os.WriteFile(amadan, []byte("#!/bin/sh\nexit 0\n"), 0700)) |
| return Config{BwrapPath: "/usr/bin/bwrap", ClaudePath: "/usr/bin/claude", CodexCodeModeHostPath: "/usr/bin/codex-code-mode-host", Origin: "https://equipo.example", StateDir: filepath.Join(root, "state"), AmadanCredentialPath: filepath.Join(root, "forge.json"), AccountBindingsPath: filepath.Join(root, "bindings.json"), CodexPath: "/usr/bin/codex", GoRoot: "/opt/go", GoBinary: "/opt/go/bin/go", WorkspaceRoot: filepath.Join(root, "work"), ScratchRoot: filepath.Join(root, "scratch"), GitPath: "/usr/bin/git", AmadanPath: amadan, Executable: "/usr/bin/equipo-runner", InstanceID: "instance"} |
| } |
| func TestRunnerConfig(t *testing.T) { |
| c := configFixture(t) |
| - if err := c.validate(); err != nil { |
| - t.Fatal(err) |
| + mustJournal(t, c.validate()) |
| + policy, err := bindingPolicy(c, nil, AccountBinding{}) |
| + if err != nil || c.securityPaths(nil).ForgeCredential != c.AmadanCredentialPath || !slices.Contains(policy.DeniedPaths, c.AmadanCredentialPath) { |
| + t.Fatal("forge credentials absent from protected paths", err) |
| } |
| for _, origin := range []string{"http://example.com", "https://user:pass@example.com", "https://example.com/path", "https://example.com?x=y", "https://example.com/#x"} { |
| bad := c |
diff --git a/internal/runner/direct_graph_test.go b/internal/runner/direct_graph_test.go| index f431d8c7..3394278e 100644 |
| --- a/internal/runner/direct_graph_test.go |
| +++ b/internal/runner/direct_graph_test.go |
| @@ -236,7 +236,7 @@ func runDirectPlanGraph(t *testing.T, feature, extra, readWork bool) { |
| publisher, err = forge.New(forge.Config{Root: pubroot, GitPath: gitSpy, Runner: "runner", Incarnation: status.Incarnation, Clock: time.Now, Authorize: w.PublicationAuthorization, Revalidate: func(ctx context.Context, a forge.Authorization) error { |
| return core.ValidateHandle(ctx, a.Ticket.Scope, a.Ticket.Handle) |
| }, Export: manager.ExportCandidate, Credential: func(context.Context, string) (forge.Credential, error) { |
| - return forge.Credential{Remote: "https://amadan.net/test/fixture", Agent: "test~person@example.test", Bearer: "fixture-only"}, nil |
| + return forge.Credential{Remote: "https://amadan.net/test/fixture", Agent: "test~person@example.test", Bearer: "fixture-only", GitPassword: "git-fixture-only"}, nil |
| }, Description: &workflowDescription{}}) |
| wfMust(t, err) |
| } |
diff --git a/internal/runner/forge/credential_file.go b/internal/runner/forge/credential_file.go| new file mode 100644 |
| index 00000000..17e85da9 |
| --- /dev/null |
| +++ b/internal/runner/forge/credential_file.go |
| @@ -0,0 +1,67 @@ |
| +package forge |
| + |
| +import ( |
| + "context" |
| + "encoding/json" |
| + "os" |
| + "strings" |
| + |
| + "amadan.net/oficina/equipo/internal/runner/provider" |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| + "amadan.net/oficina/equipo/internal/runnerproto" |
| +) |
| + |
| +type FileCredentials struct{ Path string } |
| +type forgeCredentialFile struct { |
| + Agent string `json:"agent"` |
| + Repositories map[string]json.RawMessage `json:"repositories"` |
| +} |
| + |
| +func (f FileCredentials) Credential(_ context.Context, repo string) (Credential, error) { |
| + var file forgeCredentialFile |
| + if err := readCredentialFile(f.Path, &file); err != nil { |
| + return Credential{}, err |
| + } |
| + var entry struct { |
| + API string `json:"api"` |
| + Git string `json:"git"` |
| + } |
| + raw := file.Repositories[repo] |
| + // Legacy entries grant API access only; an agent bearer is not a git password. |
| + if json.Unmarshal(raw, &entry.API) != nil { |
| + if err := runnerproto.DecodeLimit(strings.NewReader(string(raw)), &entry, 1<<20); err != nil { |
| + return Credential{}, provider.ErrIdentity |
| + } |
| + } |
| + token := entry.API |
| + if !strings.HasPrefix(repo, "amadan.net/") || strings.ContainsAny(repo+token+entry.Git, "\r\n\x00") || token == "" || file.Agent == "" { |
| + return Credential{}, provider.ErrIdentity |
| + } |
| + return Credential{Remote: "https://" + repo, Agent: file.Agent, Bearer: token, GitPassword: entry.Git}, nil |
| +} |
| +func (f FileCredentials) Resolve(ctx context.Context, repo string) (workspace.Remote, error) { |
| + c, err := f.Credential(ctx, repo) |
| + if err != nil { |
| + return workspace.Remote{}, err |
| + } |
| + if c.GitPassword == "" { |
| + return workspace.Remote{}, workspace.ErrGitPassword |
| + } |
| + return workspace.Remote{URL: c.Remote, GitPassword: c.GitPassword}, nil |
| +} |
| + |
| +func readCredentialFile(path string, out *forgeCredentialFile) error { |
| + info, err := os.Lstat(path) |
| + if err != nil { |
| + return err |
| + } |
| + if !info.Mode().IsRegular() || info.Mode().Perm() != 0600 || info.Size() > 1<<20 { |
| + return provider.ErrPolicy |
| + } |
| + f, err := os.Open(path) |
| + if err != nil { |
| + return err |
| + } |
| + defer f.Close() |
| + return runnerproto.DecodeLimit(f, out, 1<<20) |
| +} |
diff --git a/internal/runner/forge/credential_file_test.go b/internal/runner/forge/credential_file_test.go| new file mode 100644 |
| index 00000000..84cba013 |
| --- /dev/null |
| +++ b/internal/runner/forge/credential_file_test.go |
| @@ -0,0 +1,76 @@ |
| +package forge |
| + |
| +import ( |
| + "context" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +func TestForgeCredentialsSplitAndLegacy(t *testing.T) { |
| + for _, tc := range []struct { |
| + name, entry string |
| + git bool |
| + }{ |
| + {"split", `{"api":"api-canary","git":"git-canary"}`, true}, |
| + {"legacy", `"api-canary"`, false}, |
| + {"api only", `{"api":"api-canary"}`, false}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + path := filepath.Join(t.TempDir(), "amadan.json") |
| + raw := `{"agent":"equipo~owner@example.test","repositories":{"amadan.net/ns/repo":` + tc.entry + `}}` |
| + must(t, os.WriteFile(path, []byte(raw), 0600)) |
| + f := FileCredentials{Path: path} |
| + c, err := f.Credential(context.Background(), "amadan.net/ns/repo") |
| + if err != nil || c.Bearer != "api-canary" { |
| + t.Fatal("API credential unavailable", err) |
| + } |
| + remote, err := f.Resolve(context.Background(), "amadan.net/ns/repo") |
| + if tc.git && (err != nil || c.GitPassword != "git-canary" || remote.GitPassword != "git-canary") { |
| + t.Fatal("git credential unavailable", err) |
| + } |
| + if !tc.git && (err == nil || !strings.Contains(err.Error(), "git password")) { |
| + t.Fatal("missing PAT needs a clear configuration error", err) |
| + } |
| + if _, err := f.Credential(context.Background(), "amadan.net/ns/other"); err == nil { |
| + t.Fatal("credential crossed repository boundary") |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestForgeCredentialFileProtection(t *testing.T) { |
| + path := filepath.Join(t.TempDir(), "amadan.json") |
| + raw := `{"agent":"equipo~owner@example.test","repositories":{"amadan.net/ns/repo":{"api":"api-canary","git":"git-canary"}}}` |
| + must(t, os.WriteFile(path, []byte(raw), 0600)) |
| + must(t, os.Chmod(path, 0644)) |
| + if _, err := (FileCredentials{Path: path}).Credential(context.Background(), "amadan.net/ns/repo"); err == nil { |
| + t.Fatal("public credential file accepted") |
| + } |
| + must(t, os.Chmod(path, 0600)) |
| + alias := filepath.Join(t.TempDir(), "alias") |
| + must(t, os.Symlink(path, alias)) |
| + if _, err := (FileCredentials{Path: alias}).Credential(context.Background(), "amadan.net/ns/repo"); err == nil { |
| + t.Fatal("symlink credential file accepted") |
| + } |
| +} |
| + |
| +func TestForgeCredentialInvalidEntries(t *testing.T) { |
| + for _, entry := range []string{`null`, `42`, `[]`, `{}`, `{"git":"git-canary"}`, `{"api":"api-canary","git":123}`, `{"api":"api-canary","git":"git-canary","extra":"secret-canary"}`, `{"api":"api-canary\r\nInjected: secret-canary","git":"git-canary"}`, `{"api":"api-canary","git":"git-canary\u0000"}`} { |
| + t.Run(entry, func(t *testing.T) { |
| + path := filepath.Join(t.TempDir(), "amadan.json") |
| + raw := `{"agent":"equipo~owner@example.test","repositories":{"amadan.net/ns/repo":` + entry + `}}` |
| + must(t, os.WriteFile(path, []byte(raw), 0600)) |
| + _, err := (FileCredentials{Path: path}).Resolve(context.Background(), "amadan.net/ns/repo") |
| + if err == nil { |
| + t.Fatal("invalid credential accepted") |
| + } |
| + for _, secret := range []string{"api-canary", "git-canary", "secret-canary"} { |
| + if strings.Contains(err.Error(), secret) { |
| + t.Fatal("credential leaked in error") |
| + } |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/runner/forge/description_test.go b/internal/runner/forge/description_test.go| index a1bbfa09..2934fe5b 100644 |
| --- a/internal/runner/forge/description_test.go |
| +++ b/internal/runner/forge/description_test.go |
| @@ -79,7 +79,7 @@ func TestAmadanDescriptionLengthHash(t *testing.T) { |
| } |
| func TestAmadanDescriptionReadback(t *testing.T) { |
| - cred := Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only"} |
| + cred := Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only", GitPassword: "git-canary"} |
| body := " Equipo café\n unconfined; approved beyond profile\n" |
| for _, name := range []string{"valid", "optional_agent", "reordered", "tamper", "wrong_hash", "wrong_agent", "bad_metadata", "empty", "invalid_utf8", "malformed", "malformed_at", "trailing", "oversized", "redirect", "auth", "timeout"} { |
| t.Run(name, func(t *testing.T) { |
| @@ -205,7 +205,7 @@ assert json.load(open(path)) == {'https://amadan.net':'fake-only'} |
| assert sys.stdin.read() == ' Equipo café\n unconfined; approved beyond profile\n' |
| ` |
| must(t, os.WriteFile(command, []byte(script), 0700)) |
| - cred := Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only"} |
| + cred := Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only", GitPassword: "git-canary"} |
| desc := Description{Repository: "amadan.net/oficina/equipo", Ref: "review/trial", Agent: cred.Agent, Body: " Equipo café\n unconfined; approved beyond profile\n"} |
| desc.Digest = Digest([]byte(desc.Body)) |
| scratch := filepath.Join(root, "scratch") |
| @@ -292,7 +292,7 @@ func TestAmadanDescriptionNotDispatched(t *testing.T) { |
| root := t.TempDir() |
| command := filepath.Join(root, "command") |
| must(t, os.WriteFile(command, []byte("#!/bin/sh\nexit 1\n"), 0700)) |
| - cred := Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only"} |
| + cred := Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only", GitPassword: "git-canary"} |
| desc := Description{Repository: "amadan.net/oficina/equipo", Ref: "review/trial", Agent: cred.Agent, Body: "body"} |
| desc.Digest = Digest([]byte(desc.Body)) |
| for _, mode := range []string{"validation", "relative_path", "unclean_path", "missing_command", "not_executable", "scratch", "cancelled", "started", "missing_writer"} { |
| @@ -343,7 +343,7 @@ func TestDescriptionIgnoresDefaultProxyClient(t *testing.T) { |
| })} |
| ctx, cancel := context.WithCancel(context.Background()) |
| cancel() |
| - _, _ = ReadBranchDescription(ctx, nil, Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only"}, "amadan.net/oficina/equipo", "heads/fix") |
| + _, _ = ReadBranchDescription(ctx, nil, Credential{Remote: "https://amadan.net/oficina/equipo", Agent: "equipo~owner@example.com", Bearer: "fake-only", GitPassword: "git-canary"}, "amadan.net/oficina/equipo", "heads/fix") |
| if called { |
| t.Fatal("description used ambient proxy client") |
| } |
diff --git a/internal/runner/forge/git.go b/internal/runner/forge/git.go| index 9626586c..aa0678a5 100644 |
| --- a/internal/runner/forge/git.go |
| +++ b/internal/runner/forge/git.go |
| @@ -2,6 +2,7 @@ package forge |
| import ( |
| "context" |
| + "encoding/base64" |
| "io" |
| "os" |
| "os/exec" |
| @@ -29,7 +30,7 @@ func (p *Publisher) git(ctx context.Context, dir string, cred *Credential, args |
| if cred != nil && p.localRemote == nil { |
| env["GIT_CONFIG_COUNT"] = "10" |
| env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Bearer " + cred.Bearer |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+cred.GitPassword)) |
| } |
| for k, v := range env { |
| cmd.Env = append(cmd.Env, k+"="+v) |
diff --git a/internal/runner/forge/publisher.go b/internal/runner/forge/publisher.go| index 347de1f1..d292a66b 100644 |
| --- a/internal/runner/forge/publisher.go |
| +++ b/internal/runner/forge/publisher.go |
| @@ -16,12 +16,13 @@ import ( |
| "time" |
| "amadan.net/oficina/equipo/internal/equipo/team" |
| + "amadan.net/oficina/equipo/internal/runner/workspace" |
| "amadan.net/oficina/equipo/internal/runnerproto" |
| ) |
| type Authorization = runnerproto.PublicationAuthorization |
| -type Credential struct{ Remote, Agent, Bearer string } |
| +type Credential struct{ Remote, Agent, Bearer, GitPassword string } |
| type Description struct { |
| Repository, Ref, Agent, Body, Digest string |
| At int64 |
| @@ -147,9 +148,12 @@ func (p *Publisher) credential(ctx context.Context, repository string) (Credenti |
| return Credential{}, team.ErrUncertain |
| } |
| u, e := url.Parse(c.Remote) |
| - if e != nil || !team.ValidPublicationAgent(c.Agent) || c.Bearer == "" || strings.ContainsAny(c.Bearer+c.Remote, "\r\n\x00") || u.Scheme != "https" || u.Host == "" || u.User != nil || u.RawQuery != "" || u.Fragment != "" || u.RawPath != "" || c.Remote != "https://"+repository || u.String() != c.Remote { |
| + if e != nil || !team.ValidPublicationAgent(c.Agent) || c.Bearer == "" || strings.ContainsAny(c.Bearer+c.GitPassword+c.Remote, "\r\n\x00") || u.Scheme != "https" || u.Host == "" || u.User != nil || u.RawQuery != "" || u.Fragment != "" || u.RawPath != "" || c.Remote != "https://"+repository || u.String() != c.Remote { |
| return Credential{}, team.ErrInvalid |
| } |
| + if c.GitPassword == "" { |
| + return Credential{}, workspace.ErrGitPassword |
| + } |
| return c, nil |
| } |
diff --git a/internal/runner/forge/publisher_test.go b/internal/runner/forge/publisher_test.go| index 445a1fd8..069e01da 100644 |
| --- a/internal/runner/forge/publisher_test.go |
| +++ b/internal/runner/forge/publisher_test.go |
| @@ -2,6 +2,7 @@ package forge |
| import ( |
| "context" |
| + "encoding/base64" |
| "encoding/json" |
| "errors" |
| "fmt" |
| @@ -124,7 +125,7 @@ func newFixture(t *testing.T) *fixture { |
| gitTest(t, root, "clone", "--no-local", "--template=", source, dir) |
| return nil |
| }, Credential: func(context.Context, string) (Credential, error) { |
| - return Credential{Remote: "https://amadan.net/example/repo", Agent: "equipo~operator@example.test", Bearer: "agent-canary"}, nil |
| + return Credential{Remote: "https://amadan.net/example/repo", Agent: "equipo~operator@example.test", Bearer: "agent-canary", GitPassword: "git-canary"}, nil |
| }, Description: f.desc} |
| var err error |
| f.p, err = newPublisher(cfg, func(_ string) string { return remote }) |
| @@ -257,7 +258,7 @@ func TestPublishCredentialIsolation(t *testing.T) { |
| if e != nil { |
| return e |
| } |
| - if strings.Contains(string(b), "agent-canary") || strings.Contains(string(b), "person-canary") { |
| + if strings.Contains(string(b), "agent-canary") || strings.Contains(string(b), "person-canary") || strings.Contains(string(b), "git-canary") || strings.Contains(string(b), base64.StdEncoding.EncodeToString([]byte("x:git-canary"))) { |
| t.Fatal("credential persisted", path) |
| } |
| } |
| @@ -421,7 +422,7 @@ func TestPublishLostReceiptNoRedispatch(t *testing.T) { |
| } |
| func TestPublishEvidenceAndCredentialGuards(t *testing.T) { |
| - for _, name := range []string{"description", "digest", "taint", "acknowledgement", "tuple", "tuple_identity", "tags", "person", "http", "foreign_remote", "header"} { |
| + for _, name := range []string{"description", "digest", "taint", "acknowledgement", "tuple", "tuple_identity", "tags", "person", "http", "foreign_remote", "header", "git_header", "git_missing"} { |
| t.Run(name, func(t *testing.T) { |
| f := newFixture(t) |
| switch name { |
| @@ -455,6 +456,10 @@ func TestPublishEvidenceAndCredentialGuards(t *testing.T) { |
| c.Remote = "https://amadan.net/foreign/repo.git" |
| case "header": |
| c.Bearer = "token\r\nHeader: value" |
| + case "git_header": |
| + c.GitPassword = "git-canary\r\nHeader: value" |
| + case "git_missing": |
| + c.GitPassword = "" |
| } |
| return c, e |
| } |
| @@ -477,7 +482,7 @@ func TestPublishCanonicalRepository(t *testing.T) { |
| raw, _ := json.Marshal(f.auth.Publication) |
| f.auth.Ticket.Dispatch.Payload, f.auth.Ticket.Dispatch.Hash, _ = Canonical(raw) |
| f.p.cfg.Credential = func(context.Context, string) (Credential, error) { |
| - return Credential{Remote: "https://amadan.net/example/repo", Agent: "equipo~operator@example.test", Bearer: "agent-canary"}, nil |
| + return Credential{Remote: "https://amadan.net/example/repo", Agent: "equipo~operator@example.test", Bearer: "agent-canary", GitPassword: "git-canary"}, nil |
| } |
| if _, err := f.p.Execute(ctx, f.auth.Ticket.Dispatch); err != nil { |
| t.Fatal("saved canonical project repository rejected", err) |
| @@ -515,7 +520,7 @@ os.execve('/usr/bin/git',['/usr/bin/git']+args,dict(os.environ)) |
| } |
| must(t, json.Unmarshal([]byte(line), &row)) |
| args := strings.Join(row.Args, " ") |
| - if strings.Contains(args, "agent-canary") || row.Env["PERSON_SECRET"] != "" { |
| + if strings.Contains(args, "agent-canary") || strings.Contains(args, "git-canary") || strings.Contains(args, base64.StdEncoding.EncodeToString([]byte("x:git-canary"))) || strings.Contains(fmt.Sprint(row.Env), "agent-canary") || row.Env["PERSON_SECRET"] != "" { |
| t.Fatal("credential escaped allowed environment") |
| } |
| if row.Env["GIT_CONFIG_KEY_7"] != "maintenance.auto" || row.Env["GIT_CONFIG_VALUE_7"] != "false" || row.Env["GIT_CONFIG_KEY_8"] != "gc.autoDetach" || row.Env["GIT_CONFIG_VALUE_8"] != "false" { |
| @@ -524,10 +529,10 @@ os.execve('/usr/bin/git',['/usr/bin/git']+args,dict(os.environ)) |
| remote := strings.Contains(args, "https://amadan.net/example/repo") |
| if remote { |
| remoteCalls++ |
| - if row.Env["GIT_CONFIG_COUNT"] != "10" || row.Env["GIT_CONFIG_KEY_9"] != "http.extraHeader" || row.Env["GIT_CONFIG_VALUE_9"] != "Authorization: Bearer agent-canary" { |
| + if row.Env["GIT_CONFIG_COUNT"] != "10" || row.Env["GIT_CONFIG_KEY_9"] != "http.extraHeader" || row.Env["GIT_CONFIG_VALUE_9"] != "Authorization: Basic "+base64.StdEncoding.EncodeToString([]byte("x:git-canary")) { |
| t.Fatal("runner credential missing") |
| } |
| - } else if strings.Contains(fmt.Sprint(row.Env), "agent-canary") { |
| + } else if strings.Contains(fmt.Sprint(row.Env), "git-canary") || strings.Contains(fmt.Sprint(row.Env), base64.StdEncoding.EncodeToString([]byte("x:git-canary"))) { |
| t.Fatal("credential exposed to local Git") |
| } |
| if strings.Contains(args, " push ") { |
diff --git a/internal/runner/http.go b/internal/runner/http.go| index 3ea7e4e8..e5ca5bdd 100644 |
| --- a/internal/runner/http.go |
| +++ b/internal/runner/http.go |
| @@ -5,6 +5,7 @@ import ( |
| "context" |
| "crypto/rand" |
| "encoding/json" |
| + "fmt" |
| "io" |
| "net/http" |
| "net/url" |
| @@ -49,10 +50,12 @@ func (c *HTTPInstance) post(ctx context.Context, op string, body any, token stri |
| } |
| defer response.Body.Close() |
| if response.StatusCode != http.StatusOK { |
| + check := fmt.Sprintf("http.response.status_%d", response.StatusCode) |
| if response.StatusCode == 403 || response.StatusCode == 401 || response.StatusCode == 409 || response.StatusCode == 422 || (strings.HasPrefix(op, "coordinator/") || op == "account-setups") && response.StatusCode >= 400 && response.StatusCode < 500 { |
| var body runnerproto.ErrorResponse |
| _ = runnerproto.DecodeLimit(io.LimitReader(response.Body, 4096), &body, 4096) |
| - return &RefusalError{Reason: refusalReason(body.Error), Status: response.StatusCode, Claim: op == "claim"} |
| + refusal := &RefusalError{Reason: refusalReason(body.Error), Status: response.StatusCode, Claim: op == "claim"} |
| + return diagnosticAt(refusal, check+"."+refusal.Reason) |
| } |
| if op == "claim" && response.StatusCode == http.StatusServiceUnavailable { |
| return ErrClaimRefused |
| @@ -61,19 +64,25 @@ func (c *HTTPInstance) post(ctx context.Context, op string, body any, token stri |
| if response.StatusCode >= 500 || response.StatusCode == http.StatusTooManyRequests { |
| return ErrTransient |
| } |
| - return provider.ErrContract |
| + return diagnosticAt(provider.ErrContract, check) |
| } |
| var envelope struct { |
| Version int `json:"version"` |
| Result json.RawMessage `json:"result"` |
| } |
| - if err = runnerproto.DecodeLimit(io.LimitReader(response.Body, 3<<20), &envelope, 3<<20); err != nil || envelope.Version != 2 { |
| - return provider.ErrContract |
| + if err = runnerproto.DecodeLimit(io.LimitReader(response.Body, 3<<20), &envelope, 3<<20); err != nil { |
| + return diagnosticAt(provider.ErrContract, "http.response.envelope") |
| + } |
| + if envelope.Version != 2 { |
| + return diagnosticAt(provider.ErrContract, "http.response.version") |
| } |
| if out == nil || bytes.Equal(envelope.Result, []byte("null")) { |
| return nil |
| } |
| - return runnerproto.DecodeLimit(bytes.NewReader(envelope.Result), out, 3<<20) |
| + if err = runnerproto.DecodeLimit(bytes.NewReader(envelope.Result), out, 3<<20); err != nil { |
| + return diagnosticAt(provider.ErrContract, "http.response.result") |
| + } |
| + return nil |
| } |
| func (c *HTTPInstance) token(assignment string, cleanup bool) (string, error) { |
| c.mu.Lock() |
| @@ -187,7 +196,7 @@ func (c *HTTPInstance) Heartbeat(ctx context.Context, reports []runnerproto.Conn |
| if err != nil { |
| return err |
| } |
| - raw, err := json.Marshal(reports) |
| + raw, err := runnerproto.Marshal(reports) |
| if err != nil { |
| return err |
| } |
diff --git a/internal/runner/journal_test.go b/internal/runner/journal_test.go| index 3e29c484..fa0405df 100644 |
| --- a/internal/runner/journal_test.go |
| +++ b/internal/runner/journal_test.go |
| @@ -202,12 +202,12 @@ func TestRunnerJournalSecretsAndLog(t *testing.T) { |
| mustJournal(t, err) |
| defer j.Close() |
| e := journalEvent("secret", 1) |
| - e.Payload = json.RawMessage(`{"authorization":"Bearer credential-value","text":"Bearer credential-value <script>alert(1)</script>","inputTokens":2}`) |
| + e.Payload = json.RawMessage(`{"authorization":"Bearer credential-value","text":"Bearer credential-value Authorization: Basic eDpnaXQtY2FuYXJ5 <script>alert(1)</script>","inputTokens":2}`) |
| mustJournal(t, j.Append(journalCtx, e)) |
| rows, err := j.Pending(journalCtx, 10) |
| mustJournal(t, err) |
| - if strings.Contains(string(rows[0].Payload), "credential-value") || !strings.Contains(string(rows[0].Payload), "inputTokens") { |
| - t.Fatal("redaction lost accounting or leaked secret", string(rows[0].Payload)) |
| + if strings.Contains(string(rows[0].Payload), "credential-value") || strings.Contains(string(rows[0].Payload), "eDpnaXQtY2FuYXJ5") || !strings.Contains(string(rows[0].Payload), "inputTokens") { |
| + t.Error("redaction lost accounting or leaked secret", string(rows[0].Payload)) |
| } |
| intent := provider.Intent{Kind: "agent", Key: "secret-intent", RequestHash: "hash", Request: json.RawMessage(`{"env":{"EQUIPO_TOOL_TOKEN":"private-key-value"}}`)} |
| mustJournal(t, j.RecordIntent(journalCtx, intent)) |
| @@ -217,9 +217,9 @@ func TestRunnerJournalSecretsAndLog(t *testing.T) { |
| t.Fatal("intent persisted credential") |
| } |
| w := httptest.NewRecorder() |
| - DownloadLog(w, []byte(`<script>secret</script> Bearer credential-value`), []string{"secret"}) |
| - if strings.Contains(w.Body.String(), "<script>") || strings.Contains(w.Body.String(), "credential-value") || strings.Contains(w.Body.String(), "secret") || w.Header().Get("Content-Type") != "text/plain; charset=utf-8" { |
| - t.Fatal("unsafe log download", w.Body.String()) |
| + DownloadLog(w, []byte(`<script>secret</script> Bearer credential-value Authorization: Basic eDpnaXQtY2FuYXJ5`), []string{"secret"}) |
| + if strings.Contains(w.Body.String(), "<script>") || strings.Contains(w.Body.String(), "credential-value") || strings.Contains(w.Body.String(), "eDpnaXQtY2FuYXJ5") || strings.Contains(w.Body.String(), "secret") || w.Header().Get("Content-Type") != "text/plain; charset=utf-8" { |
| + t.Error("unsafe log download", w.Body.String()) |
| } |
| } |
| func TestBufferFullStopsWorkSQLite(t *testing.T) { |
diff --git a/internal/runner/runtime_workflow.go b/internal/runner/runtime_workflow.go| index 14b85738..551a4ab5 100644 |
| --- a/internal/runner/runtime_workflow.go |
| +++ b/internal/runner/runtime_workflow.go |
| @@ -4,7 +4,6 @@ import ( |
| "context" |
| "encoding/json" |
| "path/filepath" |
| - "strings" |
| "time" |
| "amadan.net/oficina/equipo/internal/equipo/team" |
| @@ -15,28 +14,6 @@ import ( |
| "amadan.net/oficina/equipo/internal/runnerproto" |
| ) |
| -type forgeCredentials struct{ path string } |
| -type forgeCredentialFile struct { |
| - Agent string `json:"agent"` |
| - Repositories map[string]string `json:"repositories"` |
| -} |
| - |
| -func (f forgeCredentials) credential(_ context.Context, repo string) (forge.Credential, error) { |
| - var file forgeCredentialFile |
| - if err := privateJSON(f.path, &file); err != nil { |
| - return forge.Credential{}, err |
| - } |
| - token := file.Repositories[repo] |
| - if !strings.HasPrefix(repo, "amadan.net/") || strings.ContainsAny(repo+token, "\r\n\x00") || token == "" || file.Agent == "" { |
| - return forge.Credential{}, provider.ErrIdentity |
| - } |
| - return forge.Credential{Remote: "https://" + repo, Agent: file.Agent, Bearer: token}, nil |
| -} |
| -func (f forgeCredentials) Resolve(ctx context.Context, repo string) (workspace.Remote, error) { |
| - c, err := f.credential(ctx, repo) |
| - return workspace.Remote{URL: c.Remote, Bearer: c.Bearer}, err |
| -} |
| - |
| func (r *Runtime) active() (RunClaim, error) { |
| r.mu.Lock() |
| defer r.mu.Unlock() |
| @@ -133,7 +110,7 @@ func (r *Runtime) wire(ctx context.Context) error { |
| return provider.ErrIdentity |
| }}, r.sandbox) |
| } |
| - credentials := forgeCredentials{r.cfg.AmadanCredentialPath} |
| + credentials := forge.FileCredentials{Path: r.cfg.AmadanCredentialPath} |
| manager, err = workspace.New(workspace.Config{Protected: r.cfg.securityPaths(bs), PrivateRoot: filepath.Join(r.cfg.StateDir, "private"), WorkspaceRoot: r.cfg.WorkspaceRoot, GitPath: r.cfg.GitPath, Forge: credentials, Policy: r.policy, Definitions: func(ctx context.Context, target team.TargetBinding, repo string) (runnerproto.PreparedBug, error) { |
| c, err := r.active() |
| if err != nil { |
| @@ -167,7 +144,7 @@ func (r *Runtime) wire(ctx context.Context) error { |
| return provider.ErrIdentity |
| } |
| return r.api.Call(ctx, "validate", claimRequest(c, "publish-validate"), nil) |
| - }, Export: manager.ExportCandidate, Credential: credentials.credential, Description: forge.NewDescriptionTransport(nil, forge.NewCommandDescriptionWriter(r.cfg.AmadanPath, r.cfg.ScratchRoot))}) |
| + }, Export: manager.ExportCandidate, Credential: credentials.Credential, Description: forge.NewDescriptionTransport(nil, forge.NewCommandDescriptionWriter(r.cfg.AmadanPath, r.cfg.ScratchRoot))}) |
| } |
| workflow, err := NewPlanWorkflow(BugWorkflowConfig{UploadBlob: func(ctx context.Context, c RunClaim, hash string, raw []byte) error { |
| token, err := r.api.token(c.Assignment.ID, false) |
diff --git a/internal/runner/transporttest/budget_test.go b/internal/runner/transporttest/budget_test.go| new file mode 100644 |
| index 00000000..9fbb4850 |
| --- /dev/null |
| +++ b/internal/runner/transporttest/budget_test.go |
| @@ -0,0 +1,10 @@ |
| +package transporttest |
| + |
| +import ( |
| + "os" |
| + "testing" |
| + |
| + "amadan.net/rastrillo/rastrillo/budget" |
| +) |
| + |
| +func TestMain(m *testing.M) { os.Exit(budget.Main(m)) } |
diff --git a/internal/runner/transporttest/http_start_test.go b/internal/runner/transporttest/http_start_test.go| new file mode 100644 |
| index 00000000..071f9b59 |
| --- /dev/null |
| +++ b/internal/runner/transporttest/http_start_test.go |
| @@ -0,0 +1,124 @@ |
| +package transporttest |
| + |
| +import ( |
| + "context" |
| + "errors" |
| + "net/http" |
| + "net/http/httptest" |
| + "path/filepath" |
| + "reflect" |
| + "strings" |
| + "sync/atomic" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/runner" |
| + "amadan.net/oficina/equipo/internal/runner/provider" |
| + "amadan.net/oficina/equipo/internal/runnerproto" |
| +) |
| + |
| +func TestRunnerHeartbeatWireReports(t *testing.T) { |
| + reports := []runnerproto.ConnectionReport{ |
| + {LocalID: "claude-a", Provider: "claude", Family: "claude", Model: "claude-opus-5-5", Available: true, Routing: runnerproto.ConnectionRouting{BindingID: "claude-a", AccountID: "account-a", AccountPinned: true}}, |
| + {LocalID: "claude-b", Provider: "claude", Family: "claude", Model: "claude-opus-5-5", UnavailableReason: "capability_unverified", Routing: runnerproto.ConnectionRouting{BindingID: "claude-b", AccountID: "account-b"}}, |
| + } |
| + for _, tc := range []struct { |
| + name string |
| + reports []runnerproto.ConnectionReport |
| + }{{"two accounts", reports}, {"empty", []runnerproto.ConnectionReport{}}, {"nil", nil}} { |
| + t.Run(tc.name, func(t *testing.T) { |
| + reports := tc.reports |
| + var called atomic.Bool |
| + handler := (&runnerproto.Handler{ |
| + AuthenticateRunner: func(context.Context, string) (runnerproto.RunnerPrincipal, error) { |
| + return runnerproto.RunnerPrincipal{}, nil |
| + }, |
| + ReportConnections: func(_ context.Context, _ runnerproto.RunnerPrincipal, got []runnerproto.ConnectionReport) error { |
| + called.Store(true) |
| + if !reflect.DeepEqual(got, reports) { |
| + t.Errorf("reports changed: %#v", got) |
| + } |
| + return nil |
| + }, |
| + Invalid: runnerproto.ErrInvalid, |
| + Failure: func(w http.ResponseWriter, _ error) { w.WriteHeader(422) }, |
| + JSON: func(w http.ResponseWriter, status int, v any) { |
| + raw, err := runnerproto.Marshal(v) |
| + if err != nil { |
| + t.Error(err) |
| + w.WriteHeader(http.StatusInternalServerError) |
| + return |
| + } |
| + w.WriteHeader(status) |
| + _, _ = w.Write(raw) |
| + }, |
| + }).Router() |
| + client := httpClient(t, handler) |
| + if err := client.Heartbeat(context.Background(), reports); err != nil { |
| + t.Fatalf("heartbeat rejected: %v", err) |
| + } |
| + if !called.Load() { |
| + t.Fatal("heartbeat did not report accounts") |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func TestRunnerHTTPContractDiagnostics(t *testing.T) { |
| + for _, tc := range []struct { |
| + name string |
| + status int |
| + body, check string |
| + }{ |
| + {"refusal", 422, `{"version":2,"error":"form.invalid"}`, "http.response.status_422.form.invalid"}, |
| + {"untrusted refusal", 409, `{"version":2,"error":"secret-response"}`, "http.response.status_409.form.invalid"}, |
| + {"redirect", 302, "secret-response", "http.response.status_302"}, |
| + {"malformed envelope", 200, "secret-response", "http.response.envelope"}, |
| + {"wrong version", 200, `{"version":1,"result":null}`, "http.response.version"}, |
| + {"wrong result", 200, `{"version":2,"result":{"secret-response":true}}`, "http.response.result"}, |
| + } { |
| + t.Run(tc.name, func(t *testing.T) { |
| + c := httpClient(t, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| + w.WriteHeader(tc.status) |
| + _, _ = w.Write([]byte(tc.body)) |
| + })) |
| + _, err := c.Poll(context.Background()) |
| + code, check := runner.Diagnostic(err) |
| + if code != "runner.contract" || check != tc.check { |
| + t.Fatalf("diagnostic = %s at %s; want runner.contract at %s", code, check, tc.check) |
| + } |
| + if !errors.Is(err, provider.ErrContract) { |
| + t.Fatalf("contract classification lost: %v", err) |
| + } |
| + if strings.Contains(err.Error()+code+check, "secret-") { |
| + t.Fatal("secret in diagnostic") |
| + } |
| + if tc.status == 422 || tc.status == 409 { |
| + var refusal *runner.RefusalError |
| + if !errors.As(err, &refusal) || refusal.Status != tc.status { |
| + t.Fatal("refusal details lost") |
| + } |
| + } |
| + }) |
| + } |
| +} |
| + |
| +func httpClient(t *testing.T, handler http.Handler) *runner.HTTPInstance { |
| + t.Helper() |
| + server := httptest.NewServer(handler) |
| + t.Cleanup(server.Close) |
| + journal, err := runner.OpenJournal(context.Background(), filepath.Join(t.TempDir(), "state", "journal.db")) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + t.Cleanup(func() { |
| + if err := journal.Close(); err != nil { |
| + t.Error(err) |
| + } |
| + }) |
| + client, err := runner.NewHTTPInstance(server.URL, journal, runnerproto.RunnerCredential{Token: "secret-token", ExpiresAt: time.Now().Add(time.Hour)}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + return client |
| +} |
diff --git a/internal/runner/workspace/git_auth_test.go b/internal/runner/workspace/git_auth_test.go| new file mode 100644 |
| index 00000000..2ad232a3 |
| --- /dev/null |
| +++ b/internal/runner/workspace/git_auth_test.go |
| @@ -0,0 +1,142 @@ |
| +package workspace |
| + |
| +import ( |
| + "encoding/base64" |
| + "encoding/json" |
| + "fmt" |
| + "os" |
| + "path/filepath" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +func TestWorkspaceGitBasicIsolation(t *testing.T) { |
| + f := setup(t) |
| + password := "git-canary" |
| + header := "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+password)) |
| + f.forge.remote = Remote{URL: "https://amadan.test/team/repo", GitPassword: password} |
| + log := filepath.Join(f.root, "observations") |
| + spy := filepath.Join(f.root, "git-spy") |
| + script := fmt.Sprintf(`#!/usr/bin/python3 |
| +import os,sys,json |
| +args=sys.argv[1:] |
| +with open(%q,'a') as out: |
| + out.write(json.dumps({'args':args,'env':dict(os.environ)})+'\n') |
| +if 'https://amadan.test/team/repo' in args: |
| + args[args.index('https://amadan.test/team/repo')]=%q |
| + args=['-c','protocol.file.allow=always']+args |
| +os.execve('/usr/bin/git',['/usr/bin/git']+args,dict(os.environ)) |
| +`, log, f.remote) |
| + put(t, spy, script) |
| + if err := os.Chmod(spy, 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + f.m.cfg.GitPath = spy |
| + t.Setenv("EQUIPO_API_SECRET", "api-canary") |
| + t.Setenv("GIT_TRACE_CURL", "1") |
| + w := f.create(t) |
| + data, err := os.ReadFile(log) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + fetches := 0 |
| + for _, line := range strings.Split(strings.TrimSpace(string(data)), "\n") { |
| + var row struct { |
| + Args []string |
| + Env map[string]string |
| + } |
| + if err := json.Unmarshal([]byte(line), &row); err != nil { |
| + t.Fatal(err) |
| + } |
| + args := strings.Join(row.Args, " ") |
| + if strings.Contains(args, password) || strings.Contains(args, header) || row.Env["EQUIPO_API_SECRET"] != "" || row.Env["GIT_TRACE_CURL"] != "" { |
| + t.Fatal("credentials or tracing escaped into git process") |
| + } |
| + if strings.Contains(args, "https://amadan.test/team/repo") { |
| + fetches++ |
| + if row.Env["GIT_CONFIG_VALUE_9"] != header || row.Env["GIT_CONFIG_KEY_9"] != "http.extraHeader" || row.Env["GIT_CONFIG_COUNT"] != "10" { |
| + t.Fatal("fetch did not use Basic PAT") |
| + } |
| + } else if strings.Contains(fmt.Sprint(row.Env), header) { |
| + t.Fatal("PAT exposed to local git") |
| + } |
| + } |
| + if fetches != 1 { |
| + t.Fatal("HTTPS fetch not exercised") |
| + } |
| + if strings.Contains(fmt.Sprint(w.Environment()), password) || strings.Contains(fmt.Sprint(w.Environment()), header) { |
| + t.Fatal("PAT exposed to provider environment") |
| + } |
| + for _, root := range []string{f.cfg.PrivateRoot, f.cfg.WorkspaceRoot} { |
| + err := filepath.WalkDir(root, func(path string, d os.DirEntry, err error) error { |
| + if err != nil { |
| + return err |
| + } |
| + if !d.Type().IsRegular() { |
| + return nil |
| + } |
| + b, err := os.ReadFile(path) |
| + if err != nil { |
| + return err |
| + } |
| + if strings.Contains(string(b), password) || strings.Contains(string(b), header) { |
| + t.Error("credential persisted in workspace state") |
| + } |
| + return nil |
| + }) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + // Git may echo its environment on failure; callers must get only a safe error. |
| + put(t, spy, "#!/bin/sh\nprintf '%s' \"$GIT_CONFIG_VALUE_9\"\nprintf '%s' \"$GIT_CONFIG_VALUE_9\" >&2\nexit 1\n") |
| + _, _, err = f.m.fetch(ctx, f.target) |
| + if err == nil || strings.Contains(err.Error(), password) || strings.Contains(err.Error(), header) { |
| + t.Fatal("git failure leaked credentials") |
| + } |
| +} |
| + |
| +func TestWorkspaceGitRequiresPassword(t *testing.T) { |
| + f := setup(t) |
| + f.forge.remote = Remote{URL: "https://amadan.test/team/repo"} |
| + marker := filepath.Join(f.root, "git-ran") |
| + spy := filepath.Join(f.root, "git-spy") |
| + put(t, spy, "#!/bin/sh\ntouch '"+marker+"'\nexit 1\n") |
| + if err := os.Chmod(spy, 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + f.m.cfg.GitPath = spy |
| + _, _, err := f.m.fetch(ctx, f.target) |
| + if err == nil || !strings.Contains(err.Error(), "git password") { |
| + t.Fatal("missing PAT needs a clear configuration error", err) |
| + } |
| + if _, err := os.Stat(marker); !os.IsNotExist(err) { |
| + t.Fatal("git ran without a PAT") |
| + } |
| +} |
| + |
| +func TestWorkspaceGitPasswordValidation(t *testing.T) { |
| + for _, password := range []string{"git\rpassword", "git\npassword", "git\x00password", "local"} { |
| + t.Run(password, func(t *testing.T) { |
| + f := setup(t) |
| + marker := filepath.Join(f.root, "git-ran") |
| + spy := filepath.Join(f.root, "git-spy") |
| + put(t, spy, "#!/bin/sh\ntouch '"+marker+"'\nexit 1\n") |
| + if err := os.Chmod(spy, 0700); err != nil { |
| + t.Fatal(err) |
| + } |
| + f.m.cfg.GitPath = spy |
| + if password == "local" { |
| + f.forge.remote.GitPassword = password |
| + } else { |
| + f.forge.remote = Remote{URL: "https://amadan.test/team/repo", GitPassword: password} |
| + } |
| + if _, _, err := f.m.fetch(ctx, f.target); err == nil { |
| + t.Fatal("invalid git credential accepted") |
| + } |
| + if _, err := os.Stat(marker); !os.IsNotExist(err) { |
| + t.Fatal("invalid git credential reached git") |
| + } |
| + }) |
| + } |
| +} |
diff --git a/internal/runner/workspace/workspace.go b/internal/runner/workspace/workspace.go| index 04d117e4..72d7b59b 100644 |
| --- a/internal/runner/workspace/workspace.go |
| +++ b/internal/runner/workspace/workspace.go |
| @@ -5,8 +5,10 @@ import ( |
| "context" |
| "crypto/sha1" |
| "crypto/sha256" |
| + "encoding/base64" |
| "encoding/hex" |
| "encoding/json" |
| + "errors" |
| "fmt" |
| "io" |
| "net/url" |
| @@ -25,7 +27,10 @@ import ( |
| type PreparedBug = runnerproto.PreparedBug |
| type GitCandidate = team.GitCandidate |
| -type Remote struct{ URL, Bearer string } |
| +type Remote struct{ URL, GitPassword string } |
| + |
| +var ErrGitPassword = errors.New("configure a repository git password (PAT) in EQUIPO_AMADAN_CREDENTIAL_PATH") |
| + |
| type ForgeRead interface { |
| Resolve(context.Context, string) (Remote, error) |
| } |
| @@ -219,21 +224,27 @@ func objectFormat(id string) string { |
| } |
| func (m *Manager) fetch(ctx context.Context, t team.TargetBinding) (string, string, error) { |
| remote, err := m.cfg.Forge.Resolve(ctx, t.Repository) |
| + if errors.Is(err, ErrGitPassword) { |
| + return "", "", ErrGitPassword |
| + } |
| if err != nil { |
| return "", "", provider.ErrContract |
| } |
| protocol := "" |
| if filepath.IsAbs(remote.URL) { |
| r, e := canonical(remote.URL) |
| - if e != nil || r != remote.URL || remote.Bearer != "" { |
| + if e != nil || r != remote.URL || remote.GitPassword != "" { |
| return "", "", provider.ErrPolicy |
| } |
| protocol = "file" |
| } else { |
| u, e := url.Parse(remote.URL) |
| - if e != nil || u.Scheme != "https" || u.Host == "" || u.User != nil || u.RawQuery != "" || u.Fragment != "" || strings.ContainsAny(remote.URL+remote.Bearer, "\r\n\x00") { |
| + if e != nil || u.Scheme != "https" || u.Host == "" || u.User != nil || u.RawQuery != "" || u.Fragment != "" || strings.ContainsAny(remote.URL+remote.GitPassword, "\r\n\x00") { |
| return "", "", provider.ErrPolicy |
| } |
| + if remote.GitPassword == "" { |
| + return "", "", ErrGitPassword |
| + } |
| protocol = "https" |
| } |
| repo := filepath.Join(m.cfg.PrivateRoot, "project-"+digest(t.Repository)) |
| @@ -249,10 +260,10 @@ func (m *Manager) fetch(ctx context.Context, t team.TargetBinding) (string, stri |
| ref = "refs/heads/" + t.DefaultRef |
| } |
| env := map[string]string{} |
| - if remote.Bearer != "" { |
| + if remote.GitPassword != "" { |
| env["GIT_CONFIG_COUNT"] = "10" |
| env["GIT_CONFIG_KEY_9"] = "http.extraHeader" |
| - env["GIT_CONFIG_VALUE_9"] = "Authorization: Bearer " + remote.Bearer |
| + env["GIT_CONFIG_VALUE_9"] = "Authorization: Basic " + base64.StdEncoding.EncodeToString([]byte("x:"+remote.GitPassword)) |
| } |
| if _, err := m.git(ctx, repo, nil, env, "-c", "protocol."+protocol+".allow=always", "-c", "http.followRedirects=false", "fetch", "--no-auto-maintenance", "--no-tags", "--no-recurse-submodules", "--", remote.URL, ref); err != nil { |
| return "", "", err |
diff --git a/internal/runner/workspace/workspace_test.go b/internal/runner/workspace/workspace_test.go| index 4532ad15..ca0a2a0a 100644 |
| --- a/internal/runner/workspace/workspace_test.go |
| +++ b/internal/runner/workspace/workspace_test.go |
| @@ -383,7 +383,7 @@ func TestWorkspaceHasNoCredentials(t *testing.T) { |
| if _, err := os.Stat(marker); !os.IsNotExist(err) { |
| t.Fatal("poison git configuration executed") |
| } |
| - f.forge.remote = Remote{URL: "https://user:secret@invalid.test/repo", Bearer: sentinel} |
| + f.forge.remote = Remote{URL: "https://user:secret@invalid.test/repo", GitPassword: sentinel} |
| f.target.Repository = "invalid" |
| if _, err := f.m.Prepare(ctx, f.target); err == nil || strings.Contains(err.Error(), sentinel) { |
| t.Fatal("credential URL accepted or diagnostic leaked") |
diff --git a/internal/runnerproto/event_io.go b/internal/runnerproto/event_io.go| index 7f681029..2b75112a 100644 |
| --- a/internal/runnerproto/event_io.go |
| +++ b/internal/runnerproto/event_io.go |
| @@ -47,7 +47,7 @@ func WaitReconnect(ctx context.Context, attempt int, leaseDeadline time.Time) er |
| } |
| } |
| -var secretPattern = regexp.MustCompile(`(?i)(bearer\s+)[A-Za-z0-9._~+/=-]+|((?:api[_-]?key|password|secret|token)\s*[=:]\s*)[^\s,"'<>]+|(?:sk-|ghp_|github_pat_)[A-Za-z0-9_-]{8,}`) |
| +var secretPattern = regexp.MustCompile(`(?i)((?:bearer|basic)\s+)[A-Za-z0-9._~+/=-]+|((?:api[_-]?key|password|secret|token)\s*[=:]\s*)[^\s,"'<>]+|(?:sk-|ghp_|github_pat_)[A-Za-z0-9_-]{8,}`) |
| func RedactText(s string, secrets []string) string { |
| for _, secret := range secrets { |
diff --git a/packaging/install/install-v1.sh b/packaging/install/install-v1.sh| index 594abf30..4ca28186 100644 |
| --- a/packaging/install/install-v1.sh |
| +++ b/packaging/install/install-v1.sh |
| @@ -23,7 +23,10 @@ m = json.load(open(sys.argv[1])) |
| r = m['release'] |
| assert m['version'] == sys.argv[2] and m['target'] == 'linux/amd64' |
| assert r['live_gate_copy_reviewed'] and r['direct_policies'] and r['certifications'] |
| -assert not r.get('uncertified_policies') |
| +assert any(p['provider'] == c['provider'] and p['policy_hash'] == c['policy_hash'] |
| + and not any(u['provider'] == p['provider'] and u['action'] == p['action'] |
| + for u in r.get('uncertified_policies', [])) |
| + for p in r['direct_policies'] for c in r['certifications']) |
| assert re.fullmatch('[0-9a-f]{64}', m['runner_sha256']) |
| print(m['runner_sha256']) |
| PY |
diff --git a/scripts/build-instance-release.sh b/scripts/build-instance-release.sh| new file mode 100755 |
| index 00000000..11d7c7d2 |
| --- /dev/null |
| +++ b/scripts/build-instance-release.sh |
| @@ -0,0 +1,20 @@ |
| +#!/bin/sh |
| +set -eu |
| +source=$1 |
| +output=$2 |
| +target_os=$3 |
| +target_arch=$4 |
| +version=$5 |
| +bundle=internal/release/bundled |
| +# An existing directory belongs to another build. Never remove or reuse it. |
| +mkdir "$bundle" |
| +trap 'rm -rf "$bundle"' EXIT |
| +trap 'exit 1' HUP INT TERM |
| +for name in install-manifest.json equipo-runner equipo-tool-proxy install-v1.sh; do |
| + cp "$source/$name" "$bundle/$name" |
| +done |
| +# Exercise the same manifest and digest checks as the download handler. |
| +EQUIPO_BUNDLE_VERSION="$version" CGO_ENABLED=0 go test -tags runnerassets ./internal/release -run '^TestBundledInstallAssets$' -count=1 |
| +CGO_ENABLED=0 GOOS="$target_os" GOARCH="$target_arch" go build -tags runnerassets -trimpath \ |
| + -ldflags "-s -w -X amadan.net/rastrillo/rastrillo.BuildVersion=$version" \ |
| + -o "$output" ./cmd/equipo |
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json| index c63c27d7..81a2a8c7 100644 |
| --- a/scripts/runner-reference-allowlist.json |
| +++ b/scripts/runner-reference-allowlist.json |
| @@ -9413,5 +9413,418 @@ |
| "match": "Node", |
| "count": 1, |
| "reason": "Browser DOM removedNodes property retains older visible messages during live refresh." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-enable-execution.md", |
| + "line_sha256": "725b03626c59b5c2c35578745468eaf582e58b52099352fa2a989d7dcbfe070f", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller brief for packaging and enrolling the direct runner." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-enable-execution.md", |
| + "line_sha256": "d8aed7d2f2bbabb9466b77ad21493d4fe00a155be0aac1f69587d152c91bb870", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller brief for packaging and enrolling the direct runner." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "f1e8b1772989bf277bbb66891651157d64cd2b14c1752953d80abd0b164d5776", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "9a21c3d1716593c9b181ac3df80821e57196e92e598715f9cc3f0acd6c711129", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "c2e78754bc69070c8d1fb062fadeeafd98242c7e1b3205feaae7a0ff12610ba0", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "89f990061721427250123559349d8d249c0777d5897c980c60ae662b88066068", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "a59aedce8c8ca1c4c38f75a479c7ca1c45eda0cde8b45a4145db67e1f4799ea5", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "f458d1c675528381853c2de9e904da9bbd483d0bcbb022b15a7f49bc67dfd5fd", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "137e299d3f2a92705a84006f416fef22d8a42d1e82dab6dcec19e4d4f1b8530c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "0e6eb59656ac69cb501f7155b5ebca3bc7ce66ba44d93934711563c0878a3251", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "73a5726b070d9414e9fdc7e47c1f13a94cc979c7137493f603938aec58dda3cc", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "bbda4738f0e41cf49f60c15ae401d08d923e355d1b278d6ffaea1f221fa52a03", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "b0fd3a759250a52890a05d207df9a3bab6e26d0e8bc21078050b440a44cca36d", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "e3bfc9d4673ecafc37651f036ff5fcee5210fc55330c0ea41024575e557526d3", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "6519e70e12e3f2d52afb52e0b1349ccefe0d40c752bd72ab43c23d97835f3257", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "f87d64e038662cfb6c2866c6600b9bae6aeac45f1309b56742d0ea0237dc38fe", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "51d69bfc5d3e9516c198b85825a961548f10ab00d70c9c9e95189a4bae335af7", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "6481d5b4370f7d25e4662af62667f9dbdb4e7dfe30408604ad60e9077e6fa583", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "3e3f969d6b750f4017aa1755e4ee85d89a53b82540325226bcd26929d969915f", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "960f5d28c215bdb5cec1418d2e5aaec5917d003acdcd0404b625e3180c3efd81", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "74f302fa6d62452ec5fa0dec979b843880f08659bc24cdcf155620cbe213d609", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "5fb6b184a06c696cdf146ee0e6cf1ed3764392d2b74195043f51bd550338f396", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-enable-execution.md", |
| + "line_sha256": "3689f53443f64872b822033a5de0c31ae6a5b771c043a5a9d019467f977b8a8f", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller commands and evidence for the direct runner installation." |
| + }, |
| + { |
| + "path": "internal/release/embedded_install_test.go", |
| + "line_sha256": "604348f151973255fb5a95bbd557d548f8979ce92ede7c71c5d99446c501bf86", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Fixture asset names verify the embedded direct runner downloads." |
| + }, |
| + { |
| + "path": "internal/release/embedded_install_test.go", |
| + "line_sha256": "3e81052e624d6f37dfe1bb3e29f11a4335d2515586a4c8932fed567e7007bc89", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Fixture asset names verify the embedded direct runner downloads." |
| + }, |
| + { |
| + "path": "internal/release/embedded_install_test.go", |
| + "line_sha256": "7d43a13d095c9ba429d82e666602ff219bbb48f1a98b0e5f5b0305b52e4b3c1e", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Fixture asset names verify the embedded direct runner downloads." |
| + }, |
| + { |
| + "path": "internal/release/embedded_install_test.go", |
| + "line_sha256": "dd061d43e4415884a2f6f8211836cc21ecd81f82b3734b188d585f956a24791c", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Fixture asset names verify the embedded direct runner downloads." |
| + }, |
| + { |
| + "path": "scripts/build-instance-release.sh", |
| + "line_sha256": "e9040c1b6d39ee0d2a91f0e6c958aa099deef3523146410a9dcf113ec4958d16", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Copies the certified direct runner into the instance release bundle." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "0934f4cb518a0a333bf859d586229d645c259f95b155107908c9e58086300368", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "0d642f5ef31db3815c39aab26a76c8a9fc96b055895344f0d49a126a2239c245", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "160ee97289a53d8a28eeb7e62527206b8240a17f75edb5bc9c6d9576f3131b2e", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "20d2c4a4b29d8dbc2bb51cd782788e091e2222e6e959c23f3db97820ccbc3141", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "33d3fcdc591c649e6fa46d3523ccc99476d099f5e59ef3f45c5febf2f6b0b1af", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "3689f53443f64872b822033a5de0c31ae6a5b771c043a5a9d019467f977b8a8f", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "48caae6a92a2e17b0b33edff59925866cd412dd0e8313cdf8bd08c24e1d96417", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "5156740b74f365a0bb08e492ce93b8438211509eedc0ef7a9c14ac177a88493b", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "6a8da0e833ccdbb5edf396cc0078ff31ac183eacbff5c63bf7d164ff8f6730c6", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "823fd9f5c5531ee0d3a14e99691aa2d6d35d3ad1fdc0aa0b49e5acd735cc16ba", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "87cf203e48b52a3f2168c1cf967b8c9e299390809dd7bfe81939581792b2efa7", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "8a7937ed8202458a949542a1659f3bb443dbbcb6d639a7eeabaa1754abc5cdbf", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "8d2b9ce44e3eacffe9878510e8c8b54d0c0101da738b13c6617c5c9553ca0d2f", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "8efd545e09f72849a24ed6590e6537b5c339cb39910103c73daf5e9b016d5c36", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "af7ac8af352e900773b5c6c54a51e14ca1652f080f7b036744d46cd4c1701f08", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "ecbca8cf8b52ce1dafdc3486f1a52241e87c1ec5b435265622f5850c9fb81015", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-runner-start.md", |
| + "line_sha256": "f1e8b1772989bf277bbb66891651157d64cd2b14c1752953d80abd0b164d5776", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-runner-start.md", |
| + "line_sha256": "151ad8840260187c1d84265c00625e554c5a5b547154bd0a1602d329b0135888", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-runner-start.md", |
| + "line_sha256": "16702129532841215c35bc33986d4af136879f6af50f8adbe02fc3c6b9b0c907", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-runner-start.md", |
| + "line_sha256": "25f96df976f231cbb8e09daeaf855d04924b9fc4e82a57633013a00a864707da", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-runner-start.md", |
| + "line_sha256": "5177f7cf8daa802b7257d4aac248e5bd60673e9ee7a15b604639026db0634a41", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-runner-start.md", |
| + "line_sha256": "7e49eb5cb4c45192fae7e39d09e6d2749092bea9ce87576143710703b04f5b3f", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-runner-start.md", |
| + "line_sha256": "b2e3379e64ca0ca85702f7bbde7adaca27db200f16d09c991b76bde719f53908", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller instructions and evidence for the runner startup fix." |
| + }, |
| + { |
| + "path": "docs/live-gate.md", |
| + "line_sha256": "ae238c413722092b05860a9c9c0728955e525e31e7369687fbcce7d64cb8f807", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Current runner credential setup and private agent home paths." |
| + }, |
| + { |
| + "path": "docs/live-gate.md", |
| + "line_sha256": "bfb85cecdb8d62210fe819a17d2a88f135f5dbb4bb0d86593978fec3f87eec89", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Current runner credential setup and private agent home paths." |
| + }, |
| + { |
| + "path": "docs/live-gate.md", |
| + "line_sha256": "e5e3a34f6108b461856ac55e3c6aa3c69302fbcd0004c6831957588bd4523abf", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Current runner credential setup and private agent home paths." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md", |
| + "line_sha256": "53f8659045c7b81f8ed70d45b1b4b007ffad5dd07661d1b3e3e32edbfa108a6f", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller task brief naming existing private runner credential paths." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CODEX-BRIEF-forge-git-auth.md", |
| + "line_sha256": "5fa92a6abee5ed79c2c0088dcd7516aef9f50393eaec587eb2a0081bf73827c5", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller task brief naming existing private runner credential paths." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md", |
| + "line_sha256": "91d38503704564d86bd4c5c031bf63eaec4e31d7bddaa7e69e9e57a85369170e", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller conversion instructions for private runner credential files." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md", |
| + "line_sha256": "a317372bc4fc473f7e1a3247dc67c13e98009fb58a05767faddc2a4ffa9085af", |
| + "match": "equipo-runner", |
| + "count": 1, |
| + "reason": "Controller conversion instructions for private runner credential files." |
| + }, |
| + { |
| + "path": "docs/superpowers/plans/CONTROLLER-REPORT-forge-git-auth.md", |
| + "line_sha256": "e609174dd7b9861d9b3989921bf12b8778feadf07fe75d31aaef6c853bce7582", |
| + "match": "equipo-runner", |
| + "count": 2, |
| + "reason": "Controller conversion instructions for private runner credential files." |
| } |
| ] |