Repository navigation
PLX-253: every runner host mails its tenant of a full disk, a failed unit and a slot that cannot register - #92
Merged
davidjalbers merged 15 commits intoDec 3, 2026
Conversation
… item mail-relay (PLX-253) A newborn of its own, beside runner-host.test.ts, with a stand-in relay on the host's loopback that takes STARTTLS and AUTH and records what it is handed, and a forge that refuses mintings when told: a host without the item is set up and says so in its journal; with it, one mail per failed unit and for a disk over the housekeeping's threshold, none for one failed minting, one saying for how long for a slot that cannot mint past the threshold, no SMTP port on the loopback the slots share, and a refusing relay said in the journal. Co-Authored-By: Claude Opus <noreply@anthropic.com>
…ult's item mail-relay (PLX-253) The playbook mounts the host baseline's mail role as the platform's does, with mail_smtp from the vault's optional item mail-relay (server, port, mode, username, password, from-address, mailto). A vault without the whole item fails no run: the host is set up, sends no mail, and says so in its journal (logger, tag plexus-ci). The mail role gains mail_loopback_smtp, true by default, so app hosts stay as they are: false comments out master.cf's `smtp inet`, since a runner host's slots share its loopback and would otherwise mail as the host. Co-Authored-By: Claude Opus <noreply@anthropic.com>
… minutes, and says for how long (PLX-253) A slot fails as a unit at every failed attempt and is started again, so the host's mail on a failed unit would mail one refusal of the forge. ci-runner-jit keeps the first failed attempt of a row in /run/ci-runner/<slot>.failing, which a minting that succeeds, or a stop, removes, and says at each failure for how long the slot has failed. A drop-in of failure-mail@ adds an ExecCondition, ci-runner-mail-hold, which holds back the mail on a slot until that row is actions_runners_slot_alert_after old (300 s); a slot whose container failed, and every other unit, mails at once. The retry loop and its cadence are unchanged; the mail role's daily interval keeps it to one mail. The headers of the playbook, of both Terraform modules and of the template's root ci/ name the vault's item mail-relay. Co-Authored-By: Claude Opus <noreply@anthropic.com>
…e, and a failure of the same unit earlier that day (PLX-253) New and changed cases of the runner host's mail newborn, ahead of the code: an item that lacks a field, leaves one empty or names an unknown mode is no item, and a field on the command line counts; a mail role that fails fails no run; the disk check mails although the housekeeping mailed that day; a slot that cannot register mails although its container failed that day; the row of failed mintings fails towards mailing (a row or a threshold that is no number, a stop between two attempts, a minting systemd ends for its time); mail_loopback_smtp opens the port again and closes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r own, with a mail budget of their own (PLX-253) ci-runner-disk, hourly by its own timer, is the disk check the housekeeping ran after its pull: a pull that failed earlier the same day no longer takes the disk's mail, and one that fails for a full disk no longer keeps the check from running. ci-runner-cannot-register@<slot>, started by the slot's ExecStopPost after an attempt that failed, fails once the row of failed mintings is older than actions_runners_slot_alert_after and says for how long; a container of the slot that failed earlier the same day takes nothing from its mail. The slot's own mail is held back for a failed minting alone. The row fails towards mailing: it holds the host's uptime, which no time step moves; it is written as an attempt starts, so that one systemd ends for its time counts; a start that is no restart of systemd's begins a new one; a row or a threshold that holds no number mails at once and says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng mail role leave a host set up and say why it sends no mail (PLX-253) What is wrong with the mail relay is computed from the variables, so that a ci_mail_* given on the command line counts, as vars/vault.yml says of every variable; an empty field counts as missing, and a mode other than starttls or tls is said. The mail role runs first in the second play, in a block whose rescue says in the journal what failed, so that a Postfix that cannot be installed fails no run and stops no slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ring the line false commented out (PLX-253) False comments out smtp inet behind a mark of the role's; true restores the marked line alone, so a line commented out by hand stays. On a host with the default the file is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…point to vars/vault.yml for its fields (PLX-253) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers/plx-253-every-runner-host-notifies
…ers/plx-253-every-runner-host-notifies
…PLX-253) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out mail; the hold says what a held-back minting's mail rests on (PLX-253) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers/plx-253-every-runner-host-notifies
…ers/plx-253-every-runner-host-notifies
# Conflicts:
# templates/repo-operations/files/{% if ci_jobs_strategy == 'byom' %}ci{% endif %}/main.tf.jinja
# terraform/ci_runner_host_user_data/main.tf
davidjalbers
deleted the
davidjalbers/plx-253-every-runner-host-notifies
branch
December 3, 2026 04:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PLX-253: every runner host set up by
plexus.ci.playbookmails its tenant when its disk passes the threshold, when a unit of its own fails, and when a slot cannot register for longer than a few minutes.Since 0.135.0 a runner host sent no mail.
Mechanism
mailrole, as the platform's playbook does: Postfix send-only, every sender and recipient rewritten to the tenant's, and the role'sfailure-mail@as theOnFailure=of every service, at most once a day per unit (mail_failure_interval).mail_smtpcomes from the vault<owner>-ci-host, one item read like the others invars/vault.yml, its entries markedoptional.ci-runner-disk.service, hourly by its own timer, a unit apart from the housekeeping, fails when the root file system is fuller thanactions_runners_disk_alert_percent(85).Its mail says "root file system N% used" and "above 85%: look at …".
Being a unit of its own, it has its own daily budget: a pull that failed earlier the same day takes nothing from it, and a pull that fails because the disk is full does not keep it from running.
Restart=alwaysthrough the failed state, soOnFailure=fires each time; tried).ci-runner-jitwrites/run/ci-runner/<slot>.failing, the host's uptime in seconds (/proc/uptime, which no time step moves), as an attempt starts where there is no row, and removes it once it has minted.A start that is not one of systemd's restarts (
NRestarts0) begins a new row, since a stop between two attempts runs noExecStopPost(tried) and would leave the old one.A minting that systemd ends for its time keeps the row, since it was written at the start.
ExecStopPoststartsci-runner-cannot-register@<slot>.service(--no-block).It fails once the row is older than
actions_runners_slot_alert_after(300 s) and says "the slot repo-1 has failed to mint its runner config at every attempt for 6 min 2 s", followed by the slot's last 20 journal lines; younger, or without a row, it exits 0 and nobody is mailed.Being a unit of its own, it has its own daily budget: a container of the slot that failed earlier the same day, which a job can cause on purpose, takes nothing from it.
failure-mail@.service(20-ci-runner.conf) addsExecCondition=ci-runner-mail-hold %i, which holds back the mail on a slot while its row holds a number, that is, for a failed minting; a container that failed after it minted is mailed at once.A condition that holds back is no failure, and the role's script touches its stamp only after the condition, so a held-back attempt does not count as sent.
ci-runner-cannot-registerfail at once and say what it holds, and lets the slot's own mail go.A held-back minting is mailed only if the slot's
ExecStopPostcan startci-runner-cannot-register@, as the hold's header says.starttlsortls: no run fails; the host is set up and says in its journal (logger --tag plexus-ci --priority user.warning) "This host sends no mail: the item mail-relay of the vault<owner>-ci-hostlacks port; the item mail-relay names the mode pigeon, which is neither starttls nor tls. …".What is wrong is computed from the variables, not from the reads, so a
ci_mail_*given on the command line counts, as the header ofvars/vault.ymlsays of every variable.It runs before the roles, as before ahead of the units it reports on, so that a slot that cannot register on the first run is mailed about.
postfix/smtp: "SASL authentication failed; server … said: 535 …").The vault item
mail-relayin<owner>-ci-host, fields in the style of the others, each filling the key ofmail_smtpbeside it:mail_smtpserverserverportport587modemodestarttlsortls(implicit TLS)usernameusernamepasswordpasswordfrom-addressfrom_addressmailtomailtoAll seven, none empty, or none: anything less is a host without mail, and the journal line names what is wrong.
vars/vault.ymlis the one place the fields are named; the headers of the Terraform module and of the renderedci/main.tfname the item and point there.A change to the
mailroleThe role assumes that nothing untrusted reaches the host's loopback: Postfix listens on 127.0.0.1:25 and, by its defaults (
mynetworks_style = host,permit_mynetworksinsmtpd_relay_restrictions, read in postconf(5), not tried), relays what loopback hands it.A runner host's slots share its network, so a job could mail as the host, to the tenant's mailbox, through the tenant's relay.
The role gains
mail_loopback_smtp, true by default; the runner host's playbook sets it false.False comments out
smtp inetinmaster.cfbehind a mark of the role's (#closed by mail_loopback_smtp:); true restores that marked line alone, so it round-trips and leaves a line commented out by hand as it is.On an app host the file is unchanged: the task that reopens finds no marked line, and the one that closes is skipped (by reading; no app host was run).
mail(1), cron andfailure-mailsubmit throughsendmail(1)and are unaffected (the tests' mails go that way).Tests
newborns/runner-host-mail.test.ts, a newborn besiderunner-host.test.ts: the same privileged Debian 13 container with systemd, the same stand-in forop, a forge stand-in that refuses mintings or keeps one waiting when told, a relay stand-in on the host's loopback (STARTTLS, AUTH PLAIN and LOGIN, 535 when told, each message recorded), and in place of a slot's container a runner that waits for a job that never comes.Thirteen tests, in order:
mailto, leavesusernameempty and names the porttwenty-fiveand the modepigeon, withci_mail_mailtoon the command line: the run passes, the slot runs, Postfix is not installed, and the journal namesusername,twenty-fiveandpigeonand notmailto.plexus.host.mail.-vvvprints neither the relay's user nor its password, Postfix runs, and nothing listens on port 25.ci-runner-disk.service, that says how full, though the check fails twice.ci-runner-cannot-register@repo-1.service, not before the threshold, saying "for 1 min …"; two more refused attempts mail nothing more, and the slot's own mails stay at the container's one.ci-runner-cannot-registerandci-runner-mail-holdby hand: no row (exit 0, mail); a young row (no mail, hold); a row 150 s old (mail, "for 2 min … s"); a row of garbage (mail at once, sayinggarbage; the hold lets the slot's mail go); a thresholdsoon(mail, sayingsoon).mail_loopback_smtptrue by-eopens port 25 again, a run without it closes it, and a run after that reports the close taskok, notchanged.Red first, each run of the one file alone:
7f72774, the first seven tests alone: all red, each because the host had no mail.b8a4c31, the mail mounted without the hold: the slot's test red for the right reason, a single failed minting attempt mailed.036b65a, the review's points: tests 1 to 7 green as before; and on7b016c2(the new tests, with the code of036b65a) eight red, each for its point: 2, the journal namedmailto(from the read, not the variable) and notport(an empty field counted as present); 3, the run failed at "Install Postfix and mail(1)"; 6, no mail aboutci-runner-disk.service(the check was the housekeeping's, whose day's mail the pull had taken); 8, no mail aboutci-runner-cannot-register@repo-1.servicewithin 5 min (the container's mail had taken the slot's day); 9,ci-runner-cannot-registernot found; 10, the row after the new start was the old one; 13, port 25 stayed closed withmail_loopback_smtptrue.Test 11 failed there on its own precondition, a row left by test 10's failure;
be3d060makes it wait for a running slot, and run alone after test 1 on the same old code it was red for its point: systemd ended the minting at 20 s and no row was left.f82a5df, the code: all thirteen green, exit 0 in 775 s; and again on the merge2b9a7c2ofplain-pipeline-2, exit 0 in 795 s.mise run test: exit 0 on the merge2b9a7c2(check first), and one4b94f3after the merge ofc64f5fe.The port case (
d77c621,e4b94f3) was added after the last newborn run and has not run in it; the coordinator's run covers it.Tried, and not
The disk was not filled: the container's root is the test machine's disk, so a drop-in puts the threshold under what the disk holds.
The container runs the same playbook against localhost as root with the bootstrap token alone; cloud-init and a disk of its own are what it lacks.
runner-host.test.ts,runner-unregister.test.tsand the rest ofmise run e2e, left to the coordinator.They run the changed playbook (optional vault entries; the mail role skipped without the item) and the changed slot unit (one
ExecStopPostthat startsci-runner-cannot-register@), andrunner-host.test.tsasserts the housekeeping timer, which is unchanged beside the new disk timer.Readings
ci-runner-disk,ci-runner-cannot-register@<slot>), each with the mail role's daily budget per unit, rather than budgets of their own inside the mail role, which would be a second mailer or a larger role change.What still shares a budget: two failures of one unit on one day (the housekeeping's registry refresh and its pull; a slot's container twice; a slot that cannot register, recovers and cannot again) are one mail.
ExecConditionon the mail role's unit, not byRestartMode=directon the slot: withdirecta failed attempt never fails the unit, butsystemctl startthen waits until a minting succeeds (tried: it hung), so the playbook's restart of the slots would hang through a forge outage.mail_failure_interval.portandmode; an empty field counts as missing.loggerat each run, beside the run's output, which under cloud-init is a file nobody reads.ci-runner-cannot-registerand of a slot carries the slot's last journal lines, the runner's own output among them (job and repository names); it goes to the tenant's own mailbox.For a tenant
Create the item
mail-relayin<owner>-ci-hostwith the seven fields.Hosts that exist get this with their replacement: a runner host is never updated.
Owed
mail-relay, as the issue names; the maintainer's to write.approaches/delivery.md:<owner>-ci-hostgains the mail relay, optional;byom: the vault's items gain the optionalmail-relay, with the fact that the tenant provides the relay and that a host without it sends no mail.The field list stays in
vars/vault.ymlalone (§ 1.8, one home).approaches/platform.md: the CI playbook's roles ("takes the baseline, the container engine,plexus.ci.turbo_cacheandplexus.ci.actions_runners") gainmail, and the line "On a CI runner host the role's removal is off" gains a twin for the mail role: on a CI runner host its SMTP port on loopback is closed (mail_loopback_smtp), since the slots share the host's network.Done when, not met
No virtual machine: see "Tried, and not".
🤖 Generated with Claude Code