A Reviewer in bypass mode raised a permission prompt: rm on a path from a variable #54
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!54
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-mkr"
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?
A Reviewer of
claudeacp, in bypass mode, raised a permission prompt on 2026-11-12: its scratch script ranrm -fon a path built from a variable. Claude Code asks before anrmon a path it cannot resolve, bypass mode or not, and nobody sits at a Reviewer's session, so the request was held until the Operator denied it. The Worker's skill got the rules against this in #39; the Reviewer has no skill, and its formula said only "you remove nothing withrm -rf".What changed
forgejo/formulas/mol-forgejo-review.toml: the rules of the step now carry, in the Reviewer's terms, where scratch files go (the clone under its own directory and the$CLONE.body.mdand$CLONE.difffiles the step names beside it; anything else in amktemp -ddirectory under$TMPDIR; all left where they are), that it never runsrm, with or without-r, whatever its path: not on a path from a variable or a command substitution, and not inside a script passed tobash -corenv -i ... bash -c(a test that needs a file gone makes a newmktemp -dper case, checks the file out from a commit that lacks it, or overwrites it with>), that normshares a command with a hand-over, and that a refusal does not end its turn, so it goes on without therm. This replaces the old "you remove nothing withrm -rf". The rules sit in the formula and not in a skill because the Reviewer has none (inject_assigned_skills = false) and follows the formula; the step stays under the 28000-character limit its test keeps.tests/reviewer.sh: holds each rule by its phrase (read from the rules section joined to one line, so the formula can wrap), and fails if any code block of the step runs anrm, inside abash -cstring or not; the pattern is checked against eight forms that must match (therm -f "$R/CHANGELOG.md"of the first incident and therm .changelog/bad.mdinsideenv -i bash -cof the second) and three that must not..changelog/reviewer-scratch-and-rm.md: the fragment. No shell logic is added.Round 1
The Reviewer found the first head too narrow. The Operator's note of 13:46 records a second prompt, from
rexcity/forgejo.reviewerat 13:43:rm .changelog/bad.md, a literal path, inside anenv -i bash -cscript. Claude Code cannot resolve a path in such a script either, and this formula sends every test command through that wrapper. The rule now forbidsrmwhatever its path, on the command line and insidebash -c, with the alternatives above, and the test holds the new phrases and scans for anyrm. The Reviewer's minor finding is mended too: the scratch rule no longer contradicts the$CLONE.*files the step writes. The branch is rebased onto origin/main (739c65a).Why the order reported "Bead: unknown"
permission-request.shfinds the bead by listing the rig's in-progress beads assigned to the requester's alias or template. A Reviewer's session holds none:gcg-prefix and live in the infra binding, whichgc bd listdoes not read (it answers with an empty list, not an error).servicebead) is open and unassigned, routed to the Reviewer bygc.routed_to; nothing marks it with the session that works it.This is not special to the Reviewer: since #39 a rig Worker's work bead is in progress with no assignee too (marked by
worker_session), so the order finds none for it either, asgascitypacks-n04found for a city-scoped Worker. I did not mend it here. A mend is not small: the order would look up by--metadata-field worker_session=<session name>, and the Reviewer's Part 1 would have to write a matching mark on the review bead, which is a formula change with a test, in an order that has no lookup test and is to move to Go (docs/shell.md, plan item 2). I added the finding togascitypacks-n04, which is the same gap.Verification
tests/*.shall pass underenv -i,tests/reviewer.shincluded, andgc lint .passes. Removing one phrase from the formula makes the test fail, and so does inserting anrmin abash -cstring of the step.-base main, reportsvalid=true.Bead: gascitypacks-mkr
Review of
393376e164for gascitypacks-mkr. Checks of the head: success.Verdict
fail
Findings
rexcity/forgejo.reviewerat 13:43: a script run throughenv -i bash -c '...'that didrm .changelog/bad.mdin a scratch worktree. That path is literal, and the note says: "the rule has to cover an rm inside a script passed to bash -c, not only one on the command line." The rule as written forbids only anrm"on a path that comes from a variable or a command substitution", which reads as if a literal-pathrmwere fine. Yet the formula itself sends every test command throughenv -i ... bash -c(line 207), where Claude Code cannot resolve any path. Fix: say that normis run inside a script passed tobash -c(orenv -i ... bash -c) whatever its path, or forbidrmoutright, since the rule already says "you remove nothing". Give the same alternative for a case that needs a file gone (a newmktemp -dworktree per case, orgit rm --cached/a checkout without the file), hold the new phrase in tests/reviewer.sh, and widen the scan at tests/reviewer.sh:183 or add a second one so it also fails on anrminside abash -cstring in the step's code blocks. Mention the note in the PR description.mktemp -dunder$TMPDIR" contradicts the formula's ownBODY="$CLONE.body.md"(line 105) and>"$CLONE.diff"(line 187). Both are files beside the clone in the agent's directory, not in the clone or in a mktemp directory. Either name those two as exceptions ("the clone, and the$CLONE.*files the step names") or move them; as it stands, a careful Reviewer is told two different things.Verified
739c65a): clean,mergeable.env -i, proved to leave 0 of them):gc lint .passes;tests/formula.sh,tests/reviewer.sh,worktree-setup,worktree,gnu-tools,merge,apply,upgrade,view-beads,view-mail,permission-denyandpermission-requestall exit 0;go vet ./...andgo test -race ./...in forgejo/ pass.-base=mainon the merge result:valid=true.rm -f "$CLONE.diff"into Part 5's code block makes it fail with "a command of the step runs rm on a path that comes from a variable or a substitution". The test does what it claims for the rules it holds.393376e1647dcc0d3adeReview of
7dcc0d3adefor gascitypacks-mkr. Checks of the head: success.Verdict
pass
Findings
gc bd updateof the review bead, the one that closes the step,gc runtime drain-ack) was written before #80. #80 added the verdict mail to the Operator (gc mail send ... "REVIEW $WORK_BEAD: ...", line 344 of the merge result), which is a hand-over too and sits in the same Part 5 block. The rule still covers that block, because it namesdrain-ack, so nothing needs to change in this pull request. When the text is next touched, add "the verdict's mail" to the list.Round 1
rmwhatever its path, including a literal path inside a script passed tobash -corenv -i ... bash -c, and gives three alternatives (a newmktemp -dper case, a checkout from a commit that lacks the file, overwriting with>).tests/reviewer.shholds each phrase. Its scan fails on anyrmin the step's bash blocks, inside abash -cstring or not, and is itself checked against 8 forms it must catch and 3 it must not. The PR description cites the Operator's note of 13:46.$CLONE.body.mdand$CLONE.diffas the step's own files beside the clone, so it no longer contradicts lines 113 and 206.Verified
739c65a→4a39722: #80, #60 and the 0.7.0 release, which rewrote 96 lines of this formula). The head merges into origin/main4a39722cleanly, and the forge reportsmergeable. I read the merged formula's rules section: the new item sits correctly beside #80's text, and the merged step names no other scratch file beside the clone.env -i, which I first checked leaves 0 of them): everytests/*.shthe workflow runs exits 0 (formula, reviewer, operator-overlay, worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny, permission-request).gc lint .reports 2 packs ok, andgo vet ./...andgo test -race ./...pass.-base=mainon the merge result:valid=true.tests/reviewer.shon copies of the merge result. Addingrm .changelog/bad.mdinside the Part 3bash -cstring fails it with "a command of the step runs rm". Removing "check the file out from a commit that lacks it" fails it on that rule. The copy left unchanged passes.city-root referenced this pull request2026-11-12 17:36:47 +00:00