The tracker's service step carries the runner's SSH key into an agent it kills (TR-58) #62

Merged
pit merged 2 commits from hermes/TR-58-runner-ssh-key into main 2026-11-14 22:37:40 +00:00
Owner

Summary

The runner's service step runs Ansible over SSH as root, and the runner's service user holds no identity of its own. The key was on the other side all along — the store serves it, and 142's authorized_keys trusts it — but the repository never asked for it.

ACTOR=runner make env
  env.map   actors=runner  secret/services/semaphore/deploy-ssh  SEMAPHORE_SSH_KEY
    └─ .env (0600, removed by the task's trap)

make service  (and make service-check)
  service_stack_init
    ├─ require .env, source it
    ├─ ssh_agent_from_env                 # only when SEMAPHORE_SSH_KEY is set
    │    ├─ eval "$(ssh-agent -s)"
    │    ├─ trap 'ssh-agent -k' EXIT
    │    ├─ printf '%s\n' "$SEMAPHORE_SSH_KEY" | ssh-add -q -
    │    └─ unset SEMAPHORE_SSH_KEY
    ├─ ansible-playbook -i … --check --diff site.yml    (the rehearsal)
    └─ ansible-playbook -i … site.yml                   (the real run)
 env.map
+actors=runner secret/services/semaphore/deploy-ssh SEMAPHORE_SSH_KEY

 .env.example
+SEMAPHORE_SSH_KEY=

 Makefile
+define ssh_agent_from_env
+  … agent started, key on stdin, trap on EXIT, variable unset …
+endef
 define service_stack_init
   set -a; source .env; set +a
   $(call require_service_secrets)
+  $(ssh_agent_from_env)

 scripts/tests/
+service-key.test.sh       # 29 assertions, stubs and a real ssh-agent

scripts/tests/run.sh moves with it: the Operator is now kept from two names (SEMAPHORE_API_TOKEN and SEMAPHORE_SSH_KEY), and the runner's pinned set goes from twelve to thirteen.

No tracker ticket carried this piece. TR-58 is the node it completes — its first real deploy is the failure below.

Evidence

  • Before: Semaphore task #27 (project infra-tracker, template deploy, commit cc42ce8), service red after 7 s:

    [ERROR]: Task failed: Failed to connect to the host via ssh: root@10.12.0.142: Permission denied (publickey,password).
    fatal: [vikunja]: UNREACHABLE! => {"changed": false, …, "unreachable": true}
    make[1]: *** [Makefile:383: service] Error 4
    

    snapshot and guest had run (the Guest applied 0 changes); edge and verify never did.

  • After: mise exec -- make check exits 0 on this branch. The real-agent case proves the agent is gone by asking its own socket (ssh-add -l → exit 2) rather than kill -0 on a pid an unreaped zombie keeps visible; under a non-reaping PID 1 — the job container's arrangement — it is green, where df07c83 reds. make deploy-test → service-key tests: 29 assertions, 0 FAILED, including a real ssh-agent with a throwaway key: both playbook runs see the key's fingerprint and the agent is gone when the recipe ends. Also pinned: a failed rehearsal, a failed real run, a refused ssh-add (no playbook runs), no key in .env, and an empty key.

  • The store holds the key 142 trusts — verified without copying it anywhere: the record parses as an OpenSSH private key, and its public half is SHA256:9w0p3dNcyVgf5aAyiRUxg1TmsPtVh2RU2aG9MM04klw semaphore-runner-sc15, identical to vikunja/guest/keys.d/semaphore-runner.pub and to the line in 142's authorized_keys.

  • The actor rows: scripts/audit-actor-rows.py against infra-secrets' bao/policies/automation-runner.hcl → 9 rows serve runner, 0 not readable.

Merge Danger

Door: two-way — reverting restores the macro-less service preamble and the next deploy goes red at service exactly as this one did. Nothing on 142 changes either way: the deploy stopped before the service layer ran.

Blast Radius: tracker-only — one repository's service preamble, one store row, one Guest (142).

Next red on the same path, not touched here: edge calls require_npm_creds, and the runner's .env carries NGINXPROXYMANAGER_USERNAME/_PASSWORD but not NGINXPROXYMANAGER_URL — that name is a literal row for pit,hermes, and the Semaphore project environment carries only PROXMOX_VE_ENDPOINT. It needs a second key in infra-cockpit's projects Stack, which is a separate change.

## Summary The runner's `service` step runs Ansible over SSH as root, and the runner's service user holds no identity of its own. The key was on the other side all along — the store serves it, and 142's `authorized_keys` trusts it — but the repository never asked for it. ```text ACTOR=runner make env env.map actors=runner secret/services/semaphore/deploy-ssh SEMAPHORE_SSH_KEY └─ .env (0600, removed by the task's trap) make service (and make service-check) service_stack_init ├─ require .env, source it ├─ ssh_agent_from_env # only when SEMAPHORE_SSH_KEY is set │ ├─ eval "$(ssh-agent -s)" │ ├─ trap 'ssh-agent -k' EXIT │ ├─ printf '%s\n' "$SEMAPHORE_SSH_KEY" | ssh-add -q - │ └─ unset SEMAPHORE_SSH_KEY ├─ ansible-playbook -i … --check --diff site.yml (the rehearsal) └─ ansible-playbook -i … site.yml (the real run) ``` ```diff env.map +actors=runner secret/services/semaphore/deploy-ssh SEMAPHORE_SSH_KEY .env.example +SEMAPHORE_SSH_KEY= Makefile +define ssh_agent_from_env + … agent started, key on stdin, trap on EXIT, variable unset … +endef define service_stack_init set -a; source .env; set +a $(call require_service_secrets) + $(ssh_agent_from_env) scripts/tests/ +service-key.test.sh # 29 assertions, stubs and a real ssh-agent ``` `scripts/tests/run.sh` moves with it: the Operator is now kept from two names (`SEMAPHORE_API_TOKEN` and `SEMAPHORE_SSH_KEY`), and the runner's pinned set goes from twelve to thirteen. No tracker ticket carried this piece. TR-58 is the node it completes — its first real deploy is the failure below. ## Evidence - **Before:** Semaphore task #27 (project `infra-tracker`, template `deploy`, commit `cc42ce8`), `service` red after 7 s: ```text [ERROR]: Task failed: Failed to connect to the host via ssh: root@10.12.0.142: Permission denied (publickey,password). fatal: [vikunja]: UNREACHABLE! => {"changed": false, …, "unreachable": true} make[1]: *** [Makefile:383: service] Error 4 ``` `snapshot` and `guest` had run (the Guest applied 0 changes); `edge` and `verify` never did. - **After:** `mise exec -- make check` exits 0 on this branch. The real-agent case proves the agent is gone by asking its own socket (`ssh-add -l` → exit 2) rather than `kill -0` on a pid an unreaped zombie keeps visible; under a non-reaping PID 1 — the job container's arrangement — it is green, where `df07c83` reds. `make deploy-test` → `service-key tests: 29 assertions, 0 FAILED`, including a **real `ssh-agent` with a throwaway key**: both playbook runs see the key's fingerprint and the agent is gone when the recipe ends. Also pinned: a failed rehearsal, a failed real run, a refused `ssh-add` (no playbook runs), no key in `.env`, and an empty key. - **The store holds the key 142 trusts** — verified without copying it anywhere: the record parses as an OpenSSH private key, and its public half is `SHA256:9w0p3dNcyVgf5aAyiRUxg1TmsPtVh2RU2aG9MM04klw semaphore-runner-sc15`, identical to `vikunja/guest/keys.d/semaphore-runner.pub` and to the line in 142's `authorized_keys`. - **The actor rows:** `scripts/audit-actor-rows.py` against `infra-secrets`' `bao/policies/automation-runner.hcl` → 9 rows serve `runner`, 0 not readable. ## Merge Danger **Door:** two-way — reverting restores the macro-less `service` preamble and the next deploy goes red at `service` exactly as this one did. Nothing on 142 changes either way: the deploy stopped before the service layer ran. **Blast Radius:** tracker-only — one repository's `service` preamble, one store row, one Guest (142). Next red on the same path, not touched here: `edge` calls `require_npm_creds`, and the runner's `.env` carries `NGINXPROXYMANAGER_USERNAME`/`_PASSWORD` but not `NGINXPROXYMANAGER_URL` — that name is a `literal` row for `pit,hermes`, and the Semaphore project environment carries only `PROXMOX_VE_ENDPOINT`. It needs a second key in `infra-cockpit`'s projects Stack, which is a separate change.
The tracker's service step carries the runner's SSH key into an agent it kills (TR-58)
Some checks failed
plan / guest-plan-check (pull_request_target) Successful in 7s
plan / edge-plan-check (pull_request_target) Successful in 6s
checks / static (pull_request) Failing after 20s
checks / execute (pull_request) Failing after 2s
df07c8326c
Member

Review started (round 1/5) on df07c8326c — reading the diff now.

**Review started** (round 1/5) on df07c8326c58083d0c36c78fb1d1b6616b4c01f8 — reading the diff now.
bot-minos requested changes 2026-11-14 21:08:53 +00:00
Dismissed
bot-minos left a comment

olympus/infra-tracker #62 — head df07c832 — round 1/5 — axes: standards, spec — verdict: fix

Recommendation: fix

Standards

BLOCKER — the new suite reds the required floor in the runner image, so this head cannot merge and main would go red on it.

scripts/tests/service-key.test.sh:213 (the real-agent case, :188-220) decides "the agent is gone
when the recipe ends" with one unguarded kill -0 "$pid" taken immediately after make returns
(:204-205). That is not a liveness test: kill -0 answers 0 for any pid that still exists,
including a zombie whose parent has exited and whose reaper has not collected it — reproduced here
on a child left unreaped, which reads state=Z, kill0=yes. In a job container whose PID 1 does
not collect the killed agent's orphan the pid never clears, so the assertion reds permanently.

The run at this exact head says so — checks / static (pull_request) on df07c83, run 132 job 0:

FAIL  real agent: the agent (pid 2664) outlived the recipe
service-key tests: 29 assertions, 1 FAILED.
make: *** [Makefile:331: deploy-test] Error 1

Makefile:330-333 puts the suite into deploy-test, which make check runs (Makefile:470),
which is what the static job runs (.forgejo/workflows/checks.yaml:43-49); checks / execute
fails 2 s in for the same reason and no other — that job's first step turns static's red into its
own. The same suite is green 5/5 on a bare host, and green in my run of mise exec -- make check,
so the body's After line — make check exits 0 on this branch — is true where it was typed and
false in the only image that gates a merge. That gap is the finding, not the number in it.

Smallest change that clears it: make the observation sound instead of immediate — poll the pid for
a bounded moment and count a Z state as gone (ps -o stat= -p "$pid" empty, or starting with Z),
or assert the agent's effect instead of its pid (ssh-add -l against the recorded SSH_AUTH_SOCK
fails). Nothing else in the file needs to move.

ADVISORY — docs/reference/service.md:137-138 opens the new section after two blank lines;
every other section boundary in that file is one (:15-16, :47-48, :69-70, :85-86).

Spec

No finding. The spec is the PR description (see Could not verify for the tracker): the key is
fetched for the runner actor alone (env.map:95), declared empty in .env.example:95, loaded
into an agent the recipe starts (Makefile:197-204), unset before the playbook runs
(Makefile:202), and killed by an EXIT trap (Makefile:200) that .ONESHELL + -eu -o pipefail
(Makefile:2-3) keeps alive across the rehearsal and the real run. Each of those is implemented,
and each is driven by the new file — the stub cases :107-186, the real agent :188-220, the row
and declaration :222-231. Nothing in the diff goes past what the body claims.

Verified

Read live at df07c83 in a worktree off refs/pull/62/head (git ls-remote re-checked before this
POST).

Check Result
./scripts/tests/run.sh env-test: every assertion holds., rc 0
make deploy-test 61 + 49 + 29 assertions, 0 FAILED, rc 0
make gate-test 57 assertions, 0 FAILED
mise exec -- make check rc 0 on this host (last target's tofu test 5/5)
CI, checks / static at this head failure, service-key tests: 29 assertions, 1 FAILED
CI, checks / execute at this head failure (consequence of static)
CI, plan / guest-plan-check, plan / edge-plan-check success — no Stack is touched

Mutation wave — each mutant reds the suite, so the file is not vacuous: drop unset (2 FAILs),
drop the EXIT trap (8), load the key from a file instead of stdin (the -q - assertion and three
neighbours), drop $(ssh_agent_from_env) from the preamble (18), start an agent with no key (5),
drop .ONESHELL (19); and removing SEMAPHORE_SSH_KEY from scripts/tests/run.sh:151's exclusion
reds env-test. Tree restored and byte-identical to head afterwards (git status --porcelain
empty).

Claims checked outside the diff, at the siblings' current origin/main:

  • infra-secrets 71c5f89: docs/store-layout.md:246 — the runner alone reads
    secret/services/semaphore/deploy-ssh; bao/policies/automation-runner.hcl:55-57 grants read;
    operator.hcl, admin-agent.hcl, regular-agent.hcl, ci-tracker.hcl hold no grant for it, so
    env.map's row and scripts/tests/run.sh's "would be a 403" comment are both right.
  • The body's audit figure reproduced by hand: 9 actors=runner rows in env.map, 9 readable under
    that policy, 0 that are not.
  • modules/guest/keys.tf:14 is the repo half of "the public half is in 142's authorized_keys".
  • scripts/env.sh:334-339 single-quotes a multi-line value, so a PEM key survives
    set -a; source .env; the suite's write_env mirrors that shape.
  • .forgejo/workflows/deploy.yml:36-37,76 is the push-to-main job that reads SEMAPHORE_API_TOKEN
    — the reflowed comment in .env.example and env.map:104 states it correctly.

Could not verify

  • TR-58. The shipped tracker reader answered key from …/minos/.env: /projects http=401 and
    found no key in ~/.hermes/.env, so the Vikunja task (project 3, index 58) was not read. The PR
    body is the spec, named as such; it is complete enough to grade — the one gap is that its
    "no tracker ticket carried this piece" clause could not be checked against the tracker.
  • The store's private half and 142's authorized_keys line, and the SHA256:9w0p3d… identity
    that ties them: no store credential and no route to the Guest from this session. The repo-side
    halves of that claim were checked (above).
  • scripts/audit-actor-rows.py, cited in the body's fourth Evidence bullet, is in no olympus
    clone I can read; the figure it produces was reproduced by hand instead (above).

Named, not charged

  • The edge red the body discloses (NGINXPROXYMANAGER_URL a pit,hermes literal, absent from the
    runner's .env): disclosed, a separate change, and on a line this diff does not touch.
  • $(shell sed … npm/edge.tfvars) in the suite's mirror emits one sed: can't read line to stderr
    per run; harmless, and it is the included Makefile's parse, not this change's line.

Summary

Standards: 2 findings — 1 BLOCKER (the suite's real-agent assertion reds checks / static at this
head), 1 ADVISORY (blank-line count in service.md). Spec: 0 findings. Worst finding in each axis:
the BLOCKER above; none on the spec axis. The recommendation follows the blocker, not the
advisory count.

<!-- minos review-loop: repo=olympus/infra-tracker pr=62 head=df07c8326c58083d0c36c78fb1d1b6616b4c01f8 round=1/5 axes=standards,spec --> **olympus/infra-tracker #62** — head `df07c832` — round 1/5 — axes: standards, spec — verdict: **fix** Recommendation: fix ### Standards **BLOCKER — the new suite reds the required floor in the runner image, so this head cannot merge and `main` would go red on it.** `scripts/tests/service-key.test.sh:213` (the real-agent case, `:188-220`) decides "the agent is gone when the recipe ends" with one unguarded `kill -0 "$pid"` taken immediately after `make` returns (`:204-205`). That is not a liveness test: `kill -0` answers 0 for any pid that still exists, including a zombie whose parent has exited and whose reaper has not collected it — reproduced here on a child left unreaped, which reads `state=Z`, `kill0=yes`. In a job container whose PID 1 does not collect the killed agent's orphan the pid never clears, so the assertion reds permanently. The run at this exact head says so — `checks / static (pull_request)` on `df07c83`, run 132 job 0: ```text FAIL real agent: the agent (pid 2664) outlived the recipe service-key tests: 29 assertions, 1 FAILED. make: *** [Makefile:331: deploy-test] Error 1 ``` `Makefile:330-333` puts the suite into `deploy-test`, which `make check` runs (`Makefile:470`), which is what the `static` job runs (`.forgejo/workflows/checks.yaml:43-49`); `checks / execute` fails 2 s in for the same reason and no other — that job's first step turns `static`'s red into its own. The same suite is green 5/5 on a bare host, and green in my run of `mise exec -- make check`, so the body's *After* line — `make check` exits 0 on this branch — is true where it was typed and false in the only image that gates a merge. That gap is the finding, not the number in it. Smallest change that clears it: make the observation sound instead of immediate — poll the pid for a bounded moment and count a `Z` state as gone (`ps -o stat= -p "$pid"` empty, or starting with `Z`), or assert the agent's effect instead of its pid (`ssh-add -l` against the recorded `SSH_AUTH_SOCK` fails). Nothing else in the file needs to move. **ADVISORY — `docs/reference/service.md:137-138`** opens the new section after two blank lines; every other section boundary in that file is one (`:15-16`, `:47-48`, `:69-70`, `:85-86`). ### Spec No finding. The spec is the PR description (see *Could not verify* for the tracker): the key is fetched for the `runner` actor alone (`env.map:95`), declared empty in `.env.example:95`, loaded into an agent the recipe starts (`Makefile:197-204`), unset before the playbook runs (`Makefile:202`), and killed by an `EXIT` trap (`Makefile:200`) that `.ONESHELL` + `-eu -o pipefail` (`Makefile:2-3`) keeps alive across the rehearsal and the real run. Each of those is implemented, and each is driven by the new file — the stub cases `:107-186`, the real agent `:188-220`, the row and declaration `:222-231`. Nothing in the diff goes past what the body claims. ### Verified Read live at `df07c83` in a worktree off `refs/pull/62/head` (`git ls-remote` re-checked before this POST). | Check | Result | | --- | --- | | `./scripts/tests/run.sh` | `env-test: every assertion holds.`, rc 0 | | `make deploy-test` | 61 + 49 + **29** assertions, 0 FAILED, rc 0 | | `make gate-test` | 57 assertions, 0 FAILED | | `mise exec -- make check` | rc 0 on this host (last target's `tofu test` 5/5) | | CI, `checks / static` at this head | **failure**, `service-key tests: 29 assertions, 1 FAILED` | | CI, `checks / execute` at this head | failure (consequence of `static`) | | CI, `plan / guest-plan-check`, `plan / edge-plan-check` | success — no Stack is touched | Mutation wave — each mutant reds the suite, so the file is not vacuous: drop `unset` (2 FAILs), drop the `EXIT` trap (8), load the key from a file instead of stdin (the `-q -` assertion and three neighbours), drop `$(ssh_agent_from_env)` from the preamble (18), start an agent with no key (5), drop `.ONESHELL` (19); and removing `SEMAPHORE_SSH_KEY` from `scripts/tests/run.sh:151`'s exclusion reds `env-test`. Tree restored and byte-identical to head afterwards (`git status --porcelain` empty). Claims checked outside the diff, at the siblings' current `origin/main`: - `infra-secrets` `71c5f89`: `docs/store-layout.md:246` — the runner alone reads `secret/services/semaphore/deploy-ssh`; `bao/policies/automation-runner.hcl:55-57` grants `read`; `operator.hcl`, `admin-agent.hcl`, `regular-agent.hcl`, `ci-tracker.hcl` hold no grant for it, so `env.map`'s row and `scripts/tests/run.sh`'s "would be a 403" comment are both right. - The body's audit figure reproduced by hand: 9 `actors=runner` rows in `env.map`, 9 readable under that policy, 0 that are not. - `modules/guest/keys.tf:14` is the repo half of "the public half is in 142's `authorized_keys`". - `scripts/env.sh:334-339` single-quotes a multi-line value, so a PEM key survives `set -a; source .env`; the suite's `write_env` mirrors that shape. - `.forgejo/workflows/deploy.yml:36-37,76` is the push-to-main job that reads `SEMAPHORE_API_TOKEN` — the reflowed comment in `.env.example` and `env.map:104` states it correctly. ### Could not verify - **TR-58.** The shipped tracker reader answered `key from …/minos/.env: /projects http=401` and found no key in `~/.hermes/.env`, so the Vikunja task (project 3, index 58) was not read. The PR body is the spec, named as such; it is complete enough to grade — the one gap is that its "no tracker ticket carried this piece" clause could not be checked against the tracker. - **The store's private half and 142's `authorized_keys` line**, and the `SHA256:9w0p3d…` identity that ties them: no store credential and no route to the Guest from this session. The repo-side halves of that claim were checked (above). - **`scripts/audit-actor-rows.py`**, cited in the body's fourth Evidence bullet, is in no olympus clone I can read; the figure it produces was reproduced by hand instead (above). ### Named, not charged - The `edge` red the body discloses (`NGINXPROXYMANAGER_URL` a `pit,hermes` literal, absent from the runner's `.env`): disclosed, a separate change, and on a line this diff does not touch. - `$(shell sed … npm/edge.tfvars)` in the suite's mirror emits one `sed: can't read` line to stderr per run; harmless, and it is the included Makefile's parse, not this change's line. ### Summary Standards: 2 findings — 1 BLOCKER (the suite's real-agent assertion reds `checks / static` at this head), 1 ADVISORY (blank-line count in `service.md`). Spec: 0 findings. Worst finding in each axis: the BLOCKER above; none on the spec axis. The recommendation follows the blocker, not the advisory count.
Member

Acknowledged (round 1/5) — fixing now; what changed and how I verified it follows.

**Acknowledged** (round 1/5) — fixing now; what changed and how I verified it follows.
Author
Owner

Loop stopped — the fix dispatch produced no outcome for 20 minutes. Nothing else happens on this PR until its state label changes.

**Loop stopped** — the fix dispatch produced no outcome for 20 minutes. Nothing else happens on this PR until its state label changes.
Member

Acknowledged (round 0/5) — fixing now; what changed and how I verified it follows.

**Acknowledged** (round 0/5) — fixing now; what changed and how I verified it follows.
Author
Owner

Loop stopped — the fix dispatch produced no outcome for 20 minutes. Nothing else happens on this PR until its state label changes.

**Loop stopped** — the fix dispatch produced no outcome for 20 minutes. Nothing else happens on this PR until its state label changes.
The suite proves the runner's agent is gone by asking its socket, not by its pid (TR-58)
All checks were successful
plan / guest-plan-check (pull_request_target) Successful in 9s
plan / edge-plan-check (pull_request_target) Successful in 7s
checks / static (pull_request) Successful in 25s
checks / execute (pull_request) Successful in 3m0s
e26189a0d5
`kill -0` answers 0 for a zombie, so an agent killed by the recipe's EXIT trap
reads as alive wherever nothing reaps it: in the job container whose PID 1 does
not collect the orphaned agent, the real-agent case red the required floor while
passing on a bare host. Ask the agent itself instead — `ssh-add -l` against the
socket the playbook recorded exits 2 once nothing listens there — and keep that
socket in the stub's log beside the pid, which the cleanup trap still uses.

Also closes the review's advisory: one blank line before the new section in
docs/reference/service.md, as every other section boundary in that file has.
Author
Owner

Fixed in e26189a — a commit on top of the reviewed head, both findings.

BLOCKER — the real-agent case now asks the agent, not its pid

scripts/tests/service-key.test.sh:210-235. The false positive reproduces here, with the
process made a child subreaper (prctl(PR_SET_CHILD_SUBREAPER), no privilege needed) and never
waiting on its descendants — which is what a job container's PID 1 does:

What the test asks live agent agent killed by the recipe's trap, never reaped
kill -0 "$pid" (before) 0 0 — ps reads Z, the pid never clears
ssh-add -l on the recorded socket (after) 0, or 1 with no identity 2 — Error connecting to agent: No such file or directory

So the stub now records SSH_AUTH_SOCK in the log beside the pid, and the assertion polls that
socket for up to 2 s and counts only exit 2 as gone. 0 and 1 still mean the agent answered.
The pid stays, for the cleanup trap and for the failure message, which now carries the pid's ps
state. 29 assertions before and after — one observation replaced, not a case added.

Proof

Same host, same suite, run as bash scripts/tests/service-key.test.sh under a parent that
reproduces the container: the killed agent stays Zs under an unreaped parent in both runs.

Tree Result
df07c83 — this head's previous commit FAIL real agent: the agent (pid 1686724) outlived the recipe → 29 assertions, 1 FAILED, exit 1
e26189a — this commit ok real ssh-agent: the agent is gone when the recipe ends → 29 assertions, 0 FAILED, exit 0

The new assertion is not vacuous: dropping trap 'ssh-agent -k > /dev/null' EXIT reds it with
the agent still answers on <sock> … (pid …, state Ss), and dropping $(ssh_agent_from_env)
from the preamble reds its other branch with the real run recorded no agent socket.

mise exec -- make deploy-test → 61 + 49 + 29 assertions, 0 FAILED. mise exec -- make check
→ rc 0: tofu fmt -check clean, three Stacks valid, the plan-only suites green.

ADVISORY — docs/reference/service.md

One blank line before ## How the runner reaches the Guest, as every other section boundary in
that file has (:15, :47, :69, :85). The file carries no other double blank line.

The edge NGINXPROXYMANAGER_URL red the body discloses is untouched — separate change, as filed.

Agent-written.

**Fixed in `e26189a`** — a commit on top of the reviewed head, both findings. ### BLOCKER — the real-agent case now asks the agent, not its pid `scripts/tests/service-key.test.sh:210-235`. The false positive reproduces here, with the process made a child subreaper (`prctl(PR_SET_CHILD_SUBREAPER)`, no privilege needed) and never waiting on its descendants — which is what a job container's PID 1 does: | What the test asks | live agent | agent killed by the recipe's trap, never reaped | | --- | --- | --- | | `kill -0 "$pid"` (before) | `0` | **`0`** — `ps` reads `Z`, the pid never clears | | `ssh-add -l` on the recorded socket (after) | `0`, or `1` with no identity | **`2`** — `Error connecting to agent: No such file or directory` | So the stub now records `SSH_AUTH_SOCK` in the log beside the pid, and the assertion polls that socket for up to 2 s and counts only exit `2` as gone. `0` and `1` still mean the agent answered. The pid stays, for the cleanup trap and for the failure message, which now carries the pid's `ps` state. **29 assertions before and after** — one observation replaced, not a case added. ### Proof Same host, same suite, run as `bash scripts/tests/service-key.test.sh` under a parent that reproduces the container: the killed agent stays `Zs` under an unreaped parent in *both* runs. | Tree | Result | | --- | --- | | `df07c83` — this head's previous commit | `FAIL real agent: the agent (pid 1686724) outlived the recipe` → 29 assertions, 1 FAILED, exit 1 | | `e26189a` — this commit | `ok real ssh-agent: the agent is gone when the recipe ends` → 29 assertions, 0 FAILED, exit 0 | The new assertion is not vacuous: dropping `trap 'ssh-agent -k > /dev/null' EXIT` reds it with `the agent still answers on <sock> … (pid …, state Ss)`, and dropping `$(ssh_agent_from_env)` from the preamble reds its other branch with `the real run recorded no agent socket`. `mise exec -- make deploy-test` → 61 + 49 + **29** assertions, 0 FAILED. `mise exec -- make check` → rc 0: `tofu fmt -check` clean, three Stacks valid, the plan-only suites green. ### ADVISORY — `docs/reference/service.md` One blank line before `## How the runner reaches the Guest`, as every other section boundary in that file has (`:15`, `:47`, `:69`, `:85`). The file carries no other double blank line. The `edge` `NGINXPROXYMANAGER_URL` red the body discloses is untouched — separate change, as filed. _Agent-written._
Member

Review started (round 1/5) on e26189a0d5 — reading the diff now.

**Review started** (round 1/5) on e26189a0d5408268b8cf306a6348ef5e6ce08019 — reading the diff now.
bot-minos approved these changes 2026-11-14 22:35:11 +00:00
bot-minos left a comment

olympus/infra-tracker #62 — head e26189a0d — round 2/5 — axes: standards, spec — verdict: merge

(The dispatch numbers this round 1/5; that is its own counter. The thread already carries one review, at df07c832, so the header counts this as the second.)

Recommendation: merge

The delta is git diff df07c832 e26189a — a fix stacked on the reviewed head, two files, 26 added lines. Round 1's other six files are not re-charged; both of its findings are re-driven below.

Prior round's findings, re-driven at e26189a

BLOCKER — cleared. Round 1 blocked because scripts/tests/service-key.test.sh decided "the agent is gone" with a bare kill -0, which answers 0 for a zombie under a PID 1 that does not reap, so the case red the runner image. The fix replaces the observation instead of the case: the stub records SSH_AUTH_SOCK beside the pid (scripts/tests/service-key.test.sh:199), and the assertion polls ssh-add -l against that socket for up to 2 s, counting only exit 2 as gone (:222-235), with 0/1 meaning the agent answered.

Red/green pair, one host, one harness — a parent that sets PR_SET_CHILD_SUBREAPER and never waits on its orphans, which is the job container's arrangement:

Tree Result
df07c83 (prior head) FAIL real agent: the agent (pid 1696769) outlived the recipe → 29 assertions, 1 FAILED, exit 1
e26189a (this head) ok real ssh-agent: the agent is gone when the recipe ends → 29 assertions, 0 FAILED, exit 0
e26189a, second run same, 29 assertions, 0 FAILED

And on the runner image, the same digest in both runs (forgejo.thepit.space/olympus/infra-tracker-test@sha256:9ad6b1e9…), read from each job's own log:

Run at service-key lines
run 132, df07c83 FAIL real agent: the agent (pid 2664) outlived the recipe / 29 assertions, 1 FAILED
run 134, e26189a service-key tests: 29 assertions, 0 FAILED

ADVISORY — cleared. The double blank line before ## How the runner reaches the Guest is gone: every section boundary in docs/reference/service.md now carries exactly one blank line (:16, :48, :70, :86, :138), and the file holds no double-blank run.

The new assertion is not vacuous — mutants of the property it pins, each restored by git checkout before the next:

Mutant Result
the EXIT trap no longer kills the agent FAIL real agent: the agent still answers on /tmp/ssh-…/agent.… after the recipe ends (pid …, state Ss)
the preamble never loads the key FAIL real agent: the real run recorded no agent socket — the branch the fix comment names
count 29 assertions before and after, as the fix comment states

Standards

No finding. The delta is one observation replaced in the suite and one blank line deleted in the doc. AGENTS.md:11-17 §Toolchain (a target runs through mise; CI runs make direct, ADR-0004) is what the floor was run through; AGENTS.md:35-56 §Environment ties a new env.map row to .env.example and to the actor's policy grant — round 1's to judge, and this delta does not touch it. No repo record moved: this repo's docs/adr/0001-0005 and olympus/workshop's docs/adr/0001-0015 at origin/main are untouched by the diff.

Gate check, since scripts/tests/run.sh is a script a required job runs — all four parts hold: .forgejo/workflows/checks.yaml is not in the diff (workflow file); the required contexts checks / static, checks / execute, plan / guest-plan-check, plan / edge-plan-check are unchanged; the job names static (checks.yaml:37) and execute (:54) are unchanged; and the targets those jobs run, make check (:49) and make test-ci (:97), are unchanged. A content change, not a gate change.

Spec

No finding. No ticket carried this piece — the body says so, and TR-58 is the node it completes. The PR description is the spec, read again at updated_at 2026-11-14T22:29:52Z (that bump is this round's sign-on comment; the body text is byte-identical to the first read).

The delta's own stated contract is met, clause by clause: "one observation replaced, not a case added" (29 assertions on both sides, measured); "the pid stays, for the cleanup trap and for the failure message" (scripts/tests/service-key.test.sh:212, :234); "polls that socket for up to 2 s and counts only exit 2 as gone" (:222-229). Nothing in the delta goes past the round-1 findings' clearing changes.

Verified

Read live at e26189a0d, in a worktree off refs/pull/62/head; git ls-remote origin refs/pull/62/head re-checked immediately before this POST.

Check Result
bash scripts/tests/service-key.test.sh 29 assertions, 0 FAILED, rc 0
./scripts/tests/run.sh env-test: every assertion holds., rc 0
mise exec -- make deploy-test 61 + 49 + 29 assertions, 0 FAILED, rc 0
mise exec -- make check rc 0 — gate-test 57 assertions, the three suites green, three Stacks valid, tofu test 1 + 5 passed
CI checks / static at this head (run 134 job 0) success, 25 s
CI checks / execute at this head (run 134 job 1) success, 3m0s — the job's log ends 🏁 Job succeeded, its converges read ok=31 changed=0 failed=0, then ok=27 changed=0 failed=0 twice
CI plan / guest-plan-check, plan / edge-plan-check success — this delta touches no Stack
tree after the wave git status --porcelain empty, HEAD still e26189a

A hypothesis I raised and refuted, so no later round inherits it: a mutant that kills the agent three seconds after the recipe returns still greens this case. That is not a tolerance hole — the case collects make's output through $(…), the backgrounded trap holds the pipe, and the substitution does not return until the kill has happened. Instrumenting the poll confirmed it (ssh-add answered 2, process state empty, on the first iteration). Refuted, not charged.

Could not verify

  • TR-58. The shipped reader still refuses this session: fetch-vikunja-task.sh 3 58 → key from …/minos/.env: /projects http=401, and no MCP_VIKUNJA_API_KEY answered 200 in either .env. The PR body stands as the spec, named as such.
  • The store's private half and 142's authorized_keys line, and the SHA256:9w0p3d… identity tying them: no store credential and no route to the Guest from here. Round 1 checked the repo-side halves and this delta does not touch them.

Named, not charged

  • The edge NGINXPROXYMANAGER_URL red the body discloses — a separate change, on no line this diff touches.
  • sed: can't read npm/edge.tfvars on stderr per suite run — round 1 named it; still harmless, still the included Makefile's parse.
  • make check leaves an untracked scripts/__pycache__/ on a host run, which .gitignore does not cover — not this change's line. Removed before this POST, so the tree graded here is the head's.

Summary

Standards: 0 findings (round 1's 1 BLOCKER and 1 ADVISORY both cleared at this head). Spec: 0 findings. Worst finding in each axis: none. The word above is merge; the review state, that line and the label are one value, and no blocker or counted advisory stands to move any of them.

<!-- minos review-loop: repo=olympus/infra-tracker pr=62 head=e26189a0d5408268b8cf306a6348ef5e6ce08019 round=2/5 axes=standards,spec --> **olympus/infra-tracker #62** — head `e26189a0d` — round 2/5 — axes: standards, spec — verdict: **merge** (The dispatch numbers this round 1/5; that is its own counter. The thread already carries one review, at `df07c832`, so the header counts this as the second.) Recommendation: merge The delta is `git diff df07c832 e26189a` — a fix stacked on the reviewed head, two files, 26 added lines. Round 1's other six files are not re-charged; both of its findings are re-driven below. ### Prior round's findings, re-driven at `e26189a` **BLOCKER — cleared.** Round 1 blocked because `scripts/tests/service-key.test.sh` decided "the agent is gone" with a bare `kill -0`, which answers 0 for a zombie under a PID 1 that does not reap, so the case red the runner image. The fix replaces the observation instead of the case: the stub records `SSH_AUTH_SOCK` beside the pid (`scripts/tests/service-key.test.sh:199`), and the assertion polls `ssh-add -l` against that socket for up to 2 s, counting only exit `2` as gone (`:222-235`), with `0`/`1` meaning the agent answered. Red/green pair, one host, one harness — a parent that sets `PR_SET_CHILD_SUBREAPER` and never waits on its orphans, which is the job container's arrangement: | Tree | Result | | --- | --- | | `df07c83` (prior head) | `FAIL real agent: the agent (pid 1696769) outlived the recipe` → 29 assertions, 1 FAILED, exit 1 | | `e26189a` (this head) | `ok real ssh-agent: the agent is gone when the recipe ends` → 29 assertions, 0 FAILED, exit 0 | | `e26189a`, second run | same, 29 assertions, 0 FAILED | And on the runner image, the same digest in both runs (`forgejo.thepit.space/olympus/infra-tracker-test@sha256:9ad6b1e9…`), read from each job's own log: | Run at | `service-key` lines | | --- | --- | | run 132, `df07c83` | `FAIL real agent: the agent (pid 2664) outlived the recipe` / `29 assertions, 1 FAILED` | | run 134, `e26189a` | `service-key tests: 29 assertions, 0 FAILED` | **ADVISORY — cleared.** The double blank line before `## How the runner reaches the Guest` is gone: every section boundary in `docs/reference/service.md` now carries exactly one blank line (`:16`, `:48`, `:70`, `:86`, `:138`), and the file holds no double-blank run. The new assertion is not vacuous — mutants of the property it pins, each restored by `git checkout` before the next: | Mutant | Result | | --- | --- | | the `EXIT` trap no longer kills the agent | `FAIL real agent: the agent still answers on /tmp/ssh-…/agent.… after the recipe ends (pid …, state Ss)` | | the preamble never loads the key | `FAIL real agent: the real run recorded no agent socket` — the branch the fix comment names | | count | 29 assertions before and after, as the fix comment states | ### Standards No finding. The delta is one observation replaced in the suite and one blank line deleted in the doc. `AGENTS.md:11-17` §Toolchain (a target runs through `mise`; CI runs `make` direct, ADR-0004) is what the floor was run through; `AGENTS.md:35-56` §Environment ties a new `env.map` row to `.env.example` and to the actor's policy grant — round 1's to judge, and this delta does not touch it. No repo record moved: this repo's `docs/adr/0001-0005` and `olympus/workshop`'s `docs/adr/0001-0015` at `origin/main` are untouched by the diff. Gate check, since `scripts/tests/run.sh` is a script a required job runs — all four parts hold: `.forgejo/workflows/checks.yaml` is not in the diff (workflow file); the required contexts `checks / static`, `checks / execute`, `plan / guest-plan-check`, `plan / edge-plan-check` are unchanged; the job names `static` (`checks.yaml:37`) and `execute` (`:54`) are unchanged; and the targets those jobs run, `make check` (`:49`) and `make test-ci` (`:97`), are unchanged. A content change, not a gate change. ### Spec No finding. No ticket carried this piece — the body says so, and TR-58 is the node it completes. The PR description is the spec, read again at `updated_at 2026-11-14T22:29:52Z` (that bump is this round's sign-on comment; the body text is byte-identical to the first read). The delta's own stated contract is met, clause by clause: "one observation replaced, not a case added" (29 assertions on both sides, measured); "the pid stays, for the cleanup trap and for the failure message" (`scripts/tests/service-key.test.sh:212`, `:234`); "polls that socket for up to 2 s and counts only exit `2` as gone" (`:222-229`). Nothing in the delta goes past the round-1 findings' clearing changes. ### Verified Read live at `e26189a0d`, in a worktree off `refs/pull/62/head`; `git ls-remote origin refs/pull/62/head` re-checked immediately before this POST. | Check | Result | | --- | --- | | `bash scripts/tests/service-key.test.sh` | 29 assertions, 0 FAILED, rc 0 | | `./scripts/tests/run.sh` | `env-test: every assertion holds.`, rc 0 | | `mise exec -- make deploy-test` | 61 + 49 + 29 assertions, 0 FAILED, rc 0 | | `mise exec -- make check` | rc 0 — `gate-test` 57 assertions, the three suites green, three Stacks valid, `tofu test` 1 + 5 passed | | CI `checks / static` at this head (run 134 job 0) | success, 25 s | | CI `checks / execute` at this head (run 134 job 1) | **success, 3m0s** — the job's log ends `🏁 Job succeeded`, its converges read `ok=31 changed=0 failed=0`, then `ok=27 changed=0 failed=0` twice | | CI `plan / guest-plan-check`, `plan / edge-plan-check` | success — this delta touches no Stack | | tree after the wave | `git status --porcelain` empty, HEAD still `e26189a` | A hypothesis I raised and refuted, so no later round inherits it: a mutant that kills the agent three seconds *after* the recipe returns still greens this case. That is not a tolerance hole — the case collects `make`'s output through `$(…)`, the backgrounded trap holds the pipe, and the substitution does not return until the kill has happened. Instrumenting the poll confirmed it (`ssh-add` answered `2`, process state empty, on the first iteration). Refuted, not charged. ### Could not verify - **TR-58.** The shipped reader still refuses this session: `fetch-vikunja-task.sh 3 58` → `key from …/minos/.env: /projects http=401`, and no `MCP_VIKUNJA_API_KEY` answered 200 in either `.env`. The PR body stands as the spec, named as such. - **The store's private half and 142's `authorized_keys` line**, and the `SHA256:9w0p3d…` identity tying them: no store credential and no route to the Guest from here. Round 1 checked the repo-side halves and this delta does not touch them. ### Named, not charged - The `edge` `NGINXPROXYMANAGER_URL` red the body discloses — a separate change, on no line this diff touches. - `sed: can't read npm/edge.tfvars` on stderr per suite run — round 1 named it; still harmless, still the included Makefile's parse. - `make check` leaves an untracked `scripts/__pycache__/` on a host run, which `.gitignore` does not cover — not this change's line. Removed before this POST, so the tree graded here is the head's. ### Summary Standards: 0 findings (round 1's 1 BLOCKER and 1 ADVISORY both cleared at this head). Spec: 0 findings. Worst finding in each axis: none. The word above is merge; the review state, that line and the label are one value, and no blocker or counted advisory stands to move any of them.
pit merged commit ba575700e3 into main 2026-11-14 22:37:40 +00:00
pit deleted branch hermes/TR-58-runner-ssh-key 2026-11-14 22:37:40 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
olympus/infra-tracker!62
No description provided.