The tracker's service step carries the runner's SSH key into an agent it kills (TR-58) #62
No reviewers
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
needs-info
needs-triage
ready-for-agent
ready-for-human
review
merge-ready
review
needs-fix
review
needs-human
review
needs-operator
review
needs-review
review
waiting
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
olympus/infra-tracker!62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "hermes/TR-58-runner-ssh-key"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The runner's
servicestep 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'sauthorized_keystrusts it — but the repository never asked for it.scripts/tests/run.shmoves with it: the Operator is now kept from two names (SEMAPHORE_API_TOKENandSEMAPHORE_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, templatedeploy, commitcc42ce8),servicered after 7 s:snapshotandguesthad run (the Guest applied 0 changes);edgeandverifynever did.After:
mise exec -- make checkexits 0 on this branch. The real-agent case proves the agent is gone by asking its own socket (ssh-add -l→ exit 2) rather thankill -0on a pid an unreaped zombie keeps visible; under a non-reaping PID 1 — the job container's arrangement — it is green, wheredf07c83reds.make deploy-test→service-key tests: 29 assertions, 0 FAILED, including a realssh-agentwith 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 refusedssh-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 tovikunja/guest/keys.d/semaphore-runner.puband to the line in 142'sauthorized_keys.The actor rows:
scripts/audit-actor-rows.pyagainstinfra-secrets'bao/policies/automation-runner.hcl→ 9 rows serverunner, 0 not readable.Merge Danger
Door: two-way — reverting restores the macro-less
servicepreamble and the next deploy goes red atserviceexactly 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
servicepreamble, one store row, one Guest (142).Next red on the same path, not touched here:
edgecallsrequire_npm_creds, and the runner's.envcarriesNGINXPROXYMANAGER_USERNAME/_PASSWORDbut notNGINXPROXYMANAGER_URL— that name is aliteralrow forpit,hermes, and the Semaphore project environment carries onlyPROXMOX_VE_ENDPOINT. It needs a second key ininfra-cockpit's projects Stack, which is a separate change.Review started (round 1/5) on
df07c8326c— reading the diff now.olympus/infra-tracker #62 — head
df07c832— round 1/5 — axes: standards, spec — verdict: fixRecommendation: fix
Standards
BLOCKER — the new suite reds the required floor in the runner image, so this head cannot merge and
mainwould go red on it.scripts/tests/service-key.test.sh:213(the real-agent case,:188-220) decides "the agent is gonewhen the recipe ends" with one unguarded
kill -0 "$pid"taken immediately aftermakereturns(
:204-205). That is not a liveness test:kill -0answers 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 doesnot 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)ondf07c83, run 132 job 0:Makefile:330-333puts the suite intodeploy-test, whichmake checkruns (Makefile:470),which is what the
staticjob runs (.forgejo/workflows/checks.yaml:43-49);checks / executefails 2 s in for the same reason and no other — that job's first step turns
static's red into itsown. 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 checkexits 0 on this branch — is true where it was typed andfalse 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
Zstate as gone (ps -o stat= -p "$pid"empty, or starting withZ),or assert the agent's effect instead of its pid (
ssh-add -lagainst the recordedSSH_AUTH_SOCKfails). Nothing else in the file needs to move.
ADVISORY —
docs/reference/service.md:137-138opens 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
runneractor alone (env.map:95), declared empty in.env.example:95, loadedinto an agent the recipe starts (
Makefile:197-204), unset before the playbook runs(
Makefile:202), and killed by anEXITtrap (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 rowand declaration
:222-231. Nothing in the diff goes past what the body claims.Verified
Read live at
df07c83in a worktree offrefs/pull/62/head(git ls-remotere-checked before thisPOST).
./scripts/tests/run.shenv-test: every assertion holds., rc 0make deploy-testmake gate-testmise exec -- make checktofu test5/5)checks / staticat this headservice-key tests: 29 assertions, 1 FAILEDchecks / executeat this headstatic)plan / guest-plan-check,plan / edge-plan-checkMutation wave — each mutant reds the suite, so the file is not vacuous: drop
unset(2 FAILs),drop the
EXITtrap (8), load the key from a file instead of stdin (the-q -assertion and threeneighbours), drop
$(ssh_agent_from_env)from the preamble (18), start an agent with no key (5),drop
.ONESHELL(19); and removingSEMAPHORE_SSH_KEYfromscripts/tests/run.sh:151's exclusionreds
env-test. Tree restored and byte-identical to head afterwards (git status --porcelainempty).
Claims checked outside the diff, at the siblings' current
origin/main:infra-secrets71c5f89:docs/store-layout.md:246— the runner alone readssecret/services/semaphore/deploy-ssh;bao/policies/automation-runner.hcl:55-57grantsread;operator.hcl,admin-agent.hcl,regular-agent.hcl,ci-tracker.hclhold no grant for it, soenv.map's row andscripts/tests/run.sh's "would be a 403" comment are both right.actors=runnerrows inenv.map, 9 readable underthat policy, 0 that are not.
modules/guest/keys.tf:14is the repo half of "the public half is in 142'sauthorized_keys".scripts/env.sh:334-339single-quotes a multi-line value, so a PEM key survivesset -a; source .env; the suite'swrite_envmirrors that shape..forgejo/workflows/deploy.yml:36-37,76is the push-to-main job that readsSEMAPHORE_API_TOKEN— the reflowed comment in
.env.exampleandenv.map:104states it correctly.Could not verify
key from …/minos/.env: /projects http=401andfound no key in
~/.hermes/.env, so the Vikunja task (project 3, index 58) was not read. The PRbody 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.
authorized_keysline, and theSHA256:9w0p3d…identitythat 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 olympusclone I can read; the figure it produces was reproduced by hand instead (above).
Named, not charged
edgered the body discloses (NGINXPROXYMANAGER_URLapit,hermesliteral, absent from therunner'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 onesed: can't readline to stderrper 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 / staticat thishead), 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.
Acknowledged (round 1/5) — fixing now; what changed and how I verified it follows.
Loop stopped — the fix dispatch produced no outcome for 20 minutes. Nothing else happens on this PR until its state label changes.
Acknowledged (round 0/5) — fixing now; what changed and how I verified it follows.
Loop stopped — the fix dispatch produced no outcome for 20 minutes. Nothing else happens on this PR until its state label changes.
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 theprocess made a child subreaper (
prctl(PR_SET_CHILD_SUBREAPER), no privilege needed) and neverwaiting on its descendants — which is what a job container's PID 1 does:
kill -0 "$pid"(before)00—psreadsZ, the pid never clearsssh-add -lon the recorded socket (after)0, or1with no identity2—Error connecting to agent: No such file or directorySo the stub now records
SSH_AUTH_SOCKin the log beside the pid, and the assertion polls thatsocket for up to 2 s and counts only exit
2as gone.0and1still mean the agent answered.The pid stays, for the cleanup trap and for the failure message, which now carries the pid's
psstate. 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.shunder a parent thatreproduces the container: the killed agent stays
Zsunder an unreaped parent in both runs.df07c83— this head's previous commitFAIL real agent: the agent (pid 1686724) outlived the recipe→ 29 assertions, 1 FAILED, exit 1e26189a— this commitok real ssh-agent: the agent is gone when the recipe ends→ 29 assertions, 0 FAILED, exit 0The new assertion is not vacuous: dropping
trap 'ssh-agent -k > /dev/null' EXITreds it withthe 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 -checkclean, three Stacks valid, the plan-only suites green.ADVISORY —
docs/reference/service.mdOne blank line before
## How the runner reaches the Guest, as every other section boundary inthat file has (
:15,:47,:69,:85). The file carries no other double blank line.The
edgeNGINXPROXYMANAGER_URLred the body discloses is untouched — separate change, as filed.Agent-written.
Review started (round 1/5) on
e26189a0d5— reading the diff now.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
e26189aBLOCKER — cleared. Round 1 blocked because
scripts/tests/service-key.test.shdecided "the agent is gone" with a barekill -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 recordsSSH_AUTH_SOCKbeside the pid (scripts/tests/service-key.test.sh:199), and the assertion pollsssh-add -lagainst that socket for up to 2 s, counting only exit2as gone (:222-235), with0/1meaning the agent answered.Red/green pair, one host, one harness — a parent that sets
PR_SET_CHILD_SUBREAPERand never waits on its orphans, which is the job container's arrangement:df07c83(prior head)FAIL real agent: the agent (pid 1696769) outlived the recipe→ 29 assertions, 1 FAILED, exit 1e26189a(this head)ok real ssh-agent: the agent is gone when the recipe ends→ 29 assertions, 0 FAILED, exit 0e26189a, second runAnd 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:service-keylinesdf07c83FAIL real agent: the agent (pid 2664) outlived the recipe/29 assertions, 1 FAILEDe26189aservice-key tests: 29 assertions, 0 FAILEDADVISORY — cleared. The double blank line before
## How the runner reaches the Guestis gone: every section boundary indocs/reference/service.mdnow 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 checkoutbefore the next:EXITtrap no longer kills the agentFAIL real agent: the agent still answers on /tmp/ssh-…/agent.… after the recipe ends (pid …, state Ss)FAIL real agent: the real run recorded no agent socket— the branch the fix comment namesStandards
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 throughmise; CI runsmakedirect, ADR-0004) is what the floor was run through;AGENTS.md:35-56§Environment ties a newenv.maprow to.env.exampleand to the actor's policy grant — round 1's to judge, and this delta does not touch it. No repo record moved: this repo'sdocs/adr/0001-0005andolympus/workshop'sdocs/adr/0001-0015atorigin/mainare untouched by the diff.Gate check, since
scripts/tests/run.shis a script a required job runs — all four parts hold:.forgejo/workflows/checks.yamlis not in the diff (workflow file); the required contextschecks / static,checks / execute,plan / guest-plan-check,plan / edge-plan-checkare unchanged; the job namesstatic(checks.yaml:37) andexecute(:54) are unchanged; and the targets those jobs run,make check(:49) andmake 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 exit2as gone" (:222-229). Nothing in the delta goes past the round-1 findings' clearing changes.Verified
Read live at
e26189a0d, in a worktree offrefs/pull/62/head;git ls-remote origin refs/pull/62/headre-checked immediately before this POST.bash scripts/tests/service-key.test.sh./scripts/tests/run.shenv-test: every assertion holds., rc 0mise exec -- make deploy-testmise exec -- make checkgate-test57 assertions, the three suites green, three Stacks valid,tofu test1 + 5 passedchecks / staticat this head (run 134 job 0)checks / executeat this head (run 134 job 1)🏁 Job succeeded, its converges readok=31 changed=0 failed=0, thenok=27 changed=0 failed=0twiceplan / guest-plan-check,plan / edge-plan-checkgit status --porcelainempty, HEAD stille26189aA 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-addanswered2, process state empty, on the first iteration). Refuted, not charged.Could not verify
fetch-vikunja-task.sh 3 58→key from …/minos/.env: /projects http=401, and noMCP_VIKUNJA_API_KEYanswered 200 in either.env. The PR body stands as the spec, named as such.authorized_keysline, and theSHA256: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
edgeNGINXPROXYMANAGER_URLred the body discloses — a separate change, on no line this diff touches.sed: can't read npm/edge.tfvarson stderr per suite run — round 1 named it; still harmless, still the included Makefile's parse.make checkleaves an untrackedscripts/__pycache__/on a host run, which.gitignoredoes 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.