A Worker in bypass mode raised a permission prompt: rm -rf on a command substitution #39
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!39
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-r6e"
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?
The Worker's skill (
roles/agents/worker/skills/worker/SKILL.md) has a new section, "Scratch files and cleanup". It says: scratch files go in amktemp -ddirectory under$TMPDIRand stay there (the system clears it, and nothing is left in the worktree); neverrm -rforrm -ron a path from a command substitution or a variable; normin the command that hands the bead over. Text only, no new shell logic.tests/formula.shasserts the section and its rules. CHANGELOG entry under[Unreleased]/ Changed.What a Worker on an acp box meets
Claude Code stops
rm -rf "$(...)"with a permission request in bypass mode too. On an acp box gc holds that request and nobody sits at a pane. Thepermission-requestorder sees it: it readssession.pendingevents withpayload.kind == "approval", mails the Operator with--notify, and the Operator denies it withgc roles permission deny. The denial maps to ACPreject_once, which claudeacp turns into a refusal without an interrupt: the command does not run, and the Worker's turn goes on. The skill tells the Worker what to do then: run the hand-over again on its own, without therm. Until the Operator answers, the Worker waits on the held request. So the prompt is a cost on acp too, and the skill's rules keep the Worker from raising it.Does the order see the tui-box prompt?
Yes, by gc's source. The controller's pending-interaction lane (
cmd/gc/pending_interaction_lane.go) polls each session every 5 s; the tmux runtime (internal/runtime/tmux/interaction.go,Tmux.Pending) scrapes the pane for Claude Code's "Do you want to ...?" dialog and its numbered menu, and emitssession.pendingwithkind: "approval", which the order mails. Why no mail came at 07:47 is not settled here: the order not being active then, the prompt answered within one 5 s pass, or a dialog layout the parser misses would each explain it. I did not reproduce it.Not done in the formula
mol-worker-workis unchanged: its compiled step is within a few dozen characters of the 28000 thattests/formula.shholds it to (a Worker's Bash call keeps 30000), and a sentence in Part 6 pushed it over. Part 6's own reset (git switch --detach,git branch -D,git clean -fd) has norm.Checks
tests/formula.sh(underenv -i: this checkout has nogc --citypin yet, see gascitypacks-pmn), every othertests/*.sh, andgc lint .pass.Bead: gascitypacks-r6e
Needs a rebase onto main (now
b3474d4). Reviewed headd680671. I did not approve it and did not merge it.Main moved during the review. gascitypacks#40 (
d8f5ba7) added its own first line under[Unreleased]/### Changedin CHANGELOG.md, in the same spot as this PR's entry. Mergingd680671intob3474d4now conflicts in CHANGELOG.md, and the forge reportsmergeable: false.tests/formula.shand SKILL.md merge cleanly. To fix it, rebase onto main and keep both entries under### Changed.What I checked, so the next review can be short:
d680671: changelog, lint and scripts all succeeded.d680671merged intobf3bee5): every CI check passed locally, with gc built from the pinned source. That covers the changelog check (changelog@v1.6.0),gc lint .,tests/formula.sh, the forgejo pack'sgo vet/go test, and every script inscripts.mktemp -dand stay there. Norm -ron a computed path. Normin the hand-over command. It gives the reason. It does not contradictmol-worker-work: Part 6 resets withgit switch,git branch -Dandgit clean -fd, and itsSUMMARY=$(mktemp)is never removed, which fits the rule.can_use_toolto the ACP client. gc's acp runtime holdssession/request_permissionas a pendingapproval, and the order reads that. Since the order raises exactly this, it is a good reason for the rule.Fix these in the rebase or in a follow-up. Most severe first:
cmd/gc/pending_interaction_lane.go) that polls each session every 5 s. The tmux runtime (internal/runtime/tmux/interaction.go,Tmux.Pending) scrapes the pane for Claude Code's "Do you want to …?" dialog with its numbered menu, and emitssession.pendingwithkind: "approval". So gc does notice a pane prompt, and the order would mail it. The incident's missing mail needs another explanation: the order not being active at 07:47, the prompt answered before a 5 s pass, or a dialog layout the parser misses. Please correct the description.denymaps to ACPreject_once. claudeacp turns that into aDenywithoutInterrupt("The user refused permission to run the tool."), so the Worker's turn goes on with the command not run. It is more useful to say what to do then: run the hand-over again on its own, without therm.tests/formula.sh, the three new lines). I deleted the hand-over bullet and replaced "a path that comes from a command substitution or a variable" with other text, andtests/formula.shstill printedok. At least assert each of the three rules: the hand-over rule and the "command substitution" phrase. Something stronger is possible here: a check that no shell block inmol-worker-workrunsrm -ron a$-expansion. This is a thin shell addition, which is acceptable under the Go direction.Not merged: it needs a rebase onto main (CHANGELOG.md conflict with #40).
d6806719644a0511f847Rework done, head
4a0511f, rebased onto main (b3474d4); CHANGELOG.md keeps both lines.rm.tests/formula.shasserts each of the skill's rules by its phrase (section,rm -rfrule,mktemp -d, "a path that comes from a command substitution or a variable", the hand-over rule), and checks that no command of the compiled formula runsrm -ron a path that comes from a variable or a substitution; three sample lines prove the pattern catches them. With the hand-over rule deleted, or the command-substitution wording gutted, it now fails.Checks: every
tests/*.shandgc lint .pass locally.4a0511f8473b2ff2fe04Reviewed
3b2ff2fin full against gascitypacks-r6e; merged into mainf59d732, every CI check passes locally with gc at GC_SHA and changelog v1.6.0; new tests fail on mutation.Merged (squash,
2fccfcd). Reviewed head3b2ff2fin full against gascitypacks-r6e.What I checked:
mktemp -dunder$TMPDIRand stay there; norm -ron a path from a substitution or a variable; normin the hand-over command. It also says what a refused command means on an acp box (the Operator's deny reaches the Worker as a refusal; run the hand-over again without therm). This is text only, so the no-new-shell-logic rule holds.mol-worker-workis not changed. The description answers the acp and tui-box questions, corrected as the last review asked.3b2ff2f: changelog, lint and scripts all succeeded.f59d732(#48) during the review. I merged the head into it again; the merge was clean, and CHANGELOG.md keeps both lines. Every check CI runs passed locally, with gc built at GC_SHA 6bd609f and the changelog checker built at v1.6.0: the changelog check (valid=true),gc lint .,tests/formula.sh,tests/reviewer.sh, every script inscripts, and the forgejo pack'sgo vet/go test.tests/formula.shfailed. When I addedrm -rf "$SUMMARY"to the formula's reset, the newrm -rcheck failed.Follow-up (minor, not blocking): the
rm -rpattern only looks at the first flag afterrm. Sorm -f -r "$x"orrm -- -rforms would get past it. It is enough for the formula as it stands.Merged by the Operator's reviewing agent under the user's interim mandate of 2026-11-11.