Commit Graph
9 Commits
Author SHA1 Message Date
fl0rianrandSreeram d906de81ae ci: skip expensive jobs for small docs-only PRs (#2889)
* ci: skip expensive jobs for small docs-only PRs

* ci: port docs-only fast path to current CI graph

* ci: preserve required checks for small docs PRs

---------

Co-authored-by: Sreeram <[email protected]>
2026-11-16 09:55:49 +00:00
a5b414b7fb feat(backends): run container backends through ContainerManager, starting with llamacpp:nathanw (#3709)
* feat(backends): run container backends through ContainerManager, starting with llamacpp:nathanw

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* feat(containers): list every missing setup step and ask for consent at install

Container setup now reports what a user still has to do in one pass,
in the order they do it, and the CLI finishes the install once only
consent is left.

- Setup checks run in two groups. Before consent: the container tool
  on PATH, then the video/render groups (or the Docker socket), then
  enable_containers. These read only PATH, groups and sockets, so no
  container command runs before the user opts in; Podman counts as
  rootful when CONTAINER_HOST is set or lemond runs as root, until
  podman info answers. After consent: podman info, then SELinux.
- Every failed check is reported at once. /system-info gives one
  problem per line in message, numbered steps in action (install
  commands, group changes, enable_containers, and logging out last),
  and the failed checks' ids in setup_checks.
- lemonade backends prints message and action lines side by side.
- lemonade backends install, run and load check the backend's setup
  before installing or downloading anything. When enable_containers
  is the only step left, they show the existing warning, enable it on
  yes and finish the command; backends install --yes skips the prompt.
  Otherwise they print every problem and step and exit 1.
- The spec, user guide, CLI and API docs follow the new order and
  fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V3HB9nm64VVxScERksHiia

* fix(cli): read the selected backend only when recipe options were given

lemonade run and load without a --<recipe> option have no recipe
options, and reading the backend option from them aborted the CLI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V3HB9nm64VVxScERksHiia

* style(containers): trim the setup comments the comment-slop hook flagged

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V3HB9nm64VVxScERksHiia

* ci(containers): gate the container smoke test like the other hosted test jobs

The signing and release-branch skips exist to spare self-hosted runners;
the smoke test runs on ubuntu-latest.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* ci(containers): pin the container smoke test to Ubuntu 24.04

The job installs the 24.04 .deb on the bare runner, and ubuntu-latest moves
to 26.04 in November 2026, where libmbedcrypto7t64 does not exist. The
comments now say why the job runs on the bare runner and needs the PPA.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(containers): assert lemond's mode in the smoke test and log at debug

test_03 now checks the published port on lemond's container, so each leg
proves lemond detected the intended mode, not only that the tool runs in it.
LEMONADE_CI_MODE puts llama-server's output in the uploaded logs, as in the
other jobs that start lemond.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* ci: say why backends-gate also lists jobs that run on every PR

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs(spec): cut the container spec changes back to what the implementation made false

Keeps the opt-in invariants (off by default, install and load refused while
off, no container command before opt-in), rootful Podman's connection path,
the Podman answers check, and reporting every failed check at once. Drops
setup_checks, action ordering, CLI prompting, and the expect_rootless detail.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs(spec): name the enable warning instead of quoting it

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs(llamacpp): list nathanw as a guest backend, as its descriptor declares

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(cli): word the enable_containers prompts as enabling containers, not backends

The setting enables every container, whatever its tier, so the warning no
longer calls the images community-built.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* chore(backends): drop the image allowlist comment from ContainerPolicy

ContainerManager::allowed_image is the allowlist; the comment restated it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* refactor(containers): leave GPU selection and the SELinux check to the first ROCm container backend

llamacpp:nathanw maps only /dev/dri, so nothing here reached the
HIP_VISIBLE_DEVICES lookup or the SELinux check, both gated on /dev/kfd.
needs_gfx1151_cwsr_fix goes back to its own KFD read.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(containers): drop checks that restate code, and mount single files only

The directory mounts serve Halogen's tokenizer and move to that PR; here
every model file llamacpp names is a GGUF.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(containers): take the smoke test's backend as --backend

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): leave Podman and Docker alone while enable_containers is false

With containers disabled, lemond no longer sweeps at startup, connects to
the Docker socket, runs `image inspect`, or removes images on uninstall.
Setting enable_containers to false unloads every model running in a
container first, so none is left that a later crash would orphan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015BUXEd42tPQH67MQPW1XZh

* Update to a modern pin

* refactor(containers): drop the startup sweep

A killed lemond's containers already stop and remove themselves: the
attached `run --rm` child gets SIGTERM from PR_SET_PDEATHSIG and proxies it
into the container. Verified with Docker and rootful/rootless Podman. The
smoke test now kills lemond with a model loaded and checks no container
remains.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LcAshvLHhLPAw6Ka6CJXwC

* docs(load): list nathanw among the llamacpp_backend choices

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LcAshvLHhLPAw6Ka6CJXwC

* ci(containers): cap the Dispatch container job at 45 minutes

A hung job would otherwise hold a pool machine for up to 4 hours.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LcAshvLHhLPAw6Ka6CJXwC

* test(containers): skip the killed-lemond check under rootful Podman

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LcAshvLHhLPAw6Ka6CJXwC

* docs(containers): link container images to their registry pages

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(containers): skip the killed-lemond check under rootful Docker too

The Docker daemon owns the container, so whether it stops after lemond is
killed depends on the docker client forwarding SIGTERM in time, which is
racy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R5SJqLuAuPwGaJQvWTwMai

* refactor(containers): drop the enable_containers setting

Container backends no longer need an opt-in before they install or
load. The setup assistant's remaining checks still report what is
missing.

- Remove the config key, its validation, getter and config effect.
- Remove the CLI consent prompt and pre-flight check, and the --yes
  flags on `config set` and `backends install` that only served it.
- Always check the Docker socket, read the image on disk for installed
  state, and remove the image on uninstall.
- Remove helpers left unused: containers_enabled,
  Router::get_container_model_names, WrappedServer::runs_in_container,
  ServerProcess::in_container.
- Update the spec, guides, generated API docs, tests and CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019cGBZamSKYLVeygD6axiu9

* perf(containers): run container setup checks once per system-info build

The checks are host-wide, so every container backend got the same
report while each one ran them again, `podman info` included. Drop the
unused recipe and backend parameters from container_setup_failure and
compute its report at most once per pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019cGBZamSKYLVeygD6axiu9

* test(containers): fail when listing labeled containers or networks fails

A failed `ps` or `network ls` printed nothing, so the checks that expect
no leftovers passed without listing anything.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019cGBZamSKYLVeygD6axiu9

* ci(containers): restore the Dispatch container job's 4-hour timeout

Four ds4 jobs downloading DS4's 81 GB checkpoint at once on fresh Dispatch
machines each ran past 45 minutes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(containers): run container backends from lemond.service with rootless Podman

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): create Podman networks without a DNS server

Every model load failed under lemond.service with Podman 5 (Fedora 43/44,
Ubuntu 26.04, Debian 13):

  netavark: error while applying dns entries: aardvark-dns failed to start:
  Failed to connect to user scope bus via local transport

`podman network create` turns DNS on by default, and rootless netavark
(1.14 and later) starts aardvark-dns with `systemd-run --scope --user`, which
needs the account's systemd user manager. The lemonade system account has no
login session, so it has none.

Each per-model network holds one container, and lemond reaches it through
its published port or inspected address, never by name, so the network
needs no DNS server. Docker has no such option and is unaffected.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(lemond.service): let rootless Podman keep its runtime state in the host's /tmp

Every model load failed under lemond.service on Ubuntu 26.04 and Debian 13:

  Error: setting up Pasta: pasta failed with exit code 1: Couldn't open PID
  file /run/lemonade/containers/networks/rootless-netns/rootless-netns-conn.pid:
  Permission denied

Podman 5 sets up rootless networking with pasta, under $XDG_RUNTIME_DIR, which
the unit set to /run/lemonade. The AppArmor profile Ubuntu and Debian ship for
pasta allows writes only under /tmp, /run/user/<uid> and home directories under
/home, so it denied the PID file. ProtectHome=yes hides /run/user, and the
account has no login session to create /run/user/<uid> in any case.

With XDG_RUNTIME_DIR unset, Podman uses its own fallback in /tmp
(/tmp/storage-run-<uid>, or /tmp/containers-user-<uid> on Podman 4), which the
profile allows and Podman's own tmpfiles.d exempts from age-based cleanup.
lemond's own runtime directory stays /run/lemonade, through RuntimeDirectory=.

PrivateTmp goes with it. In a private /tmp, `podman` run as lemonade from a
shell finds no runtime state, and Podman 5 then refreshes the shared database:
the running container drops out of lemond's view, `podman stop` reports no such
container, and the engine keeps holding the GPU until the service stops.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(debian): create /var/lib/cni at install

On Ubuntu 24.04, every model load under lemond.service failed until the host
next rebooted:

  Error: unable to find network with name or ID lemonade-<...>: network not found

Podman 4's rootless network namespace bind-mounts a private directory over
/var/lib/cni, or, while that does not exist, over its nearest existing parent,
/var/lib. That mount hid /var/lib/lemonade, the lemonade account's home, which
holds its Podman storage and network configs, so `podman run` found no network
that `podman network create` had just made. Podman's own tmpfiles.d creates
/var/lib/cni only at boot (`D!`), so a fresh install hit this until a reboot.

The package now ships the directory in tmpfiles.d, which dh_installtmpfiles
applies at install. The .rpm keeps lemonade's home in /opt, and Podman 5 makes
no such mount, so neither needs it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): keep DNS on rootful Podman's per-model networks

Podman 4's CNI backend gives an --internal network created with
--disable-dns no gateway, so the host has no route to the container and
rootful lemond, which connects at the container's address, waited on
llama-server until the test timed out. Only rootless Podman needs DNS
off, and it reaches the container through a published port.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(app): show container setup steps in a collapsible section

The Setup guide button passed `action` to window.open, but lemond's
`action` holds a command, steps, or a link. A non-link action now shows
as a "Setup required" disclosure with the failure message and steps,
regardless of the technical-details toggle; links keep the button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(containers): check GPU device access instead of video/render membership

Desktop distros such as Ubuntu and Arch grant the logged-in account
/dev/kfd and /dev/dri access through ACLs, so an account outside video
and render could use the GPU yet was told to fix its groups. The setup
check now tests read/write access to /dev/kfd and each render node.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(containers): ask Podman its mode before the host check

container_setup_failure() ran check_host() before check_podman(), so the
first pass after startup guessed rootless and could report a GPU access
failure on rootful Podman that the next pass cleared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(containers): check Docker with docker info instead of a fixed socket

The socket probe only looked at /var/run/docker.sock, so DOCKER_HOST,
Docker contexts and Docker Desktop's socket read as a refused account.
docker info follows the CLI's own connection, and its answer also
identifies Docker Desktop and rootless Docker, which cannot run
container backends, so those now get Podman as the fix step. The spec's
device-node rows now describe the access check instead of group
membership.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(lemond.service): keep PrivateTmp and give Podman's private /tmp state to tmpfiles.d

04919f697 turned PrivateTmp off for every lemond.service user, containers or
not, raising systemd-analyze security exposure from 8.5 to 8.7. Its reason was
`podman` run as lemonade from a shell: in the host's /tmp it finds none of the
service's runtime state, and Podman 5 then refreshes the shared database, so
lemond loses track of its running containers.

PrivateTmp=yes is back. XDG_RUNTIME_DIR stays unset, so rootless Podman still
keeps its runtime state in its own fallback in /tmp, which pasta's AppArmor
profile allows; under PrivateTmp that is the service's private /tmp.

Podman's own tmpfiles.d exempts its fallback only in the host's /tmp, and
age-based cleanup of /tmp reaches into the service's private one, so a new
tmpfiles.d entry exempts that instead. The .rpm installs it under /opt with a
link in /usr/lib/tmpfiles.d, like the unit, and applies it in %post;
dh_installtmpfiles applies it for the .deb.

The guide gives the command that runs Podman in the service's /tmp, through
JoinsNamespaceOf=lemond.service, in place of a plain `sudo -u lemonade podman`.
It uses --pty: SELinux on Fedora 44 denies dbus-broker the caller's pipes
that --pipe passes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): escape container names so distinct models never share one

name_token() mapped every rejected character to `-`, so `user.foo/bar`,
`user.foo bar` and `user.foo-bar` shared a container and network name,
and starting one removed the other. Rejected characters now become `_`
plus two hex digits and `_` is doubled, so the mapping is one-to-one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(containers): return a failed result for an empty command

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(containers): explain how Lemonade chooses Podman or Docker, with service steps for rootful Podman and Docker

The guide said only that Lemonade uses Podman when installed and Docker
otherwise. It now lists when each engine runs (rootless Podman by default,
rootful through CONTAINER_HOST or a root lemond, Docker without Podman) and
that rootful Podman and Docker are root-equivalent.

Its Docker step for lemond.service did nothing: the packages pull in Podman,
which takes precedence, so it now removes Podman first. Rootful Podman under
lemond.service had no steps, and root's socket is closed to lemonade, so the
guide gives a dedicated socket and service for lemonade that leave root's
podman.socket untouched. User-mode lemond shares the user's own Podman and
follows the CONTAINER_HOST its environment sets, which the guide now says.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): require lemonade's subordinate IDs only for local rootless Podman

With CONTAINER_HOST pointing at root's Podman socket, as the guide's rootful
setup does, check_podman() still demanded subordinate UID and GID ranges for
lemonade and reported subordinate_ids when they were missing. Root's Podman
maps container IDs onto its own ranges and never uses lemonade's, so the check
blocked a working rootful setup on hosts where lemonade has no ranges.

The check now runs only when Podman is local and rootless, the same condition
check_host() already applies to the device-group checks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): report rootful Podman on CNI instead of timing out

Rootful lemond connects at the container's address, and Podman 4's CNI
backend gives an --internal network no gateway on the host, with DNS on or
off. A model load therefore waited out the whole startup timeout (8 minutes
on Ubuntu 24.04 with Podman 4.9.3) and failed with "llama-server failed to
start". Publishing a port does not help: rootful Podman does not forward a
port published on 127.0.0.1 into an internal network on either backend.

check_podman() now reads the network backend in the same `podman info` call
that reports rootless mode, and reports rootful_cni with the way back to
rootless Podman: remove CONTAINER_HOST from /etc/default/lemond (service),
unset it (user mode), or run lemond as a regular account (root). The guide
names switching root's Podman to netavark as well, and warns that the
`podman system reset` it needs deletes all of root's containers and images.
Rootless Podman publishes a port and works on CNI, and rootful Podman on
netavark keeps working, so neither is affected.

The create_network comment named CNI for netavark's behavior, now corrected.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* chore(containers): explain the rootless port vs rootful address once

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(containers): keep the runner's persistent Hugging Face cache

Devlab Dispatch runners set HF_HOME to a cache on their scratch disk that
survives the job. Pointing it at RUNNER_TEMP downloaded every model on
every run, 70 minutes for DS4's 87 GB checkpoint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(debian): keep the postinst chown out of Podman's storage and off symlinks

The postinst re-owns /var/lib/lemonade on every install with
`find ... -exec chown lemonade:lemonade`. Rootless Podman now keeps the
service's image storage in that home under .local/share/containers, so
the walk entered every image layer. Plain chown follows symlinks, and
layers are full of absolute ones (/bin/sh -> /usr/bin/busybox), so root
re-owned the host's files: reinstalling the same .deb on Ubuntu 24.04
after pulling two images handed /run, /run/lock, /etc/ssl/certs,
/usr/bin/busybox and 13 other host files to lemonade. The walk also
flattened the layers' subordinate-ID owners and cleared their setuid
bits, so `su` in an ubuntu image lost setuid.

Prune Podman's storage, which lemonade already owns and Podman manages,
and use chown -h so a symlink anywhere in the home is re-owned itself
instead of its target. The chown -R this walk replaced in #3393 never
followed symlinks, so -h restores that.

Tested on a fresh Ubuntu 24.04 VM: after the reinstall no host file
changes owner, the layers keep their 5 sub-UID files and 8 setuid files,
and a root-owned file in ~/.config is still re-owned to lemonade.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* chore(nathanw): pin the 2026-10-25 vulkan-radv-performance image

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(nathanw): default to 2048-token batches

llama-server's 512-token ubatch held the Vulkan performance fork well
below its author's published prefill. At 2048, which the author measures
and recommends for MoE models, Qwen3.6-35B-A3B prefills at 1625 tok/s at
4k and 1909 at 32k (from 1373 and 1531) and Qwen3.8-Flash-Next at 717
and 909 (from 580 and 689), with decode unchanged. A user's own -b or
-ub still wins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(packaging): recommend Podman only when Docker is missing

Recommends: podman installed Podman alongside an existing Docker, and since
Podman takes precedence when both are on PATH, Docker users had to remove it
again. The .deb now recommends podman | docker.io | docker-ce, and the .rpm
(podman or docker or docker-ce), so an installed Docker satisfies it. On
Fedora, moby-engine provides docker; Docker's own docker-ce does not.

The .rpm's recommendation also never reached the package on Fedora 43:
CPack before CMake 4.1 ignores CPACK_RPM_PACKAGE_RECOMMENDS, so the tag goes
into the spec preamble through CPACK_RPM_SPEC_MORE_DEFINE instead.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(packaging): warn when lemonade's subordinate ID range can't be allocated

The postinsts ignored a failed usermod --add-subuids/--add-subgids with
|| true, so the only sign was usermod's own error, with nothing tying it to
container backends. They now say what the failure breaks. It still doesn't
fail the install, since only container backends need the range.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): grant GPU access through render alone

Of the nodes a container backend opens, video owns only /dev/dri/card*, the
display node; /dev/kfd and the renderD* nodes belong to render. On a Strix
Halo host, nathanw ran inference on the GPU at the same speed as the
lemonade account with only render, where it could not open card1, as with
video and render, and with no card1 in the container at all. So the
packages add lemonade to render only, as they did before container
backends, and the setup steps and Docker's --group-add ask for render alone.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(lemond.service): run without PrivateTmp so Podman's state stays in the host's /tmp

With PrivateTmp, rootless Podman's runtime state sat in the service's private
/tmp, which took three workarounds: a tmpfiles.d entry to keep age-based
cleanup out of it, packaging to install that entry, and a systemd-run
JoinsNamespaceOf= command in the guide, because a plain
`sudo -u lemonade podman` saw an empty /tmp and Podman 5 then reset the state
of the containers lemond was running.

In the host's /tmp, Podman's own tmpfiles.d already protects that state and
plain `podman` sees it, so the workarounds go. The cost is the private /tmp,
a small step next to the NoNewPrivileges and RestrictNamespaces rootless
Podman already needs off.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(backends): keep the previous container image until the new pin is committed

Stage version.txt in a sibling directory, check the write, then swap it
into place. The previous image is removed only after the swap succeeds,
so a failed directory creation or marker write no longer leaves a
working backend without its image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LdWSB6RM2hfmfgheR7KvsP

* fix(packaging): allocate subordinate IDs when nsswitch.conf says subid: files

subid: files means the local /etc/subuid and /etc/subgid, so only a
subid: line naming another source (sss, ldap, ...) is left to the
administrator.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LdWSB6RM2hfmfgheR7KvsP

* fix(containers): include the lemond port in container names

Two lemond instances on one container daemon loading the same model
produced the same name, and start() removes that name unconditionally,
so the second instance killed the first one's container. The name is
now lemonade-<port>-<recipe>-<backend>-<model>, still stable per
instance so a load clears that instance's own crash leftovers, and the
container carries an ai.lemonade.instance label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LdWSB6RM2hfmfgheR7KvsP

* refactor(containers): trim the install staging and drop the unused instance label

The staging directory is hidden and cleared at the start of the next
install, so the failure paths no longer clean it up. The port in the
container name already keeps instances apart, so the ai.lemonade.instance
label is dropped until something filters on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LdWSB6RM2hfmfgheR7KvsP

* fix(lemond-user.service): keep the sandbox and run containers through podman.socket

In a user manager, every sandboxing option the unit had on main takes away
something rootless Podman needs: the seccomp-based ones set no-new-privileges,
which stops the setuid newuidmap/newgidmap helpers, and PrivateTmp and
ProtectSystem confine the service to a user namespace that maps only the
user's own UID. So the unit had dropped them all.

The unit now keeps them and sets CONTAINER_HOST to the user's podman.socket.
`podman` in the unit only sends requests to Podman's API service, which
systemd starts outside the unit, and that service creates the containers.
lemond treats a socket in the account's own runtime directory as rootless
Podman, and passes the crun annotation run.oci.keep_original_groups=1 there,
since the Podman API rejects --group-add keep-groups.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* fix(containers): require crun for rootless Podman and recommend it

Rootless containers reach the GPU through the account's render group, which
--group-add keep-groups (and its run.oci.keep_original_groups annotation)
carries into the container. Only crun supports that; runc always resets a
container's supplementary groups, so under runc the engine cannot open the
render node and silently runs on the CPU, about 14x slower on nathanw.

Podman installs crun by default, but on Debian and Ubuntu a host that had
docker.io first already has runc, which satisfies Podman's crun | runc
dependency. The Podman setup check now reads the OCI runtime from
`podman info` and, for rootless Podman on anything but crun, asks for the
host's install command for crun. That answer is not cached, so installing
crun takes effect without restarting lemond. The .deb and .rpm also
recommend crun.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* docs(spec): give the podman.socket and CONTAINER_HOST steps for a failing podman info

The setup check's step for a failing `podman info` depends on CONTAINER_HOST
since the user unit moved to podman.socket; the spec's tables still gave
only the generic step.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

* test(containers): expect the lemond port in container names

8e03e4d renamed containers to lemonade-<port>-<recipe>-<backend>-<model>,
but the smoke test still asserted the old lemonade-<recipe>-<backend>-
prefix, failing test_03_load_and_chat on docker and both podman modes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LdWSB7BgnHh2Hv3FiEwQHz

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: Sawan Srivastava <[email protected]>
2026-11-03 15:45:14 +00:00
Jeremy FowersandClaude Opus 5 f86359b9ef ci(docs): check heading anchors by replacing markdown-link-check with lychee (#3632)
* ci(docs): check heading anchors by replacing markdown-link-check with lychee

markdown-link-check resolves the file in `guide.md#a-heading` and never looks
at the fragment, and it has no option to: its whole config surface is baseUrl,
headers, httpHeaders, ignoreDisable, ignorePatterns, projectBaseUrl,
replacementPatterns and showProgressBar. A reworded heading therefore orphans
every inbound link with CI green.

Three such links have been broken since 1b3aa1a38 reworded the heading they
point at, and are fixed here. lychee --include-fragments checks files and
fragments both, so it is a strict superset of what this job did; run against
main before this change it reports exactly those three. The job id is
unchanged so any required-check config still matches, and the node install it
needed is gone.

Also drops an em dash from a vLLM heading. GitHub and python-markdown slug a
run of separators differently, so that heading was the one place in 700 links
where a valid anchor for one renderer was broken for the other.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* docs: point testing guide at the Lychee link check

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_0187jj9zdV86qWQA4n1iUfiW

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-09-21 21:00:57 +00:00
Jeremy Fowers da6ce71609 Remove the Linux Distro Builds ci job (#3524) 2026-09-09 19:09:12 +00:00
Jeremy FowersandClaude Opus 5 ce02d7e8df ci: cut installer build time on the PR/merge-queue critical path (#2989)
* ci: cut installer build time on the PR/merge-queue critical path

Three independent wins on the two jobs that gate everything downstream:

- MSVC compiled one file at a time per project, so the Windows C++ build
  used a quarter of the runner. Enable /MP for Visual Studio generators.
- The Tauri desktop app is ~8 min of the installer build and only lands in
  lemonade.msi, which no test job installs. Build it in a packaging-only
  job instead.
- The Debian package build built ~115 unit-test binaries and discarded
  them, then the next step rebuilt them from scratch.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: run the C++ unit tests in their own job

They shared nothing with the Debian packaging build in the same job — a
separate configure with different flags — so their 4.5 min landed directly
on the critical path that gates every .deb test job.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: let MSBuild overlap independent Windows projects

lemonade-server-core takes 5.2 min and the CLI and LemonadeServer, which
do not depend on it, waited for it to finish. Pass /m through to MSBuild
rather than via --parallel, which would set CL_MPCount=1 and cancel /MP.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: ship a primed compiler cache in the build-environment image

GitHub Actions caches are scoped per git ref, so merge-queue runs — which
every merge passes through — can never restore one. Priming the nightly
build image instead gives the .deb build a warm cache everywhere.

Primed at the container checkout path so the absolute include paths on the
compiler command line match, and on amd64 only: nothing consumes the arm64
image, and priming it would run the build under QEMU. Release builds opt
out, because the version-dependent -fdebug-prefix-map has to leave the
ccache hash for anything to hit.

container-build-test.yml now builds this image too — build-container.yml
publishes it on a nightly schedule, so changes were previously unexercised
until they hit the tag every Linux CI job pulls.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): stop the ccache prime at the build target

The install step wants examples/, which .dockerignore strips from the build
context. Only the compile populates the cache, so packaging was never
needed — and skipping it makes the image build faster too.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* refactor(ci): tighten the build-time changes

- Pin -fdebug-prefix-map with DEB_BUILD_DEBUGPATH instead of dropping it from
  the ccache hash. dpkg honours it over the changelog-derived path, so cached
  objects now carry correct debug paths rather than a stale version.
- Add cpp-unit-tests to backends-gate. Moving the tests out of the .deb job
  had removed them from the only gate that enforced them in the merge queue.
- Extract the duplicated WiX install into .github/actions/install-wix; the
  second copy had already lost the x86 fallback and the version check.
- Share one FetchContent cache namespace across the Windows installer jobs —
  both run bare setup.ps1, so a separate namespace only guaranteed a miss.
- Make add_cpp_ci_test fail under BUILD_TESTING=OFF, so a test block that
  forgets the guard is caught instead of silently slowing packaging builds.
- Reuse the ci:distros label rather than adding a second label to the gate it
  reports through, and document the job in the deferral table.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: stop building discarded unit-test binaries in the RPM job

setup.sh configures with testing on and the build has no --target, so all 43
test executables were built and then left out of the .rpm — the same waste
BUILD_TESTING=OFF removed from the Debian path, across a four-leg matrix.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): address review of the container prime and Windows jobs

- Prime only the image tag whose compile CI gates (24.04), via a PRIME_CCACHE
  build arg. Priming 25.10/26.04 meant a newer-toolchain break would fail the
  nightly publish and silently strand consumers on a stale image.
- Record the pinned debug path in /opt/ccache-debugpath from the prime itself
  instead of an unconditional ENV, so an unprimed image (arm64, or one built
  before this) cannot advertise a cache it does not have.
- Bind-mount the source instead of COPY, so the tree stops shipping as a layer
  in an image every Linux CI job and every PPA job pulls.
- Move the image build onto build-container.yml with a narrow paths filter.
  In container-build-test.yml it fired on every C++ PR — a long uncached job
  added to nearly every PR, against the concurrency cap this PR exists to ease.
- Upload lemonade.msi from the desktop job. release-v* pushes used to get it
  from the combined build and were left with no desktop installer artifact.
- Extract the Windows CMake fallback into a composite action and use it in all
  three Windows jobs; the new job had silently skipped it.
- Cap MSBuild at /m:2. With /MP already spawning one cl.exe per core inside
  each project, the two multiply to 16 compilers on a 4-core runner.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): give each WiX installer its own web-app fragment

wix_installer_minimal and wix_installer_full both regenerated the same
WebAppFragment.wxs and then fed it to wix build, so building the wix_installers
aggregate in parallel let one rewrite the file while the other read it — an
intermittent failure on the release and signing path only.

Also from review:
- cpp-unit-tests installs build-deps again. As a step of build-lemonade-deb it
  inherited that job's build-dep install; standalone it would have failed on a
  newly added Build-Depends until the nightly image caught up.
- Verify the primed cache on the publish path too, against the pushed tag. It
  only ran on the PR path, so a prime that produced nothing would ship.
- Drop the buildx layer cache from build-container.yml: this workflow is not
  latency sensitive, and retaining a ~300 MB ccache layer per Ubuntu release
  would evict the FetchContent caches that are on the critical path.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): harden the ccache prime and the parallel WiX build

- Seed the WiX extension cache in the install action. `wix build -ext`
  populates a shared per-user directory on first use, so the two installer
  targets would race for it once /m:2 let them run concurrently — on the
  release and signing path only.
- Never let a failed prime block publishing the build image. The prime
  compiles a .dockerignore-filtered tree, so it can fail on a change the .deb
  job accepts; blocking the publish would silently strand every consumer on a
  stale image. It warns instead, and the verify step is what turns it red.
- Warn when a primed image yields zero cache hits, which is what a drifted
  workspace path would look like. Previously the entire speedup could be lost
  with a green, merely slower, build as the only symptom.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): pin the WiX extension and stop the two Windows jobs racing to save

- `wix extension add` without a version resolves the newest package on NuGet,
  which the pinned 5.0.2 CLI would then refuse to load — a break needing no
  change on our side. Pin it to the CLI version.
- Make the desktop job's FetchContent cache restore-only. Sharing the namespace
  is what makes it hit; sharing the save just races the installer job for the
  same key and logs a reservation failure on every cold run.
- Correct the paths-filter comment, which claimed a coverage guarantee the
  .dockerignore-filtered prime does not actually provide.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): move the image layer cache to the registry, document the guard

- Restore buildx layer caching via ghcr rather than the Actions cache. Dropping
  it entirely made the nightly re-run apt build-dep under QEMU for every arm64
  leg with no reuse; ghcr has neither the 10 GB cap nor the LRU eviction that
  would have cost the FetchContent caches on the critical path.
- Document the BUILD_TESTING guard that add_cpp_ci_test now enforces, in the
  helper's own usage block and in docs/dev/testing.md — which also still named
  the internal register_cpp_ci_test().
- Check the primed cache's size before its marker file, so a prime that dies
  partway reports the explanatory error instead of a bare `cat: No such file`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): keep a Rust compile canary on the PR path

Deferring the Windows desktop installer left no PR-path job compiling
src/app/src-tauri: the macOS .dmg is ci:macos-gated and contrib/debian/rules
never sets BUILD_TAURI_APP. A broken Tauri host would have gone green and
failed only once the PR was queued. Docs And Style now cargo-checks it — a
compile canary, not a packaging build.

Also from review:
- Build wix_installers serially. It is the only target owning two concurrent
  `wix build` runs and is built only on the release and signing paths, so a
  parallel configuration there would first run for real during a release.
- Pin the WiX extension version where `wix build` uses it, not only in the CI
  pre-seed, so an unversioned resolve cannot pick up an incompatible major.
- Write GITHUB_PATH as UTF-8 in the new CMake action; `>>` under PowerShell 5.1
  emits UTF-16LE, which would silently garble the entry on a runner that
  actually takes the install branch.
- Opt release-v* pushes out of the pinned debug path too: they also produce
  .deb and -dbgsym artifacts.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): derive the WiX extension pin and separate the installer obj dirs

- Pin the UI extension to the CLI version CMake actually detected instead of
  a literal 5.0.2. The project supports WiX 5.0+, so a hardcoded pin would
  make a newer supported CLI fail to load the extension it was handed.
- Give each installer its own -intermediateFolder. Splitting the web-app
  fragment was not sufficient: both targets compile Product.wxs, so they also
  shared obj/Product.wixobj with different -d IncludeTauriApp values. CI avoids
  this with /m:1; this fixes it for anyone building the targets in parallel.
- Make the prime-verification failure state plainly that the image published
  successfully and only the cache is missing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): compile-check the Tauri host on Windows too

A Linux-only cargo check missed the platform-gated host code: webview_shim.rs
and lib.rs both branch on cfg(target_os = "windows"), and webview2-com/windows
are Windows-only dependencies. That is precisely the code whose packaging job
this PR defers, so the canary did not cover the gap it was added for. Now a
two-platform matrix in its own job.

Also from review:
- Drop the cargo cache. A cold check measures ~1.5 min, so it bought little
  while contending for the same 10 GB Actions pool this PR argues elsewhere
  must be kept clear for the FetchContent caches.
- Drop the `# syntax=docker/dockerfile:1` directive. BuildKit's built-in
  frontend already supports RUN --mount, and the directive makes every image
  build pull a frontend from rate-limited Docker Hub.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* docs: document the BUILD_TESTING guard in AGENTS.md

The add_cpp_ci_test example showed the unguarded pattern, which now trips the
configure-time check that keeps distro packaging from rebuilding the test
suite it discards.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): make the Tauri canary binding and stop a diagnostic gating the .deb

- Move the canary into the packaging workflow and into `Packaging builds`'
  needs. As two fresh job names in Docs And Style it could go red without
  blocking anything until someone registered them in branch protection —
  which is the late failure it was added to prevent.
- Report the ccache hit rate after the .deb upload, not before. A diagnostic
  running under `set -euo pipefail` sat between the build and the upload, so
  an unreadable cache would have skipped the artifact and failed four
  downstream jobs with "artifact not found". This file already codifies the
  opposite convention for the macOS .pkg upload.
- Apply BUILD_TESTING=OFF to the Arch/openSUSE builds too; they had the same
  build-and-discard waste already fixed for Debian and Fedora.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(ci): serialize the desktop installer build

wix_installer_full depends on both web-app and tauri-app, and both touch
src/app: web-app robocopies the whole tree while tauri-app runs npm ci inside
it. /m:2 let them run concurrently, so robocopy could hit files npm was
rewriting and retry under its default /R:1000000 /W:30 — hanging the job to
the workflow timeout rather than failing. /m:2 stays on wix_installer_minimal,
whose graph has no src/app writer.

Also note in the canary's comment that cargo check covers neither linking nor
asset embedding, so the boundary is written down rather than assumed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-08-09 21:10:19 +00:00
Yiğit ERDOĞAN 6536e5afa0 test: run the committed model-type classifier test in CI (#2976)
test/cpp/test_model_type_classifier.cpp and test/cpp/test_ggml_hip_path.cpp
were committed but referenced by nothing, so neither was ever built or run.

Register the classifier test, which covers get_model_type_from_labels() and
passes 17/17 against the current implementation. Remove the HIP path test:
llamacpp backend without a header declaration, so the file has not compiled
since June - which went unnoticed precisely because nothing builds it.

Also point the testing guide at add_cpp_ci_test(); #2877 made it the entry
point and AGENTS.md now forbids calling register_cpp_ci_test() directly.
2026-08-09 09:13:21 +00:00
Jeremy FowersandClaude Fable 5 e2e502c4d3 ci: run .exe/.deb inference suites in the merge queue (#2950)
* ci: run .exe/.deb inference suites in the merge queue

PR pushes no longer occupy the self-hosted rigs; the merge queue runs the
inference suites instead, reported through a new required-check-stable gate,
`Inference backend tests`. Label a PR `ci::backends` to opt it back in.

Co-Authored-By: Claude Fable 5 <[email protected]>

* ci: address review findings on backends gating

- backends-gate needs the upstream build jobs, matching the sibling gates
- fold the long if: expressions to one clause per line
- docs: fix the stale per-PR-hardware-coverage claims, point the anti-pattern
  row at the deferred-groups table, note Metal inference lives under ci:macos

Co-Authored-By: Claude Fable 5 <[email protected]>

* ci: use single-colon ci:backends to match the existing label convention

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs,ci: address second-round review findings

- note in the workflow that the gate name is a required status check
- adding-a-backend.md: warn that the CI matrices are merge-queue-gated
  and need ci:backends on the PR
- testing.md/README.md: scope the Metal-overlap claim to the wrapped
  servers the .dmg job actually runs, deduplicate the deferral policy,
  and stop implying ci:backends alone unlocks all hardware rigs

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: note fork PRs need a maintainer to apply ci:* labels

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-08 07:08:50 +00:00
Jeremy FowersandClaude Opus 5 ffcfd6b595 ci: run packaging, PPA, distro, macOS and backend-validation jobs in the merge queue (#2911)
* ci: gate Fedora RPM and Debian 13 packaging behind the merge queue

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: gate Launchpad PPA binary builds behind the merge queue

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: gate Linux distro builds behind the merge queue

Drops the pull_request paths filter so the required check always reports;
a workflow that never triggers leaves it pending forever.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: gate llama.cpp, vLLM and sd.cpp validation behind the merge queue

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: validate committed backend pins in the merge queue

The validation workflows used `event_name != 'pull_request'` to mean both
"do the expensive work" and "resolve upstream releases instead of the
committed pins". Adding merge_group flipped both, so the required gate
validated whatever releases/latest returned rather than the queued commit
— a bad upstream release would have blocked every PR in the queue.

Scopes release discovery to schedule/workflow_dispatch, and runs the lite
matrix in the queue as PRs did.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: defer most macOS jobs to the merge queue, add ci:macos / ci:distros

macOS runners are the scarcest GitHub-hosted resource (org-wide cap: 5
concurrent) and observed queue waits on PR pushes reach 40+ minutes.
Build Embeddable Lemonade (macOS) stays on every PR push as the AppleClang
compile canary; the dmg/pkg build, its CLI/endpoint suite and the embeddable
archive smoke test move to the merge queue behind a new "macOS builds" gate.

Both escape hatches are opt-in per PR: label ci:macos or ci:distros.

- test-cli-endpoints splits into per-OS jobs so the macOS half can skip at
  job level. "Test CLI/Endpoints (macos-latest)" is a required check, and a
  required context that is never created leaves a PR pending forever, whereas
  a job skipped by `if:` reports success.
- The embeddable smoke steps move to a composite action so the macOS leg can
  become its own skippable job without duplicating them.
- test-dmg-inference is restricted to the unsigned fork-PR path. Every test
  step in it is conditioned on has_signing != 'true', so with signing secrets
  present it installed the .pkg and then ran nothing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: run Metal inference tests on the signed path so they gate merges

test-dmg-inference conditioned every test step on has_signing != 'true', so
llamacpp-metal, whisper-metal and kokoro-metal only ever ran on the unsigned
fork-PR path. merge_group is a signed context, so Metal inference never gated
a merge.

The job now resolves LEMOND_BIN/CLI_BINARY per path — installed .pkg when
signing secrets are present, build dir otherwise — and runs the same tests
against either. lemond is restarted explicitly so it inherits
GGML_METAL_NO_RESIDENCY; on the signed path that needs sudo because the .pkg
postflight starts it via launchd as root.

whisper-metal is dropped from build-lemonade-macos-dmg's inline unsigned
steps, since test-dmg-inference now covers it on both paths.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: move the moonshine test alongside the other macOS inference tests

Same gap as the Metal tests: moonshine ran only in
build-lemonade-macos-dmg's inline unsigned steps, so it never gated a merge.
It moves to test-dmg-inference, which now runs on both signing paths.

That leaves the last consumer of the inline "restart lemond so Metal env is
inherited" step with nothing to run, so it goes too. The macOS split is now
uniform: non-inference suite signed in test-cli-endpoints-macos and unsigned
inline in the build job, inference suite in test-dmg-inference on both.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: build a .pkg on both signing paths and unify the macOS test jobs

Packaging never needed Apple credentials — only notarization does.
package-macos and notarize are already separate CMake targets, and CPack only
passes productbuild --sign when INSTALLER_IDENTITY is set. The build action
conflated the two, so "no signing secrets" meant "no package at all", which
forced fork PRs to ship raw binaries, which forced a second install procedure
and a second set of tests.

build-macos-dmg now always runs package-macos (ad-hoc binaries, unsigned
installer when secrets are absent) and runs notarize only when signing.
build-lemonade-macos-dmg uploads lemonade-macos-pkg unconditionally.

test-cli-endpoints-macos and test-dmg-inference install that .pkg with no
has_signing branching. The two CLI/endpoint suites had drifted apart in both
directions, so the unified job is their union: server_router.py and
test_llamacpp_system_backend.py from the signed side, server_jobs.py,
server_websocket_auth.py, test_model_name_normalization.py and
test_tray_https.py from the unsigned side. All 16 macOS test scripts that ran
before still run.

Drops the inline unsigned test block from the build job and the
lemonade-unsigned-binaries artifact, so a fork-PR test failure no longer
reports as a failure of the required Build Lemonade macOS .dmg check.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: add disable_macos_signing dispatch input to exercise the unsigned path

Same-repo runs always have Apple secrets, so the unsigned macOS path is only
reachable from a fork PR. This input forces has_signing=false on demand,
making that path reproducible without one.

It also skips test-exe-inference and test-deb-inference, since a macOS
signing probe has no reason to occupy the self-hosted rigs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: fix the two tests that assumed a build tree or a surviving server

test_tray_https.py hardcoded ./build/lemonade-tray and pointed
XDG_RUNTIME_DIR at ./build. It only ever ran inside the macOS build job, so
the build-tree assumption was invisible; it now accepts an installed binary
via LEMONADE_TRAY_BINARY, the build dir, or PATH, and uses a temp runtime dir.

Kokoro runs last in test-dmg-inference: evicting a Kokoro model takes lemond
down with it (#2916), so nothing may follow it in the same job. Moonshine and
Kokoro only became adjacent when the inference tests were unified.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: label every gated group, and document the policy

ci:distros now also activates the Launchpad PPA builds, and a new ci:upgrades
label activates the llama.cpp, vLLM and stable-diffusion.cpp validation
workflows. Every job that defers to the merge queue is now reachable from a
PR by label; nothing is merge-queue-only.

docs/dev/testing.md gains a short section on what defers, which label opts it
back in, and the two consequences that bite: a green unlabeled PR says
nothing about macOS or packaging, and a new suite added to a gated job only
runs in the queue by default.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* docs: keep the CI Expectations bullets with their intro paragraph

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: wait for both address families before restarting lemond

test-dmg-inference killed the .pkg-started lemond and then waited on
localhost before starting its own. On macOS localhost resolves to ::1 first,
so the wait returned as soon as the IPv6 socket was released while the IPv4
socket was still held. The new lemond then failed its IPv4 bind, logged it,
and served IPv6-only.

Every suite that talks to localhost kept passing against that half-bound
server; test/server_moonshine.py, which hardcodes 127.0.0.1, got
ECONNREFUSED. The wait now polls lsof for any listener on the port, and
readiness requires both 127.0.0.1 and [::1] so a half-bind fails loudly
instead of masquerading as a healthy server.

The Kokoro ordering comment is removed: it was based on a misreading of the
first failure, filed as #2916 and now closed in favor of #2917.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: stop the .pkg-started tray agent before the tray test

postinst-full-mac bootstraps com.lemonade.tray into the GUI domain, and the
tray is single-instance, so test_tray_https.py could not start its own
instance and failed with "lemonade-tray is already running". The test only
ever ran from a build tree before, where nothing had been installed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: make the macOS inference server restart race-free

The previous attempt failed in a way that looked like success. `launchctl
bootout` is asynchronous, so the .pkg-started lemond still held
127.0.0.1:13305 when the replacement started; the replacement logged "Port
13305 is already in use ... will now exit" and died, and the health check
then passed against the departing launchd instance. All four inference suites
subsequently failed with "Server is not running on port 13305".

The wait now polls until the port is genuinely free and hard-fails if it is
not, and readiness additionally checks that this job's own lemond process is
still alive, so a foreign server can no longer satisfy it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: address independent review findings

- launchpad-ppa: a ci:distros PR now builds the binary package, matching what
  the merge queue runs. It was building a source-only package, so the label
  opted into a strictly weaker check than the one it is meant to reproduce.
- test-cli-endpoints-macos now starts its own lemond instead of using the
  launchd instance, which inherits only the plist environment. The job
  declared GGML_METAL_NO_RESIDENCY and HF_HOME that never reached the server,
  and four suites moved into this job previously ran against a server that
  did inherit them.
- The restart dance is now .github/actions/restart-lemond-macos, shared by
  both macOS test jobs, and uses sudo for lsof: an unprivileged lsof cannot
  see a root-owned socket, so the port-free check was a false negative.
- Drop `unlabeled` from pull_request types. The auto-labeler fires on every
  newly opened PR, so label events already cost one cancel-and-restart;
  removing a label only ever drops work and does not need to re-trigger.
- Upload the .pkg with `if: always()` so an inline unit-test failure does not
  surface downstream as a missing artifact.
- Raise test-cli-endpoints-macos to 45m: it now runs a superset of the
  Windows suites.
- test_tray_https.py fails loudly when LEMONADE_TRAY_BINARY points nowhere
  instead of silently falling back.
- Stale metadata in build-macos-dmg, and a docs line that overstated .pkg
  coverage.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: verify the macOS test server is actually ours before running tests

kill -0 was the wrong liveness check. The child is disowned, so an exited
lemond lingers as an unreaped zombie and kill -0 keeps succeeding — which is
why the step reported "Server listening ... (PID 2775)" for a process that
had already exited with "Port 13305 is already in use".

Readiness now checks the process state (treating Z as dead) and confirms the
PID holding port 13305 is ours, so a departing launchd instance answering the
health check can no longer be mistaken for the server under test.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: keep test-cli-endpoints-macos on the launchd server; widen the port wait

Making that job restart lemond was the wrong answer to the review finding.
It passed against the launchd-started server and failed once it started its
own, so the honest fix is to stop declaring GGML_METAL_NO_RESIDENCY there —
it never reached that server before this PR either — and note where Metal
coverage actually lives.

For test-dmg-inference, which does need its own server, the port-free wait
now matches any socket state rather than LISTEN only: a socket in TIME_WAIT
still fails the IPv4 bind while -sTCP:LISTEN reports the port as free, which
is how a half-bound server got through.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* ci: give lemond the Metal setting via launchd instead of restarting it

Killing the .pkg-started server and launching a replacement lost the race for
127.0.0.1:13305 in six consecutive runs. lemond binds the two address
families separately and keeps serving when only one succeeds, so the
replacement came up IPv6-only and every test using a literal IPv4 address
failed. Widening the port wait to non-LISTEN states did not close it.

Setting GGML_METAL_NO_RESIDENCY in the launchd domain before installing means
the postflight-started server has it from birth, with no restart and no race.
The job-level env still covers the install action's manual fallback, which
runs in the step's own shell. A new step asserts the setting actually reached
the listening process via `ps eww` rather than assuming it, so a server
without it fails the job instead of quietly testing something else.

test-cli-endpoints-macos already worked this way and passed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
2026-08-07 00:45:15 +00:00
Jeremy FowersandClaude Fable 5 c839b5a56f docs: add testing guide (#2891)
* docs: add testing guide and document the mkdocs publishing flow

Adds docs/dev/testing.md covering test locations, how to run suites
locally, and what reviewers expect. Also notes in documentation.md
that docs are published via mkdocs.yml's nav, and registers the new
testing guide there.

* docs: fix review-identified inaccuracies in testing and documentation guides

- C++ test commands: require configure step, build cpp-ci-tests target explicitly
- Run app regression script from repo root, matching CI
- Scope ServerTestBase claim to server integration suites; note self-managed-server and pure-unittest suites
- Describe the Zensical build accurately; nav-excluded pages are built but unlisted

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: address second-round review feedback on testing guide

- server_cli2.py expects a persistent external server; it does not launch lemond
- add Windows-specific cpp-ci build/ctest commands (VS presets are multi-config)
- correct app regression test path to test/app/app-regression/
- link mkdocs.yml via GitHub source URL so the built site link isn't broken

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: correct Anthropic API test suite location and clarify model size caps

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: polish testing guide from fresh review pass

- include server_tts_openmoss.py in the TTS suite row
- describe skip_if_unsupported's actual capability-gating mechanism

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs: fix Windows preset mismatch, capability decorator scope, and CI wording

Addresses third review pass on the testing guide: use generator-independent
cmake/ctest commands on Windows instead of a hardcoded VS2022 preset, clarify
that @skip_if_unsupported gates on declared capabilities (not hardware) with
@requires_backend for backend-specific gating, and reword the CI expectation
to match contribute.md's review-before-CI policy.

---------

Co-authored-by: Claude Fable 5 <[email protected]>
2026-08-04 22:52:48 +00:00