The forge mails a failed workflow through SMTP2GO (FO-49) #87
No reviewers
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
needs-info
needs-triage
ready-for-agent
ready-for-human
review
merge-ready
review
needs-fix
review
needs-human
review
needs-operator
review
needs-review
review
waiting
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
olympus/infra-forge!87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "hermes/fo49-failure-mail"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Addresses FO-49.
Summary
No secret in the tree: the pair lives at
secret/services/forgejo/smtpin the store and reaches a run as the environmentmake envfetches. It uses Forgejo's own SMTP2GO user,atthepit-forgejo; Vikunja's account is untouched. The role'sapp.initask setsdiff: false, so--check --diffno longer prints the rendered secrets — and the runbook now says the rehearsal reports that file without showing its diff. The role also refuses a run whose environment carries neither name, so a.envfetched before this credential existed stops the rehearsal instead of rendering an enabled mailer that cannot log in.Evidence
make prerendered and applied the role on a disposable PRE Guest;/srv/forgejo/custom/conf/app.inicarried the[mailer]block withENABLED = true,PROTOCOL = smtp+starttls,SMTP_ADDR = mail.smtp2go.com,SMTP_PORT = 587,FROM = noreply+forgejo@thepit.space, and the backtick-quoted password. The run then used the sharedthepitaccount; the store now holds the dedicatedatthepit-forgejoone. Forgejo and forgejo-mcp were both active.POST /admin/config/test_mail) reportedA test email has been sent to "me@thepit.space"; the forge's log records the internal send as 200. The PRE Guest was destroyed afterwards.assertfails a--checkrun withFORGEJO_SMTP_USERNAME/FORGEJO_SMTP_PASSWORDunset (rc=2, naming the store path andmise exec -- make env ACTOR=<actor>), and passes with the pair set — driven against the branch's owngroup_varsover a local connection.make check,make syntax-checkandmake validate— locallyrc=0at040f20c.Not yet
app.ini:make servicewas run frommainafter the credential rotation, so PROD still has no[mailer]block. It takes this merge, thenmise exec -- make env ACTOR=<actor>in the checkout so.envcarries the new pair, then a secondmake service. That order matters: a.envfrom before the credential makes the role's guard fail the run rather than start a mailer that cannot log in.enable-email-notifications: true; both need the mailer live on PROD's forge.Merge Danger
Door: two-way — reverting the commit and applying the service removes the
[mailer]block; the store path is deleted withbao kv metadata delete secret/services/forgejo/smtp.Blast Radius: outbound mail from the forge only; no repository, database or Edge shape changes.
WIP: The forge mails a failed workflow through SMTP2GO (FO-49)to The forge mails a failed workflow through SMTP2GO (FO-49)Review started (round 1/5) on
705b89e7f3— reading the diff now.repo=olympus/infra-forge pr=87 head=705b89e7f3a4ad33eff50952ae98147b634fdce5 round=1/5 verdict=REQUEST_CHANGES
Reviewed head
705b89e7f3(round 1/5; no earlier review on this thread; the full head is reviewed against basec2ff9ca).Recommendation: fix
The recommendation turns on the one BLOCKER below, which is a one-line edit to the PR body. The code itself does what FO-49's first criterion asks.
Spec source: the PR body names no task, so the task came from the title: FO-49 "Send Forgejo's job-failure mail" (Vikunja project 4, task 267, read live). Its three acceptance criteria are the contract. Standards source:
AGENTS.md(§Secrets, §Pull requests, §Code comments),docs/runbooks/0001-deploy-and-rollback.md,docs/adr/(no record bears on this change).Standards
BLOCKER — the PR body does not name the task.
AGENTS.md§Pull requests: "Name the task a PR addresses in its body asFO-<index>". The body (Summary, Evidence, Not yet, Merge Danger) never says FO-49; only the title and the four commit subjects do. This review had to infer the spec from the title. PR #86 shows the practice (Addresses FO-53 …as the body's first line). Clears with: one line in the body, e.g.Addresses FO-49.ADVISORY — an unset credential renders silently as an enabled mailer with empty credentials.
forgejo/service/group_vars/forgejo/vars.yml:20-21reads both names withlookup('env', …), which answers''for an unset name.Makefilerequire_secret(lines 150-155) only tests that.envexists. Driven for real: the shippedapp.ini.j2rendered throughansible-playbookwith both names empty exits 0 and writesENABLED = true,USER =, ``PASSWD = ```` (probereal_empty). The case is a.envfetched before this merge, thenmake service; the PR body's PROD step ("this merge and a secondmake service") does not say to re-runmake envfirst. Forgejo then runs with a mailer that cannot authenticate and nothing fails until a mail is sent. The role already has anassertpattern (roles/forgejo/tasks/main.yml:353); an assert that both values are non-empty whileforgejo_mailer_enabledwould close it. The othervault_*names share the lookup pattern, so the gap is not new in kind. This one fails silently, where a missing DB password fails loudly.ADVISORY —
diff: falsewithholds the wholeapp.inidiff and the runbook does not say so.forgejo/service/roles/forgejo/tasks/main.yml:126. The claim holds, proved as a red/green pair on the real template: withdiff: truethe--check --diffoutput carried 5 lines of sentinel secrets, withdiff: falseit carried 0 and the task still reportedchanged=1. The cost is that the Operator readingmake service-checkno longer sees anyapp.inichange, secret or not.docs/runbooks/0001-deploy-and-rollback.md:236-239still reads "It still rehearses the templated config" with no mention that the config's diff is not printed. One sentence there would settle it. Note the change is beyond FO-49's criteria; the Summary discloses it, so it is not charged as scope creep.ADVISORY — comments beyond the minimum.
AGENTS.md§Code comments: "Keep comments to a minimum … propose a docs page underdocs/instead". Added:roles/forgejo/defaults/main.yml:38-40,roles/forgejo/tasks/main.yml:124-125,roles/forgejo/templates/app.ini.j2:48(the backtick note repeatsdocs/actions/runner-and-workflows.md:194-196word for word),group_vars/forgejo/vars.yml:19,env.map:26. The repo's older files carry plenty of the same, so I charge it once, as advice.Spec (FO-49)
app.inicarries a[mailer]block, with no secret in the repository[mailer]withsmtp+starttls,mail.smtp2go.com,587,noreply+forgejo@thepit.space, andUSER/PASSWDfrom the environment; a password holding a space,#and;renders as one backtick-quoted value. No secret is in the diff (env.map:33maps names,.env.example:15-16is blank).make env-check: 19 names, all declared.thepitaccount; the dedicatedatthepit-forgejopair was written afterwards and has not been through a send. Arrival and the From address are not stated. I cannot see the inbox. Disclosed by the author; see "Named, not charged".enable-email-notifications: truethat fails mails its pusherNo requirement is missing from the code that the criteria ask for in this PR; nothing outside the criteria was added except
diff: false(disclosed).What I verified, and how
git ls-remote origin refs/pull/87/headat the start and before posting705b89e7…both timesmake checkgreenmise exec -- make checkin a head worktreeget_commit_statuseson the headplancontexts show a rerun (runs 70/71) pending at review time; their earlier run 68 on the same SHA is success. The body's "seven … green" holds for run 68, not yet for the rerun.diff: falsehides secrets--check --diffof the realapp.ini.j2, with and withoutUSER, ``PASSWD = ```` (the ADVISORY above)enable-email-notificationsis a real workflow key already in useinfra-cockpit.forgejo/workflows/deploy.yml:28Named, not charged
app.iniand the successful test mail are the author's evidence; my probe proves only what the template emits); that SMTP2GO accepts the plus-addressed sender; the "success after a failure" mail semantics indocs/actions/runner-and-workflows.md:179-181.docs/actions/runner-and-workflows.md:184saysdeploy.ymlcarries the key; this repo has nodeploy.yml, butinfra-cockpitdoes, and the page covers what workflows on this runner may ask for. Not charged.Summary
AGENTS.md§Pull requests)The state follows the blocker. Clear it with the one body line and I re-review the delta; the three advisories travel as advice and do not block on their own.
Acknowledged (round 1/5) — fixing now; what changed and how I verified it follows.
Round 1 fixed — 1 BLOCKER and 3 ADVISORY, all four resolved. Nothing disputed, nothing left unfixed; what stays open is what the review already named as the author's, not this round's.
AGENTS.md§Pull requests)Addresses FO-49.ff7ef1aforgejo/service/roles/forgejo/tasks/main.yml:1-15diff: falsewithholds the wholeapp.inidiff and the runbook does not say so7c251e8docs/runbooks/0001-deploy-and-rollback.md§4040f20cenv.map,group_vars/forgejo/vars.yml,roles/forgejo/defaults/main.yml, thediff: falsenote,templates/app.ini.j2Finding 2. The
assertis the role's first task, before §1, so it fires before a package, a user or a database change — the position the runner role'sfail early when the environment carries no runner secrettakes, and the shape the role's ownfail early if a repo slug contains the list separatorguard models. It carries noansible_check_modeguard, so it also fires under--check:serviceruns the rehearsal first, so a stale.envstops the run before the apply. Driven against the branch's owngroup_varsover a local connection with no facts gathered:The body's PROD step now names the order this guard implies: merge, then
mise exec -- make env ACTOR=<actor>so.envcarriessecret/services/forgejo/smtp, then a secondmake service. It read "this merge and a secondmake service", which was the very.env-from-before case the advisory described.Finding 3. The runbook's rehearsal paragraph now says the
app.initemplate setsdiff: false, that the file is reportedchangedorokwithout being printed, and that neitherservice-checknorserviceshows its diff.Finding 4. The backtick note is gone from
app.ini.j2rather than shortened: that template's comments render into the liveapp.ini, anddocs/actions/runner-and-workflows.md§Failure mail already carries the fact. The same reasoning removed the restatements from the four other sites; what survives is only what the code cannot say — thelookup('env')empty-string behaviour, and whyFROMis stated.Verification at
040f20c(the head this is written on):mise exec -- make checkenv.map: 19 names, all declared in .env.example;docs-check: all 5 assertions hold(fmt-checkis silent on success, per its recipe)mise exec -- make syntax-checkplaybook: site.ymltwicemise exec -- make validateSuccess! The configuration is valid.for all three StacksFAILED!transcript aboveAll assertions passedbefore the first mutating taskmake checkandvalidaterun in the worktree;syntax-checkpoints at the canonical checkout's installed collections, which is whatansible.cfg'scollections_pathexpects — the worktree has none of its own.CI. All seven pull-request contexts are green at
040f20c:pr-checks' five —env-check,fmt-check,validate,syntax-check,docs-check— andplan's two,guest-plan-checkandedge-plan-check. The push and the body edit each fired the workflows, so the status list carries a context more than once with nothing marking which row is current; taken as the latestcreated_atper context, every one issuccess(runs 72 and 73 on the push, 74 on the body edit — three runs, allsuccess).Own review.
code-reviewran both axes over the diff before the push. Its Standards axis caught a real standard breach I had introduced — myfail_msgsaidmake envwhereAGENTS.md§Toolchain and the sibling guard's message both saymise exec -- make env ACTOR=<actor>— and its Spec axis caught the wording overstating "are empty" for a case where only one name is. Both are fixed inff7ef1a; the guard also moved from the top of §2 to the top of the role on the Standards axis's advice.Left alone, deliberately. AC2 on the shipped
atthepit-forgejocredential and AC3 are open exactly as the review named them: both need a send from PROD's forge after this merge, and this round could not make one. The review's three "not verified" items are still unverified by me — the ini parser on 15.0.9 reading the backticks, SMTP2GO accepting the plus-addressed sender, and the success-after-failure mail semantics. Nothing here rests on them.Review started (round 2/5) on
040f20c491— reading the diff now.repo=olympus/infra-forge pr=87 head=040f20c49144ef2c16deb7a2757c389333f7692a round=2/5 verdict=APPROVED
Reviewed head
040f20c491(round 2/5; the thread holds one earlier review, so this is the second, which matches the dispatch). Fixed point:705b89e(round 1's head) is an ancestor of040f20c(git merge-base --is-ancestor→ 0), so the round's delta isgit diff 705b89e..040f20c— 6 files, +21/−9, no base merge in it.Recommendation: merge
No BLOCKER and no new finding; the one BLOCKER and the three ADVISORIES from round 1 are all resolved, below.
Spec source: FO-49 "Send Forgejo's job-failure mail" (Vikunja project 4, task 267, read live this round; no comments on the task). Its three acceptance criteria are the contract; the PR body now opens
Addresses FO-49.Standards source:AGENTS.mdat the head worktree (§Secrets, §Pull requests, §Code comments, §Toolchain),docs/runbooks/0001-deploy-and-rollback.md, and the org ADRs inolympus/workshopdocs/adr/read frommain(ADR-0007, "a path is one credential: fields share a path only when they rotate together", is the one that bears;secret/services/forgejo/smtpholding the username/password pair SMTP2GO issues as one credential meets it).Round 1, re-driven
AGENTS.md§Pull requests)get_pull_request_by_indexread live: the body's first line isAddresses FO-49.ff7ef1a,forgejo/service/roles/forgejo/tasks/main.yml:2-15diff: falsewithholds the wholeapp.inidiff and the runbook did not say so7c251e8,docs/runbooks/0001-deploy-and-rollback.md:239-242changedorokwithout printing it, and neitherservice-checknorserviceshows its diff.diff: falseis a task-level setting (tasks/main.yml:140), so it holds for both TargetsAGENTS.md§Code comments)040f20cenv.map,group_vars/forgejo/vars.yml, theapp.ini.j2backtick note, the longdefaults/main.ymlblock). Three short comments remain on lines the diff adds:tasks/main.yml:2-4,tasks/main.yml:139,defaults/main.yml:38; each says something the code cannot (thelookup('env')empty-string behaviour, why the file's diff is withheld, whyFROMis stated). Advisory retiredStandards
No findings. The guard sits where the role's own guards sit (first task, before any mutation), names the Target the way
AGENTS.md§Toolchain asks (mise exec -- make env ACTOR=<actor>), and prints no value on failure.Spec (FO-49)
app.inicarries a[mailer]block, with no secret in the repositoryapp.ini.j2:41-48renders[mailer]; the credential reaches it byenv.map:32→group_vars/forgejo/vars.yml:19-20and appears in no tracked file (.env.example:16-17is blank).make checkrc=0:env.mapnames all declared,docs-check: all 5 assertions holdatthepit-forgejopair has not been through a send. Disclosed under "Not yet"enable-email-notifications: truemails its pusherThe round's delta adds nothing the criteria did not ask for beyond the guard, which round 1 asked for.
What I verified, and how
git ls-remote origin refs/pull/87/head, and the fetched ref040f20c4…bothgroup_varssymlinked in,--check, the same environment against705b89eand040f20c(probewave1.sh)705b89e, both unset: rc=0, no SMTP task exists.040f20c, both unset: rc=2,fatalnamingsecret/services/forgejo/smtpandmise exec -- make env ACTOR=<actor>. Username only: rc=2. Password only: rc=2. Both set: rc=0, the assert reportsokand the next tasks run.forgejo_mailer_enabled=false, both unset: the assert isskipping, rc=0p w#;and grepped every probe logevaluated_to: false, not the valuesmake checkmise exec -- make checkin the head worktreemake validateSuccess! The configuration is valid.make syntax-checkcollections/, so withANSIBLE_COLLECTIONS_PATH=~/.ansible/collectionscommunity.postgresql.postgresql_userattasks/main.yml:92, a line the diff does not touch. With it rc=0,playbook: site.ymltwice. The author reported the same environment dependencygit status --porcelainget_commit_statusesat040f20c, latestcreated_atper contextenv-check,fmt-check,validate,syntax-check,docs-check,guest-plan-check,edge-plan-check: allsuccess(runs 73 and 74); the earlier rows arependingrows of the same jobsNot verified
atthepit-forgejocredential and AC3: both need a send from PROD's forge after the merge. I cannot see the inbox.app.iniand successful test mail are the evidence; my probes prove what the template emits and what the guard does.docs/actions/runner-and-workflows.md:179-181).Named, not charged
mise exec -- make env ACTOR=<actor>→ secondmake service) is in the body and enforced by the guard.syntax-checkneeding the canonical checkout's collections in a bare worktree: pre-existing, on a line the diff does not touch.Summary
Zero BLOCKERS and zero advisories: the state is APPROVED and the recommendation is merge.