scope claude's tool access down from --dangerously-skip-permissions for the Reviewer and Approver stages
Id: TD-PPagop-26082428 · Status: open · Filed: 2026-08-24 · Review: reviews/project-review-2026-08-23 R-01 F-SEC-01
Severity: Critical
Split out of TD-PPagop-26082407 (part 2 of its 3-part suggested fix) —
scoping lib/stage-run.sh’s run_claude_stage down from
--dangerously-skip-permissions to an explicit --allowedTools/
--disallowedTools allow-list for the read-heavy/adversarial stages,
starting with Reviewer and Approver, per
reviews/project-review-2026-08-23/04-improvement-prompts.md’s prompt for
R-01. The prompt-framing part landed via #759 (spec requirement 45); #752, the
pipeline’s own attempt at the parent item, was closed unmerged as
superseded, and this record preserves the investigation it produced.
Two findings from that investigation that whoever picks this up needs, neither obvious from the tech-debt record’s own one-line suggested fix:
-
The stage name
"reviewer"is ambiguous between two architecturally different actors.agent-cycle.sh(the implementation pipeline) callsrun_claude_stage reviewer …forprompts/reviewer.md— a stage that does need broad write access: it edits files, commits, pushes, runs the target repo’s own lint/test/build tooling, and posts PR comments/reviews (seeprompts/reviewer.md’s Procedure, steps 4-7).review-cycle.sh(the separate repository-review pipeline) also callsrun_claude_stage reviewer …, but forprompts/project-reviewer.md— a stage that writes a whole newreviews/<date>/folder of report files, editsTECH-DEBT.md, and opens its own PR. Both need broad write access; neither is the “read-heavy/adversarial” Reviewer the improvement prompt had in mind (that description fitsprompts/approver.md, whose own text is explicit: “Do not edit, commit, or push anything… Never write code, or push, or amend the branch”). A tool-access scope keyed on the bare stage name"reviewer"would either restrict both of these write-heavy actors (breaking real, documented behaviour in both pipelines) or restrict neither (if the check is written narrowly enough to avoid that, it likely also fails to restrict the “review” case the improvement prompt actually meant).run_claude_stage’s call sites would need a caller-supplied signal beyond$stageto distinguish the two — e.g. a distinct stage name (review-cycle.sh’s call could passproject-reviewerinstead ofreviewer) or an explicit tool-profile argument — before any restriction can be scoped correctly. Verify againstagent-cycle.sh:9719andreview-cycle.sh:964, andprompts/reviewer.mdvsprompts/project-reviewer.md, before choosing. -
Approver is the only genuinely safe target for a narrow allow-list.
prompts/approver.mdis read-only by its own explicit contract (see “What you must never do”) but the same file admits “nothing stops you mechanically” — that’s exactly the gap a technical--allowedToolsrestriction should close. Its actual needs, read from the prompt:git diff/git log,gh pr view/gh pr diff, reading repository files — neverEdit/Write, nevergit commit/git push, nevergh pr review/gh pr comment/gh pr merge/gh pr ready/any other GitHub write. Reviewer, by contrast, needs a footprint close to the Implementer’s own (see finding 1) and restricting it without full test verification against a real or carefully simulated cycle — which an Implementer engagement without a staging environment cannot do — risks silently breaking the whole fleet’s review stage, the exact failure modereviews/project-review-2026-08-23/04-improvement-prompts.md’s R-01 prompt warns against (“Do not remove –dangerously-skip-permissions from every stage in one change if that risks breaking stages this task didn’t fully investigate”).
Suggested fix: scope Approver first, on its own — it is unambiguous and
low-risk per finding 2. Give run_claude_stage (or its Approver call site)
an explicit allow-list covering read-only Bash invocations of git diff,
git log, gh pr view, gh pr diff, gh api (GET only), plus Read/
Grep/Glob, and --disallowedTools (or the allow-list’s own omission) for
Edit, Write, and any Bash invocation of git commit/git push/gh pr review/gh pr comment/gh pr merge/gh pr ready/gh api with a
write verb. Verify by exercising a real Approver engagement (or as close a
simulation as is available) against a pull request with genuine findings, to
confirm nothing it legitimately needs was cut off. Treat Reviewer’s scoping
(both the implementation pipeline’s and the review pipeline’s) as further,
separate follow-up once finding 1’s stage-name ambiguity is resolved and each
one’s actual tool footprint is verified the same way.
Noticed while working PR #752.
Direction (2026-08-24, D24)
Section titled “Direction (2026-08-24, D24)”Deferred to roadmap decision D24’s trigger: this lands with the D6/D8 rewrite, or ahead of the first non-Poetic installation, whichever comes first — per-stage capability declarations are product surface, and the analysis above (the stage-name ambiguity, Approver-first) is the entry brief for whoever picks it up then.
Co-Ordinator: do not select this item. Scoping a live pipeline’s own tool access is interactive-session work (roadmap D9): a wrong allow-list silently breaks a stage fleet-wide, and verification needs a real engagement observed end to end. This note is part of the record — a pipeline claim of this item is itself a defect.
Migrated to https://github.com/Poetic-Poems/agent-ops/issues/981.