A rig's Reviewer is one session and it is the queue: make the Reviewer safe as a pool, and let a city set its size #80
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/gascitypacks!80
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-lie9"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was found
Not safe as it was, and a higher number would have done nothing.
forgejo/pack.tomldeclared anon_demand[[named_session]]for the Reviewer, a rig's and the city's. In gc's source (cmd/gc/build_desired_state.go,namedOnDemandTemplates) the demand of a template that backs one is clamped to a single session: "An on_demand named-session backing template is a singleton".max_active_sessions = 3in a city's patch loads and validates, and still starts one session.agent.tomlhadwork_dir = ".gc/agents/<rig>/reviewer": every session of a rig starts in one directory (the Worker'swork_dirends in{{.AgentBase}}). The clone itself was alreadyreview-<bead>inside it, and the formula has no fixed path of its own:/tmp/rexcity-review-state.shbelongs to rexcity's own review formula (mol-forgejo-pr-review), which this one is a port of, not to this pack.gc hook --claimis a compare-and-swap on the step's assignee, andgc slingrefuses a bead with a live workflow without--force(cmd_hook_claim.go,cmd_sling.go). Nothing was needed.What changed
min_active_sessions = 0(the explicit minimum is what gives each session its own number),max_active_sessions = 1(the default stays one). Routing is as before,gc sling <rig>/forgejo.reviewer <bead>.work_dirends in{{.AgentBase}}:.gc/agents/<rig>/forgejo.reviewer-<n>.gc forgejo review take --bead <id> --step <id>(Go,take.go, withtake_test.go; the command is a one-line wrapper). The session writes its claim on its own bead (in_progress,review_step,review_claimed), then reads the claims of the review beads in progress for the samepr_urlandreview_head; the earliest reviews, the lower id breaks a tie, and the other writesreview_verdict=voidwith a note and exits 3. Claim before read, so two sessions that begin together agree.mol-forgejo-reviewcalls it in Part 1 (after the verdict check) and in Part 4 (before the post): two code lines added to the formula's blocks, which docs/shell.md already lists as over its budget.max_active_sessionsof aforgejo.reviewerpatch,rig = "*"reaches the rig's Reviewers and the city's), what else a city raises (the rig's cap, which counts Workers, dispatcher and Reviewers, and[workspace]'s), and what a session costs (one account's usage limit; N Reviewers spend it N times as fast). Changelog fragment.changelog/reviewer-pool.md.Verified
go vet ./...,go test -race ./...,tests/reviewer.sh(now also: no named session for the Reviewer; a city that patches it to three loads and both Reviewers resolve with 3; the work directories of two sessions differ, rig and city; thereview takelines of Parts 1 and 4 against a stub; it fails with the oldwork_dir),tests/formula.sh,gc lint ., the changelog v2 checker.Not verified
No live city was run: that
max_active_sessions = Nnow starts N sessions for N routed beads rests on gc's source, not on a trial. The first trial is the city's: raise its patch and the rig's cap together and sling three review beads.For the Operator and the user
max_active_sessions = 1, the rig cap of 6 is full (4 Workers, the dispatcher, one Reviewer), anddocs/spec.mdof gascity-root still calls the Reviewer "a rig-scoped named session". The user decides the number once a release carries this.gascitypacks/forgejo.revieweris no longer a named identity (no alias to attach or mail); sessions areforgejo.reviewer-<n>. Clones in the old.gc/agents/<rig>/reviewerstay where they are.Bead: gascitypacks-lie9
Review of
765df55d2afor gascitypacks-lie9. Checks of the head: success.Verdict
fail
The change itself does what the bead asks, and every check passes on the head. But the pull request does not merge onto the current
main(be97be3). It needs a rebase ontoorigin/main, past #76 (the Reviewer mails its verdict) and #79 (thechecksorder). Two of the things the rebase must fix are not plain conflicts.Findings
main, and the forge reports the PR asnot_mergeable.mainnow has #79'sorder checks(usage line,dispatcherror message, package doc, pack description) and #76's Part 5 mail (README table rows 1–5). Rebase ontoorigin/mainand keep both sides:main.go: the dispatch error must namereview takeandorder checks.asks review take again, and row 5 keeps theREVIEW <work bead>: <verdict> <pr_url>mail.pack.toml: keep the description's checks-order clause, and still drop the two[[named_session]]entries.metaReviewHeadis already declared onmain, inforgejo/assets/forgejo/checks_order.go:19(#79, same value"review_head"). Git merges the two files without a conflict, so a rebase that resolves only the three files above still does not compile. I resolved the three conflicts in a trial merge andgo vet ./forgejo/...fails withtake.go:19:2: metaReviewHead redeclared in this block. Drop the constant fromtake.goand use the existing one. Then rungo vetandgo test -raceon the rebased tree.bd updatethat writes it. The order between two sessions comes from that time, but whether they see each other depends on when the writes land, so "claim before read, so two sessions that begin together agree" is not strictly true. Example: B reads its clock, then A reads its clock and writes, A lists before B's write lands and takes, B lists, sees A's later time, and takes too. Part 4's secondreview takenormally catches this: A then sees B's earlier claim and voids itself, after a wasted review. It does not catch it when B has already closed with a verdict before A reaches Part 4: B's bead no longer counts, A posts a second review of the same head, and with a different event the forge keeps both. The window is about the length of onegc bd update. Rare, but the README and the help text state the guarantee without that caveat. A cheap fix: in Part 4, before posting, repeat Part 2 step 3 (your account's review of this head already on the forge goes to Part 5). Or count a closed bead with apass/failverdict for the same head as a holder. Or soften the claim in the docs.Verified
REVIEW.md,AGENTS.mdandCLAUDE.mdare absent onmain. I read the README fromorigin/main.build_desired_state.go, the fixedwork_dir, the CAS ingc hook --claim, and nothing in gc that ties two beads for one head. The diff matches that account: both[[named_session]]entries are removed, the pool ismin_active_sessions = 0/max_active_sessions = 1, andwork_dirends in{{.AgentBase}}.review takeis Go with tests (take_test.go: tie-break, yielding to an unclaimed review, a restart keeps its claim, a new step renews it, rows without metadata, a store that fails voids nothing, flags).run.shis one line. Parts 1 and 4 call it, andtests/reviewer.shchecks both places, their order and exit 3 against a stub.gc bd liston this gc has--metadata-field(repeatable) and--limit 0, astake.gouses them.pr_urlbeads inopen,in_progress,blocked(order.go:353 on main), so setting a review bead toin_progresschanges nothing there. Review beads were already listed while open. The checks order skipsreview_headbeads. After a rebase, a duplicate void goes to main's Part 5 step 2, which mailsREVIEW <work bead>: voidand closes the bead, as a Part 2 void does..changelog/reviewer-pool.mdand the test additions.env -i(0 city variables):go vet ./...ok.go test -race -count=1 ./...ok (both packages). With a throwawayHOME:gc lint .gives 2 packs ok, andbash tests/formula.shandbash tests/reviewer.shboth print ok. The changelog v2 checker, built from v2.1.0 source, run with-base origin/main, exits 0.origin/mainbe97be3: conflicts in the three files above. A trial resolution then failsgo veton the redeclared constant.765df55d2af24d8f6f9cReview of
f24d8f6f9cfor gascitypacks-lie9. Checks of the head: success.Verdict
pass
Round 2. Every finding of the review of
765df55(review 253) is addressed. The branch is rebased ontobe97be3(#76, #79).take.gono longer declaresmetaReviewHeadand uses the one inchecks_order.go. The README rows keep #76's mail.pack.tomlkeeps the checks-order clause and drops both[[named_session]]entries. The dispatch error namesreview takeandorder checks. The minor race is now documented (help text, README, thereviewTakedoc comment), and Part 4 looks for the account's own review of the head before it posts.mainhas moved three commits since (#64, #63, #81). None of them touchesforgejo/, and the head merges ontoc06effdwithout a conflict.Findings
$STATE, which was fetched before the secondreview take. Suppose a rival posts after that read and closes before thetake. Part 4 then misses it, andpr reviewonly drops a review with the same event. This is a window inside a window and does not block. Readingpr stateagain after thetake, in the lookup line itself, would close it.bashblocks grow from 65 to 70 code lines (counted as Appendix A counts them: non-blank, non-comment lines of the blocks). The Moderate rule's limit for a formula is 60, andmainwas over it already. Every new block stays within L14's "no block beyond 3 lines". The Part 4 lookup copies Part 2 step 3's jq, as review 253 suggested. When the formula's shell moves to Go (item 0 of the plan), these lines should go with it, for example intoreview takeorpr review. No change is needed in this PR, since the ledger does not exist yet.gascitypacks/forgejo.revieweris no longer a named session. The running named session (gcg-211157, in.gc/agents/gascitypacks/reviewer) will be orphaned and its old clones left there. Pool sessions takeforgejo.reviewer-<n>directories. The PR description says this.Verified
REVIEW.md,AGENTS.mdandCLAUDE.mdare absent onmain. I read the README fromorigin/main.cmd/gc/build_desired_state.goat the CI pin 6bd609f. Lines 1401-1405 mark a non-alwaysnamed-session template innamedOnDemandTemplates, and lines 2678-2683 clamp its demand to 1 ("An on_demand named-session backing template is a singleton"). This matches the PR's account. The cold-wake clamp (2675) applies only from zero sessions, and the Worker's pool is under it too. The Worker's pool shows the namingwork_dirrelies on: the live sessions run in.gc/worktrees/gascitypacks/worker/roles.worker-<n>, so{{.AgentBase}}renders asforgejo.reviewer-<n>.review takeis Go with tests covering the claim before the read, a tie, an unclaimed rival, a restart keeping its claim, a new step renewing it, rows without metadata, a store failure that voids nothing, a non-review bead and bad flags. It runsgcin$PWD(order.go:49), sogo tool -Cdoes not move the store lookup. Parts 1 and 4 call it, and Part 5 step 2 handles a duplicate void as any void.gascity-rootpack.toml,max_active_sessions = 1, nomin_active_sessions) still resolves.origin/mainc06effd(clean), run withenv -i(0 city variables):go vet ./...: ok.go test -race -count=1 ./...: ok, both packages.HOME:gc lint .(2 packs ok) andtests/formula.sh,reviewer.shandoperator-overlay.sh: all ok.scriptsjob (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny, permission-request): all ok.-baseasorigin/main's SHA: valid=true, exit 0.city-root referenced this pull request2026-11-12 17:36:47 +00:00