Skip to content

Continuous integration

How Shaken Fist's CI is put together: the workflows, the merge queue, the automated jobs that open their own pull requests, and the bot commands available on a PR.

GitHub Actions workflows

Every workflow in .github/workflows/:

Workflow Purpose Trigger
functional-tests.yml Main CI: lint, unit tests, functional tests, credential scanning, and the automated reviewer, delinter and exception fixer jobs. The functional jobs deploy nested test clusters via the shakenfist.shakenfist Ansible collection (shakenfist/deploy/collection/), driven by the reusable smoke-cluster workflow in the shakenfist/actions repository PR, merge_group
docs-tests.yml Build and test documentation PR touching docs/** or mkdocs.yml
agent-context.yml Lint the agent context -- AGENTS.md and .claude/ -- for malformed frontmatter, smuggled instructions, embedded credentials and dangerous hook configuration, by running the skillsaw pre-commit hook. Advisory: see Branch Protection PR or push to develop touching the agent context, .pre-commit-config.yaml or the workflow itself
mermaid-lint.yml Render every tracked mermaid diagram and fail on one that does not parse (runs tools/mermaid-lint.sh in the pinned mermaid-cli container, on a debian-13-docker runner because it needs a docker daemon). Advisory: see Branch Protection PR or push to develop touching markdown, the script, its exclude file or the workflow itself
code-formatting.yml Whole-tree formatting sweep Daily schedule, manual, self-test PR
codeql-analysis.yml CodeQL static analysis Push, PR, weekly schedule
pin-indirect-dependencies.yml Reconcile pinned indirect dependencies, adding new ones and removing obsolete ones (runs tools/pin-indirect-dependencies.sh) Daily schedule, PR self-test
ci-headroom-health.yml Harvest the ten newest merge runs' CI headroom bundles and assert the probe which wrote them is still working (runs tools/ci_headroom_health.py; see Is the instrument still alive?). The one headroom check allowed to fail, because it is scheduled: it must never gain a PR or merge_group trigger Weekly schedule (Mondays 07:30 UTC), manual
export-repo-config.yml Export GitHub repo settings to version control, via a shared reusable workflow in the actions/ repository Daily schedule
pr-re-review.yml Re-review PR on bot command @shakenfist-bot please re-review
pr-retest.yml Re-run the functional tests on bot command @shakenfist-bot please retest
pr-fix-tests.yml Fix test failures on bot command @shakenfist-bot please attempt to fix
test-drift-fix.yml Unit test fixer (called by pr-fix-tests.yml) workflow_call, workflow_dispatch
issue-fix.yml Triage open issues, propose a fix as a draft PR workflow_dispatch
merge-failure-triage.yml Triage a failed merge queue run: PR-caused or systemic, record the occurrence, post a verdict workflow_run (a failed Functional tests merge group run), workflow_dispatch
functional-lanes.yml Defines every functional cluster lane once; its callers choose which run where. See Merge lanes and weekly lanes workflow_call (from functional-tests.yml and scheduled-tests.yml)
scheduled-tests.yml The functional lanes which do not gate a merge, run weekly against develop, filing a ci-failure issue per failed lane (tools/ci_report_scheduled_failures.py) Weekly schedule (Fridays 15:00 UTC, early Saturday in Canberra), manual
publish-website.yml Publish the mkdocs site Push to develop, manual
refresh-website.yml Trigger a GitHub Pages rebuild Daily schedule, manual
sync-external-docs.yml Import the sibling repositories' documentation into docs/components/ Hourly schedule, manual
release.yml Build and publish a release Tag push, manual

Dependency updates are not in that table, because Renovate does not run from this repository. It runs from the fleet runner, .github/workflows/renovate-fleet.yml in shakenfist/development, which works over every managed repository in one pass. All this repository carries is renovate.json, which extends the fleet preset local>shakenfist/development:renovate-fleet and adds only what is particular to Shaken Fist -- the package groups, and the custom manager for the Ansible tool pins in functional-tests.yml. A repository-local Renovate workflow is a consistency-audit failure rather than a belt and braces, because two Renovate instances over one repository race on branch creation; see the Renovate audit.

Merge lanes and weekly lanes

A lane is one functional cluster job: a topology deployed by the shakenfist.shakenfist collection, and a suite run against it. Most lanes call shakenfist/actions's reusable smoke-cluster.yml and run a stestr suite, and are named by their concurrency_key. Every lane is defined once, as a job in .github/workflows/functional-lanes.yml. Two workflows call it with a list of lane names, and that list is the only thing which decides when a lane runs:

Lane Runs Topology Suite
debian-13-slim-primary (Debian 13 cluster) Every merge slim-primary cluster-ci.conf
guests (Guests) Every merge slim-primary guest-ci.conf
ubuntu-2404-slim-primary (Ubuntu 24.04 cluster) Weekly slim-primary cluster-ci.conf
debian-13-slim-tier (Debian 13 tier, with Kerbside) Weekly slim-tier cluster-ci.conf
debian-13-localhost (Debian 13 single machine) Weekly localhost cluster-ci.conf
ansible-modules (Ansible modules) Weekly slim-primary ansiblemoduletests.sh, with test_kind: ansible-modules
node-lifecycle (Node lifecycle) Weekly slim-primary nodelifecycletests.sh

smoke-cluster.yml's tier input does not appear in that table because it does not select anything: it names the bundle artifact and forms part of the concurrency group, and nothing else reads it. A lane's suite is its stestr_config alone. debian-13-localhost passes tier: smoke and runs the whole of cluster-ci.conf, the same suite as the multi-node lanes, which is why its test_timeout_minutes is the largest of any lane rather than the smallest -- one node at concurrency 3 needs about 48 minutes for the suite the three-node lane finishes in 34 at concurrency 5. Making that lane a real smoke subset would be a change to what it runs.

functional-tests.yml's functional_lanes job selects the merge lanes, and can_merge needs it. scheduled-tests.yml's weekly_lanes job selects the rest. Every merge lane deploys a nested cluster onto the sfcbr under-cloud that every Shaken Fist repository shares, so a lane earns a place in the merge queue by catching what the other merge lanes do not. The Ubuntu 24.04 and slim-tier lanes moved to the weekly run on 2026-10-25: the Debian 13 cluster lane runs the same suite on the same topology, and what the weekly run gives up is catching a base image or Kerbside regression on the merge which caused it rather than within a week.

The Ansible modules and Node lifecycle lanes followed. Over thirty days the first failed alone three times and the second once, and no failure in either was caused by the change under test, so what every merge was paying for was two more nested clusters on that shared under-cloud rather than a bug the lane would have caught. Node lifecycle is the one lane which does not call smoke-cluster.yml. It shares only the deploy (the build-smoke-cluster composite action) and runs its own steps, because its teardown powers nodes off and the reusable workflow's does not. It has no concurrency_key to pass, so its own concurrency.group carries the lane name, and the seam test reads it from there.

The node lifecycle lane is where cluster-disturbing checks live

nodelifecycletests.sh runs alone against its own slim-primary cluster and breaks that cluster on purpose, so it is the home for any check whose side effects would fail unrelated tests if it ran inside a stestr suite. It carries three such exercises, two of them beyond the node kills it is named for:

  • the documented API_VALIDATION_MODE rollback, which flips a cluster-wide config value and restarts sf-api (apivalidationrollbacktests.py);
  • node resource health, which makes a hypervisor's storage really fail — a read-only bind mount over STORAGE_PATH/uploads — and asserts the node reaches error with a diagnosis naming the path, leaves the scheduler's candidate set, publishes node_resource_health 0, and comes back only when sf-ctl clear-node-error is run (noderesourcehealthtests.py);
  • the node kills themselves, and the maintainer failover they force.

The constraint that puts the second one here is worth stating, because it applies to anything that would error a node. slim-tier's three nodes are all hypervisors and sum to exactly the cluster ledger floor cluster_ci_tests/test_nodes.py asserts, and the two non-network hypervisors test_network_lifecycle.py pins instances onto are the only two a fault could pick from — so erroring one inside cluster-ci.conf would fail tests that have nothing to do with the fault. What the cluster suite keeps is the half that is read-only: cluster_ci_tests/test_node_health.py asserts every node publishes a healthy gauge and a write heartbeat in each path its roles declare, which catches a probe thread that never started on the merge that broke it.

Two of its steps reach the cluster's nodes over ssh: the cached-image upload, which deliberately targets a hypervisor rather than the primary, and tools/ci-restart-cluster-nodes.sh, which power cycles the nodes once the test has killed some. Both ask tools/ci-cluster-nodes.sh which nodes exist. They used to carry the same hand-written list of five addresses, indexed positionally against sf1_uuid..sf5_uuid — and those addresses are the slim-primary topology, which lives in shakenfist/actions and is consumed at @main with nothing to bump. The list was correct and nothing made it stay correct; both failure modes were quiet (#4320). A renumbered node failed for a reason that said nothing about topology, and an added node was never chosen, because RANDOM % 5 keeps picking from the first five, so the coverage the upload step exists to provide narrowed without anything noticing.

The helper reads the list the cluster build already writes: ci-environment.sh (from shakenfist/actions' ci-include-common-localhost.yml) exports nodes, and for each node its address as <node> and its under-cloud instance as <node>_uuid, all from one loop over the topology — the same contract tools/ci-jwks-ca.sh reads. So no naming or numbering convention stands between the topology and this repository: a node added there appears on the next run whatever it is called. The helper leaves out the node named primary (the name build-smoke-cluster exports the primary's address under), because the lifecycle test runs there and the upload exists to exercise a non-primary node. It refuses, printing nothing, rather than print a short or guessed list, and its output is buffered so a caller cannot act on the first few nodes of a list that then failed; ci-restart-cluster-nodes.sh checks its exit status before reading a line. shakenfist/tests/test_ci_cluster_nodes_seams.py holds the node set out of both callers, and runs the helper and the restart script against a constructed environment for each refusal path.

A weekly run now deploys all five weekly lanes at once: twenty-two nested instances (six each for the three slim-primary lanes, three for slim-tier, one for localhost; see ci-topology-*.yml in shakenfist/actions). That is two fewer than every code-changing merge deployed before these two lanes left the queue -- four six-instance slim-primary clusters, at whatever hour the merge happened -- so the weekly peak is smaller than one the under-cloud already carried routinely, and it now lands in the quietest window of the week.

A weekly lane blocks nothing, so its failures have to reach a person some other way. When weekly_lanes fails, report_failures runs tools/ci_report_scheduled_failures.py, which files one issue per failed lane, labelled ci-failure, naming the commit tested, the last commit the lane passed on and a compare link between them. A lane which is still red the following week adds a comment to its open issue rather than filing another. Close the issue when the lane is fixed. The open issue is found by the lane's display name (its name: in functional-lanes.yml), so renaming a lane files a fresh issue and leaves the old one to be closed by hand.

Two things make that reporting reachable, both of them about cancellation. The workflow carries a workflow-level concurrency group with cancel-in-progress: false, so a second dispatch queues behind a run in flight instead of cancelling it. Without that it did cancel it: every lane this workflow calls carries a job-level group keyed outside a merge group on github.ref, two runs on develop share that ref, and the superseded run concluded cancelled rather than failure — which neither reaches report_failures nor sends a GitHub failure notification, so a lost weekly run was silent. A workflow-level group is the whole fix rather than half of it, because a queued run starts no jobs at all, so the lane-level groups never see two runs of this workflow at once and need no edit. One residue remains by construction: GitHub holds at most one pending run per group, so a third dispatch arriving while one run is in flight and one is already pending displaces the pending one. That run tested nothing and lost nothing.

report_failures therefore also runs when weekly_lanes concludes cancelled, not only failure. A run cancelled mid-flight after a lane had already failed used to bury that failure completely, and reporting a cancellation adds no noise because FAILED_CONCLUSIONS in the reporter does not count a cancelled job as a failure. The --lanes-result argument is what separates the two cases: with no failed job a failure still files the unattributed issue, which is the guarantee that a red run never comes back silent, while a cancelled exits quietly because it lost nothing.

GitHub runs a schedule: trigger only from the copy of the workflow on the repository's default branch, and with that branch checked out. The default branch is develop, which is what makes the weekly run test develop. If the default branch ever changes, the weekly lanes test the new default branch, and a scheduled-tests.yml which exists only on develop would stop running at all.

To move a lane, move its name from one caller's lanes list to the other's. shakenfist/tests/test_functional_lanes_workflow_seams.py fails if a caller names a lane functional-lanes.yml does not define (a lane which does not exist skips, and a called workflow whose jobs all skip succeeds, so the merge gate would pass having tested nothing), or if a lane runs in both places or in neither. Moving a lane into the merge queue also needs a BUNDLE_TOPOLOGIES row in tools/ci_headroom_harvest.py if its bundle name is new there. A merge lane's job is reported as Functional lanes / <lane> / Smoke tests (collection).

The weekly schedule is GitHub's schedule:, which has run hours late and sometimes not at all since August 2026. It is a stopgap until shakenfist/private-ci's periodic CI plan (PLAN-periodic-ci.md) has the conductor dispatch this workflow into gaps in sfcbr's load, which is why scheduled-tests.yml's workflow_dispatch takes no inputs. To run the weekly lanes against a branch, dispatch it by hand: gh workflow run scheduled-tests.yml --ref <branch>. A failure there files nothing: report_failures prints the issue it would have filed to its log, because the failure is the branch's and not the lane's, and only runs of the default branch are reported.

Human login is covered against a real provider, weekly

The federated exchange is tested against a throwaway JWKS server the test process runs itself (cluster_ci_tests/test_federation.py), which is the right trade for validation and no use at all for a flow: discovery reads a document we did not write, and the login exchange trades a token a provider minted for its own reasons. So the cluster suite also stands up one real OpenID Connect provider, Keycloak in a container on the cluster's primary, and cluster_ci_tests/test_oidc_login.py covers, against it:

  • discovery, with an issuer configured from the provider's real issuer URL and every login endpoint filled in from the document it publishes;
  • the login exchange at /auth/login, with a group bound mapping rule;
  • the credential set that login mints, and the metadata on its key, including its provenance;
  • a refusal, when the identity's group matches no rule, and a login whose audience is checked against the client identifier rather than the API's URL;
  • a real sf-client login --flow device, run as a subprocess, with the test playing the person at the provider's own pages while the client polls, and asserting what the client leaves in its cache.

This coverage is weekly. It does not gate a merge. The provider runs on the debian-13-slim-tier lane only, because that lane's primary is the one with the memory for it: 12288 MiB in the slim-tier topology, against 4096 MiB in slim-primary, which is what both merge-gating lanes put the suite on. A login regression therefore arrives as a ci-failure issue from the weekly run, up to a week after the change which caused it, and not as a blocked merge. shakenfist/tests/test_ci_oidc_login_guard.py fails a pull request which moves that lane into the merge queue or adds a topology the suite's rule for "is a provider expected here?" has no answer for.

On the lane that is supposed to have a provider the tests fail rather than skip when the provider's descriptor is missing, so a bring-up step which quietly stopped working is a failure and not a silent gap. Which lane that is, the suite works out from the cluster rather than from a setting: it finds the host running the suite in the node roster by its mesh IP and asks whether that node carries the hypervisor, network and database roles together, which is the shape of the provider topology's primary and of no merge-gating one, with the single-machine deployment carved out first because its one node also holds every role. That verdict is sizing.provider_is_expected() -- a pure function, so every roster shape the fleet can present is exercised on every pull request. It is deliberately not a method on the test class: the decision it makes is reached only on a lane that runs neither on a pull request nor in the merge queue, so getting it wrong either fails every cluster job for a week or skips in a way nobody can tell from coverage that has never worked.

What has no functional coverage. The authorization code flow is not exercised against a running provider, because it needs a browser and the suite's host has none. client-python's own unit tests are what cover it.

Authentik is not run in CI. Its coverage is its committed captures under shakenfist/tests/files/idp/ (a discovery document and a claim set), the reproducible lab in tools/idp-lab/, and the walkthrough in the operator guide. One provider was chosen because two do not fit: Authentik needs four containers and database migrations on a cold first boot, and the primary's memory does not stretch to running both.

Where the pieces live:

Piece Location
Bring-up: certificate, container, realm, client, person, descriptor tools/ci-idp-keycloak.sh
The step which calls it smoke-cluster.yml in shakenfist/actions
The tests shakenfist/deploy/shakenfist_ci/cluster_ci_tests/test_oidc_login.py
The person's half of a device login, parsed from the provider's HTML shakenfist/deploy/shakenfist_ci/idp_pages.py, unit tested against the captured pages in shakenfist/tests/files/idp/keycloak-device-*.html
The verdict on whether a provider is expected on this deployment sizing.provider_is_expected() in shakenfist/deploy/shakenfist_ci/sizing.py
The guard on where the provider may run, and on that verdict shakenfist/tests/test_ci_oidc_login_guard.py
Regenerating the captures tools/idp-lab/capture-fixtures.sh

The provider's certificate is signed by the authority tools/ci-jwks-ca.sh already installs, which the cluster trusts through FEDERATION_JWKS_CA_BUNDLE. sf-client has no equivalent setting, so the device login test points it at that authority with REQUESTS_CA_BUNDLE.

The live MariaDB tests

shakenfist/tests/test_mariadb_*_live.py need a real MariaDB server rather than the sqlite engine the unit suite uses, so they run in one place: the Schema ENUM widening job in functional-tests.yml, which apt-installs MariaDB and then runs every one of those modules (tools/ci-enum-widening-test.sh). It is not itself a protected context: the ruleset requires Can see status, Can enqueue and Can merge, and this job is required through their needs. The job and the script keep the ENUM widening name because the script, the job, the gate jobs and the seam tests name each other, not because branch protection does; rename them together.

That job ran on merge_group and workflow_dispatch only, so a change to a schema migration met a real server for the first time after review and approval, inside the queue. #4954 added UNIQUE (instance_uuid, order, active) to network_interfaces; a pre-existing live test rolls that table back to version 2 by dropping active, which the new constraint blocks, so the merge group failed with Key column 'active' doesn't exist in table, the entry was ejected, every functional lane in the group was cancelled, and the pull request went back for a fixup it could have had before review (issue #5005). The sqlite stand-in that closed the same gap for the batch hard delete (#4897, after #4880) does not carry over: a migration is MariaDB DDL, and sqlite neither runs ALTER TABLE ... ADD CONSTRAINT nor has the information_schema those tests probe.

So the job also runs on a pull_request whose diff touches what those modules cover — shakenfist/mariadb*.py, shakenfist/schema/**, the live modules themselves, the test-support modules they import (shakenfist/tests/hard_delete_cases.py decides what the hard delete live test asserts), the object modules a live test drives directly (shakenfist/network/interface.py for the device index live test), and the job's own three tools files — through the live_mariadb output of a second dorny/paths-filter step in check_paths. It is a second step and not another filter in the first because predicate-quantifier is a step-level input: the first step needs every for its "everything except docs" filter, and under every a multi-pattern filter matches nothing at all. can_enqueue needs the job, so a red pull request run blocks enqueue rather than only being visible; on a pull request which does not touch those paths the job is skipped, and can_enqueue counts a skip as success.

Two asymmetries are deliberate. The pull request arm is narrower than a code change, because installing a database server on every pull request is not the trade. The merge_group arm is not narrowed at all and stays on code_changed, because can_merge excuses a skipped dependency only when check_paths found no code, so a narrower merge arm would fail every code-changing merge group that did not touch the schema. shakenfist/tests/test_schema_enum_widening_seams.py holds the filter to the files the job runs and to every in-repo module the live modules import (bar a short named list of deliberate exclusions: the generic test harness, constants and exceptions), holds can_enqueue to consuming the job, and holds those two arms apart, because a live module the filter does not match is one whose pull request CI has quietly stopped running it.

Where the functional jobs get their code

The functional jobs do not install released packages. shakenfist/actions's setup-test-environment checks out three repositories -- shakenfist/shakenfist, shakenfist/client-python and shakenfist/agent-python -- with the repository that triggered the workflow at its triggering ref and the others at develop. Its tools/deploy-collection.sh then runs the collection's example playbook with sf_build_local_wheels=true, repo_path and client_repo_path pointing at those checkouts. Play 0 of examples/_shared/site.yml builds a server wheel and a client wheel, play 1 copies them to every node, and the node role installs the wheel paths in place of the PyPI names it would otherwise use (shakenfist/deploy/collection/roles/node/tasks/bootstrap.yml).

The consequence is worth stating plainly, because it was missed for two months: an unreleased client change is available to the functional jobs as soon as it merges to client-python's develop. No PyPI release is involved. A test in this repository may be written against a new apiclient verb the moment that verb merges next door.

Two things this does not mean. An operator deploying the collection normally gets the PyPI packages, since sf_build_local_wheels defaults to false -- so an unreleased verb reaches CI, and no operator. And the coupling runs both ways: a regression merged to client-python's develop breaks this repository's functional jobs with no change here.

The private CI conductor is on the same footing, not the opposite one. Its deployment playbook pip-installs client-python@develop into the conductor virtualenv with state: latest, overriding the unpinned shakenfist-client its requirements.txt resolves from PyPI, and has since 2026-07-12 -- for the same reason: develop moves API contracts faster than releases do, and a released client that was behind a server contract once wedged the conductor's main loop overnight. So the conductor picks up a client change on its next deploy, and a release is not what gets a verb to it.

That leaves a released client mattering to exactly one audience -- operators -- which is worth knowing before treating a release as a prerequisite for anything internal.

Work on docs/plans/PLAN-scheduler-reservations.md reasoned from the opposite belief and deliberately wrote its functional coverage against apiclient.Client._request_url() to work around a constraint which had already been gone for seven weeks. It then made the same mistake about the conductor, in the same document that corrected the first one -- because it checked this repository's install path and took the conductor's from another plan. If you find yourself about to do something similar, check this section first, and check the install path itself rather than a description of it.

Balancing the functional suites across their workers

stestr splits a suite across its workers once, before any test runs, and never moves a test afterwards. How it splits depends on whether its repository knows how long each test takes. Knowing, it deals the tests longest first onto whichever worker has the least work so far, which keeps the workers within a test or two of each other. Not knowing, it deals them round robin, so every worker gets the same number of tests whatever they cost -- and a CI node's repository never knows, because the node is built for the job.

The functional suites are dominated by a few tests which take several minutes each, so round robin decides the step's wall clock by luck. Issue

5010 found the cluster suite with 136 minutes of work across five workers,

one of which drew 55 of them and ran the step out of its 60 minute budget while the other four sat idle; the smoke tier did the same on pull request

5026, with one worker carrying 43 minutes of a 45 minute budget and the

other two finished after 23. Neither run had a failing test.

So the durations are kept in the tree, in shakenfist/deploy/stestr-times.json, and the Run functional tests step of shakenfist/actions's smoke-cluster.yml runs tools/ci_stestr_times.py seed on the node immediately before stestr run. It writes the durations into the empty repository's times database and reads them back through stestr's own API to prove stestr sees them. A seeding failure is printed and the suite runs anyway, unbalanced: slower to finish, never wrong. Seeding records no run, so stestr failing after a timed out step still says there is no run rather than reporting a made up one in which everything passed.

The file is regenerated from CI, not edited by hand:

tools/ci_stestr_times.py harvest

reads the per-test durations printed by the functional jobs of the last fifteen completed runs of functional-tests.yml and scheduled-tests.yml from the last thirty days (--runs and --days change those), takes each test's median, and rewrites the file. It needs gh. Refresh it when the suites change shape, for instance after adding or substantially slowing a long test. Until then nothing breaks: a test the file does not name is still run, and stestr deals the tests it does not know round robin after placing the ones it does.

Running commands from the functional suite

shakenfist_ci/process.py is how the functional suite shells out. It is subprocess.run() with an acceptable-exit-code list, and it replaced oslo_concurrency.processutils.execute() -- which the harness was importing without declaring, and which nothing else in this repository used.

Three things about it are load-bearing, and are the reason it is a module rather than ten inline subprocess calls:

  • Output is returned unstripped, and decoded with os.fsdecode. Callers split on newlines and parse JSON, so a trailing newline is data. ip, ssh and the client run against real hosts and occasionally emit a byte that is not UTF-8; fsdecode maps it to a surrogate instead of losing the test to a UnicodeDecodeError.
  • stdin is /dev/null. ssh reads stdin, and a command that inherited the test runner's would block rather than fail.
  • ProcessTimeoutError subclasses ProcessExecutionError. A node that accepts an ssh connection and then wedges is exactly as untestable as one that refuses it, so _require_node_exec() skips on both without being taught the difference.

Why assertions run on a named node, over the mesh

A test which needs to see real host state -- a network namespace, a link, an iptables rule, a libvirt domain -- usually needs to see it on a node which is not the one running the suite. In the collection's multi-node topologies the suite runs on primary, which is deployed with SHAKENFIST_NODE_IS_NETWORK_NODE=False, and a floating IP's netns, flt-<hex> veth, /32 and DNAT rule are plumbed on a separate network node (sf1 in the slim topologies), where the floating network lives as an uplink-less island on egr-br-eth0.

Assuming otherwise cost coverage twice over. ping <floating> run locally on primary could never succeed, because that host has no interface or route onto the floating network, which is the visible merge-queue failure on PR #3389. Worse, the host-level plumbing and cleanup assertions guarded on a local /var/run/netns/<net> check, false on primary, so they silently no-op'd and the floating-leak regression coverage they existed for never ran at all.

The API's own ping endpoint is not a substitute. It runs ip netns exec <net> ping, and inside the namespace the floating /32 is local and the DNAT PREROUTING path is never traversed, so it cannot answer whether a floating address is reachable. That can only be asked from an egress-side vantage, which means the root namespace of the network node.

So the helpers on BaseTestCase discover the cluster's nodes from GET /nodes and run a command on a chosen one. Three choices in that design are load-bearing:

  • Discovery is API-native, never hardcoded. get_nodes() reports each node's name, mesh ip, is_network_node and is_hypervisor, so a test carries no knowledge of the CI IP plan or of node names, and on a single-node cluster the network node resolves to the local host.
  • Local versus remote is decided by mesh IP, not by name. _node_is_local() compares the node's ip against the addresses on this host, because the SF node name (config.NODE_NAME, sf1) and the OS fqdn (t-6dFds-1) are different strings -- the mismatch that already makes the placement tests skip.
  • An unavailable channel skips loudly. _require_node_exec() runs true on the node first and calls skipTest with the node's name and mesh IP if that fails. A silent no-op is what hid the breakage above, and a skip which names the node does not.

The deploy prerequisite for the remote path -- the CI key present on the suite host as ~/.ssh/id_rsa, which every node already trusts for debian -- is in place: shakenfist/actions' smoke-cluster.yml copies id_ci onto the primary for every functional job, in its "Authorise the primary to reach other nodes over the mesh" step. So a node-exec skip is now a real signal rather than the expected state, and should be read as the mesh or the key being broken.

Two things these assertions deliberately do not do. They add no new SF API surface: they observe kernel and libvirt state out of band rather than reading SF's own bookkeeping, which could hide the very drift they exist to catch. And they do not work by periodic node-state logging to Loki, which cannot prove reachability at all, is a racy oracle for absence and cleanup, and would couple test correctness to log volume. An on-demand operator diagnostic dumping a network's host-side plumbing may be worth building on its own merits, but not as these tests' mechanism.

Where a test needs the plumbing to be present on a particular pair of nodes, it pins instances with force_placement=<node name> rather than trusting the scheduler to spread them: the presence assertion is only deterministic if the test chose the nodes, and choosing two hypervisors which are not the network node is what makes it sharp, since after teardown the network must vanish from both while remaining on the network node.

Reconciling a node's accounting with libvirt

cluster_ci_tests/test_nodes.py's test_node_accounting_agrees_with_libvirt is the one assertion which holds Shaken Fist's per-node accounting against the hypervisor rather than against another part of Shaken Fist. Three figures in an /admin/resources per_node entry are measurements of libvirt and not ledger entries -- instances_active, cpu_measured and ram_measured, all built in one pass over get_active_sf_domains() by sf-resources -- and both CPU and memory admission measure a node against them, so a node whose measurement has drifted from what it is running refuses or admits work on a number which is not true.

The sample is one sh -c per node (BaseTestCase._node_sf_domains()), which prints the node's clock and then a virsh dominfo per active domain: one ssh round trip, because a reading is only worth comparing if nothing changed while it was taken. /admin/resources is read between two samples, and a node is judged only when those two agree. A node whose domains moved across the read is resampled, and a publish is allowed to catch up, so only a node which disagreed in every comparable reading fails.

The parsing and the arithmetic live in shakenfist_ci/accounting.py, which imports nothing from the rest of the suite, for the reason sizing.py does: shakenfist/tests/test_ci_node_accounting.py loads it by path and exercises it on every pull request, where the test which calls it runs only in the merge queue.

Teardown is asserted on the node, not only through the API

An object's delete is reported done by the API as soon as the cluster-wide bookkeeping is finished, which says nothing about the files and daemons the hosting node still holds. Residue of that kind is invisible until the node runs short of disk, so two mixins under deploy/shakenfist_ci/ assert the host side of a delete instead, and both are subclassed from the smoke and cluster suites so a break shows up on the pull request rather than in the merge queue:

  • dhcp_state.py -- a deleted network's dnsmasq configuration directory, and so its leases file, is gone from the network node.
  • instance_state.py -- a deleted instance's directory under STORAGE_PATH, the nvram file libvirt boots a UEFI instance from, and its libvirt domain are all gone from the hypervisor it was pinned to.

Three things both do deliberately. They read the state before the delete, because state which was never there is also state which was removed, and an assertion which cannot tell those apart passes on a cluster where nothing works. They poll for absence, because teardown is asynchronous and queued behind whatever else that node's workers are doing. And they read as root and skip loudly if they cannot (_require_node_sudo()), so a deploy which tightens a mode makes the test skip with the node named rather than report state it cannot see as removed.

The instance mixin asks libvirt for the nvram path with virsh dumpxml rather than deriving it from STORAGE_PATH. The nvram is libvirt's file rather than Shaken Fist's, and the two steps are coupled: libvirt refuses to undefine a domain which still has nvram unless it is asked to remove the nvram too, so a failed unlink leaves the domain defined and the domain then holds its disks. That is the shape of the defect the cleaner's several virsh undefine --nvram paths exist for, and naming all three kinds of residue in one failure message is what tells them apart.

Credentials go through the environment, not argv

_exec() in the command-line tests writes every command it runs to stderr, and the harness prints it again on failure. So the namespace key reaches sf-client as SHAKENFIST_KEY in the child's environment -- along with SHAKENFIST_NAMESPACE and SHAKENFIST_API_URL, which the client has honoured since v0.2.5 -- and never appears on a command line at all.

process.mask_secrets() exists as well, and rewrites the value of --key-shaped flags to *** before a command or its output goes into an exception. It is a backstop and not the protection. Name-based redaction is the technique this repository already abandoned once in the API layer, for the reason recorded under "Credential-carrying routes are not logged, not redacted" in coding_rules.md: it silently starts leaking the day somebody adds a name it has not heard of. It cannot match a short option, a positional secret, or a flag nobody thought of. Keep the credential out of the string.

Node-exec commands have a timeout

_node_exec() passes SF_CI_NODE_EXEC_TIMEOUT (seconds, default 300) to every command it runs, local or over ssh. These are introspection commands -- ip, iptables, virsh -- so one of them taking minutes means the node is wedged, which is a state a test may well have just put it in. ssh's ConnectTimeout=10 bounds the TCP connect only, and does nothing for a session that connects and then stops responding; without this the job would stall until the CI runner's own timeout killed it, with no indication of which test was to blame.

Waiting for an object's cluster operations

A test that mutates an instance or a network and then asserts on the result waits with self._await_instance_operations_complete() or self._await_network_operations_complete() (both in shakenfist/deploy/shakenfist_ci/base.py). Mutating API calls often return once the database is updated and leave the real work to a cluster operation which runs later, so an assertion made straight after the call can race it.

Do not wait by polling last_cluster_operation. It names only the newest operation, so a later background operation reaching a final state masks an earlier one which is still queued, and the wait returns before the operation under test has run. The helpers instead wait on has_pending_operations, through the client's await_no_pending_operations(). That field covers every mutating operation, and leaves out observational work such as the billing and health sweep, so that work neither holds a wait open nor fails it. See Waiting for an object to settle for what the field means.

The field is a boolean, and an operation in error is not pending, so waiting on it alone would return happily after the operation under test had failed. The helpers therefore also list the object's operations either side of the wait. A mutating operation which ends in error during the wait fails the test. One which was already in error beforehand does not, because that is history and would otherwise fail every later wait on the same object. Operations still pending after five minutes fail the test, and so does an object which is deleted while the helper waits on it.

The suite always runs against a server built from its own revision, so the helpers do not skip on an old server: if it does not advertise the object-pending-operations capability, the test fails.

Creating instances in the functional suite

Every functional test creates instances through self.create_instance() on BaseTestCase (shakenfist/deploy/shakenfist_ci/base.py), never through a client's create_instance() directly. The wrapper forwards its arguments unchanged and waits out a transient InsufficientResourcesException (a 507) rather than failing the test on it.

The reason is that a 507 on a shared CI cluster is usually a statement about a moment, not about the cluster: the capacity the refusing node is holding is very often already being returned by a sibling test that is mid-delete. Failing the test on that makes a run's pass/fail a coin flip on sibling timing. The wrapper polls /admin/resources for room for up to CLUSTER_HEADROOM_WAIT -- 420 seconds, which cluster_ci_tests/test_namespace_claims.py imports from base.py rather than keeping its own copy of -- and only for a plain 507: an AffinityConstraintUnsatisfiable 409 is never caught, because that refusal does not become satisfiable by waiting.

"Room" means room for the whole create, on one node. The scheduler pre-filters a candidate on cpus, memory and disk, and refuses for whichever of the three binds, so the wait models all three (retries.wait_for_capacity()): a node satisfies the wait only when every dimension the create asks for fits on that node, and the wait record names the dimension it was short of. Reading just one dimension is not a smaller version of the same thing but a different failure -- a predicate that is permanently satisfied while the server is permanently refusing, which turns one 507 into a retry loop rather than a wait.

For the same reason the loop is paced. The first wait after a refusal may hand control straight back, because capacity returning between the refusal and the poll is both common and the case the whole mechanism exists for. Every wait after that sleeps at least one poll interval, because a second refusal following a satisfied wait means the create is being refused for something the predicate cannot see, and an unpaced loop there re-issues as fast as two HTTP round trips allow until the deadline -- leaving an error-deleted instance behind on every turn. MAX_CREATE_ATTEMPTS is a ceiling under that, and a failure that cites it says so rather than blaming the cluster's capacity.

A retry uses a fresh name, because the refused instance holds the caller's name until its error delete completes: the instance object is created and then error-deleted, and Instance.ACTIVE_STATES includes the error states, so the name still resolves while that delete is in flight. The base name is trimmed so that the name plus the retry suffix stays inside the server's 63 character limit.

This means the instance's name is not always the name you asked for. A test that looks an instance up by the literal it passed in will 404 after a wait; read the name back from the returned dict (inst['name']) instead, which is what test_object_names.py does. A test whose subject is the name -- one asserting that two namespaces can hold the same name -- cannot be renamed at all without silently asserting nothing, and so uses a # raw-create: marker rather than the wrapper.

If the deadline passes, which is what it means for a test that is genuinely asking for more than the cloud has, the test fails with the last refusal's body, the node the wrapper waited for (or "unpinned" if the create had no placement), and the per_node capacity roster from the last successful poll, plus the dimensions the waits were short of -- so the failure carries the diagnosis a reader needs rather than a bare 507.

A raw call -- self.test_client.create_instance(...), a local client, another test's client, anything that does not go through self.create_instance() -- skips the wait silently, and needs a # raw-create: <reason> comment in the block of comment lines immediately above it, with a non-empty reason. A unit test in shakenfist/tests/ (test_ci_raw_creates.py) walks the suite's source with ast looking for exactly this, rather than importing the suite, which depends on shakenfist_client -- not a test dependency of this repository. An empty reason fails the same as no marker at all, so the allowlist cannot grow by copy-pasting an existing line.

A call is not the only way to reach a client's create_instance(). assertRaises(Exc, self.test_client.create_instance, ...) hands the bound method over as a reference and lets assertRaises do the calling, and the guard checks those too -- the marker goes on the line above the reference, inside the assertRaises call. Six sites in the suite use that shape, each asserting a 400, 404 or 409 that must not be waited out, and each carries a marker saying which.

The marker exists for a caller that must see the 507 rather than have it waited out. cluster_ci_tests/test_coalescing.py's mesh burst is the current example: it pins instances round robin across the hypervisors inside a try that tolerates and records a capacity refusal as a normal outcome on a shared cluster, and carries on -- wrapping that create would break it twice, since the wrapper's own deadline failure is a test failure rather than an APIException the except clause could catch, and waiting up to seven minutes per refusal would serialise a burst whose simultaneity is the thing under test. The other reserved use is the wrapper's own call inside base.py, which has to reach the client somehow. The saturation tests planned in PLAN-ci-cloud-sizing are expected to need the marker too, to assert that a genuinely full cluster refuses rather than have the refusal waited away.

Request bodies in the functional suite

Request validation refuses an undeclared body key outright -- <name>: not declared by this endpoint, 400, before the handler runs -- so a functional test which sends one never reaches its own assertions. The test looks correct, fails in setup, and what it was written to prove stays unproven.

shakenfist/tests/test_ci_request_bodies.py compares the suite's request bodies against the declarations on every pull request. It parses the suite with ast rather than importing it, reduces each request's URL to literal text with a wildcard for everything it cannot read, matches that against app.py's mounts, and checks the body's keys against what that endpoint declares in any location -- which is what the validator does, so a query parameter sent in the body is not a finding. It reads a body given as a dict literal, spread through **, or returned by a helper which does nothing else; a body assembled by mutation is not readable and is not checked, and a URL it cannot place to exactly one route is not checked either, which is how the identity provider's own endpoints and Loki's stay out of it without being named.

A test whose subject is the refusal says so with an # undeclared-body: <reason> comment immediately above the call, with the same shape and the same empty-reason rule as # raw-create:. There is one such site: cluster_ci_tests/test_api_validation.py, which asserts the refusal is what the API answers.

This exists because of issue 5152. test_oidc_login.py built one issuer body and sent it to POST /auth/issuers, which takes the issuer's name in the body, and to PUT /auth/issuers/<issuer_name>, which takes it in the path and so does not declare it. Every repoint was refused, and the only test that checks a human login is verified against client_id rather than against the cluster's API URL failed in its setup. On a weekly lane that is a week of silence, which is why the check runs here rather than there.

Hard power events in the functional suite

A hard reboot (reset()) and a power off (destroy()) are both a pulled plug from the guest's point of view, and Linux holds dirty pages for about 30 seconds before writing them back. Functional tests usually make these calls within seconds of the guest's first boot finishing, when cloud-init has only just written the ssh host keys and the rendered network configuration. A reset in that window brings the guest back with zero length host keys (Failed to start ssh.service), no network, and a two minute stall in systemd-networkd-wait-online -- issue 4407, which looked like under-cloud contention for weeks because the agent, talking over vsock, still came back.

So a test which hard reboots or powers off a guest and then boots it again calls self._flush_guest_writes() (in base.py) first, which runs sync in the guest through the agent. The test is about Shaken Fist's power plumbing, not the guest's crash consistency. Tests which only assert that the instance went off, and never boot it again, do not need it.

When a ping which was expected to succeed fails, _test_ping() also asks the agent for the guest's addresses, routes, failed units and ssh host key sizes, since the console tail rarely says why a guest is unreachable.

Deploy profiles

A cluster job can deploy more than the default stack without that change living in shakenfist/actions. It names a deploy profile, a Jinja2 template in this repository that the actions render against the topology's facts. A profile can do five things, all optional:

  • add inventory groups, with group variables, for hosts named in the topology;
  • pass extra variables to site.yml;
  • run MariaDB SQL once on the primary before the deploy;
  • ask for a second deploy straight afterwards, after which no unit matching a given pattern may have restarted (compared by systemd InvocationID, which changes on every start); and
  • export environment variables into the functional test run.

The profile schema, the facts it renders against and the validation rules are in the actions consuming guide. Profiles live in tools/ci-deploy-profiles/ and are named <purpose>-<topology>.yml.j2.

The Kerbside profile

tools/ci-deploy-profiles/kerbside-slim-tier.yml.j2 is used by the debian-13-slim-tier lane, which runs weekly rather than in the merge queue (see Merge lanes and weekly lanes), so a Kerbside regression is caught within a week rather than on the merge which caused it. It deploys Kerbside on sf2, a hypervisor outside the database tier, scraping the primary's sf-api across hosts. It creates Kerbside's database on the primary's MariaDB, sets throwaway CI credentials, and exports SF_CI_EXPECT_VDI_CONSOLE_PROXY into the test run. Kerbside is addressed by IP because CI nodes have no DNS, so its certificate carries an IP SAN.

The role which deploys Kerbside is not in this repository: it is the kerbside role of Kerbside's shakenfist.kerbside collection, published on Galaxy. The profile's collections key lists collections for the deploy to install before the first deploy (ci-apply-deploy-profile.py in shakenfist/actions does the install), and this profile installs shakenfist.kerbside from Galaxy in the same version range as examples/_shared/requirements.yml, so the row deploys the release an operator gets. test_ci_deploy_profiles.py checks the two ranges are equal, so change them together. The profile leaves the role's own variables, including its package, at their defaults.

The redeploy check runs straight after the first deploy, before anything restarts sf-api on purpose and before the tests. It asserts that a second site.yml run restarts none of the sf-* or kerbside-* units on any node, and a failure names the host and unit. This is the restart-on-change guarantee for all three node roles and for Kerbside.

Kerbside's tests skip on clusters without it. On this row SF_CI_EXPECT_VDI_CONSOLE_PROXY turns those skips into failures, so a deploy that silently stopped enabling Kerbside cannot go green. The tests that run there are test_vdi_tokens.py (minting and verifying a console token) and test_vdi_kerbside_exchange.py (exchanging a token for a console file at Kerbside, replay rejection, the proxy's TLS endpoint, and a check that no daemon holds the signing key in its environment).

Profiles are checked offline, without a cluster, by shakenfist/tests/test_ci_deploy_profiles.py. It renders every profile and checks the result against the roles' own validation rules.

CI cloud sizing and headroom

CI's clouds are sized against the scheduler's admission ledger rather than against real CPU, because the ledger is what the scheduler actually admits onto. Of the bounds checked against it, only the cluster-wide upper bound can fail a job -- nothing else does. A probe samples every cluster job that runs through the reusable smoke-cluster workflow with test_kind: functional or test_kind: ansible-modules, and publishes a series recording what the cluster actually carried. The jobs that deploy through the composite action instead are not probed yet (#4367). See CI cloud sizing and headroom for the sizing model, the instrumentation and how to re-measure it.

Coverage the functional suite does not have

An affinity run which says nothing skips, and names why

cluster_ci_tests/test_scheduler.py's test_affinity and test_binary_affinity_prefers_the_tagged_node cannot assert on every run. Two degeneracies make a run say nothing about affinity -- the scorer considered fewer than two candidates, or the node the test is affine to was ejected by an admission filter before scoring -- and in both the assertion could not have failed, so a pass would be a false green.

Both used to skip unconditionally, which made a regression green (issue #5110). The verdict is now reached by sizing.affinity_reading(), from the scheduler's own per-stage dropped payloads rather than from the topology, and it splits the two by attribution:

  • A candidate a resource filter took away -- cpu_max_per_instance, sufficient_idle_cpu, sufficient_idle_memory or sufficient_free_disk -- is a choice the scorer never had. The run skips, and the skip names every node, stage and reason involved. This is issue #3565's documented mechanism and it is not an affinity defect.
  • A degeneracy no resource filter accounts for fails: an affinity_detail payload which is absent or empty (the scheduler stopped publishing it), a candidate set which collapsed to one with no resource filter dropping anything, an affine node dropped at a stage which is not a shortage (it hosts the instance the scored one is affine to, so it is a hypervisor by construction and these tests set no hard affinity constraint), or an affine node which is simply absent with no stage owning the drop.

Attribution is used in place of a node count because the topology cannot answer the question: slim-tier runs this suite on three hypervisors and slim-primary on four, so a count-based guard either fails every small-cluster run or excuses every large one. The drops say, per run, whether the choice was taken away by scarcity.

What this does not do is count skips across runs. A slim-primary run which reports the scarcity skip is still worth looking at -- that lane is not expected to be resource-bound -- but it is green, and nothing aggregates it. The lane's test step runs in shakenfist/actions, so standing cross-lane instrumentation is not an edit to this repository. What changed is that a regression can no longer arrive as a skip, which is the risk the absent census was carrying.

test_unsatisfiable_require_with_tag_is_refused shares neither degeneracy: it asserts a refusal, needs no successful create and no candidate count, and so is expected to run on every topology including a single-node one. A skip there is a bug in the test.

Per-node accounting is never checked against libvirt

cluster_ci_tests/test_nodes.py asserts that /admin/resources reports the nodes it should with the fields it should, but only against Shaken Fist's own view of itself. Nothing enumerates the sf: domains libvirt actually has on a hypervisor and compares their count, vCPU and memory totals with that node's ledger entry, so a ledger which drifts from reality during create and delete churn is only ever caught from a symptom -- a create refused 507 while the cluster has room, which is #3772 -- and drift which refuses nothing is invisible. The node-exec helpers make the assertion cheap to write; it is tracked as #5059.

The same helpers answer a neighbouring question for disks. cluster_ci_tests/test_disk_specs.py's test_requested_bus_and_type_reach_libvirt builds an instance whose root disk is on a bus which is not the cluster default, with an extra disk on a third bus and a cdrom beside it, and asserts on the <disk> elements virsh dumpxml returns on that instance's hypervisor: device type, target bus, driver format and cache mode. The reader is _domain_disks() on BaseTestCase, beside the virsh dominfo and virsh domblklist helpers. An nvme disk is invisible to it, because libvirt has no <disk> element for one and Shaken Fist renders it as qemu:commandline arguments instead.

Upgrade data verification

Every functional job deploys a fresh cluster, so nothing in the suite observes an upgraded one. cluster_ci_tests/test_upgrades.py used to look like coverage for this: it asserted that a namespace called upgrade still held its networks, its instances and their connectivity after an upgrade, guarded by a skipTest() for clusters which have no such namespace. Nothing has ever built that namespace, and the guard was in any case written as 'upgrade' not in client.get_namespaces() -- a name against a list of dicts, which is always true -- so the test would have skipped even on a cluster which did have one. It was removed in the change which fixed that comparison across the suite, rather than left to report as a skip in every run's summary.

Reinstating it means building the upgrade namespace and its objects before the upgrade, in a job which then upgrades in place. Until that job exists, upgrade-data verification is unimplemented, and the nearest thing the suite does have is the Schema ENUM widening job in functional-tests.yml, which covers exactly one upgrade hazard (ENUM columns frozen at CREATE TABLE time) on a purpose-built database rather than a deployed cluster.

Merge Queue Pattern

The CI uses a two-stage merge queue pattern (see this blog post):

  1. Can enqueue - Runs on pull_request events, gates entry to merge queue
  2. Can merge - Runs on merge_group events, gates the actual merge

Important: Only Can see status and Can enqueue are required status checks in branch protection. Can merge is evaluated by the merge queue itself, not as a required check.

Can merge needs every job that runs in the queue, Sanity checks included: lint, unit tests and mypy run again on the merge group, because the code they check is the pull request rebased onto a develop that may have moved since Can enqueue passed. The two gates also read a skipped job differently. Can enqueue accepts any skip, because some of its jobs skip for reasons that are not failures (Smoke tests (collection) on a pull request from a fork, Issue links on a manual dispatch). Can merge accepts a skip only when Check paths found no code change, so a queue job that skipped for any other reason, such as a broken if:, fails the merge instead of landing an untested commit.

A failed Can merge ejects the pull request from the queue, and merge failure triage then classifies the failure automatically.

The queue run is also the one a release counts: release.yml's ci-gate job accepts a tag only on a commit whose merge queue run of functional-tests.yml succeeded. So merge through the queue, never around it; see the release process.

Can enqueue also needs the Issue links job, which calls the reusable issue-link-check.yml in shakenfist/actions. It compares what a pull request claims to fix -- its branch name, its description, and its commit messages -- against closingIssuesReferences, which is GitHub's own parse of what will actually close, and fails when the two disagree.

The closing stanza has to be in the pull request description. Two things that look like they would work do not:

  • A stanza wrapped in backticks is a code span. GitHub renders it and parses nothing.
  • A stanza in a commit message closes nothing on this repository. GitHub acts on commit-message stanzas only for commits pushed to the default branch in the ordinary way, and the merge queue advances develop from its own staging ref. Putting the stanza in the commit message as well is still worth doing -- it is how git log records why a change was made -- but it is traceability, not closure.

So a description needs a plain, unbackticked Fixes #NNNN on a line of its own. issue-fix.yml already emits one: the workflow appends its own Fixes #${ISSUE_NUMBER} as the first line of the body, after tools/neutralise-pr-body.sh has run over the model's prose, so bot-authored fix pull requests satisfy this gate as they stand. Do not "fix" a failure here by loosening the branch-name pattern in the checker.

Where a pull request is deliberately only part of the work on an issue, opt out with a line of the form X-No-Autoclose: #NNNN in the description.

The job also prints the issues GitHub will close that nobody asked for -- the other direction of the same defect, and how a closing keyword sitting beside a reference in ordinary prose reveals itself before it shuts a live bug. That direction is reported and never enforced: real descriptions carry headings and table cells of the same shape, and a check that cried wolf on those would be ignored within a week.

Editing the description does not re-run the check. functional-tests.yml declares no types: on its pull_request trigger, so it fires on opened, synchronize and reopened only. After correcting a description, re-run the failed jobs from the Actions tab (or push a commit) to clear the required check. Adding edited to the trigger is not the fix -- it would re-run the entire functional matrix on every description tweak.

Superseded merge groups are cancelled

Every job that can run in the queue and holds a scarce runner carries a concurrency: block whose key is merge-group aware — the merge lanes functional_lanes selects, through the shared smoke-cluster.yml, and schema_enum_widening and automated_delinter in this repository. The weekly lanes carry the same key -- through smoke-cluster.yml, or for Node lifecycle in its own job -- but need none of it, since a weekly run has no merge group to be superseded by; the key's merge group arm is kept so that a lane can move back into the queue without an edit. sanity_checks holds only a static runner, but is keyed the same way so that a superseded queue run does not finish its lint and unit tests either.

github.ref is the obvious key and is right on every other event. On merge_group it is the per-attempt queue branch gh-readonly-queue/develop/pr-<N>-<SHA>, and GitHub mints a fresh SHA every time it rebuilds the group — which it does on every push to develop. Keyed on that, every rebuild lands in a concurrency group of its own, cancel-in-progress never matches, and superseded merge groups run to completion. Each one deploys several nested clusters onto the sfcbr under-cloud that every Shaken Fist repository shares, so the cost lands on the neighbours as well as here: shakenfist/kerbside#284 records a kerbside merge group failing to place a 12 vCPU instance while two superseded shakenfist merge groups held the capacity. So the key branches on the event and uses github.event.merge_group.base_ref in the queue, with a merge_group- prefix so a queue run does not share a group with a workflow_dispatch run on develop.

The queue is serial — the develop ruleset sets max_entries_to_build: 1 — so when two merge_group runs share one of these groups, one of them is superseded. That alone does not make cancelling safe, because cancel-in-progress has no idea which one: it cancels whichever run entered the group first. When GitHub rebuilds a queue entry, the old and new runs both run Check paths, and the queue jobs of whichever finishes last enter the groups last and win. Several times that was the superseded run, so the live merge group lost every functional job, Can merge failed on cancelled dependencies, and the pull request was ejected with nothing tested (issue #3998).

So a superseded run removes itself first. The last step of Check paths runs tools/ci-merge-group-current.sh, which compares the event's merge_group.base_sha with the current head of the base branch. With max_entries_to_build: 1 a live merge group is always built directly on that head, so a mismatch means GitHub has already rebuilt the entry — after the queue merged the entry ahead of it, or after anything pushed to develop outside the queue, such as sfconductor landing a previously ejected pull request. The run then cancels itself (which is why Check paths holds actions: write) before any queue job enters a concurrency group. A rebuild that lands just after the check passed still resolves the right way: the replacement run is only created after the push, and its jobs cannot enter the groups until its own Check paths has run, so they enter last and cancel the superseded run's.

The check fails in the direction that cannot eject a pull request. If the base branch's head cannot be read, the run is treated as current and carries on, which is no worse than before the check existed. A run judged superseded whose self-cancellation does not land exits non-zero instead, skipping every queue job and failing Can merge on a commit the queue has already abandoned.

Only a run's first attempt uses the base-branch key; the keys in this repository, and the one smoke-cluster.yml in shakenfist/actions gives the merge lanes, test github.run_attempt == '1' as well as the event. A re-run is not a queue build: it keeps its original merge_group event, so with the base-branch key a "Re-run jobs" on an old queue run would cancel the live queue entry or be cancelled by it. A re-run therefore keeps its own queue branch's group.

Raising max_entries_to_build breaks both halves: the key would cancel live queue entries building in parallel, and a parallel entry is not built on the base branch's head, so the check would cancel it too. They have to move together. The key is audited fleet-wide; see merge-group-cancellation.

Exported Repository Configuration

Repository settings (rulesets, branch protection, merge queue config) are exported to .github/exported-config/ for version control and audit purposes:

  • repository-settings.json - Repo-level settings
  • rulesets-summary.json - List of all rulesets
  • ruleset-*.json - Full details for each ruleset

If the export-repo-config workflow creates a PR, it means GitHub UI settings have changed and should be reviewed.

Credential scanning

The credential_scan job in functional-tests.yml runs tools/gitleaks-scan.sh, which scans every commit reachable from HEAD for leaked credentials. On a pull request that is the whole of develop plus the branch under test: about three seconds over five and a half thousand commits. It is one of Can enqueue's dependencies, so a credential cannot be merged, and unlike most jobs it is not skipped for documentation-only changes -- a credential pasted into a code sample is still a credential, and the one real key secret this scan found in our own history had been published in the user guide.

The scan is scoped to HEAD rather than every ref because gh-pages carries the built documentation site, whose search index is a single enormous JSON blob quoting every code sample we have. Scanning it takes five minutes instead of three seconds, produces around a hundred and fifty findings which are all duplicates of source files already scanned, and -- in gitleaks 8.16 -- attributes them to unrelated develop merge commits, so they cannot even be triaged by commit.

The scan carries a positive control: it plants a key secret and an SSH private key in a scratch directory and fails if gitleaks does not report both. An empty result is otherwise indistinguishable from a broken scanner, and the allowlists described below could in principle grow until they forgive everything.

To reproduce a CI failure, run tools/gitleaks-scan.sh yourself, passing --gitleaks PATH if the available binary is not the pinned 8.16.0. It does not matter which directory you run it from: it changes to the top of the working tree first, because both .gitleaks.toml and .gitleaksignore are resolved relative to the working directory, and from a subdirectory the ignore file would be missed silently and the three accepted historical findings reported as new. It does need a full clone -- a shallow one cannot see the history the scan claims to cover, so the script says so and exits rather than passing over a fraction of it.

Two rules are ours rather than upstream's:

  • shakenfist-key-secret matches the sfk_ credential format. Unit tests in shakenfist/tests/test_credentials.py read the rule's regex out of .gitleaks.toml and assert it matches what credentials.generate() actually produces, so the format and the scanner cannot drift apart silently.
  • shakenfist/tests/test_no_committed_credentials.py walks the working tree for the same format but verifies the checksum, which distinguishes a real credential from a documented example. It runs in the unit suite and needs no allowlist at all.

Accepting a finding

There are two places to record a finding you have decided to accept, and they are not interchangeable.

Content which will recur -- a documentation placeholder, a test fixture, an upstream default -- goes in the [allowlist] regexes list in .gitleaks.toml, keyed on the text itself. Editing the paragraph around a placeholder creates a new finding in a new commit, so anything keyed on a commit would need replacing every time. Do not use paths for this: blinding a whole file also blinds a real credential added to it later. Note that 8.16 matches these regexes against the whole match rather than the secret alone, so anchoring one with ^...$ quietly stops it matching.

A specific historical event goes in .gitleaksignore as a commit:path:rule-id:line fingerprint, which forgives that one occurrence and nothing else -- the same secret in a new commit fails the scan again. History cannot be rewritten to make such an entry unnecessary: this repository is public, so anything committed here has been world-readable since the day it landed. An entry therefore asserts that the credential has been dealt with where it was trusted, not that it has been tidied out of sight. Write down which credential, and what was done. A unit test enforces that every entry is well formed and carries a comment.

Source size ratchet

The source_size_ratchet job in functional-tests.yml runs tools/source-size-ratchet.py, which measures every tracked source file against tools/source-size-baseline. The baseline lists each file over 1,500 lines with its current length. A listed file may stay that long for ever; it may not grow, and no new file may cross the line, unless the same change raises or adds its entry.

That is the whole mechanism, and it exists because a file that is already too long never got there in one pull request. It grows a few dozen lines at a time, each landing reviewable on its own merits, and a review scoped to a diff cannot see growth that only shows up across fifty of them. Editing the baseline turns that growth into a one-line diff a reviewer cannot scroll past.

When a change has a good reason to make an oversize file longer, raise that file's entry by hand to the new length and say in the pull request description why the file should grow rather than split. A new file crossing the threshold is the same: add its line, sorted by path. Shrinking needs nothing -- an entry higher than its file is not a failure -- and tools/source-size-ratchet.py --update tightens the baseline when you want it tightened, lowering entries and dropping files that fell under the threshold, but never raising one. Do not run --init after adoption: it silently accepts whatever has grown since.

Nothing here forces a split. The baseline in the adopting change is the list of files that already owe a stated reason to stay whole, not an endorsement of their length, and splitting them is planned work of its own; the ratchet only stops the numbers getting worse while it waits.

The job is in both can_enqueue's and can_merge's dependencies, and it is fork-guarded, because it executes a script from the checkout on self-hosted runners. A fork pull request therefore reports no ratchet verdict and can_enqueue counts the skip as success, which is the same trade smoke_collection makes; the merge queue runs the job, so the tree that lands is measured. .pre-commit-config.yaml declares the same check as a hook, which catches it earlier for anyone who has run pre-commit install.

tools/source-size-ratchet.py is copied byte for byte from templates/source-size-ratchet/ in shakenfist/development, and its threshold is a constant rather than a flag so that one review of the template is a review of every copy. Change it there and re-sync; the audit specification describes what the script counts, which extensions it reads, and the optional tools/source-size-exclude for generated or vendored trees.

Automated CI Jobs

functional-tests.yml carries three jobs which act on the pull request themselves rather than only reporting on it. A fourth piece of automation, merge failure triage, is a separate workflow for the reasons given below.

Automated Delinter

When flake8 fails, the automated_delinter job runs Claude Code to fix lint errors automatically. It skips if the last commit was from the bot to prevent loops.

Automated Exception Fixer

When functional tests detect exceptions in logs, the automated_exception_fixer job downloads the test bundles and runs Claude Code to analyze and fix the issues.

Automated Reviewer

After successful tests, the automated_reviewer job calls the shared shakenfist/actions/.github/workflows/pr-auto-review.yml@main reusable workflow, which reviews the PR with the review-pr-with-claude action. All the gating other than "CI passed" lives in that shared workflow: the runner, the 60 minute timeout, the pull-request-event and same-repository restrictions, its own concurrency group, and the bot-commit check which keeps a bot push from triggering a review which triggers another bot push. What this repository supplies is the needs: list naming the test jobs and the token permissions, which a cross-repository reusable workflow cannot grant itself.

The @shakenfist-bot please re-review command in pr-re-review.yml still uses the shakenfist/actions/review-pr-with-claude@main action directly, because it deliberately passes force to review a PR the bot has already reviewed.

The reviewer produces structured JSON reviews, creates GitHub issues for actionable items, and embeds the JSON in the PR comment so a later reader -- human or machine -- can recover the item vocabulary, severities and verdicts that the rendered markdown flattens. Nothing consumes it today: the comment addresser was the only reader, and it has been retired.

Merge failure triage

When Functional tests fails on a merge_group event, GitHub ejects the pull request from the merge queue and somebody has to decide whether the pull request broke something or whether the test cloud fell over again. merge-failure-triage.yml does that first pass automatically, following the same steps a maintainer follows by hand: find the first failing step (later failures are usually cascade), classify the failure as caused by the pull request or systemic, search for an existing tracking issue and record the occurrence on it — or file one — and recommend re-queueing or fixing first. The verdict is posted as a comment on the ejected pull request.

Merge groups here launch several nested test clusters at once, so merge CI is far more sensitive to under-cloud capacity than pull request CI is, and historically most merge failures have been environmental rather than code regressions. That prior is in the prompt, which is why the evidence rules below matter: a model given no evidence and that prior will happily conclude "systemic, re-queue".

Most of the work is in tools/merge-ci-triage.sh, which gathers the evidence, runs the model, and publishes the result; tools/merge-triage.py parses, validates and renders the verdict. The evidence includes the other recent merge group runs of the workflow that failed — --event merge_group on its own is every workflow in the repository, and those twenty slots exist to answer "is this happening to everybody?" about this suite.

A merge group run can also be cut short. The private-ci conductor's merge queue fail-fast cancels a run once one of its jobs has failed, so the queue moves on instead of waiting for the rest; that run concludes cancelled, which workflow_run never triages. The conductor dispatches the workflow for it instead, with cut_short: true and cut_short_job naming the job it saw fail. The flag alone is not believed, because after a cancel the aggregator job always fails, superseded runs included: the named job has to have concluded failure or timed_out in the run's latest attempt according to GitHub. A dispatch that does not check out — no job named, or a job that did not fail — publishes no document and fails the triage run, since only a broken dispatch gets there. A cancelled run dispatched without the flag is refused as before, and so is a failed run with it, which is workflow_run's to triage. A run that does check out is triaged as usual, with cut_short and cut_short_job (GitHub's spelling of the name) in the document's envelope, a line on the pull request comment saying so, and a paragraph in the prompt telling the model that cancelled jobs and steps were stopped deliberately and are not evidence. Failed-job selection counts timed_out jobs as failures on every run.

Why it is a separate workflow

The obvious implementation is another job in functional-tests.yml, gated on can_merge having failed. It races the queue: once Can merge reports its failure the queue ejects the pull request and tears down the gh-readonly-queue ref the run is on, and a triage job which takes minutes sits in exactly that window. Moving the triage into an earlier step of can_merge avoids the race but holds the merge queue open while a model reads logs. A job reachable on merge_group would also fall under the merge-group-cancellation audit, whose correct behaviour — be cancelled when a newer merge group supersedes you — is the opposite of what a triage job wants.

The workflow's permissions: block names actions: read, which is not optional: naming any scope at all sets every unnamed scope to none, and every piece of evidence the triage gathers is an Actions API read.

workflow_run runs after the merge group run has finished, on the default branch, in the base repository context, and none of that can cancel it. The trigger carries a branches: ['gh-readonly-queue/**'] filter so the workflow is only invoked for merge group runs; without it every pull request run of the test suite would create a skipped run here. workflow_run has no conclusion filter, so the "did it actually fail?" half of the gate is the job's if:.

The workflow never checks out or runs the code it is triaging. It reads the failed run through gh and checks out the default branch, which is what makes a writable token safe in a workflow that reads a pull request diff.

The verdict document

Each triage produces one JSON document matching tools/merge-triage-schema.json. It is published twice: as the merge-triage-<run id> build artifact, and embedded in a collapsed <details> section of the pull request comment, the same way the automated reviewer embeds its review. The private-ci conductor consumes these to track which merge failures have been triaged and which of them blamed the pull request, so the fields that matter to a consumer are:

Field Meaning
verdict pr_caused, systemic, ambiguous, or unknown
recommendation requeue, fix_first, or investigate
failure_signature Short stable string for grouping recurrences
tracking_issue Issue recording a systemic failure, or null
tracking_issue_action commented, created, or none
run_id, pull_request What was triaged

Four properties of that document are worth knowing before consuming it:

  • A document is always written. A model that answers in prose, a model that could not be run at all, a run that cannot be read, a document that fails its own schema — each yields verdict: unknown with an error explaining why, never a missing file. Those are different failures and the error names which one it was: the model wrapper's exit status is kept, so "every model is out of subscription credit" does not reach a maintainer disguised as "the response contained no JSON verdict object". The guarantee is kept by an EXIT trap over an envelope written before anything can fail, so it holds for the paths that fall over early too. A missing document is indistinguishable from a triage that never ran; an unknown one is not. The single exception is a run that was not a failed merge group run at all: nothing was triaged, so there is nothing to publish a verdict about. A document that failed the schema is uploaded alongside the replacement as triage.invalid.json, since that is a bug in the tooling rather than a triage outcome and the discarded document is the only evidence of it.
  • No evidence means no verdict. If neither the failed job list nor the failed step logs can be read, no model is run: the document says so and the verdict is unknown. Anything else that could not be gathered — the sibling runs, the pull request diff — is named in evidence, so a verdict always carries its own caveats rather than reading as though the model saw everything.
  • The envelope is not model output. The repository, run id and pull request number are written from what GitHub said and overwrite whatever the model put in those fields, so a verdict cannot be filed against the wrong failure. Only the fields in MODEL_FIELDS are taken from the response at all.
  • A cited tracking issue has been checked. A consumer can treat a non-null tracking_issue as evidence the occurrence really was recorded — but only when tracking_issue_action is commented or created, and those two are the claims that get verified. The issue has to exist and the issue or one of its comments has to carry the failed run's URL; a claim that does not check out is downgraded to an action of none, keeping the number as a reference and losing only the assertion, with the reason appended to evidence. An issue that cannot be read at all is dropped outright, number and all — on a dry run too, since an unreadable issue is not a useful pointer whichever mode produced the citation. A citation whose action is already none is not checked for the run URL — nothing was written to it, so it will not reference this run, and checking anyway would drop every reference-only citation ever made. A dry run forces none unconditionally, whatever the model reports, because nothing was written to GitHub on that path; the verification still runs against what the model claimed, so that path is exercised outside production too. On a dry run the missing reference is reported as such — nothing was written, so the citation is unverified — rather than in the words used for a claim that did not check out, which on that path would always read as a caught lie.

The comment is only posted if the body could be neutralised — tools/neutralise-pr-body.sh rewrites it in place, and a failure inside it would otherwise leave the un-neutralised model prose where gh pr comment reads it from. A triage nobody sees is a smaller problem than one that fires an @mention on publication, and the verdict is still in the artifact.

An unknown verdict is posted on the pull request like any other. It is a thin comment, but the alternative is silence, and silence on an ejected pull request reads as "triage never ran" — the same ambiguity the always-write-a-document rule exists to remove, moved from the artifact to the thread. The comment names why triage reached nothing, which is what tells a maintainer whether to look at the failed run or at this workflow.

Re-triaging the same run does not double-post: the comment carries an invisible <!-- merge-triage run:<id> --> marker which a later run recognises.

A comment that could not be posted fails the triage run. The verdict is in the artifact either way, but a green run with nothing on the pull request is indistinguishable from a triage that never ran, so the run itself carries the signal.

What the model can and cannot touch

The model runs with --dangerously-skip-permissions and the checkout as its working directory, so the job stages everything it executes into runner.temp before the model starts: merge-ci-triage.sh itself, merge-triage.py, its schema, neutralise-pr-body.sh and claude-model-fallback.sh. issue-fix.yml stages the same set for the same two reasons. Bash reads a script lazily as it executes, so an edit to the running driver would corrupt it mid-run; and the extractor and the neutraliser run after the model has exited, so reading them from the workspace would mean parsing and defusing model output with a copy the model could have rewritten. With the staging in place a workspace write has no effect at all — the checkout is discarded with the runner and is never pushed.

The failed step logs are cut to a byte budget before they reach the prompt, and both ends are kept with the tail given the larger share. Keeping only the head is the obvious implementation and it is wrong here: a single Ansible cluster-build step routinely exceeds the whole budget in progress output, and the message saying what actually broke is the last thing it emits. The elision is marked inline with the number of bytes dropped, and each half is passed through iconv -c so a cut landing inside a multi-byte character cannot leave invalid UTF-8 at the join.

The prompt reaches the model as a file, through claude-model-fallback.sh --prompt-file, which feeds it on stdin. Never as an argument: Linux caps a single argv element at 128KiB whatever ulimit says, this prompt is mostly log, and an argument over the cap does not truncate — the exec fails with Argument list too long and no model runs at all, on precisely the failures whose logs are largest. The byte budget above is therefore about what a model can usefully attend to and what the run costs, not about what can be passed to it. issue-fix.yml feeds its prompt the same way, for the same reason.

What the staging does not bound is worth stating plainly: the model runs with --dangerously-skip-permissions and no tool restrictions on a persistent self-hosted runner, so it can run arbitrary commands as the runner user, and anything it leaves outside the workspace — ~/.claude state, caches, the runner's own tree, a cron entry — survives the job and is there for whatever runs on that runner next. A narrower tool list does not help: triage reads GitHub through arbitrary gh sub-commands, so it needs Bash, and a model with Bash can write anything a --disallowed-tools list would have stopped. The risk is accepted on the same argument as the token — the content it is fed has already passed review, on the same runner fleet issue-fix.yml already hands a model with the same flags. Anything stronger means a disposable runner, not a longer flag list.

Developer Automation (Bot Commands)

Authorized users can trigger automation by commenting on PRs:

  • @shakenfist-bot please re-review - Triggers a fresh automated review of the PR using the shared review action.
  • @shakenfist-bot please retest - Dispatches functional-tests.yml against the PR branch, which is how a run is re-tried after a bot commit or an infrastructure failure without pushing a new commit. This is the merge queue's lane, not the pull request's, and it is the most expensive thing a comment can start here. The dispatch arrives as a workflow_dispatch event, and functional_lanes and schema_enum_widening are each gated on merge_group || workflow_dispatch -- so a retest runs the multi-node nested-cluster merge lanes on top of the pull request set. It does not run the weekly lanes (see Merge lanes and weekly lanes), the Ansible modules and Node lifecycle lanes among them, so a retest of a change to either suite does not exercise it; dispatch scheduled-tests.yml for that. Nor does the docs-only skip apply: check_paths runs its path filter only for events other than workflow_dispatch and otherwise defaults code_changed to true, so a documentation-only branch gets the whole suite. That is usually what you want, because the failure worth re-trying is normally a merge queue one -- but it is a poor way to re-run a lint job, and on a busy day it is several nested clusters' worth of under-cloud capacity. Re-run the individual failed workflow from the Actions tab when that is all that is needed.
  • @shakenfist-bot please attempt to fix - Runs Claude Code to fix unit test failures (tox -ecover). Uses test-drift-fix.yml with structured commit summaries.

issue-fix.yml is required to check a proposed fix against the plans in docs/plans/ before writing any code. Triage skims docs/plans/index.md and deprioritises issues an unlanded plan already owns; the fix job reads the plan files covering the code it means to change, follows the pattern established by phases which have landed, and declines with NO_FIX when an outstanding phase is the proper home for the fix. The plans are read from the checkout at run time rather than summarised into the workflow, because they change constantly. This exists because one-off automated fixes had been landing across partially implemented plans and having to be unpicked (see the step 3 note in docs/plans/PLAN-scheduler-reservations-phase-01-node-metrics-columns.md).

issue-fix.yml will not publish a fix whose non-test diff exceeds max_diff_lines (400 by default); an over-budget fix is pushed to its issue-fix-<N> branch for a human instead. Files that .gitattributes marks linguist-generated are not counted. That attribute covers the protobuf stubs tox -e genprotos writes, because adding one field to a message rewrites every serialized offset in the regenerated _pb2.py and once made a fix of about 200 lines measure 1800. The count is made by tools/measure-change-size.sh, a copy of the script in shakenfist/development's templates/issue-fix/. It reads both the attributes and the diff base from the commit recorded before the model ran, so a fix cannot mark its own code generated. It also fails closed: an inline git diff | awk without pipefail would measure a failing git as zero lines. shakenfist/tests/test_measure_change_size.py pins those rules, and test_issue_fix_workflow_seams.py checks that every stub under shakenfist/protos/ is still covered. Mark only files a generator writes: the attribute is an exemption from the cap as well as a display hint.

issue-fix.yml asks the model for two marker delimited blocks on stdout: a commit message and a pull request description. The commit message is pushed and its first line becomes the pull request title; the description is published as the pull request body, so an automated fix arrives explaining its own root cause, what it deliberately did not do, and any judgement call a reviewer might make differently, rather than as a diffstat under boilerplate.

Neither block is required. A missing description falls back to the commit message body, and a missing commit message to a generic note telling the reviewer to read the diff -- a correct fix is worth publishing even when the prose is lost. Both cases are logged rather than fatal, because the run cannot be retried to recover them.

The parsing lives in tools/extract-model-block.sh rather than inline in the workflow, and is covered by shakenfist/tests/test_extract_model_block.py. It takes only the first complete block, requires both markers (an unterminated block would otherwise run to the end of the captured output and swallow the block after it), treats a marker as a terminator only when it is the entire line, and strips a code fence only when one wraps the whole block -- never globally, because a description may legitimately quote code.

The description is model output, so the workflow assembles the pull request body into a file and passes it with gh pr create --body-file. It must never be interpolated into a shell string.

It is also run through tools/neutralise-pr-body.sh before publication, which drops the @ from a mention and separates an issue-closing keyword from its reference. Both of those are things GitHub acts on rather than renders: a mention notifies a real person the instant the draft is created, and a closing keyword closes an unrelated issue on merge. The prompt forbids both, and a side effect which fires automatically and cannot be undone should not rest on the model having complied. Fenced code is passed through untouched -- GitHub does not linkify inside a fence, and a description quoting a decorator or an email address is a normal description. shakenfist/tests/test_neutralise_pr_body.py covers both halves.

Neutralising the model's prose does not leave the draft unable to close its issue. The workflow appends its own Fixes #${ISSUE_NUMBER} as the first line of the body after this pass, above the model text and outside any fence the model may have left open, which is what satisfies the issue link check.

issue-fix.yml runs its fix attempt through tools/claude-model-fallback.sh, which takes a comma-separated preference list (--models, default claude-opus-5) and moves to the next model when one reports its subscription credit is exhausted, so a caller that passes a longer list gets a fallback. That case arrives as an HTTP 429 in the --output-format json payload (api_error_status), which the claude CLI's own --fallback-model flag does not handle -- it only covers overloaded or unavailable models. A refused request is free, so the wrapper attempts the real job rather than paying for a pre-flight probe.

Give it the prompt with --prompt-file, never as a claude argument. Linux caps a single argv element at 128KiB whatever ulimit says, and an argument over the cap does not truncate -- the exec fails with Argument list too long, so no model runs and the caller sees an empty answer it will blame on the model. --prompt-file feeds the prompt on stdin, which has no such limit. The option takes a path rather than reading the wrapper's own stdin because the wrapper may run claude more than once as it falls back through the model list, and one stream is drained by the first attempt. shakenfist/tests/test_claude_model_fallback.py covers both properties.

CI Caching

Workflows that download packages use environment variables to route traffic through local caches:

  • HTTP proxy: http_proxy/https_proxy set to http://192.168.1.15:3128 (Squid cache) for apt, curl, and general HTTP downloads.
  • PyPI mirror: PIP_INDEX_URL set to https://devpi.home.stillhq.com/root/pypi/+simple/ (devpi) for pip package installs.
  • uv mirror: uv does not read pip's PIP_* variables, so workflows that resolve with uv must also set UV_INDEX_URL (and UV_EXTRA_INDEX_URL if a fallback index is wanted) to the same values. Setting only PIP_INDEX_URL silently sends the uv resolve straight to pypi.

CI VMs provisioned by the shakenfist/actions Ansible playbooks also get system-level config files (/etc/apt/apt.conf.d/01proxy and /etc/pip.conf) so that the collection deploy and other tools use the caches. - Proxy bypass: no_proxy/NO_PROXY set to localhost,127.0.0.1,10.0.0.0/8 to prevent local service traffic from being routed through the proxy.

Guest images come from the cache disk

Guest images are not cached by the proxy -- they are too big to be worth it, and a nested cluster fetching one pays for it inside whatever await budget the test gave the create. The /srv/ci disk attached to the CI clusters carries a copy of each image the shakenfist/actions dependencies build caches, so a suite which boots a guest should import the cached copy and boot from the artifact rather than naming the image.

A disk base which is a well known image name (debian:11) is always an internet fetch: the server expands it against IMAGE_DOWNLOAD_URL and downloads it, whatever is on the cache disk. sf-client artifact upload <name> /srv/ci/<image> --shared --no-checksum turns a cached file into an artifact, and sf://upload/system/<name> is the base which boots it. The upload has to be shared for a test running in its own namespace to see it. shakenfist/deploy/ansiblemoduletests.sh does this for debian:11 and overrides the scenarios' debian_11_base with the result, falling back to the image name when the cache disk is absent.

Fork pull requests and the runner pool

Workflow runs from a fork wait for a maintainer's approval: fork-pr-contributor-approval on this repository is all_external_contributors, not just first-time ones. That is what makes the static runner pool safe to use for jobs that execute repository content.

It matters most for agent-context.yml. That lane runs on [self-hosted, static] -- a long-lived, shared host with the fleet proxy and devpi reachable -- and it builds its hook environment from the pull request head's own .pre-commit-config.yaml, which is also one of its triggers. So the set of third-party code it installs and runs is chosen by the change under test. Nothing else in this repository has that shape; every other PR-head job on the static pool runs code from a fixed configuration. The fork-approval setting is the control, so if it is ever relaxed this lane moves to an ephemeral vm runner rather than staying where it is.

mermaid-lint.yml executes tools/mermaid-lint.sh from the pull request head under the same rule, but on an ephemeral vm runner, and the container it starts gets --network none. It also refuses a fork's pull request outright, as defence in depth: the script itself runs on the runner, outside that container. The guard lives in the workflow a pull request can edit, so the approval setting stays the control.

Branch Protection

The develop branch uses: - Required status checks: Can see status, Can enqueue - Merge queue with ALLGREEN grouping strategy - Configuration exported to .github/exported-config/

agent-context.yml and mermaid-lint.yml are deliberate exceptions: both can fail a pull request and neither gates one. They are path-filtered, and a path-filtered workflow made a required check reports pending forever on the pull requests it filters out -- so a required Mermaid lint would block every pull request that touches no markdown. needs: cannot reach across workflow files either, so neither is named in can_enqueue or can_merge. A red result on either is visible on the pull request and blocks nothing automatically; treat it as something to fix before merging rather than as something the queue will catch.

Both lanes are vendored from shakenfist/development's templates: tools/mermaid-lint.sh is byte-identical to templates/mermaid-lint/mermaid-lint.sh there and is synced rather than edited. What this repository chooses for itself lives beside it in tools/mermaid-lint-exclude, which drops docs/components/ -- sync-external-docs.yml imports those 664 files hourly from the sibling repositories and AGENTS.md forbids editing them here, so a diagram broken upstream is fixed upstream rather than failing a pull request here that cannot fix it. GitHub Actions cannot read that file, so mermaid-lint.yml's path filters carry the same exclusion by hand and the two have to move together.

📝 Report an issue with this page