Skip to content

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:

  1. The stage name "reviewer" is ambiguous between two architecturally different actors. agent-cycle.sh (the implementation pipeline) calls run_claude_stage reviewer … for prompts/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 (see prompts/reviewer.md’s Procedure, steps 4-7). review-cycle.sh (the separate repository-review pipeline) also calls run_claude_stage reviewer …, but for prompts/project-reviewer.md — a stage that writes a whole new reviews/<date>/ folder of report files, edits TECH-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 fits prompts/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 $stage to distinguish the two — e.g. a distinct stage name (review-cycle.sh’s call could pass project-reviewer instead of reviewer) or an explicit tool-profile argument — before any restriction can be scoped correctly. Verify against agent-cycle.sh:9719 and review-cycle.sh:964, and prompts/reviewer.md vs prompts/project-reviewer.md, before choosing.

  2. Approver is the only genuinely safe target for a narrow allow-list. prompts/approver.md is 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 --allowedTools restriction should close. Its actual needs, read from the prompt: git diff/git log, gh pr view/gh pr diff, reading repository files — never Edit/Write, never git commit/git push, never gh 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 mode reviews/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.

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.