Landing L14: the Reviewer, an acp agent that reviews a pull request and posts its verdict #48

Merged
city-root merged 1 commit from worker/gascitypacks-7mb into main 2026-11-12 11:28:17 +00:00
Contributor

Row L14 of gascity-root docs/handoffs.md (bead gascitypacks-7mb, HQ ticket root-ons.17): the Reviewer, a rig's agent that reviews one head of one pull request and posts its verdict on the forge, and its formula mol-forgejo-review.

What it is

  • forgejo/agents/reviewer: a rig-scoped named session ([[named_session]], mode = "on_demand", in forgejo/pack.toml), session = "acp", permission_mode = "unrestricted", claiming with gc hook --claim --drain-ack --json. max_active_sessions = 1 with no min_active_sessions: gc lint reads that as a singleton a named session may target, and a min_active_sessions = 0 made it fail as a pool. The city's own import makes no Reviewer (rig scope), and tests/reviewer.sh asserts one Reviewer per rig.
  • forgejo/formulas/mol-forgejo-review.toml: one step, five parts, held from the claim to the close like the Worker's. rexcity's mol-forgejo-pr-review less its wait for checks; no new shell, only the formula's text and the Go tool's pr state and pr review.
    1. Load; check the review bead's keys (pr_url, review_head, work_bead).
    2. Clone of its own (never the rig's checkout; the rig's origin URL is the one thing read from it); void when the pull request is not open or its head is not review_head (review_verdict=void, nothing posted); halt when the checks have not completed (it never waits); if the account of its token already has a review of the head on the forge, go to Part 5.
    3. The review, carried over from the Operator's brief: the work bead is the requirement; the whole diff; the pull request's description with .body alone; REVIEW.md and conventions read from the target branch; the head merged into current main in the clone (a conflict is REQUEST_CHANGES saying it needs a rebase); what the repository's workflows run, under env -i so the city's variables are gone; the head's failed check read and reported, never approved.
    4. Post with gc forgejo pr review --expect-head: APPROVED or REQUEST_CHANGES with the findings as the body.
    5. Read its own review back from the forge, write review_verdict (pass/fail/void), review_reviewed (the head), review_url and a note on the review bead, close it with gc.work_outcome=no-op, close the step, gc runtime drain-ack. The verdict is written only after the review is on the forge, and from what the forge holds, so a restart posts nothing twice.
  • It never merges, pushes or changes the work bead; its only gc writes are the review bead, its own step and the mail of a halt. No rm -rf, no rex/rexcity, the token read only inside an Authorization header. Its clone stays under its work directory.
  • L7 is not there. The place for L7's handoff check of the review bead is marked in Part 1; nothing calls it. The three keys are checked by hand.
  • README section "The Reviewer", CHANGELOG entry under [Unreleased].

What is Claude Code's own

The formula is plain text: gc, git, curl and jq commands, read through gc bd show. Any ACP adapter and model that can run commands and follow a step can run it. Claude's: permission_mode, model and effort in option_defaults and the city's patch (options claudeacp takes), session = "acp" with the city's acp provider, and the 28000-character size of the step, which tests/reviewer.sh keeps under Claude Code's 30000-character inline Bash output.

Verification

  • tests/reviewer.sh (new, wired into the lint job): resolves the agent in a throwaway city with a rig (gc --city, so a session's GC_* does not matter), compiles the formula, checks the safety rules and the order of the writes in the text, and runs the lines that read and write the bead against a stub gc and curl (state block, "already reviewed" filter with other accounts', other heads' and dismissed reviews, pass/fail record, void, close order, halt). I broke four rules in the formula one at a time (a git push, a missing --expect-head, a write to the work bead, a changed account filter) and the test failed each time.
  • gc lint ., go vet and go test ./... in forgejo, every other tests/*.sh, tests/formula.sh (under env -i: the checkout's copy has no --city, the known gascitypacks-pmn symptom), and the v1 changelog check (valid=true) pass. Rebased on 43dce15 (L12) right before the push; the README and pack.toml conflicts were line-level and resolved to keep both.
  • Not run: the formula against a live forge and a live acp session, and jq 1.6 (its constructs are 1.6's; I did not download a binary). That is the trial below.

The city's patch (the Operator's to file, with the import bump)

An import of this pack that carries the Reviewer fails scripts/check-pins.sh for every rig unless this patch goes in the same pull request. I checked it in a throwaway city: gc config show --validate passes and the Reviewer of the rig resolves with the acp provider, MaxActiveSessions 1, the pinned model and effort, and FORGEJO_TOKEN_FILE set to the review token. An agent's env wins over workspace.env, so no other agent's FORGEJO_TOKEN_FILE changes. In pack.toml of gascity-root:

# The Reviewer of each rig (gascitypacks forgejo pack): an acp named session on demand,
# one at a time, on the review account's token. The model and effort are the user's
# choice; rexcity's reviewer used claude-opus-5-5 at high.
[[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" }

(The path is the review account's token file from the Operator's brief; adjust if it is not.) The pull request that bumps [imports.forgejo] to the release with this change also needs the release of this repository first.

The trial (question 4 of section 4: which assignee string wakes an acp named session)

Not for me to run on the live city. After the release, the import bump and the patch have landed, gc config show has <rig>/forgejo.reviewer:

  1. Pick a pull request of the rig, open, checks completed: gc forgejo pr state --json --repo <rig checkout> --pr <url> | jq '{state, head, base, checks}'. Note the full head, and the work bead it answers.
  2. Make the review bead in the rig's store: gc bd --rig <rig> create --title "Review <url> at <head, 7 chars>" --type task --labels service,review --metadata '{"pr_url":"<url>","review_head":"<full head>","work_bead":"<work bead id>"}'.
  3. Sling it (from outside a rig's directory): gc sling <rig>/forgejo.reviewer <review bead>. Expected within a few minutes: the bead is routed and has a workflow (gc bd show shows gc.execution_routed_to), a session of template reviewer starts (gc session list), and, within roughly ten minutes, the review bead is closed with review_verdict pass or fail, review_reviewed the head, review_url and a note that says "as <account>". The pull request shows one review at that head by the review account (city-root-review): if the note names the city's account instead, the patch's env did not apply. The work bead is unchanged. The pull request is not merged by it.
  4. Assign instead of sling (the question): make a second review bead as in step 2, for another open pull request, and gc bd --rig <rig> update <bead> --assignee <rig>/forgejo.reviewer. Wait two minutes and look at gc session list for a reviewer session. If none starts, try the other strings sessionAssigneeMatches takes in turn, setting the assignee each time: the session's name, its alias, the named identity without the rig. Record which one woke it. Expected when one does: the Reviewer has no workflow for a bare bead, mails the Operator "assigned and not slung" and exits (gc mail inbox); that mail is the pass of this step, and it shows the review order (L15) must sling and not only assign.
  5. Void: a review bead whose review_head is an older commit of an open pull request, slung. Expected: closed, review_verdict=void, a note saying so, and no new review on the pull request.
  6. Restart safety: sling a new review bead for the head of step 3 again. Expected: it finds its own review (no second review is posted), and records the same verdict and URL.

After each, gc bd show of the review bead and the pull request's reviews are the evidence; the Reviewer's clone is under .gc/agents/<rig>/reviewer/ and can be cleared by hand.

Bead: gascitypacks-7mb

Row L14 of gascity-root `docs/handoffs.md` (bead gascitypacks-7mb, HQ ticket root-ons.17): the Reviewer, a rig's agent that reviews one head of one pull request and posts its verdict on the forge, and its formula `mol-forgejo-review`. ## What it is - `forgejo/agents/reviewer`: a rig-scoped named session (`[[named_session]]`, `mode = "on_demand"`, in `forgejo/pack.toml`), `session = "acp"`, `permission_mode = "unrestricted"`, claiming with `gc hook --claim --drain-ack --json`. `max_active_sessions = 1` with no `min_active_sessions`: `gc lint` reads that as a singleton a named session may target, and a `min_active_sessions = 0` made it fail as a pool. The city's own import makes no Reviewer (rig scope), and `tests/reviewer.sh` asserts one Reviewer per rig. - `forgejo/formulas/mol-forgejo-review.toml`: one step, five parts, held from the claim to the close like the Worker's. rexcity's `mol-forgejo-pr-review` less its wait for checks; no new shell, only the formula's text and the Go tool's `pr state` and `pr review`. 1. Load; check the review bead's keys (`pr_url`, `review_head`, `work_bead`). 2. Clone of its own (never the rig's checkout; the rig's origin URL is the one thing read from it); **void** when the pull request is not open or its head is not `review_head` (`review_verdict=void`, nothing posted); halt when the checks have not completed (it never waits); if the account of its token already has a review of the head on the forge, go to Part 5. 3. The review, carried over from the Operator's brief: the work bead is the requirement; the whole diff; the pull request's description with `.body` alone; `REVIEW.md` and conventions read from the target branch; the head merged into current main in the clone (a conflict is REQUEST_CHANGES saying it needs a rebase); what the repository's workflows run, under `env -i` so the city's variables are gone; the head's failed check read and reported, never approved. 4. Post with `gc forgejo pr review --expect-head`: `APPROVED` or `REQUEST_CHANGES` with the findings as the body. 5. Read its own review back from the forge, write `review_verdict` (`pass`/`fail`/`void`), `review_reviewed` (the head), `review_url` and a note on the review bead, close it with `gc.work_outcome=no-op`, close the step, `gc runtime drain-ack`. The verdict is written only after the review is on the forge, and from what the forge holds, so a restart posts nothing twice. - It never merges, pushes or changes the work bead; its only `gc` writes are the review bead, its own step and the mail of a halt. No `rm -rf`, no `rex`/`rexcity`, the token read only inside an Authorization header. Its clone stays under its work directory. - **L7 is not there.** The place for L7's handoff check of the review bead is marked in Part 1; nothing calls it. The three keys are checked by hand. - README section "The Reviewer", CHANGELOG entry under `[Unreleased]`. ## What is Claude Code's own The formula is plain text: `gc`, `git`, `curl` and `jq` commands, read through `gc bd show`. Any ACP adapter and model that can run commands and follow a step can run it. Claude's: `permission_mode`, `model` and `effort` in `option_defaults` and the city's patch (options `claudeacp` takes), `session = "acp"` with the city's `acp` provider, and the 28000-character size of the step, which `tests/reviewer.sh` keeps under Claude Code's 30000-character inline Bash output. ## Verification - `tests/reviewer.sh` (new, wired into the `lint` job): resolves the agent in a throwaway city with a rig (`gc --city`, so a session's `GC_*` does not matter), compiles the formula, checks the safety rules and the order of the writes in the text, and runs the lines that read and write the bead against a stub `gc` and `curl` (state block, "already reviewed" filter with other accounts', other heads' and dismissed reviews, pass/fail record, void, close order, halt). I broke four rules in the formula one at a time (a `git push`, a missing `--expect-head`, a write to the work bead, a changed account filter) and the test failed each time. - `gc lint .`, `go vet` and `go test ./...` in `forgejo`, every other `tests/*.sh`, `tests/formula.sh` (under `env -i`: the checkout's copy has no `--city`, the known `gascitypacks-pmn` symptom), and the v1 changelog check (`valid=true`) pass. Rebased on `43dce15` (L12) right before the push; the README and `pack.toml` conflicts were line-level and resolved to keep both. - Not run: the formula against a live forge and a live acp session, and jq 1.6 (its constructs are 1.6's; I did not download a binary). That is the trial below. ## The city's patch (the Operator's to file, with the import bump) An import of this pack that carries the Reviewer fails `scripts/check-pins.sh` for every rig unless this patch goes in the same pull request. I checked it in a throwaway city: `gc config show --validate` passes and the Reviewer of the rig resolves with the acp provider, `MaxActiveSessions` 1, the pinned model and effort, and `FORGEJO_TOKEN_FILE` set to the review token. An agent's `env` wins over `workspace.env`, so no other agent's `FORGEJO_TOKEN_FILE` changes. In `pack.toml` of gascity-root: ```toml # The Reviewer of each rig (gascitypacks forgejo pack): an acp named session on demand, # one at a time, on the review account's token. The model and effort are the user's # choice; rexcity's reviewer used claude-opus-5-5 at high. [[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" } ``` (The path is the review account's token file from the Operator's brief; adjust if it is not.) The pull request that bumps `[imports.forgejo]` to the release with this change also needs the release of this repository first. ## The trial (question 4 of section 4: which assignee string wakes an acp named session) Not for me to run on the live city. After the release, the import bump and the patch have landed, `gc config show` has `<rig>/forgejo.reviewer`: 1. **Pick a pull request** of the rig, open, checks completed: `gc forgejo pr state --json --repo <rig checkout> --pr <url> | jq '{state, head, base, checks}'`. Note the full `head`, and the work bead it answers. 2. **Make the review bead** in the rig's store: `gc bd --rig <rig> create --title "Review <url> at <head, 7 chars>" --type task --labels service,review --metadata '{"pr_url":"<url>","review_head":"<full head>","work_bead":"<work bead id>"}'`. 3. **Sling it** (from outside a rig's directory): `gc sling <rig>/forgejo.reviewer <review bead>`. Expected within a few minutes: the bead is routed and has a workflow (`gc bd show` shows `gc.execution_routed_to`), a session of template `reviewer` starts (`gc session list`), and, within roughly ten minutes, the review bead is closed with `review_verdict` `pass` or `fail`, `review_reviewed` the head, `review_url` and a note that says "as `<account>`". The pull request shows one review at that head by the review account (`city-root-review`): if the note names the city's account instead, the patch's `env` did not apply. The work bead is unchanged. The pull request is not merged by it. 4. **Assign instead of sling** (the question): make a second review bead as in step 2, for another open pull request, and `gc bd --rig <rig> update <bead> --assignee <rig>/forgejo.reviewer`. Wait two minutes and look at `gc session list` for a `reviewer` session. If none starts, try the other strings `sessionAssigneeMatches` takes in turn, setting the assignee each time: the session's name, its alias, the named identity without the rig. Record which one woke it. Expected when one does: the Reviewer has no workflow for a bare bead, mails the Operator "assigned and not slung" and exits (`gc mail inbox`); that mail is the pass of this step, and it shows the review order (L15) must sling and not only assign. 5. **Void:** a review bead whose `review_head` is an older commit of an open pull request, slung. Expected: closed, `review_verdict=void`, a note saying so, and no new review on the pull request. 6. **Restart safety:** sling a new review bead for the head of step 3 again. Expected: it finds its own review (no second review is posted), and records the same verdict and URL. After each, `gc bd show` of the review bead and the pull request's reviews are the evidence; the Reviewer's clone is under `.gc/agents/<rig>/reviewer/` and can be cleared by hand. Bead: gascitypacks-7mb
Landing L14: the Reviewer, a rig's agent that reviews a pull request and posts its verdict (gascitypacks-7mb)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 27s
test / scripts (pull_request) Successful in 36s
136899ba3c
Adds forgejo.reviewer and its formula mol-forgejo-review: the agent that works one
review bead into one review of one head on the forge. It ports rexcity's
mol-forgejo-pr-review less its wait for the checks, with the rules of the
Operator's interim reviewing agents carried into the formula's text: the bead is
the requirement, the whole diff, REVIEW.md from the target branch, the merge result
against current main, what CI runs (in a clone of its own, under env -i), a failed
check read and reported and never approved, and no push, merge or write to the work
bead.

The agent is a rig-scoped named session, on demand, max_active_sessions = 1 with no
min_active_sessions (gc lint reads that as a singleton a named session may target),
session acp, claiming with --drain-ack. The formula is one step of five parts, held
from the claim to the close like the Worker's. It voids a bead whose head moved,
posts through gc forgejo pr review --expect-head, writes review_verdict,
review_reviewed and review_url only after the review is on the forge and from what
the forge holds, and closes the bead with the work outcome no-op, so a restart posts
nothing twice. Row L7's handoff check does not exist; its place in Part 1 is marked
and nothing calls it.

tests/reviewer.sh (in the lint job) resolves the agent in a throwaway city with a
rig, compiles the formula, checks its safety rules and the order of its writes in
its text, and runs its bead-reading and bead-writing lines against a stub gc and
curl; each rule was checked by breaking it once. README section "The Reviewer"
carries the patch gascity-root needs, and the CHANGELOG entry stands under
Unreleased. Also run: gc lint ., tests/formula.sh (under env -i, as before),
the v1 changelog check.

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

Reviewed 136899b in full against gascitypacks-7mb: agent, formula, tests/reviewer.sh, README, CHANGELOG, description (city patch + trial); merge onto main 43dce15 is a fast-forward and CI on that tree is green.

Reviewed 136899b in full against gascitypacks-7mb: agent, formula, tests/reviewer.sh, README, CHANGELOG, description (city patch + trial); merge onto main 43dce15 is a fast-forward and CI on that tree is green.
Author
Contributor

Review of 136899b against gascitypacks-7mb (Landing L14), approved and merged.

Checked:

  • The bead, read in full: everything it lists is here. forgejo/agents/reviewer is a rig-scoped on-demand named session on acp, unrestricted, with at most one session. mol-forgejo-review is one step of five parts. It voids on a moved head or a closed PR, never waits, never merges, never pushes and never writes the work bead. It posts with gc forgejo pr review --expect-head and records review_verdict/review_reviewed/review_url and a note, read back from the forge, then closes with no-op. The place for L7 is marked and nothing calls it. The description says what is Claude Code's own.
  • The whole diff: agent.toml, prompt, pack.toml, formula, tests/reviewer.sh, README section, CHANGELOG entry under [Unreleased], workflow line.
  • The description carries the city patch, and it matches the existing roles.worker patches in gascity-root pack.toml. The review token is set only through the Reviewer's agent env, and every other agent keeps workspace.env's city token. The description also carries the trial for question 4.
  • No new shell logic beyond the formula text and its test, which the bead asks for, since the Worker's formula is tested the same way.
  • Merge result: main was still at 43dce15 (the PR base), so the merge is a fast-forward to the head. CI on that tree (changelog, lint incl. tests/reviewer.sh, scripts) is all green.

Follow-ups:

  • The Operator files the gascity-root patch together with the import bump, after the release.
  • Run the trial in the description (sling, assign, void, restart) to settle question 4.
  • Minor: Part 4 calls exit 3/4 "a void" and does not repeat the void write from Part 2. A Reviewer has to infer that it should write it.

Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.

Review of 136899b against gascitypacks-7mb (Landing L14), approved and merged. Checked: - The bead, read in full: everything it lists is here. `forgejo/agents/reviewer` is a rig-scoped on-demand named session on acp, unrestricted, with at most one session. `mol-forgejo-review` is one step of five parts. It voids on a moved head or a closed PR, never waits, never merges, never pushes and never writes the work bead. It posts with `gc forgejo pr review --expect-head` and records `review_verdict`/`review_reviewed`/`review_url` and a note, read back from the forge, then closes with `no-op`. The place for L7 is marked and nothing calls it. The description says what is Claude Code's own. - The whole diff: agent.toml, prompt, pack.toml, formula, tests/reviewer.sh, README section, CHANGELOG entry under [Unreleased], workflow line. - The description carries the city patch, and it matches the existing `roles.worker` patches in gascity-root `pack.toml`. The review token is set only through the Reviewer's agent `env`, and every other agent keeps `workspace.env`'s city token. The description also carries the trial for question 4. - No new shell logic beyond the formula text and its test, which the bead asks for, since the Worker's formula is tested the same way. - Merge result: main was still at 43dce15 (the PR base), so the merge is a fast-forward to the head. CI on that tree (changelog, lint incl. tests/reviewer.sh, scripts) is all green. Follow-ups: - The Operator files the gascity-root patch together with the import bump, after the release. - Run the trial in the description (sling, assign, void, restart) to settle question 4. - Minor: Part 4 calls exit 3/4 "a void" and does not repeat the void write from Part 2. A Reviewer has to infer that it should write it. Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.
mikluko referenced this pull request from a commit 2026-11-12 11:42:07 +00:00
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!48
No description provided.