Landing L16: a Reviewer for the city's own repository #56

Merged
city-root merged 2 commits from worker/gascitypacks-wmm into main 2026-11-12 13:30:05 +00:00
Contributor

Row L16 of gascity-root docs/handoffs.md (bead gascitypacks-wmm, HQ ticket root-ons.17, factory review root-i0s item 2): a Reviewer for the city's own repository. gascity-root is no rig, so no rig's Reviewer can review it, and every one of its pull requests has gone to a sub-agent of the Operator's session with a hand-written brief. Decision 4's condition is met: the rigs' Reviewers have run.

What it is

  • The agent. forgejo/agents/reviewer loses scope = "rig". With no scope gc instantiates it for each rig and, as for the Worker, for a city that imports the pack at the city level: forgejo.reviewer with no rig, Dir empty, working the HQ store. forgejo/pack.toml declares a second on-demand [[named_session]] (scope city) beside the rig's, so each is a one-session singleton. work_dir leaves the rig segment out when Rig is empty, as the Worker's does (.gc/agents/reviewer). The prompt names the rig or the city repository.
  • The formula is the same one, mol-forgejo-review, with the same tool (gc forgejo pr state, pr review). What differs for a repository that is no rig (README, "The city's Reviewer", has the table):
    • How it finds the repository: Part 2 reads the origin of ${GC_RIG_ROOT:-$GC_CITY_PATH}, still refuses a pull request that is not of that origin (halt), and the target branch is base from pr state as for a rig.
    • Where it clones: .gc/agents/reviewer/review-<bead>.
    • Where REVIEW.md comes from: as before, the target branch, never the pull request. gascity-root has none; its AGENTS.md carries what the Operator's sub-agents were told by hand.
    • The hook, for every Reviewer: Part 3 step 4 now runs the Quality Gates of the target's own AGENTS.md or CLAUDE.md, read from the target as REVIEW.md is, as written on the merge result, provided they write nothing outside the clone. For the city repository that is the three gates of its AGENTS.md with --city "$CLONE" (a gc command on the clone without it answers for the live city, and gc import rewrites the live packs.lock), plus the steps of .forgejo/workflows/test.yaml, which the formula already read from the merged tree.
  • It never merges, as no Reviewer does: the Operator keeps the merge of gascity-root.
  • The two findings of the rigs' first day. gascitypacks-imy (an assigned, unslung bead leaves the session holding it): the prompt now has the Reviewer hand the bead to the Operator (--assignee roles.operator --status open) and mail it before gc runtime drain-ack, which gc refuses while the session holds a bead it claimed; a test holds the order in the rendered prompt of both agents. gascitypacks-mkr (the permission prompt on an rm): the rules belong to the formula text, which is the one agent's for rigs and city alike, and #54 carries them, so this branch does not repeat them. The two pull requests touch neighbouring lines of the formula's rules section and may need a trivial rebase.
  • README section "The Reviewer" and the new "The city's Reviewer"; a changelog fragment, .changelog/city-reviewer.md. No new shell logic: the one new shell is the default expansion ${GC_RIG_ROOT:-$GC_CITY_PATH} in an existing line of the formula.

Verification

  • tests/reviewer.sh (extended): resolves two Reviewers (Dir "" and "demo") and two named sessions in a throwaway city; checks the work_dir template; renders each prompt with gc prime under env -i and holds the claim and the hand-over order; runs the origin check of Part 2 on two local repositories (a rig's origin and the city's) for the four cases of pull request x Reviewer; checks the Quality Gates hook and --city "$CLONE" in Part 3; the existing cases still pass (the allowed git outside the clone is now the ${GC_RIG_ROOT:-$GC_CITY_PATH} read). The step stays under the 28000-character bound.
  • gc lint . ok (it flagged --notify in my first draft of the prompt line; fixed), tests/formula.sh, go vet and go test ./... in forgejo pass; the v2 changelog checker, built from the tag v2.0.1 and run with -base main, says valid=true with the fragment.
  • Not run: the Reviewer against a live forge and a live session (the trial below).

The patch gascity-root needs

None new, if its rig = "*" patch of forgejo.reviewer is in place (the one the rigs' Reviewers run on). I resolved it in a throwaway city: a [[patches.agent]] with rig = "*" reaches the city's forgejo.reviewer as well as every rig's. The city's agent comes out with provider = "acp", max_active_sessions = 1, claude-opus-5-5 at high, permission_mode = "unrestricted" and FORGEJO_TOKEN_FILE set to the review account's token file, in these two agents' env and no other's; an entry with no rig key wins over the * one for the city's agent alone (tried with a different model). So the bump of [imports.forgejo] to the release that carries this needs only the existing entry:

[[patches.agent]]
rig = "*"
name = "forgejo.reviewer"
provider = "acp"
max_active_sessions = 1
option_defaults = { permission_mode = "unrestricted", model = "claude-opus-5-5", effort = "high" }
env = { FORGEJO_TOKEN_FILE = "/Users/mikluko/.config/gascity-root/forgejo-review-token" }

If the city wants a different model or token for its own Reviewer, the same entry again with no rig key. Without a patch that reaches the city's agent, scripts/check-pins.sh fails it. Note the city's session cap (gascity-root#36 counted a rig's Reviewer against it): the city's Reviewer is one more possible session, at most one, on demand.

The trial, for the Operator (after the release, the import bump and this patch; not for me to run on the live city)

  1. gc config show has forgejo.reviewer (no rig) and gc order/gc session show nothing running for it.
  2. Pick a gascity-root pull request, open, checks completed: gc forgejo pr state --json --repo <city checkout> --pr <url> | jq '{state, head, base, checks}'. Note the full head and the work bead.
  3. Make the review bead in the HQ store (gc bd create --labels service,review --metadata '{"pr_url":"<url>","review_head":"<full head>","work_bead":"<id>"}') and sling it: gc sling forgejo.reviewer <review bead>. Expect within about ten minutes: a session of template reviewer with no rig starts, the review bead closes with review_verdict pass or fail, review_reviewed the head, review_url, and one review at that head by the review account. The gates ran with --city "$CLONE": check that the live city's checkout is still clean afterwards (scripts/check-live-city.sh), the failure that AGENTS.md's rule exists to avoid. The clone stays under .gc/agents/reviewer/ and can be cleared by hand.
  4. Assign instead of sling a second review bead to forgejo.reviewer: it mails the Operator "assigned and not slung", the bead is the Operator's (open, assigned to roles.operator), and the session drains (the gascitypacks-imy fix; gc session list shows it gone).
  5. Void (an old review_head of an open pull request) and restart safety (sling the same head again: no second review) as in #48's trial.
  6. Confirm the merge stays with you: the Reviewer's approval is the account's, and nothing merges until the Operator does.

Bead: gascitypacks-wmm

🤖 Generated with Claude Code

Bead: gascitypacks-wmm

Row L16 of gascity-root `docs/handoffs.md` (bead gascitypacks-wmm, HQ ticket root-ons.17, factory review root-i0s item 2): a Reviewer for the city's own repository. gascity-root is no rig, so no rig's Reviewer can review it, and every one of its pull requests has gone to a sub-agent of the Operator's session with a hand-written brief. Decision 4's condition is met: the rigs' Reviewers have run. ## What it is - **The agent.** `forgejo/agents/reviewer` loses `scope = "rig"`. With no scope gc instantiates it for each rig and, as for the Worker, for a city that imports the pack at the city level: `forgejo.reviewer` with no rig, `Dir` empty, working the HQ store. `forgejo/pack.toml` declares a second on-demand `[[named_session]]` (scope `city`) beside the rig's, so each is a one-session singleton. `work_dir` leaves the rig segment out when `Rig` is empty, as the Worker's does (`.gc/agents/reviewer`). The prompt names the rig or the city repository. - **The formula is the same one, `mol-forgejo-review`**, with the same tool (`gc forgejo pr state`, `pr review`). What differs for a repository that is no rig (README, "The city's Reviewer", has the table): - *How it finds the repository:* Part 2 reads the origin of `${GC_RIG_ROOT:-$GC_CITY_PATH}`, still refuses a pull request that is not of that origin (halt), and the target branch is `base` from `pr state` as for a rig. - *Where it clones:* `.gc/agents/reviewer/review-<bead>`. - *Where REVIEW.md comes from:* as before, the target branch, never the pull request. gascity-root has none; its `AGENTS.md` carries what the Operator's sub-agents were told by hand. - *The hook, for every Reviewer:* Part 3 step 4 now runs the **Quality Gates of the target's own `AGENTS.md` or `CLAUDE.md`**, read from the target as `REVIEW.md` is, as written on the merge result, provided they write nothing outside the clone. For the city repository that is the three gates of its `AGENTS.md` with `--city "$CLONE"` (a `gc` command on the clone without it answers for the live city, and `gc import` rewrites the live `packs.lock`), plus the steps of `.forgejo/workflows/test.yaml`, which the formula already read from the merged tree. - **It never merges**, as no Reviewer does: the Operator keeps the merge of gascity-root. - **The two findings of the rigs' first day.** `gascitypacks-imy` (an assigned, unslung bead leaves the session holding it): the prompt now has the Reviewer hand the bead to the Operator (`--assignee roles.operator --status open`) and mail it before `gc runtime drain-ack`, which gc refuses while the session holds a bead it claimed; a test holds the order in the rendered prompt of both agents. `gascitypacks-mkr` (the permission prompt on an `rm`): the rules belong to the formula text, which is the one agent's for rigs and city alike, and #54 carries them, so this branch does not repeat them. The two pull requests touch neighbouring lines of the formula's rules section and may need a trivial rebase. - README section "The Reviewer" and the new "The city's Reviewer"; a changelog fragment, `.changelog/city-reviewer.md`. No new shell logic: the one new shell is the default expansion `${GC_RIG_ROOT:-$GC_CITY_PATH}` in an existing line of the formula. ## Verification - `tests/reviewer.sh` (extended): resolves two Reviewers (`Dir` "" and "demo") and two named sessions in a throwaway city; checks the work_dir template; renders each prompt with `gc prime` under `env -i` and holds the claim and the hand-over order; runs the origin check of Part 2 on two local repositories (a rig's origin and the city's) for the four cases of pull request x Reviewer; checks the Quality Gates hook and `--city "$CLONE"` in Part 3; the existing cases still pass (the allowed `git` outside the clone is now the `${GC_RIG_ROOT:-$GC_CITY_PATH}` read). The step stays under the 28000-character bound. - `gc lint .` ok (it flagged `--notify` in my first draft of the prompt line; fixed), `tests/formula.sh`, `go vet` and `go test ./...` in `forgejo` pass; the v2 changelog checker, built from the tag v2.0.1 and run with `-base main`, says `valid=true` with the fragment. - Not run: the Reviewer against a live forge and a live session (the trial below). ## The patch gascity-root needs **None new, if its `rig = "*"` patch of `forgejo.reviewer` is in place** (the one the rigs' Reviewers run on). I resolved it in a throwaway city: a `[[patches.agent]]` with `rig = "*"` reaches the city's `forgejo.reviewer` as well as every rig's. The city's agent comes out with `provider = "acp"`, `max_active_sessions = 1`, `claude-opus-5-5` at `high`, `permission_mode = "unrestricted"` and `FORGEJO_TOKEN_FILE` set to the review account's token file, in these two agents' `env` and no other's; an entry with no `rig` key wins over the `*` one for the city's agent alone (tried with a different model). So the bump of `[imports.forgejo]` to the release that carries this needs only the existing entry: ```toml [[patches.agent]] rig = "*" name = "forgejo.reviewer" provider = "acp" max_active_sessions = 1 option_defaults = { permission_mode = "unrestricted", model = "claude-opus-5-5", effort = "high" } env = { FORGEJO_TOKEN_FILE = "/Users/mikluko/.config/gascity-root/forgejo-review-token" } ``` If the city wants a different model or token for its own Reviewer, the same entry again with no `rig` key. Without a patch that reaches the city's agent, `scripts/check-pins.sh` fails it. Note the city's session cap (`gascity-root#36` counted a rig's Reviewer against it): the city's Reviewer is one more possible session, at most one, on demand. ## The trial, for the Operator (after the release, the import bump and this patch; not for me to run on the live city) 1. `gc config show` has `forgejo.reviewer` (no rig) and `gc order`/`gc session` show nothing running for it. 2. **Pick a gascity-root pull request**, open, checks completed: `gc forgejo pr state --json --repo <city checkout> --pr <url> | jq '{state, head, base, checks}'`. Note the full `head` and the work bead. 3. **Make the review bead in the HQ store** (`gc bd create --labels service,review --metadata '{"pr_url":"<url>","review_head":"<full head>","work_bead":"<id>"}'`) and **sling it**: `gc sling forgejo.reviewer <review bead>`. Expect within about ten minutes: a session of template `reviewer` with no rig starts, the review bead closes with `review_verdict` `pass` or `fail`, `review_reviewed` the head, `review_url`, and one review at that head by the review account. The gates ran with `--city "$CLONE"`: check that the live city's checkout is still clean afterwards (`scripts/check-live-city.sh`), the failure that `AGENTS.md`'s rule exists to avoid. The clone stays under `.gc/agents/reviewer/` and can be cleared by hand. 4. **Assign instead of sling** a second review bead to `forgejo.reviewer`: it mails the Operator "assigned and not slung", the bead is the Operator's (`open`, assigned to `roles.operator`), and the session **drains** (the `gascitypacks-imy` fix; `gc session list` shows it gone). 5. **Void** (an old `review_head` of an open pull request) and **restart safety** (sling the same head again: no second review) as in #48's trial. 6. Confirm the merge stays with you: the Reviewer's approval is the account's, and nothing merges until the Operator does. Bead: gascitypacks-wmm 🤖 Generated with [Claude Code](https://claude.com/claude-code) Bead: gascitypacks-wmm
Row L16 of Landing: gascity-root is no rig, so no rig's Reviewer can review its pull requests, and every one of them has been reviewed by a sub-agent of the Operator's session with a brief written by hand. The Reviewer agent loses its scope, so that a city importing the pack at the city level gets one as the Worker does, and the pack declares an on-demand named session of scope city beside the rig's.

The formula is the same. Part 2 finds the repository by the origin of GC_RIG_ROOT or, for the city's Reviewer, GC_CITY_PATH, and still refuses a pull request that is not of it. The work_dir leaves out the rig segment when Rig is empty. Part 3 gains the one hook the city repository needs, for every Reviewer: it runs the Quality Gates the target's own AGENTS.md or CLAUDE.md names, with --city naming the clone, so that what the Operator's sub-agents were told by hand about gascity-root now comes from the repository.

The prompt, for a review bead assigned by hand, now hands it to the Operator before gc runtime drain-ack, which gc refuses while the session holds a bead it claimed (gascitypacks-imy). The rm rules of gascitypacks-mkr are the one agent's formula text and are in #54.

Validation: tests/reviewer.sh resolves both agents and both named sessions in a throwaway city, renders both prompts, and runs the origin check for each; tests/formula.sh, gc lint and the forgejo Go tests pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
docs: the city's Reviewer needs no new patch where rig = "*" is patched (gascitypacks-wmm)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 20s
test / scripts (pull_request) Successful in 33s
c0953217d8
Resolved in a throwaway city: a [[patches.agent]] entry with rig = "*" reaches the city's forgejo.reviewer as well as every rig's, and an entry with no rig key wins over it for the city's agent alone. The README and the changelog fragment said the city needed a patch of its own; corrected to what gc does.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Review of c0953217d8 for gascitypacks-wmm. Checks of the head: success.

Verdict

pass

Findings

  • [minor] forgejo/formulas/mol-forgejo-review.toml:202-209: the city repository's three gates do not pass "as written" in a fresh clone. I cloned gascity-root at d32ed6d and ran them under env -i. With the throwaway HOME the formula prescribes for gc on a clone, gc --city "$CLONE" config show --validate and scripts/check-pins.sh --city "$CLONE" both fail: the remote import "is locked but not cached ... run gc import install". With the real HOME, config show --validate still fails, with rig "kuberex": path is required, because a clone has no .gc/site.toml. Both gates pass once the setup steps of gascity-root's test.yaml config job have run in the clone: gc --city "$CLONE" import install, which went into the throwaway HOME and left packs.lock unchanged, and its site binding written to $CLONE/.gc/site.toml. A Reviewer that reproduces test.yaml in order before the gates gets this right. One that takes the paragraph literally, or skips gc import install as needing the network, fails every gascity-root pull request ("pass only when every check you ran passed"). Fix: say in the paragraph that the city repository's gates run after test.yaml's config setup (import install with --city "$CLONE" into the throwaway HOME, then the site binding). Or put that in gascity-root's AGENTS.md, which matches the bead's "from the repository it reviews". Step 3 of the trial will show this either way.
  • [minor] same lines: "only the commands that read and write nothing outside $CLONE": gc config show reads the pack cache under HOME, and import install reads the network. Read literally, the rule excludes the three gates the next sentence names. "write nothing outside $CLONE" says what is meant.
  • [minor, suggestion] check-live-city.sh in the clone proves little, as the text says. Running scripts/check-live-city.sh "$GC_CITY_PATH" after the gates, which is read-only, would check the thing that AGENTS.md rule exists for: that the live city's checkout is still clean. Today the trial leaves that check to the Operator.

Verified

  • Read the work bead gascitypacks-wmm, the PR description and the whole diff (7 files, +137/-37). Main has no REVIEW.md, AGENTS.md or CLAUDE.md.
  • Merged the head into origin/main (98f2d80, which includes #51, #53 and #55): clean, and forge mergeable.
  • On the merge result, under env -i (0 city variables, checked): gc lint . ok. tests/formula.sh and tests/reviewer.sh ok. go vet ./..., go test ./... and go test -race ./... in forgejo ok. All ten script tests of the scripts job ok. The changelog checker built from mikluko/changelog v2.0.1 with -base=main reports valid=true with .changelog/city-reviewer.md.
  • The PR's patch claim, tested in a throwaway city: with gascity-root's existing rig = "*" entry for forgejo.reviewer, both Reviewers resolve (Dir "" and "demo") with provider acp, max_active_sessions = 1, claude-opus-5-5 at high, permission_mode unrestricted and FORGEJO_TOKEN_FILE. gascity-root imports forgejo at the city level (pack.toml [imports.forgejo]), so it gets the city's Reviewer, and no other pack's agent uses .gc/agents/reviewer.
  • ${GC_RIG_ROOT:-$GC_CITY_PATH} is the fallback the city's Worker already uses (roles/commands/worktree/setup/run.sh:28). The test runs the origin check for all four combinations of pull request and Reviewer.
  • check-live-city.sh in a plain clone reads the clone's own status (--git-common-dir is $CLONE/.git), as the text says. The live city's checkout was clean after all of the above.
  • The prompt now hands an unslung bead to the Operator and mails it before gc runtime drain-ack, and the test checks that order in the rendered prompts of both agents. The step stays under the 28000-character limit.
Review of c0953217d8799c582bc810fb9c450f8a8eb91c45 for gascitypacks-wmm. Checks of the head: success. ### Verdict pass ### Findings - [minor] forgejo/formulas/mol-forgejo-review.toml:202-209: the city repository's three gates do not pass "as written" in a fresh clone. I cloned gascity-root at d32ed6d and ran them under `env -i`. With the throwaway `HOME` the formula prescribes for `gc` on a clone, `gc --city "$CLONE" config show --validate` and `scripts/check-pins.sh --city "$CLONE"` both fail: the remote import "is locked but not cached ... run gc import install". With the real `HOME`, `config show --validate` still fails, with `rig "kuberex": path is required`, because a clone has no `.gc/site.toml`. Both gates pass once the setup steps of gascity-root's `test.yaml` `config` job have run in the clone: `gc --city "$CLONE" import install`, which went into the throwaway HOME and left packs.lock unchanged, and its site binding written to `$CLONE/.gc/site.toml`. A Reviewer that reproduces test.yaml in order before the gates gets this right. One that takes the paragraph literally, or skips `gc import install` as needing the network, fails every gascity-root pull request ("pass only when every check you ran passed"). Fix: say in the paragraph that the city repository's gates run after test.yaml's `config` setup (import install with `--city "$CLONE"` into the throwaway HOME, then the site binding). Or put that in gascity-root's AGENTS.md, which matches the bead's "from the repository it reviews". Step 3 of the trial will show this either way. - [minor] same lines: "only the commands that read and write nothing outside `$CLONE`": `gc config show` reads the pack cache under HOME, and `import install` reads the network. Read literally, the rule excludes the three gates the next sentence names. "write nothing outside `$CLONE`" says what is meant. - [minor, suggestion] `check-live-city.sh` in the clone proves little, as the text says. Running `scripts/check-live-city.sh "$GC_CITY_PATH"` after the gates, which is read-only, would check the thing that AGENTS.md rule exists for: that the live city's checkout is still clean. Today the trial leaves that check to the Operator. ### Verified - Read the work bead gascitypacks-wmm, the PR description and the whole diff (7 files, +137/-37). Main has no REVIEW.md, AGENTS.md or CLAUDE.md. - Merged the head into origin/main (98f2d80, which includes #51, #53 and #55): clean, and forge `mergeable`. - On the merge result, under `env -i` (0 city variables, checked): `gc lint .` ok. `tests/formula.sh` and `tests/reviewer.sh` ok. `go vet ./...`, `go test ./...` and `go test -race ./...` in forgejo ok. All ten script tests of the `scripts` job ok. The changelog checker built from mikluko/changelog v2.0.1 with `-base=main` reports `valid=true` with `.changelog/city-reviewer.md`. - The PR's patch claim, tested in a throwaway city: with gascity-root's existing `rig = "*"` entry for `forgejo.reviewer`, both Reviewers resolve (Dir "" and "demo") with provider acp, `max_active_sessions = 1`, claude-opus-5-5 at high, `permission_mode` unrestricted and `FORGEJO_TOKEN_FILE`. gascity-root imports forgejo at the city level (`pack.toml` `[imports.forgejo]`), so it gets the city's Reviewer, and no other pack's agent uses `.gc/agents/reviewer`. - `${GC_RIG_ROOT:-$GC_CITY_PATH}` is the fallback the city's Worker already uses (`roles/commands/worktree/setup/run.sh:28`). The test runs the origin check for all four combinations of pull request and Reviewer. - `check-live-city.sh` in a plain clone reads the clone's own status (`--git-common-dir` is `$CLONE/.git`), as the text says. The live city's checkout was clean after all of the above. - The prompt now hands an unslung bead to the Operator and mails it before `gc runtime drain-ack`, and the test checks that order in the rendered prompts of both agents. The step stays under the 28000-character limit.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 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!56
No description provided.