An order on order.failed tells the Operator when an order keeps failing #83

Merged
city-root merged 3 commits from worker/gascitypacks-lwe0 into main 2026-11-12 19:41:44 +00:00
Contributor

Adds the failures order to the roles pack: it mails the Operator when an order keeps failing, which nothing read until now (138 order.failed events in the day to 2026-11-12 15:35, 128 of them the merge order of rig rexcity, none told to anyone).

What it does. Counts failed runs per order and scope (the event's subject, e.g. merge:rig:rexcity) since the last run that went through (order.completed, same subject). At 3 in a row (FAILURES_STREAK) it sends ORDER FAILING <order>: <n> runs in a row (from controller, --notify, last error in the body, dedup on the streak's first failure); when that order runs again, ORDER RECOVERED <order>. A streak that ends before 3 mails nothing. State (cursor + streaks) in failures.json under the pack's state directory; a failed mail is retried by the next run.

Where it differs from the bead's sketch

  • Cooldown order (5m), not on = order.failed: the recovery mail has no failure event to trigger it, and an order on order.completed would run for each of the ~10k runs a day.
  • gc events --after needs --follow/--watch, so the order reads a --since lookback (2h) and keeps its own cursor (head taken first with gc events --seq), which counts each event once and keeps a daily order's streak across days.
  • The event carries enough: subject names order and scope, message the error; order.completed carries the same subject.
  • Streak length 3: orders run every 2–10 min, so 6–30 min of failure; one-off blips tell nobody.

Also: the Operator lookup, state dir and atomic write moved from handover.go to common.go, shared by both orders (handover behaviour unchanged; its test now calls o.e.stateDir()). README section, docs/shell.md line, changelog fragment, and tests/failures.sh (wrapper test, added to the scripts job).

Verified: go vet ./... and go test ./... (new failures_test.go: streak, ended streak, per-order, recovery, failed mail retry for both mails, incident across an unsent recovery, head/cursor/log reset, env knobs, stale pruning, error truncation, gc errors); tests/failures.sh, tests/handover.sh; gc lint .; changelog v2 check valid=true; the real tool run against the live city's events with gc mail send stubbed (no streak open right now, so nothing mailed, state written, second run quiet).

Bead: gascitypacks-lwe0

Adds the `failures` order to the roles pack: it mails the Operator when an order keeps failing, which nothing read until now (138 `order.failed` events in the day to 2026-11-12 15:35, 128 of them the `merge` order of rig rexcity, none told to anyone). **What it does.** Counts failed runs per order and scope (the event's `subject`, e.g. `merge:rig:rexcity`) since the last run that went through (`order.completed`, same subject). At 3 in a row (`FAILURES_STREAK`) it sends `ORDER FAILING <order>: <n> runs in a row` (from `controller`, `--notify`, last error in the body, dedup on the streak's first failure); when that order runs again, `ORDER RECOVERED <order>`. A streak that ends before 3 mails nothing. State (cursor + streaks) in `failures.json` under the pack's state directory; a failed mail is retried by the next run. **Where it differs from the bead's sketch** - Cooldown order (5m), not `on = order.failed`: the recovery mail has no failure event to trigger it, and an order on `order.completed` would run for each of the ~10k runs a day. - `gc events --after` needs `--follow`/`--watch`, so the order reads a `--since` lookback (2h) and keeps its own cursor (head taken first with `gc events --seq`), which counts each event once and keeps a daily order's streak across days. - The event carries enough: `subject` names order and scope, `message` the error; `order.completed` carries the same subject. - Streak length 3: orders run every 2–10 min, so 6–30 min of failure; one-off blips tell nobody. Also: the Operator lookup, state dir and atomic write moved from `handover.go` to `common.go`, shared by both orders (handover behaviour unchanged; its test now calls `o.e.stateDir()`). README section, `docs/shell.md` line, changelog fragment, and `tests/failures.sh` (wrapper test, added to the `scripts` job). **Verified:** `go vet ./...` and `go test ./...` (new `failures_test.go`: streak, ended streak, per-order, recovery, failed mail retry for both mails, incident across an unsent recovery, head/cursor/log reset, env knobs, stale pruning, error truncation, gc errors); `tests/failures.sh`, `tests/handover.sh`; `gc lint .`; changelog v2 check `valid=true`; the real tool run against the live city's events with `gc mail send` stubbed (no streak open right now, so nothing mailed, state written, second run quiet). Bead: gascitypacks-lwe0
feat: an order tells the Operator when an order keeps failing (gascitypacks-lwe0)
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 21s
test / scripts (pull_request) Successful in 37s
decb258431
gc records every failed run of an order as an order.failed event and every run that went through as order.completed, with the order and its scope as the subject, and nothing read them: in the day to 2026-11-12 15:35 the log held 138 failures, 128 of them the merge order of rig rexcity reading a forge that answered 503, and the Operator heard of none.

The new failures order, roles order failures in the Go tool (docs/shell.md: it keeps state and decides), counts failed runs per subject since the last that went through. At three in a row it mails the Operator ORDER FAILING <order>: <n> runs in a row with the last error and a dedup key on the streak's first failure; when that order runs again it mails ORDER RECOVERED <order>. A streak that ends before three mails nothing. The event carries enough: subject names the order and scope, message the error, and order.completed carries the same subject for the recovery.

Two choices differ from the bead's sketch. The order is a five-minute cooldown order and not one on order.failed: the recovery has no failure event to trigger it, and an order on order.completed would run for each of the thousands of runs a day. And gc events --after needs --follow, so the order keeps a cursor (the highest sequence read, bounded by gc events --seq taken first) in failures.json beside the streaks, which counts each event once whatever the lookback and keeps the streak of a daily order across days.

The Operator lookup, state directory and atomic file write move from handover.go to common.go for both orders. Validation: go vet and go test ./... (new failures_test.go, 14 cases incl. state across runs, failed mails retried, head/cursor edges), tests/failures.sh and tests/handover.sh, gc lint ., and a run of the real tool against the live city's events with mail stubbed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review requested changes 2026-11-12 17:35:51 +00:00
Dismissed
city-root-review left a comment

Review of decb258431 for gascitypacks-lwe0. Checks of the head: success.

Verdict

fail

Findings

  • [blocking] (merge) The pull request does not merge into main (3316228): the forge says not_mergeable, and a merge in a clone conflicts in README.md line 7, the packs table. main gained the review order in the forgejo row (#73) and this branch changes the roles row next to it. Rebase onto origin/main and keep main's forgejo row as it is, with only handover and failures changed in the roles row.
  • [blocking] roles/orders/failures.toml:1-5: the order has no scope = "city". Every other roles order that reads city-wide state has it (apply, upgrade, handover, permission-request, each at line 5). The roles pack is imported at the city level and in each rig, and an order with no scope runs once per import: gc order list on the live city shows merge, which has no scope, 7 times (HQ plus baox, changelog, claudeacp, gascitypacks, kuberex, rexcity), and apply and upgrade once each. So failures would run 7 times every five minutes. Each run reads the same city-wide gc events log (--seq and --type ... --since 2h, two reads of up to ~2h of order.completed), and each would mail the same incidents. The state directory is the pack's, and the checks order names its files checks-<rig>.json for that reason, so the instances would probably share one failures.json. They would then read, change and write it at the same time: the last writer wins, and an Alerted or a cleared RecoveredSeq that one instance wrote can be overwritten by another, which then mails again. The dedup key hides that only until the Operator archives the first mail. Add scope = "city". A test like those for the other city-scoped orders would also help, for example one that asserts the order's scope in tests/failures.sh or in gc lint's view.
  • [minor] roles/assets/roles/failures.go:192-195: a failure that comes after a run that went through, before the recovery mail goes out, sets Failures back to 0 but keeps FirstSeq and FirstTS of the first streak. The later ORDER RECOVERED body (line 308) then gives e.g. "Failed runs before it ran again: 1" next to the first failure of an earlier, longer streak. Either keep counting (do not reset), or reset FirstSeq and FirstTS as well, and say in the body which one it is.
  • [minor] roles/assets/roles/failures.go:262: when the order has not run for longer than FAILURES_LOOKBACK (a city stopped for more than 2h), the events between the cursor and the start of the lookback are skipped and nothing says so. A line on stderr when the oldest event read is far above cursor+1 would make that gap visible. This is not blocking: the README documents the lookback.

Verified

  • Read the work bead, the PR description and the whole diff (13 files, +1181/−98). The PR uses a cooldown order where the bead asked for on = order.failed, and argues why: the recovery mail has no failure event to start it. I agree. The streak length 3 is chosen and justified, and the event fields were checked against the live log: order.failed carries subject (merge:rig:gascitypacks), message with the error, and ts in RFC 3339 with fractional seconds and an offset, which time.Parse(time.RFC3339, …) accepts. gc events --seq prints the head.
  • The move of the Operator lookup, stateDir and writeFileAtomic to common.go leaves handover behaving as before.
  • In a clone, merged the head into origin/main (README conflict, resolved locally only so that the checks could run) and ran, with the city's variables removed: go vet ./... (ok), go test ./... and go test -race ./... (both packages ok), and the scripts job's tests failures, handover, merge, apply, upgrade, view-beads, view-mail, permission-deny, permission-request, worktree-setup, worktree and gnu-tools (all ok). With a throwaway HOME: gc lint . (2 packs ok), tests/formula.sh, tests/reviewer.sh and tests/operator-overlay.sh (ok). The changelog checker built from mikluko/changelog v2 printed valid=true.
  • README section, docs/shell.md line and changelog fragment are present. The test asserts the wrapper's go tool -C call, the mail's arguments and that a second run sends nothing.
Review of decb258431b1c66487f7aebf77c1e299aa28cfb2 for gascitypacks-lwe0. Checks of the head: success. ### Verdict fail ### Findings - [blocking] (merge) The pull request does not merge into `main` (3316228): the forge says `not_mergeable`, and a merge in a clone conflicts in `README.md` line 7, the packs table. `main` gained the `review` order in the `forgejo` row (#73) and this branch changes the `roles` row next to it. Rebase onto `origin/main` and keep main's `forgejo` row as it is, with only `handover` and `failures` changed in the `roles` row. - [blocking] roles/orders/failures.toml:1-5: the order has no `scope = "city"`. Every other roles order that reads city-wide state has it (`apply`, `upgrade`, `handover`, `permission-request`, each at line 5). The roles pack is imported at the city level and in each rig, and an order with no scope runs once per import: `gc order list` on the live city shows `merge`, which has no scope, 7 times (HQ plus baox, changelog, claudeacp, gascitypacks, kuberex, rexcity), and `apply` and `upgrade` once each. So `failures` would run 7 times every five minutes. Each run reads the same city-wide `gc events` log (`--seq` and `--type ... --since 2h`, two reads of up to ~2h of `order.completed`), and each would mail the same incidents. The state directory is the pack's, and the `checks` order names its files `checks-<rig>.json` for that reason, so the instances would probably share one `failures.json`. They would then read, change and write it at the same time: the last writer wins, and an `Alerted` or a cleared `RecoveredSeq` that one instance wrote can be overwritten by another, which then mails again. The dedup key hides that only until the Operator archives the first mail. Add `scope = "city"`. A test like those for the other city-scoped orders would also help, for example one that asserts the order's scope in `tests/failures.sh` or in `gc lint`'s view. - [minor] roles/assets/roles/failures.go:192-195: a failure that comes after a run that went through, before the recovery mail goes out, sets `Failures` back to 0 but keeps `FirstSeq` and `FirstTS` of the first streak. The later `ORDER RECOVERED` body (line 308) then gives e.g. "Failed runs before it ran again: 1" next to the first failure of an earlier, longer streak. Either keep counting (do not reset), or reset `FirstSeq` and `FirstTS` as well, and say in the body which one it is. - [minor] roles/assets/roles/failures.go:262: when the order has not run for longer than `FAILURES_LOOKBACK` (a city stopped for more than 2h), the events between the cursor and the start of the lookback are skipped and nothing says so. A line on stderr when the oldest event read is far above `cursor+1` would make that gap visible. This is not blocking: the README documents the lookback. ### Verified - Read the work bead, the PR description and the whole diff (13 files, +1181/−98). The PR uses a cooldown order where the bead asked for `on = order.failed`, and argues why: the recovery mail has no failure event to start it. I agree. The streak length 3 is chosen and justified, and the event fields were checked against the live log: `order.failed` carries `subject` (`merge:rig:gascitypacks`), `message` with the error, and `ts` in RFC 3339 with fractional seconds and an offset, which `time.Parse(time.RFC3339, …)` accepts. `gc events --seq` prints the head. - The move of the Operator lookup, `stateDir` and `writeFileAtomic` to `common.go` leaves `handover` behaving as before. - In a clone, merged the head into `origin/main` (README conflict, resolved locally only so that the checks could run) and ran, with the city's variables removed: `go vet ./...` (ok), `go test ./...` and `go test -race ./...` (both packages ok), and the `scripts` job's tests `failures`, `handover`, `merge`, `apply`, `upgrade`, `view-beads`, `view-mail`, `permission-deny`, `permission-request`, `worktree-setup`, `worktree` and `gnu-tools` (all ok). With a throwaway HOME: `gc lint .` (2 packs ok), `tests/formula.sh`, `tests/reviewer.sh` and `tests/operator-overlay.sh` (ok). The changelog checker built from mikluko/changelog `v2` printed `valid=true`. - README section, `docs/shell.md` line and changelog fragment are present. The test asserts the wrapper's `go tool -C` call, the mail's arguments and that a second run sends nothing.
mikluko force-pushed worker/gascitypacks-lwe0 from decb258431
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 21s
test / scripts (pull_request) Successful in 37s
to 283cb430c1
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 21s
test / scripts (pull_request) Successful in 43s
2026-11-12 17:39:19 +00:00
Compare
city-root-review requested changes 2026-11-12 18:11:57 +00:00
Dismissed
city-root-review left a comment

Review of 283cb430c1 for gascitypacks-lwe0. Checks of the head: success.

Verdict

fail

Findings

  • [blocking] (merge) The pull request still does not merge into main (now 0deb291): the forge says not_mergeable, and a merge in a clone conflicts in README.md line 7, the packs table, again. The rework rebased onto 3316228, the main of round 1, but main has since gained #62 (gc forgejo pr comment), which adds pr comment to the forgejo row ("the commands pr open, pr state (with --json), pr merge, pr review and pr comment, ..."), and #68 and #85. The branch's forgejo row is the one from before #62, so it conflicts. Rebase onto the current origin/main and keep main's forgejo row as it is, with pr comment in it. Only failures should be added to the roles row. Nothing else conflicts: #62, #68 and #85 touch only the forgejo pack, the formulas, the agents' skills and their tests, and nothing of the roles tool.

The three findings of round 1 are addressed, and nothing else blocks:

  • roles/orders/failures.toml:5 has scope = "city", and tests/failures.sh part 6 asserts it.
  • roles/assets/roles/failures.go:201-205 keeps counting through an unmailed recovery, so the count, FirstSeq and FirstTS are all the incident's, and the recovery mail says "Failed runs in the incident" (line 322). TestFailuresAFailureBeforeTheRecoveryIsMailedIsOneIncident expects 4.
  • failures.go:123-127 says on stderr when ran_at is older than the lookback, tested by TestFailuresSaysWhenTheLastRunIsOlderThanTheLookback. README and changelog fragment say both.

Verified

  • Read the work bead, its round-1 note, the PR description, the round-1 review (307) and the whole diff (13 files, +1231/−98), including the fix commit 283cb43 on its own. Read failures.go, common.go, the main.go dispatch (runWithin), the handover.go move (unchanged behaviour: the same Operator lookup, state dir and atomic write, now on env), the stub failures.sh, the order's TOML, the README section, the docs/shell.md line, the CI line and the fragment. The base has no REVIEW.md, AGENTS.md or CLAUDE.md.
  • In a clone, merged the head into origin/main 0deb291. The README conflict was resolved locally only, taking main's forgejo row and the branch's roles row, so that the checks could run. Then ran, with the city's variables removed: go vet ./... (ok), and go test ./... and go test -race ./... (both packages ok). Ran the scripts job's tests worktree-setup, worktree, gnu-tools, merge, handover, failures, apply, upgrade, view-beads, view-mail, permission-deny and permission-request (all ok).
  • With a throwaway HOME: gc lint . (2 packs ok), and tests/formula.sh, tests/reviewer.sh and tests/operator-overlay.sh (ok).
  • The changelog checker, built from mikluko/changelog tag v2 (087d7e8) with -base=main, printed valid=true.
Review of 283cb430c1699b236fe3512c557da95c6d02609a for gascitypacks-lwe0. Checks of the head: success. ### Verdict fail ### Findings - [blocking] (merge) The pull request still does not merge into `main` (now 0deb291): the forge says `not_mergeable`, and a merge in a clone conflicts in `README.md` line 7, the packs table, again. The rework rebased onto 3316228, the `main` of round 1, but `main` has since gained #62 (`gc forgejo pr comment`), which adds `pr comment` to the `forgejo` row ("the commands `pr open`, `pr state` (with `--json`), `pr merge`, `pr review` and `pr comment`, ..."), and #68 and #85. The branch's `forgejo` row is the one from before #62, so it conflicts. Rebase onto the current `origin/main` and keep main's `forgejo` row as it is, with `pr comment` in it. Only `failures` should be added to the `roles` row. Nothing else conflicts: #62, #68 and #85 touch only the forgejo pack, the formulas, the agents' skills and their tests, and nothing of the roles tool. The three findings of round 1 are addressed, and nothing else blocks: - `roles/orders/failures.toml:5` has `scope = "city"`, and `tests/failures.sh` part 6 asserts it. - `roles/assets/roles/failures.go:201-205` keeps counting through an unmailed recovery, so the count, `FirstSeq` and `FirstTS` are all the incident's, and the recovery mail says "Failed runs in the incident" (line 322). `TestFailuresAFailureBeforeTheRecoveryIsMailedIsOneIncident` expects 4. - `failures.go:123-127` says on stderr when `ran_at` is older than the lookback, tested by `TestFailuresSaysWhenTheLastRunIsOlderThanTheLookback`. README and changelog fragment say both. ### Verified - Read the work bead, its round-1 note, the PR description, the round-1 review (307) and the whole diff (13 files, +1231/−98), including the fix commit 283cb43 on its own. Read `failures.go`, `common.go`, the `main.go` dispatch (`runWithin`), the `handover.go` move (unchanged behaviour: the same Operator lookup, state dir and atomic write, now on `env`), the stub `failures.sh`, the order's TOML, the README section, the `docs/shell.md` line, the CI line and the fragment. The base has no `REVIEW.md`, `AGENTS.md` or `CLAUDE.md`. - In a clone, merged the head into `origin/main` 0deb291. The README conflict was resolved locally only, taking main's `forgejo` row and the branch's `roles` row, so that the checks could run. Then ran, with the city's variables removed: `go vet ./...` (ok), and `go test ./...` and `go test -race ./...` (both packages ok). Ran the `scripts` job's tests `worktree-setup`, `worktree`, `gnu-tools`, `merge`, `handover`, `failures`, `apply`, `upgrade`, `view-beads`, `view-mail`, `permission-deny` and `permission-request` (all ok). - With a throwaway HOME: `gc lint .` (2 packs ok), and `tests/formula.sh`, `tests/reviewer.sh` and `tests/operator-overlay.sh` (ok). - The changelog checker, built from mikluko/changelog tag `v2` (087d7e8) with `-base=main`, printed `valid=true`.
mikluko force-pushed worker/gascitypacks-lwe0 from 283cb430c1
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 21s
test / scripts (pull_request) Successful in 43s
to 3559de78b8
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 25s
test / scripts (pull_request) Successful in 47s
2026-11-12 18:18:20 +00:00
Compare
city-root-review requested changes 2026-11-12 18:27:47 +00:00
Dismissed
city-root-review left a comment

Review of 3559de78b8 for gascitypacks-lwe0. Checks of the head: success.

Verdict

fail

Findings

  • [blocking] (merge) roles/assets/roles/main.go: the pull request does not merge into main (now fe5a75f). The forge says not_mergeable, and a merge in a clone conflicts in main.go in two places. The round-2 rework rebased onto c0246aa, and since then main has gained #66 ("The city installs the changelog tool"). #66 adds a changelog install <pin-file> <bin-dir> command to the same tool: a sentence in the package comment (lines 1-4), a line in usage (line 25) and an if len(args) == 4 && args[0] == "changelog" ... branch in run. To fix it, rebase onto the current origin/main and keep both sides: the package comment names order handover, order failures and changelog install; usage lists all three lines; and run keeps the branch's switch with runWithin, followed by main's changelog install branch unchanged. The README conflict of round 2 is resolved: the README now merges cleanly, with only failures added to main's roles row. Nothing else conflicts. #86 touches only the Researcher's skill and a fragment.
  • [minor] docs/shell.md:193: after the merge this line says the roles tool's commands are roles order handover and roles order failures, while #66 has added roles changelog install (changelog.go). Main's own line was already stale on this, but the line is now rewritten here, so name the third command when you rebase.

The change itself is unchanged since round 2: git range-diff shows the fix commit identical to 283cb43, and the feature commit differs only in the README roles row. Nothing else blocks:

  • roles/orders/failures.toml has scope = "city", a 5m cooldown and the stub exec.
  • failures.go counts per subject above the cursor, takes the head first with gc events --seq, resets on a head below the cursor, and keeps one incident through an unmailed recovery (lines 193-219). It records each mail as it is sent, does not record a failed mail (so the next run sends it), and says on stderr when ran_at is older than the lookback.
  • common.go holds the Operator lookup, state directory and atomic write moved out of handover.go. The behaviour is unchanged: the same code, now on env.

Verified

  • Read the work bead with its round-1 and round-2 notes, the PR description, the round-2 review (326) and the whole diff (13 files, +1231/-98). I read failures.go, common.go, the main.go and handover.go changes, the test changes, failures.sh, failures.toml, the README section, the docs/shell.md line, the CI line and the fragment, and skimmed failures_test.go (12 tests). The base has no REVIEW.md, AGENTS.md or CLAUDE.md.
  • In a clone, merged the head into origin/main fe5a75f: main.go conflicts. To run the checks, I resolved it locally only, keeping both sides as described above. Then ran, with the city's variables removed: go vet ./... (ok), and go test ./... and go test -race ./... (both packages ok, including #66's changelog_test.go). Also ran the scripts job's tests worktree-setup, worktree, gnu-tools, merge, handover, failures, apply, upgrade, view-beads, view-mail, permission-deny and permission-request (all ok).
  • With a throwaway HOME: gc lint . (2 packs ok), and tests/formula.sh, tests/reviewer.sh, tests/operator-overlay.sh and tests/researcher.sh (all ok).
  • The changelog checker, built from mikluko/changelog tag v2 (087d7e8) and run with -base=main on the merge result, printed valid=true.
Review of 3559de78b89b441f5558f82855f3c4bce547eb97 for gascitypacks-lwe0. Checks of the head: success. ### Verdict fail ### Findings - [blocking] (merge) `roles/assets/roles/main.go`: the pull request does not merge into `main` (now fe5a75f). The forge says `not_mergeable`, and a merge in a clone conflicts in `main.go` in two places. The round-2 rework rebased onto c0246aa, and since then `main` has gained #66 ("The city installs the changelog tool"). #66 adds a `changelog install <pin-file> <bin-dir>` command to the same tool: a sentence in the package comment (lines 1-4), a line in `usage` (line 25) and an `if len(args) == 4 && args[0] == "changelog" ...` branch in `run`. To fix it, rebase onto the current `origin/main` and keep both sides: the package comment names `order handover`, `order failures` and `changelog install`; `usage` lists all three lines; and `run` keeps the branch's `switch` with `runWithin`, followed by main's `changelog install` branch unchanged. The README conflict of round 2 is resolved: the README now merges cleanly, with only `failures` added to main's `roles` row. Nothing else conflicts. #86 touches only the Researcher's skill and a fragment. - [minor] `docs/shell.md:193`: after the merge this line says the roles tool's commands are `roles order handover` and `roles order failures`, while #66 has added `roles changelog install` (`changelog.go`). Main's own line was already stale on this, but the line is now rewritten here, so name the third command when you rebase. The change itself is unchanged since round 2: `git range-diff` shows the fix commit identical to 283cb43, and the feature commit differs only in the README `roles` row. Nothing else blocks: - `roles/orders/failures.toml` has `scope = "city"`, a 5m cooldown and the stub `exec`. - `failures.go` counts per subject above the cursor, takes the head first with `gc events --seq`, resets on a head below the cursor, and keeps one incident through an unmailed recovery (lines 193-219). It records each mail as it is sent, does not record a failed mail (so the next run sends it), and says on stderr when `ran_at` is older than the lookback. - `common.go` holds the Operator lookup, state directory and atomic write moved out of `handover.go`. The behaviour is unchanged: the same code, now on `env`. ### Verified - Read the work bead with its round-1 and round-2 notes, the PR description, the round-2 review (326) and the whole diff (13 files, +1231/-98). I read `failures.go`, `common.go`, the `main.go` and `handover.go` changes, the test changes, `failures.sh`, `failures.toml`, the README section, the `docs/shell.md` line, the CI line and the fragment, and skimmed `failures_test.go` (12 tests). The base has no `REVIEW.md`, `AGENTS.md` or `CLAUDE.md`. - In a clone, merged the head into `origin/main` fe5a75f: `main.go` conflicts. To run the checks, I resolved it locally only, keeping both sides as described above. Then ran, with the city's variables removed: `go vet ./...` (ok), and `go test ./...` and `go test -race ./...` (both packages ok, including #66's `changelog_test.go`). Also ran the `scripts` job's tests `worktree-setup`, `worktree`, `gnu-tools`, `merge`, `handover`, `failures`, `apply`, `upgrade`, `view-beads`, `view-mail`, `permission-deny` and `permission-request` (all ok). - With a throwaway HOME: `gc lint .` (2 packs ok), and `tests/formula.sh`, `tests/reviewer.sh`, `tests/operator-overlay.sh` and `tests/researcher.sh` (all ok). - The changelog checker, built from mikluko/changelog tag `v2` (087d7e8) and run with `-base=main` on the merge result, printed `valid=true`.
mikluko force-pushed worker/gascitypacks-lwe0 from 3559de78b8
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 25s
test / scripts (pull_request) Successful in 47s
to 44be94dfcd
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 23s
test / scripts (pull_request) Successful in 55s
2026-11-12 18:36:22 +00:00
Compare
city-root-review approved these changes 2026-11-12 19:22:52 +00:00
Dismissed
city-root-review left a comment

Review of 44be94dfcd for gascitypacks-lwe0. Checks of the head: success.

Verdict

pass

Findings

Round 3 (review 334) is addressed:

  • The merge conflict in roles/assets/roles/main.go is gone. The head is rebased onto fe5a75f (#66) and merges cleanly into the current main (745749e, which has #25 on top; #25 touches only the Worker's formula and skill, tests/formula.sh, a README line and a fragment). Both sides are kept as asked: the package comment names order handover, order failures and changelog install (lines 1-6), usage lists all three (lines 25-28), and run has the switch with runWithin, followed by main's changelog install branch unchanged.
  • docs/shell.md:193 now names roles changelog install (changelog.go) with the other two commands.

Nothing blocks. Two minor points, neither a reason to hold the merge:

  • [minor] docs/shell.md:193: the sentence goes on "written in Go from the start under the rule: an order that is unattended, keeps state and has more than 30 code lines". With changelog install in the list it now says that of a command that is not an order. "the two orders were written in Go from the start under the rule ..." would keep it true.
  • [minor] roles/assets/roles/failures_test.go:703: city.calls[len(city.calls)-1] == "" can never be true (every recorded call is a non-empty join), so only the second half of the ||, no agent list call, tests anything. The check is still right, but the dead half could go.

Verified

  • Read the work bead with its notes for rounds 1 to 3, the PR description, the round-3 review (334) and the whole diff against origin/main, 13 files, +1233/-100: failures.go, failures_test.go (12 tests), common.go, the handover.go, handover_test.go and main.go changes, failures.sh, failures.toml (scope = "city", 5m cooldown), tests/failures.sh, the README row and section, the docs/shell.md line, the CI line and the fragment. The logic is unchanged from rounds 2 and 3: a cursor taken from gc events --seq before the reads, a reset when the head is below the cursor, one incident through a recovery that has not been mailed yet, each mail recorded as it goes out, a failed mail left for the next run, and a line on stderr when ran_at is older than the lookback. The base has no REVIEW.md, AGENTS.md or CLAUDE.md.
  • In a clone, merged the head into origin/main 745749e: clean, with no conflict. On the merge result, with the city's variables removed, I ran go vet ./... (ok) and go test ./... and go test -race ./... (both packages ok). I also ran the scripts job's tests worktree-setup, worktree, gnu-tools, merge, handover, failures, apply, upgrade, view-beads, view-mail, permission-deny and permission-request (all ok).
  • With a throwaway HOME: gc lint . (2 packs ok), and tests/formula.sh, tests/reviewer.sh, tests/operator-overlay.sh and tests/researcher.sh (all ok).
  • The changelog checker, built from mikluko/changelog tag v2 (087d7e8) and run with -base=main on the merge result, printed valid=true.
Review of 44be94dfcd454eae3526d8452c846f9d76e9009b for gascitypacks-lwe0. Checks of the head: success. ### Verdict pass ### Findings Round 3 (review 334) is addressed: - The merge conflict in `roles/assets/roles/main.go` is gone. The head is rebased onto fe5a75f (#66) and merges cleanly into the current `main` (745749e, which has #25 on top; #25 touches only the Worker's formula and skill, `tests/formula.sh`, a README line and a fragment). Both sides are kept as asked: the package comment names `order handover`, `order failures` and `changelog install` (lines 1-6), `usage` lists all three (lines 25-28), and `run` has the `switch` with `runWithin`, followed by main's `changelog install` branch unchanged. - `docs/shell.md:193` now names `roles changelog install` (`changelog.go`) with the other two commands. Nothing blocks. Two minor points, neither a reason to hold the merge: - [minor] `docs/shell.md:193`: the sentence goes on "written in Go from the start under the rule: an order that is unattended, keeps state and has more than 30 code lines". With `changelog install` in the list it now says that of a command that is not an order. "the two orders were written in Go from the start under the rule ..." would keep it true. - [minor] `roles/assets/roles/failures_test.go:703`: `city.calls[len(city.calls)-1] == ""` can never be true (every recorded call is a non-empty join), so only the second half of the `||`, no `agent list` call, tests anything. The check is still right, but the dead half could go. ### Verified - Read the work bead with its notes for rounds 1 to 3, the PR description, the round-3 review (334) and the whole diff against `origin/main`, 13 files, +1233/-100: `failures.go`, `failures_test.go` (12 tests), `common.go`, the `handover.go`, `handover_test.go` and `main.go` changes, `failures.sh`, `failures.toml` (`scope = "city"`, 5m cooldown), `tests/failures.sh`, the README row and section, the `docs/shell.md` line, the CI line and the fragment. The logic is unchanged from rounds 2 and 3: a cursor taken from `gc events --seq` before the reads, a reset when the head is below the cursor, one incident through a recovery that has not been mailed yet, each mail recorded as it goes out, a failed mail left for the next run, and a line on stderr when `ran_at` is older than the lookback. The base has no `REVIEW.md`, `AGENTS.md` or `CLAUDE.md`. - In a clone, merged the head into `origin/main` 745749e: clean, with no conflict. On the merge result, with the city's variables removed, I ran `go vet ./...` (ok) and `go test ./...` and `go test -race ./...` (both packages ok). I also ran the `scripts` job's tests `worktree-setup`, `worktree`, `gnu-tools`, `merge`, `handover`, `failures`, `apply`, `upgrade`, `view-beads`, `view-mail`, `permission-deny` and `permission-request` (all ok). - With a throwaway HOME: `gc lint .` (2 packs ok), and `tests/formula.sh`, `tests/reviewer.sh`, `tests/operator-overlay.sh` and `tests/researcher.sh` (all ok). - The changelog checker, built from mikluko/changelog tag `v2` (087d7e8) and run with `-base=main` on the merge result, printed `valid=true`.
city-root force-pushed worker/gascitypacks-lwe0 from 44be94dfcd
All checks were successful
test / changelog (pull_request) Successful in 5s
test / lint (pull_request) Successful in 23s
test / scripts (pull_request) Successful in 55s
to fde0dac8ea
All checks were successful
test / changelog (pull_request) Successful in 8s
test / lint (pull_request) Successful in 29s
test / scripts (pull_request) Successful in 49s
2026-11-12 19:31:08 +00:00
Compare
city-root dismissed city-root-review's review 2026-11-12 19:31:08 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

city-root-review left a comment

Review of fde0dac8ea for gascitypacks-lwe0. Checks of the head: success.

Verdict

pass

Findings

  • [minor] roles/assets/roles/failures.go:216: a streak that reaches the threshold and ends inside one batch of events is deleted without a mail. apply runs the events in order, so when one run of the order reads the third failure and the run that went through together (failures at t0, t2, t4 and a success at t6, with the order run at t3.5 and t8.5; or a whole outage read in one go after the city was down), the streak is never Alerted and order.completed deletes it. README line 672 says only that a streak which ended before it reached three mails nothing. Either check for the threshold as each failure is applied (and send FAILING and RECOVERED together), or say in the README that an incident shorter than the order's interval may go untold. A test for this case would hold it either way.
  • [minor] roles/assets/roles/common.go:26: env.operator is a copy of internal/gcx.FindOperator, which main already carries. This change gives the copy a second caller. docs/shell.md says the orders move to gcx in a change of their own, so this does not block, but calling gcx.FindOperator(ctx, e.gc) here after the $OPERATOR check would have cost one line.

Verified

  • Read the work bead with its four rework notes, the PR description, main's REVIEW.md and README.md (main has no AGENTS.md or CLAUDE.md), and the whole diff (13 files, +1233/−100). git range-diff from the approved 44be94d to fde0dac: the only changes are the rebase's conflict resolutions in README.md, docs/shell.md and main.go, which keep main's text (version, the internal/gcx sentence). Main carries no part of this change, so nothing had to be dropped.
  • The head merges cleanly onto origin/main 9e45e9e, which is also its merge base.
  • On the merge result, with the city's variables removed: go vet ./... clean; go test ./... and go test -race on roles, internal/gcx and internal/budget pass; go test -v -run TestShellBudget ./internal/budget reports 28 units, 10 in the ledger, 0 findings.
  • Tests of the scripts job: failures, handover, merge, apply, upgrade, view-beads, view-mail, permission-deny, permission-request, worktree-setup, worktree and gnu-tools all print ok. Tests of the lint job: gc lint . (2 packs ok), formula, reviewer, operator-overlay, researcher and pack-cache all print ok.
  • The changelog checker, built from sarak.sh/mikluko/changelog/v2@v2.1.0 and run with -base=main, prints valid=true.
  • Checked the order against the real gc: gc events --seq prints a plain number, --since takes the 2h duration, and the live order.failed and order.completed events carry seq, subject (checks:rig:rexcity) and message as the code reads them. Their ts has fractional seconds, which time.Parse(time.RFC3339, …) accepts, so forget handles it.
  • Logic: the head is read before the events and the cursor is set to it, so an event that arrives later is read on the next run. A failed mail is not recorded as sent and is retried. The state is written after each mail. scope = "city" is set in the order's file and tests/failures.sh holds it. REVIEW.md's shell rules hold: tests/failures.sh runs rm -rf only on its own mktemp -d directory, and its grep -q reads a file, not a pipe.
Review of fde0dac8ead1e18ab8ccf905189f21c75f2a5286 for gascitypacks-lwe0. Checks of the head: success. ### Verdict pass ### Findings - [minor] roles/assets/roles/failures.go:216: a streak that reaches the threshold and ends inside one batch of events is deleted without a mail. `apply` runs the events in order, so when one run of the order reads the third failure and the run that went through together (failures at t0, t2, t4 and a success at t6, with the order run at t3.5 and t8.5; or a whole outage read in one go after the city was down), the streak is never `Alerted` and `order.completed` deletes it. README line 672 says only that a streak which ended *before it reached three* mails nothing. Either check for the threshold as each failure is applied (and send FAILING and RECOVERED together), or say in the README that an incident shorter than the order's interval may go untold. A test for this case would hold it either way. - [minor] roles/assets/roles/common.go:26: `env.operator` is a copy of `internal/gcx.FindOperator`, which main already carries. This change gives the copy a second caller. docs/shell.md says the orders move to gcx in a change of their own, so this does not block, but calling `gcx.FindOperator(ctx, e.gc)` here after the `$OPERATOR` check would have cost one line. ### Verified - Read the work bead with its four rework notes, the PR description, main's REVIEW.md and README.md (main has no AGENTS.md or CLAUDE.md), and the whole diff (13 files, +1233/−100). `git range-diff` from the approved 44be94d to fde0dac: the only changes are the rebase's conflict resolutions in README.md, docs/shell.md and main.go, which keep main's text (`version`, the `internal/gcx` sentence). Main carries no part of this change, so nothing had to be dropped. - The head merges cleanly onto origin/main 9e45e9e, which is also its merge base. - On the merge result, with the city's variables removed: `go vet ./...` clean; `go test ./...` and `go test -race` on roles, internal/gcx and internal/budget pass; `go test -v -run TestShellBudget ./internal/budget` reports 28 units, 10 in the ledger, 0 findings. - Tests of the `scripts` job: failures, handover, merge, apply, upgrade, view-beads, view-mail, permission-deny, permission-request, worktree-setup, worktree and gnu-tools all print ok. Tests of the `lint` job: `gc lint .` (2 packs ok), formula, reviewer, operator-overlay, researcher and pack-cache all print ok. - The changelog checker, built from sarak.sh/mikluko/changelog/v2@v2.1.0 and run with `-base=main`, prints `valid=true`. - Checked the order against the real gc: `gc events --seq` prints a plain number, `--since` takes the `2h` duration, and the live order.failed and order.completed events carry `seq`, `subject` (`checks:rig:rexcity`) and `message` as the code reads them. Their `ts` has fractional seconds, which `time.Parse(time.RFC3339, …)` accepts, so `forget` handles it. - Logic: the head is read before the events and the cursor is set to it, so an event that arrives later is read on the next run. A failed mail is not recorded as sent and is retried. The state is written after each mail. `scope = "city"` is set in the order's file and tests/failures.sh holds it. REVIEW.md's shell rules hold: tests/failures.sh runs `rm -rf` only on its own `mktemp -d` directory, and its `grep -q` reads a file, not a pipe.
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!83
No description provided.