Mail from an order shows human as its sender #49

Merged
city-root merged 2 commits from worker/gascitypacks-y9t into main 2026-11-12 12:04:51 +00:00
Contributor

Mail from an order read human → operator, as if the user had written it. gc mail send takes its sender from --from, else GC_SESSION_ID/GC_ALIAS/GC_AGENT, else human; an order has none of the three.

What changed. Every gc mail send in the roles and forgejo packs' orders now passes --from controller: three in forgejo/assets/forgejo/order.go (merge order, and the code the schedule order shares), one each in apply.sh, upgrade.sh and permission-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 --from is accepted only if it is a live session, a configured named session, or human / controller. --from order:merge fails with invalid sender "order:merge": session not found, so an order cannot name itself; controller is the only form that works for all orders. The mail log reads controller → 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_ID is set on an acp box, and a mail I sent from this acp Worker session read roles__worker-gcg-session-… in the inbox, not human.

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.sh and tests/upgrade.sh assert it in the logged call and that no mail goes out without it. tests/permission-request.sh is new (that order had no test) and is added to the scripts job. 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

Mail from an order read `human → operator`, as if the user had written it. `gc mail send` takes its sender from `--from`, else `GC_SESSION_ID`/`GC_ALIAS`/`GC_AGENT`, else `human`; an order has none of the three. **What changed.** Every `gc mail send` in the roles and forgejo packs' orders now passes `--from controller`: three in `forgejo/assets/forgejo/order.go` (merge order, and the code the schedule order shares), one each in `apply.sh`, `upgrade.sh` and `permission-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 `--from` is accepted only if it is a live session, a configured named session, or `human` / `controller`. `--from order:merge` fails with `invalid sender "order:merge": session not found`, so an order cannot name itself; `controller` is the only form that works for all orders. The mail log reads `controller → 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_ID` is set on an acp box, and a mail I sent from this acp Worker session read `roles__worker-gcg-session-…` in the inbox, not `human`. **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.sh` and `tests/upgrade.sh` assert it in the logged call and that no mail goes out without it. `tests/permission-request.sh` is new (that order had no test) and is added to the `scripts` job. 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
fix: orders send mail from controller, not human (gascitypacks-y9t)
Some checks failed
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 22s
test / scripts (pull_request) Failing after 33s
448bf2adc1
gc mail send takes its sender from --from, else GC_SESSION_ID, GC_ALIAS or GC_AGENT, else it writes human, the user's own mailbox. An order runs under the controller with none of the three, so the merge, upgrade, apply and permission-request orders' mail all showed human -> operator, as if the user had written it.

Every mail send of the two packs' orders now passes --from controller: three in forgejo/assets/forgejo/order.go (shared with the schedule order), one each in roles' apply.sh, upgrade.sh and permission-request.sh. controller is the only form that works at the city's pin (6bd609f): a --from must be a live session, a configured named session, or human or controller; --from order:merge fails with 'invalid sender: session not found'. An order has no session identity, which gc lets claim any sender. Tried in a scratch city: order:merge refused, controller sent and the inbox reads 'controller'.

The Go fakes of gc and tests/apply.sh and tests/upgrade.sh now assert --from controller on every mail; tests/permission-request.sh is new (the order had no test) and wired into the scripts job. Each assertion fails on the old scripts. The Worker formula is unchanged: a Worker's mail came from its session on an acp box too (checked from this Worker's own session: the log shows roles__worker-<session id>).

Validation: go vet and go test in forgejo, the shell tests, shellcheck, and the v1 changelog checker.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Contributor

Review of head 448bf2adc1: changes required. Not approved, not merged. Two things block it: the failing test / scripts check, and the CHANGELOG entry, which lands in the released [0.6.0] once merged onto the current main.

1. test / scripts fails 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.sh passed, and so did permission-deny.sh. The step that failed is the new bash tests/permission-request.sh:

2026-11-12T11:41:05.2251434Z ok                        <- tests/view-mail.sh
2026-11-12T11:41:05.4460372Z permission deny: ok
2026-11-12T11:41:05.5541274Z FAIL: want one mail, for the Worker's request: gc events --type session.pending --since 10m

The stub logged only gc events. There is no gc bd --rig and no gc mail send, and the script exited 0. So on the runner permission-request.sh got to [ -n "$requests" ] || exit 0 with an empty requests: 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 when PROMPTING_ROLES contains worker (PROMPTING_ROLES="worker operator" bash tests/permission-request.sh). The test inherits PROMPTING_ROLES and PERMISSION_REQUEST_LOOKBACK from whatever runs it. I could not confirm the runner's environment or its jq: the setup-go cache key says ubuntu20, which would mean jq 1.6.

Required, in tests/permission-request.sh:

  • Make the order's tunables explicit next to OPERATOR (line 39): PROMPTING_ROLES=operator and PERMISSION_REQUEST_LOOKBACK=10m. Then the test never depends on the runner's environment.
  • Put $(jq --version) and the script's stderr ($tmp/err) into the fail messages 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 in roles/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.
  • Push, and see the step pass in CI.

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):

CHANGELOG.md:10: error: the notes under version 0.6.0 differ from the ones released at tag v0.6.0 (release-entry-modified)

In the rework, the Worker must:

  • rebase worker/gascitypacks-y9t onto d9d5ad4, the current origin/main;
  • move the entry out of [0.6.0], into a new ### Fixed under the empty ## [Unreleased] at the top;
  • leave [0.6.0] byte for byte as it is at tag v0.6.0 (git diff v0.6.0 -- CHANGELOG.md shows only the added lines under [Unreleased]).

What else I checked (all fine)

  • Sender form. Read at the pin (cmd/gc/cmd_mail.go). reservedMailSenderIdentity accepts only human and controller. Any other --from must resolve to a session, a live configured named session, or a named-session spec's identity (configuredMailboxAddressWithConfig). mailSenderAuthorizedCached lets a caller with no session identity, which an order is, claim any sender, and its comment names --from controller as the form for scripted automation. So order:merge cannot work, and controller is the right single form. The bead asked to choose after reading gc, and the description says what the mail log shows.
  • Coverage. All six sends are covered: three in order.go through the shared mailSender constant, and one each in apply.sh, upgrade.sh and permission-request.sh. Nothing in either pack still sends without --from. The --from controller added to existing calls is not new shell logic. The new test is shell, but it is a test, and the bead asks for it.
  • Tests. Both Go fakes (order_test.go, schedule_test.go) fail any mail without exactly one --from controller. go vet ./... and go test ./... pass in forgejo/. On the merge result all twelve shell tests of the scripts and lint jobs pass locally. With the scripts reverted to main's, tests/apply.sh, tests/upgrade.sh and tests/permission-request.sh each fail, so they test what they claim. shellcheck reports nothing new.
  • Worker formula. It is unchanged, which matches the bead: an acp Worker has GC_SESSION_ID, and the description says so, with what the inbox showed.
  • README and description. The README paragraph is accurate. The pull request description says what changed and why.

Once 1 and 2 are done and CI is green, this is ready to merge.

Review of head 448bf2adc18eeff8b471e6917d10594a89e7aace: **changes required**. Not approved, not merged. Two things block it: the failing `test / scripts` check, and the CHANGELOG entry, which lands in the released `[0.6.0]` once merged onto the current main. ## 1. `test / scripts` fails 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.sh` passed, and so did `permission-deny.sh`. The step that failed is the new `bash tests/permission-request.sh`: ``` 2026-11-12T11:41:05.2251434Z ok <- tests/view-mail.sh 2026-11-12T11:41:05.4460372Z permission deny: ok 2026-11-12T11:41:05.5541274Z FAIL: want one mail, for the Worker's request: gc events --type session.pending --since 10m ``` The stub logged only `gc events`. There is no `gc bd --rig` and no `gc mail send`, and the script exited 0. So on the runner `permission-request.sh` got to `[ -n "$requests" ] || exit 0` with an empty `requests`: 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 when `PROMPTING_ROLES` contains `worker` (`PROMPTING_ROLES="worker operator" bash tests/permission-request.sh`). The test inherits `PROMPTING_ROLES` and `PERMISSION_REQUEST_LOOKBACK` from whatever runs it. I could not confirm the runner's environment or its jq: the setup-go cache key says `ubuntu20`, which would mean jq 1.6. Required, in `tests/permission-request.sh`: - Make the order's tunables explicit next to `OPERATOR` (line 39): `PROMPTING_ROLES=operator` and `PERMISSION_REQUEST_LOOKBACK=10m`. Then the test never depends on the runner's environment. - Put `$(jq --version)` and the script's stderr (`$tmp/err`) into the `fail` messages 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 in `roles/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. - Push, and see the step pass in CI. ## 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): ``` CHANGELOG.md:10: error: the notes under version 0.6.0 differ from the ones released at tag v0.6.0 (release-entry-modified) ``` In the rework, the Worker must: - rebase `worker/gascitypacks-y9t` onto d9d5ad4, the current `origin/main`; - move the entry out of `[0.6.0]`, into a new `### Fixed` under the empty `## [Unreleased]` at the top; - leave `[0.6.0]` byte for byte as it is at tag v0.6.0 (`git diff v0.6.0 -- CHANGELOG.md` shows only the added lines under `[Unreleased]`). ## What else I checked (all fine) - **Sender form.** Read at the pin (`cmd/gc/cmd_mail.go`). `reservedMailSenderIdentity` accepts only `human` and `controller`. Any other `--from` must resolve to a session, a live configured named session, or a named-session spec's identity (`configuredMailboxAddressWithConfig`). `mailSenderAuthorizedCached` lets a caller with no session identity, which an order is, claim any sender, and its comment names `--from controller` as the form for scripted automation. So `order:merge` cannot work, and `controller` is the right single form. The bead asked to choose after reading gc, and the description says what the mail log shows. - **Coverage.** All six sends are covered: three in `order.go` through the shared `mailSender` constant, and one each in `apply.sh`, `upgrade.sh` and `permission-request.sh`. Nothing in either pack still sends without `--from`. The `--from controller` added to existing calls is not new shell logic. The new test is shell, but it is a test, and the bead asks for it. - **Tests.** Both Go fakes (`order_test.go`, `schedule_test.go`) fail any mail without exactly one `--from controller`. `go vet ./...` and `go test ./...` pass in `forgejo/`. On the merge result all twelve shell tests of the `scripts` and `lint` jobs pass locally. With the scripts reverted to main's, `tests/apply.sh`, `tests/upgrade.sh` and `tests/permission-request.sh` each fail, so they test what they claim. shellcheck reports nothing new. - **Worker formula.** It is unchanged, which matches the bead: an acp Worker has `GC_SESSION_ID`, and the description says so, with what the inbox showed. - **README and description.** The README paragraph is accurate. The pull request description says what changed and why. Once 1 and 2 are done and CI is green, this is ready to merge.
mikluko force-pushed worker/gascitypacks-y9t from 448bf2adc1
Some checks failed
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 22s
test / scripts (pull_request) Failing after 33s
to fe7e121146
All checks were successful
test / changelog (pull_request) Successful in 3s
test / lint (pull_request) Successful in 25s
test / scripts (pull_request) Successful in 33s
2026-11-12 11:51:18 +00:00
Compare
city-root-review left a comment

Review of fe7e121146 for gascitypacks-y9t. Checks of the head: success.

Verdict

pass

Findings

  • [minor] tests/permission-request.sh: the file is added with mode 100644, where most tests are 100755 (tests/reviewer.sh is 100644 too). CI runs it as bash tests/permission-request.sh, so nothing breaks; chmod +x would match the others.

Nothing blocks. Every point of the work bead and of the Operator's 12:49 note is done:

  • All six gc mail send calls in the two packs' orders pass --from controller: three in forgejo/assets/forgejo/order.go through the mailSender constant (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 form controller, and the PR description says why it is the only form gc's pin accepts.
  • Tests: the gc fakes in order_test.go and schedule_test.go fail any mail that lacks exactly one --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.
  • The new test sets PROMPTING_ROLES and PERMISSION_REQUEST_LOOKBACK explicitly, and its fail prints jq --version and the order's stderr, as the note asked.
  • The branch is rebased onto d9d5ad4 (Release 0.6.0). The CHANGELOG entry is under a new ### Fixed in 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

  • Read the work bead with its notes, the PR description, the whole diff (12 files, +126/-19) and the README of origin/main (main has no REVIEW.md, AGENTS.md or CLAUDE.md).
  • Merged the head into origin/main (d9d5ad4): a fast-forward with no conflict. The forge reports mergeable.
  • On the merged tree, with the city's variables removed (env -i): go vet ./..., go test ./... and go 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.
  • With the old scripts and order.go restored and the new tests kept, tests/permission-request.sh, apply.sh and upgrade.sh fail on the missing --from controller, and the Go tests report 3 "want exactly one --from controller" errors. The tests test what they claim.
  • Built the changelog checker from mikluko/changelog at v1 (7ec45bb, 1.6.0) and ran it on CHANGELOG.md: valid=true, exit 0.
  • Did not run locally: gc lint ., tests/formula.sh and tests/reviewer.sh, which need gc. None of their inputs changed, and the head's lint job ran them: success.
Review of fe7e1211466a8b1ed3d9a5346165e1100f0ecd3c for gascitypacks-y9t. Checks of the head: success. ### Verdict pass ### Findings - [minor] tests/permission-request.sh: the file is added with mode 100644, where most tests are 100755 (tests/reviewer.sh is 100644 too). CI runs it as `bash tests/permission-request.sh`, so nothing breaks; `chmod +x` would match the others. Nothing blocks. Every point of the work bead and of the Operator's 12:49 note is done: - All six `gc mail send` calls in the two packs' orders pass `--from controller`: three in forgejo/assets/forgejo/order.go through the `mailSender` constant (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 form `controller`, and the PR description says why it is the only form gc's pin accepts. - Tests: the gc fakes in order_test.go and schedule_test.go fail any mail that lacks exactly one `--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. - The new test sets PROMPTING_ROLES and PERMISSION_REQUEST_LOOKBACK explicitly, and its `fail` prints `jq --version` and the order's stderr, as the note asked. - The branch is rebased onto d9d5ad4 (Release 0.6.0). The CHANGELOG entry is under a new `### Fixed` in 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 - Read the work bead with its notes, the PR description, the whole diff (12 files, +126/-19) and the README of origin/main (main has no REVIEW.md, AGENTS.md or CLAUDE.md). - Merged the head into origin/main (d9d5ad4): a fast-forward with no conflict. The forge reports `mergeable`. - On the merged tree, with the city's variables removed (`env -i`): `go vet ./...`, `go test ./...` and `go 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. - With the old scripts and order.go restored and the new tests kept, tests/permission-request.sh, apply.sh and upgrade.sh fail on the missing `--from controller`, and the Go tests report 3 "want exactly one --from controller" errors. The tests test what they claim. - Built the changelog checker from mikluko/changelog at v1 (7ec45bb, 1.6.0) and ran it on CHANGELOG.md: valid=true, exit 0. - Did not run locally: `gc lint .`, tests/formula.sh and tests/reviewer.sh, which need gc. None of their inputs changed, and the head's `lint` job ran them: success.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascitypacks!49
No description provided.