-
v0.9.0
Stablereleased this
2026-11-12 20:38:36 +00:00 | 5 commits to main since this releaseAdded
- The roles pack's
failuresorder mails the Operator when an order keeps failing, which nothing read before: gc records each failed run as anorder.failedevent and each run that went through asorder.completed, both with the order and its scope as the subject (merge:rig:rexcity), and in the 24 hours to 2026-11-12 15:35 the log held 138 failures, 128 of them themergeorder of one rig reading a forge that answered 503. When an order has failed three runs in a row (FAILURES_STREAK) it sendsORDER FAILING <order>: <n> runs in a rowfromcontrollerwith--notify, a body of the order, the count, the first and last failure and the end of the last error, and the dedup keyorder-failing:<order>:<seq of the first failure>; when that order runs again it sendsORDER RECOVERED <order>, without--notify, withorder-recovered:<order>:<seq>. A streak that ends before three mails nothing, and each order and scope is counted apart. The order hasscope = "city", so it runs once and not once per import of the pack, and it says on stderr when its last run is older than the lookback. The order is a five-minute cooldown order and not one onorder.failed, since the mail that an order runs again has no failure to wait for. It reads the events of the last two hours (FAILURES_LOOKBACK) above a cursor kept infailures.jsonunder the pack's state directory, so each event is counted once and the streak of an order that runs daily lasts across days; a mail that failed is sent by the next run. The logic isroles order failuresin the roles Go tool, andassets/scripts/failures.shstarts it. FORGEJO_TOKEN_COMMANDin the forgejo pack: a command, run withsh -c, whose trimmed stdout is the Forgejo API token. When it is set it wins overFORGEJO_TOKEN_FILE, and a command that fails or prints nothing is an error, not a fall back to the file; the error carries the command's stderr, cut to 300 bytes, and never its stdout. Every reader in the pack's Go tool (pr open,pr state,pr merge,pr review,pr comment, and themerge,checks,scheduleandrevieworders) takes it through one function, so a city can keep its token in a secret store and set the command that prints it, and the pack stays agnostic of the store. The command runs in the pack's directory with the environment of the process that started the tool. The Go tests (forgejo/assets/forgejo/token_test.go) carry the file, the command, the command beating the file, a command that fails, prints nothing or writes a long stderr, and the tool's commands reading the token from the command.gc forgejo token, which prints the token as the tool reads it, from the command or the file, for the one reader that is not the tool, the Reviewer's formula. It takes no argument, prints nothing and exits 1 when there is no token, and 2 for an argument. Its help says the token goes in the header of the request it is for and nowhere else.- A line in the Worker's prompt: the Forgejo token is a secret it never reads, neither the file, nor what
FORGEJO_TOKEN_COMMANDorgc forgejo tokenprints; it opens, reads and comments on pull requests with thegc forgejo prcommands, which read it themselves.tests/formula.shchecks the line in the prompt as gc renders it. tests/doctor.sh, run by thelintjob: the doctor for a file, a command, both, neither, and a command that fails or prints nothing, and that it never prints the token and runs the command once.gc roles versionprints the version of the roles pack's Go tool,roles/assets/roles, which also runs thehandoverorder. It starts asgo tool -C "$GC_PACK_DIR" roles version, as the forgejo pack's commands start their tool.internal/gcx, the code the two tools share, starting with the lookup of the city's Operator, which the forgejo tool'smerge,scheduleandchecksorders now take from it.internal/budget, a Go test run bygo test ./..., holds the packs' shell to the rule ofdocs/shell.md: it measures each unit of shell and compares it with the new ledger,docs/shell-ledger.txt, which lists the 10 units that exist and are over a threshold. CI runs it as its own step of thelintjob in warning mode, so it prints what it would fail and passes;SHELL_BUDGET=failmakes it fail.tests/pack-cache.sh, run by CI, starts both tools from a copy of the checkout as gc's pack cache holds one, offline and throughgc.REVIEW.mdstates the shell rule for the Reviewer, and the Worker's skill carries the same three paragraphs.- The Researcher's Perplexity server reads its key from
PERPLEXITY_API_KEY_COMMANDwhen that variable is set and not empty: the command is run withsh -cand its standard output is the key. A command that fails, or prints nothing, ends the start and does not fall back to the file. - The
rolespack carriesmol-researcher-work, the Researcher's formula, which its agent already names asdefault_sling_formula: one step of five parts (read the bead and mark it taken, scope the question, investigate, check, post), held by one session from the claim to the close. The Researcher posts its findings as one comment headed[research-<bead id>]on its own bead, then closes the bead with the reasonFindings posted: [research-<bead id>],gc.work_outcome=no-opandgc.work_verification, then closes the step and acknowledges the drain. The bead gets no branch, pull request or merge result. A restart counts the comments before it posts, so a comment is never posted twice. A bead that is not a question, or is a decision or a change, is halted to the Operator with the reason, as a Worker's is, with the commands in the step. - The formula's
bashblocks are 24 code lines, under the 60 thatdocs/shell.mdallows a formula, so it needs no Go tool. tests/researcher-formula.shcompiles the formula in a throwaway city and checks that it is one step of five parts, that the step is closed as passed once and as failed only by a halt, the order of its writes, that it runs no git command but a clone, norm, no sling and no write to a bead but the work bead and its step, its size, and its 60 code lines; it runs the lines that write the beads against a stubgc. CI runs it.- The README says what the trial by hand found: under
full-autoa call of the Agent tool is refused and nothing prompts; the tool names of the allow list are Claude Code's own; claudeacp acceptsfull-auto; and an allow list cannot limitBashto commands that only read, because the city's list allowsBashas a whole and a deny list names only the commands it lists. gc roles waiting [--json] [agent]andgc roles nudge [agent], two commands of the roles pack's Go tool that answer what waits on an agent and nudge it once: the logic of the city'soperator-nudgeorder, which gascity-root#44 wrote as an 18-line shell script and whose review found two defects of the kind a test catches. A bead waits on an agent when it is assigned to it and not closed (open, in_progress, blocked and deferred count alike), in the HQ store and in the store of every rig, read withgc bd list --assignee, with the HQ store read as the city's own whichever rig the caller stands in.waitingprints one line for each bead (id, status, store and title, separated by tabs), or with--jsonone object withschema_version("1"),agent,countandbeads.nudgesends onegc session nudgewith the line<n> bead(s) wait on you: <up to five ids>(andand moreafter five) when at least one bead waits and no nudge to the agent's session is pending or in flight ingc nudge status, and sends nothing otherwise. The agent is$OPERATOR, else the one city-scoped agent namedoperator, when none is named; both commands take gc's--city, which they give to everygccall. A store that cannot be read, the list of the rigs, and the nudge queue are errors that name what failed, with exit status 1:waitingprints nothing andnudgesends no nudge, not even for the stores that could be read, where the shell script took a failed HQ store or any rig but the last for "nothing waits" and a failedgc nudge statusfor success. Both read every store and the queue in each run, so a queued nudge does not hide a failure. The Go tests (roles/assets/roles/waiting_test.go) carry those cases with and without beads in the other stores, the five-id limit, the queue states, the--cityon every call and the command lines;tests/waiting.sh, run by thescriptsjob, tests the wrappers and the real tool against a stubgc. The README says what the city's order becomes (exec gc roles nudge) and how the Operator learns that an order keeps failing: from thefailuresorder.
Changed
- The roles tool's lookup of the Operator, its state directory and its atomic write of a state file are in
roles/assets/roles/common.go, shared by thehandoverandfailuresorders.handover.jsonis written as before. - The Reviewer's formula
mol-forgejo-reviewtakes its token from$(gc {{forge}} token)in each of the six places where it read$(cat "$FORGEJO_TOKEN_FILE"), so it and the tool cannot disagree about where the token is;tests/reviewer.shpins that every request of the formula is authorized that way and that no line of it namesFORGEJO_TOKEN_FILEorFORGEJO_TOKEN_COMMANDbut to say that no other agent's names the Reviewer's token, and its stubcurlrefuses a request that does not carry the token the stubgc forgejo tokenprints. The Reviewer's prompt says the account is the one whose token the pack'stokencommand prints. A Reviewer started by a city that sets onlyFORGEJO_TOKEN_FILEreads the same file as before. - The doctor of the forgejo pack accepts either variable: with
FORGEJO_TOKEN_COMMANDset it runs the command once and exits 2 when it fails or prints nothing, without showing what it printed; with neither variable set it exits 1 and says neither is set. Its message for a readable file is unchanged. - The README says where the token comes from, including that the command wins over the file even when the file is the agent's own and the command the workspace's, so a city that moves to the command moves every place that names the token. The help of
pr open,pr state,pr merge,pr reviewandpr commentsays the same. - Breaking: the Researcher's Perplexity server no longer reads
~/.config/gascity-root/perplexity-token. WithoutPERPLEXITY_API_KEY_COMMAND, it reads the file named byPERPLEXITY_API_KEY_FILE, and with neither variable set it does not start. A city that kept the file setsPERPLEXITY_API_KEY_FILEto its path in theenvof a patch ofroles.researcher. - The README's section on the Researcher no longer says that its formula and its skill are not in the pack yet.
Fixed
- The
applyandupgradeorders no longer fail when they fire together. Both fetchorigin/maininto the city repository, and git lets only one of two concurrent fetches that find it moved updaterefs/remotes/origin/main: the other failed with "cannot lock ref" and mailed the Operator, and the merged change waited for the nextapplyrun. Both now fetch throughroles git fetch <repo> <branch>, a command of the roles pack's Go tool that runs the fetch again, up to five tries 0.2 to 0.6 seconds apart, when it lost the lock on the ref; by then the ref is where the first fetch put it. Any other failure, and a lock still lost after the last try, still fails and still mails the Operator. The orders retry rather than take a lock of their own because a lock shared across two scripts needs a stale-lock rule for a run killed outright, and retrying also covers a fetch the user or a Worker runs in the city directory. Theupgradeorder now needsgoon the supervisor'sPATH, asapplyalready did. - The
scheduleorder no longer takes an open review bead for a Worker on the pull request. When the head of a pull request moved to one no bead holds, it raisedno_workeronly if no open bead carried the pull request's URL, and a review bead (pr_url,review_head) is open while the pull request is under review, so the Operator was never told that someone pushed to a branch nobody was working on. A bead that carriesreview_headis now skipped, as one that carriespr_eventalready was.
Downloads
-
Source code (ZIP)
1 download
-
Source code (TAR.GZ)
1 download
- The roles pack's