fix(nightly): start the agent in a step, not as a service #938

Merged
sharang merged 2 commits from fix/nightly-agent-step into main 2026-11-07 09:44:12 +00:00
Owner

Why

The nightly fails about every other night before scanning: the pull of rust:1.94-bookworm gets failed to fetch oauth token ... 400 from docker.io. The cause is a bug in act_runner 0.6.1, found by infra: the runner copies each service's registry credentials onto the job container's own pull, and Go's random map order decides which service is last. When it's the agent service, the Harbor robot login goes to docker.io. PR CI has no service with credentials, so it never hits this. The bug is fixed upstream in act_runner 3.0.0; this is the pruefwerk-only workaround.

What

  • agent is no longer a service. A "Start the agent" step installs the static docker CLI 27.5.1 after checking its pinned sha256, logs in to repo.breakpilot.com with --password-stdin, and runs compliance-agent:latest with --network container:$(hostname).
  • The container runs on the runner's daemon, outside the job's own limits, so it gets --memory 4g --cpus 2. Its --label pruefwerk-nightly finds one that a cancelled job left behind. It shares the job container's network: it reaches mongo by its service name, and the harness reaches it at localhost:3001.
  • Secrets reach the container as -e NAME without values, so none is on the command line.
  • A "Stop the agent" step with if: always() removes the container.
  • mongo stays a service, with no credentials. With no credentialed service left, the job pull no longer gets any.
  • The login is stored in the job container's ~/.docker and goes away with the container, so there's no logout step.

Test

workflow_dispatch runs of nightly.yml on this branch, both green: 9817 (first version) and 9820 (with the checksum, limits and label).

🤖 Generated with Claude Code

## Why The nightly fails about every other night before scanning: the pull of `rust:1.94-bookworm` gets `failed to fetch oauth token ... 400` from docker.io. The cause is a bug in act_runner 0.6.1, found by infra: the runner copies each service's registry credentials onto the job container's own pull, and Go's random map order decides which service is last. When it's the `agent` service, the Harbor robot login goes to docker.io. PR CI has no service with credentials, so it never hits this. The bug is fixed upstream in act_runner 3.0.0; this is the pruefwerk-only workaround. ## What - `agent` is no longer a service. A "Start the agent" step installs the static docker CLI 27.5.1 after checking its pinned sha256, logs in to repo.breakpilot.com with `--password-stdin`, and runs `compliance-agent:latest` with `--network container:$(hostname)`. - The container runs on the runner's daemon, outside the job's own limits, so it gets `--memory 4g --cpus 2`. Its `--label pruefwerk-nightly` finds one that a cancelled job left behind. It shares the job container's network: it reaches mongo by its service name, and the harness reaches it at `localhost:3001`. - Secrets reach the container as `-e NAME` without values, so none is on the command line. - A "Stop the agent" step with `if: always()` removes the container. - mongo stays a service, with no credentials. With no credentialed service left, the job pull no longer gets any. - The login is stored in the job container's `~/.docker` and goes away with the container, so there's no logout step. ## Test workflow_dispatch runs of `nightly.yml` on this branch, both green: 9817 (first version) and 9820 (with the checksum, limits and label). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-11-07 08:11:54 +00:00
fix(nightly): start the agent in a step, not as a service
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m42s
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Canceled after 12m19s
e6cfed2612
act_runner 0.6.1 copies each service's registry credentials onto the job
container's own image pull; with Go's random map order the agent's Harbor
login reached docker.io about every other night and the pull of
rust:1.94-bookworm failed with a 400 before any scan ran.

The agent now starts with docker run in the job container's network
(mongo by name, the API on localhost:3001), logged in with
--password-stdin, and is removed in an always() step. mongo stays a
service without credentials, so the job pull no longer gets any.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

workflow_dispatch run of nightly.yml on this branch: https://git.breakpilot.com/platform/pruefwerk/actions/runs/9817, green. The agent starts in its step and becomes healthy on localhost:3001. The corpus scan matches the baselines, and the stop step removes the container.

One green run doesn't by itself rule out a coin flip. The fix holds by construction: no remaining service carries credentials. The run confirms that the agent step works.

workflow_dispatch run of nightly.yml on this branch: https://git.breakpilot.com/platform/pruefwerk/actions/runs/9817, green. The agent starts in its step and becomes healthy on localhost:3001. The corpus scan matches the baselines, and the stop step removes the container. One green run doesn't by itself rule out a coin flip. The fix holds by construction: no remaining service carries credentials. The run confirms that the agent step works.
sharang added 1 commit 2026-11-07 08:24:13 +00:00
fix(nightly): verify the docker CLI download, limit and label the agent container
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m13s
CI / Check (pull_request) Successful in 18m20s
47fc9ecafe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Hardening from infra's review, in 47fc9ec:

  • the docker CLI tarball is checked against a pinned sha256;
  • the agent container gets --memory 4g --cpus 2 and --label pruefwerk-nightly.

Re-run: https://git.breakpilot.com/platform/pruefwerk/actions/runs/9820, green (scan and baselines included). So the 4 GB limit is enough for the corpus.

Hardening from infra's review, in 47fc9ec: - the docker CLI tarball is checked against a pinned sha256; - the agent container gets `--memory 4g --cpus 2` and `--label pruefwerk-nightly`. Re-run: https://git.breakpilot.com/platform/pruefwerk/actions/runs/9820, green (scan and baselines included). So the 4 GB limit is enough for the corpus.
sharang merged commit d9fcc75792 into main 2026-11-07 09:44:12 +00:00
Sign in to join this conversation.