Runner: run a voyage remotely as the kab-automation identity

- shakedown_lib: runs F01 -> F02 -> F03 for one engagement on KAB with no
  personal token. Signs in as the kab-automation client (client credentials,
  provisioned by Stellwerk from crucible-platform-deploy) and renews the token
  itself.
- Each stage checks its workflow id against the registered sub-agent name,
  builds inputs from the case and upstream stages, starts the run, follows it
  and judges it with cp1-agents evaluate_case.py.
- Gates (plan 5b): in config/runner.yaml gate_projects only, continue on a
  critic pass with no failed step and a note saying the system decided.
  Never on a fail. Elsewhere, wait for a person and record who decided.
  gate_projects is empty for now.
- Ledger per voyage run, with --resume; nothing secret is written.
- Cymbal voyage ENG-CYMBAL-001; workflow registry; Dockerfile and an
  unapplied Job template; 15 tests against a fake KAB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 05:08:31 +00:00
parent 07060dbb37
commit 099f9a87e8
22 changed files with 1546 additions and 1 deletions

16
deploy/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
# The Shakedown runner. Build from the repository root:
# buildah bud -f deploy/Dockerfile -t cruciblecoredevacr.azurecr.io/kab/cp1-shakedown/runner:<version> .
ARG BASE=python:3.12-slim
FROM ${BASE}
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY shakedown_lib/ shakedown_lib/
COPY config/ config/
COPY workflows/ workflows/
COPY capabilities/ capabilities/
RUN useradd -u 10001 -m shakedown && mkdir -p /ledger && chown shakedown /ledger
USER 10001
ENV CP1_AGENTS_DIR=/cp1-agents SHAKEDOWN_LEDGER=/ledger PYTHONUNBUFFERED=1
ENTRYPOINT ["python3", "-m", "shakedown_lib"]

52
deploy/runner-job.yaml Normal file
View File

@@ -0,0 +1,52 @@
# One voyage run as a Kubernetes Job in namespace `shakedown`. A template: placeholders are filled at render time,
# and nothing here is applied without the owner's approval.
#
# Provisioned outside this repository by the Stellwerk orchestrator (crucible-platform-deploy, kab-cluster/dev):
# - the `shakedown` namespace and the PVC `shakedown-ledger`;
# - Secret `shakedown-kab-automation`, key `client-secret`: the kab-automation client's secret, from Key Vault
# crucible-kab-dev-kv `kab-automation-client-secret`. The runner reads it from the environment only;
# - Secret `shakedown-gitea-read`, key `token`: read access to agents/cp1-agents, for the pinned clone.
apiVersion: batch/v1
kind: Job
metadata:
generateName: shakedown-voyage-
namespace: shakedown
labels: {app.kubernetes.io/name: shakedown-runner, app.kubernetes.io/part-of: cp1-shakedown}
spec:
backoffLimit: 0 # a failed run is resumed on purpose (--resume), never retried blind
activeDeadlineSeconds: 172800 # two days: three stages plus waiting for people at review points
template:
metadata:
labels: {app.kubernetes.io/name: shakedown-runner}
spec:
restartPolicy: Never
securityContext: {runAsNonRoot: true, runAsUser: 10001, fsGroup: 10001}
initContainers:
- name: clone-cp1-agents
image: <placeholder_for_runner_image>
command: ["sh", "-c"]
args:
- >-
git -c http.extraHeader="Authorization: token $GITEA_TOKEN" clone --quiet
https://gitea.kyndemo.live/agents/cp1-agents.git /cp1-agents &&
git -C /cp1-agents checkout --quiet <placeholder_for_cp1_agents_commit>
env:
- name: GITEA_TOKEN
valueFrom: {secretKeyRef: {name: shakedown-gitea-read, key: token}}
volumeMounts: [{name: cp1-agents, mountPath: /cp1-agents}]
containers:
- name: runner
image: <placeholder_for_runner_image>
args: ["run", "<placeholder_for_voyage_file>"]
env:
- name: KAB_CLIENT_SECRET
valueFrom: {secretKeyRef: {name: shakedown-kab-automation, key: client-secret}}
resources:
requests: {cpu: 50m, memory: 128Mi}
limits: {cpu: 500m, memory: 512Mi}
volumeMounts:
- {name: cp1-agents, mountPath: /cp1-agents, readOnly: true}
- {name: ledger, mountPath: /ledger}
volumes:
- {name: cp1-agents, emptyDir: {}}
- {name: ledger, persistentVolumeClaim: {claimName: shakedown-ledger}}