Run the AI Gateway from an upstream branch or merge request

Closes #30 (closed).

up now takes an AI Gateway source: a branch, or a merge request IID, of the upstream gateway project. The rig runs on an image built from that commit. The tag and overlay paths behave as before.

flowchart LR
  A["up --aigw-branch B or --aigw-mr N"] --> B["public API resolves the commit sha"]
  B -->|unknown ref| X["fail before any VM exists"]
  B --> C["VM builds localhost/aigw-source:sha12"]
  T["tag or overlay path"] --> D["VM pulls the tag, or uses the overlay image"]
  C --> E["podman images reads the digest"]
  D --> E
  E --> F["state: source kind, ref, sha, image digest"]
  F --> G["status --json, schema_version 7"]

What changes

  • just lab up --aigw-branch <branch> or --aigw-mr <iid> (env SIM_AIGW_BRANCH, SIM_AIGW_MR). A source with --no-aigw, SIM_AIGW_IMAGE or SIM_AIGW_TAG is refused, and a bad ref fails before the VM is created.
  • The commit resolves through the public API with no token; an MR resolves to its head sha. gce/build-aigw-image.sh fetches that sha and builds on the VM, never the laptop. An image already built for the sha is reused.
  • State records aigw_source_kind (tag, branch, mr, overlay), aigw_source_ref, aigw_source_sha and aigw_image_digest on every path, a tag pull's registry digest included. status --json exposes them at schema_version 7.
  • cmd_aigw_dev and the new build share one detached-run helper.
  • network-check expanded $AIGW_GITLAB_URL on the VM host, so curl got an empty host and reported GitLab unreachable on every image. It now runs in the container.

Proof

Selftest asserts a branch source builds, an MR source resolves to its head sha, sha and digest land in state, and the tag path records its tag and now its digest.

Live, on one omnibus rig (c2d-standard-8, default 100GB disk, which held the build):

source branch main, 7736e65e4e86
image digest sha256:cc4b636b52bb... in status --json
gateway /monitoring/healthz 200
GitLab reaching it network-check answers from the gateway and Rails sides
tag path self-hosted-v19.5.5-ee recorded with its pulled digest

The first build ran about 250 seconds before failing on the Dockerfile's type=secret,env= mount, which the rig's buildah rejects. The build now drops that mount and passes an empty token (the foundational-agents fetch is a public read). The second build, with layers cached, took 76 seconds. The rig is torn down.

Not fixed

real-model doctor reports "could not connect to the model endpoint" on a 15 second timeout in the upstream connection test, which collapses every HTTP error into that line. The fault is in the gateway's code, not this engine, and the run did not touch a model, so doctor is not used as health here.

Merge request reports

Loading
Loading