Mail from an order shows human as its sender #49
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/gascitypacks!49
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-y9t"
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?
Mail from an order read
human → operator, as if the user had written it.gc mail sendtakes its sender from--from, elseGC_SESSION_ID/GC_ALIAS/GC_AGENT, elsehuman; an order has none of the three.What changed. Every
gc mail sendin the roles and forgejo packs' orders now passes--from controller: three inforgejo/assets/forgejo/order.go(merge order, and the code the schedule order shares), one each inapply.sh,upgrade.shandpermission-request.sh.Why
controller, and what the log shows. Read at the pin (6bd609f,cmd/gc/cmd_mail.go) and tried in a scratch city (gc init --no-start): a--fromis accepted only if it is a live session, a configured named session, orhuman/controller.--from order:mergefails withinvalid sender "order:merge": session not found, so an order cannot name itself;controlleris the only form that works for all orders. The mail log readscontroller → operator, and the subject says what the mail is about (upgrade: fetch failed,Pull request merged: …). An order has no session identity, which gc lets claim any sender, so nothing refuses it.The Worker's formula is unchanged. A Worker's mail comes from its session:
GC_SESSION_IDis set on an acp box, and a mail I sent from this acp Worker session readroles__worker-gcg-session-…in the inbox, nothuman.Tests. The Go fakes of gc (
order_test.go,schedule_test.go) fail any mail without exactly one--from controller, and the exact-argument assertions include it.tests/apply.shandtests/upgrade.shassert it in the logged call and that no mail goes out without it.tests/permission-request.shis new (that order had no test) and is added to thescriptsjob. I checked that the shell tests fail against the old scripts.go vet/go test, the shell tests, shellcheck and the v1 changelog checker pass locally.CHANGELOG entry under [Unreleased], Fixed; README says who order mail is from.
Bead: gascitypacks-y9t
Review of head
448bf2adc1: changes required. Not approved, not merged. Two things block it: the failingtest / scriptscheck, and the CHANGELOG entry, which lands in the released[0.6.0]once merged onto the current main.1.
test / scriptsfails in the new test (run 1704, job 4380)This is not the known random failure of
tests/view-mail.sh(gascitypacks-r82, gascitypacks-wxd).view-mail.shpassed, and so didpermission-deny.sh. The step that failed is the newbash tests/permission-request.sh:The stub logged only
gc events. There is nogc bd --rigand nogc mail send, and the script exited 0. So on the runnerpermission-request.shgot to[ -n "$requests" ] || exit 0with an emptyrequests: its jq filter dropped the Worker's request too. Locally the test passes with jq 1.8.2 and with jq 1.7.1. I get exactly the CI message only whenPROMPTING_ROLEScontainsworker(PROMPTING_ROLES="worker operator" bash tests/permission-request.sh). The test inheritsPROMPTING_ROLESandPERMISSION_REQUEST_LOOKBACKfrom whatever runs it. I could not confirm the runner's environment or its jq: the setup-go cache key saysubuntu20, which would mean jq 1.6.Required, in
tests/permission-request.sh:OPERATOR(line 39):PROMPTING_ROLES=operatorandPERMISSION_REQUEST_LOOKBACK=10m. Then the test never depends on the runner's environment.$(jq --version)and the script's stderr ($tmp/err) into thefailmessages at lines 44 and 46. A failure on the runner then shows which of the two causes it is. If CI still fails after the first change, the cause is the runner's jq and the filter inroles/assets/scripts/permission-request.sh(around line 49) must work on it. Changing that filter is a fix to an existing call, not new logic.2. CHANGELOG: rebase onto the 0.6.0 release
main is now
d9d5ad4"Release 0.6.0 (#50)". This branch merges onto it without a conflict, and that is the trap. git puts the entry from line 32 under## [0.6.0] - 2026-11-12→### Fixed, because the new## [Unreleased]above it is empty. In that merge result the changelog check fails (mikluko/changelog v1.6.0, built from its tag and run on the merge):In the rework, the Worker must:
worker/gascitypacks-y9tontod9d5ad4, the currentorigin/main;[0.6.0], into a new### Fixedunder the empty## [Unreleased]at the top;[0.6.0]byte for byte as it is at tag v0.6.0 (git diff v0.6.0 -- CHANGELOG.mdshows only the added lines under[Unreleased]).What else I checked (all fine)
cmd/gc/cmd_mail.go).reservedMailSenderIdentityaccepts onlyhumanandcontroller. Any other--frommust resolve to a session, a live configured named session, or a named-session spec's identity (configuredMailboxAddressWithConfig).mailSenderAuthorizedCachedlets a caller with no session identity, which an order is, claim any sender, and its comment names--from controlleras the form for scripted automation. Soorder:mergecannot work, andcontrolleris the right single form. The bead asked to choose after reading gc, and the description says what the mail log shows.order.gothrough the sharedmailSenderconstant, and one each inapply.sh,upgrade.shandpermission-request.sh. Nothing in either pack still sends without--from. The--from controlleradded to existing calls is not new shell logic. The new test is shell, but it is a test, and the bead asks for it.order_test.go,schedule_test.go) fail any mail without exactly one--from controller.go vet ./...andgo test ./...pass inforgejo/. On the merge result all twelve shell tests of thescriptsandlintjobs pass locally. With the scripts reverted to main's,tests/apply.sh,tests/upgrade.shandtests/permission-request.sheach fail, so they test what they claim. shellcheck reports nothing new.GC_SESSION_ID, and the description says so, with what the inbox showed.Once 1 and 2 are done and CI is green, this is ready to merge.
448bf2adc1fe7e121146Review of
fe7e121146for gascitypacks-y9t. Checks of the head: success.Verdict
pass
Findings
bash tests/permission-request.sh, so nothing breaks;chmod +xwould match the others.Nothing blocks. Every point of the work bead and of the Operator's 12:49 note is done:
gc mail sendcalls in the two packs' orders pass--from controller: three in forgejo/assets/forgejo/order.go through themailSenderconstant (handOver, recordMerge, mailOperatorBead, which the schedule order shares), and one each in roles/assets/scripts/apply.sh:53, upgrade.sh:63 and permission-request.sh:82. A grep of roles/ and forgejo/ finds no other mail an order sends. The remaining calls are in the Worker's and Reviewer's formulas and skills, which send from a session. The Operator accepted the sender formcontroller, and the PR description says why it is the only form gc's pin accepts.--from controller, and the exact-argument assertions now include it. tests/apply.sh, tests/upgrade.sh and the new tests/permission-request.sh assert the flag in the logged call and that no mail goes out without it.failprintsjq --versionand the order's stderr, as the note asked.d9d5ad4(Release 0.6.0). The CHANGELOG entry is under a new### Fixedin the empty [Unreleased], and [0.6.0] is byte-identical to the tag v0.6.0. The README has a "Who the mail is from" paragraph, and the PR has a description, including the check of the Worker's mail on an acp box.Verified
d9d5ad4): a fast-forward with no conflict. The forge reportsmergeable.env -i):go vet ./...,go test ./...andgo test -race ./...in forgejo/ all pass. tests/permission-request.sh, apply.sh, upgrade.sh, merge.sh, view-beads.sh, view-mail.sh, permission-deny.sh, worktree-setup.sh, worktree.sh and gnu-tools.sh all print ok.--from controller, and the Go tests report 3 "want exactly one --from controller" errors. The tests test what they claim.gc lint ., tests/formula.sh and tests/reviewer.sh, which need gc. None of their inputs changed, and the head'slintjob ran them: success.