Skip to content

fix(issue-review): allow read-only Git searches - #271

Merged
datacas merged 3 commits into
mainfrom
fix/270-issue-review-git-read
Oct 19, 2026
Merged

datacas merged 3 commits into
mainfrom
fix/270-issue-review-git-read

Conversation

@datacas

@datacas datacas commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Grant the issue_review stage the existing read-only GIT_REVIEW_READ Git subcommands (merge-base, ls-files, grep, and blame). This restores repository search needed to assess work items without granting fetch or write subcommands. Existing executing-option guards still refuse git grep -O… and --open-files-in-pager.

Diagnosis

The issue reported that issue_review could not search the repository. I confirmed the cause in _check_git: GIT_REVIEW_READ was added only for review and writing roles, and issue_review was not in either set. The existing test reproduced the defect by expecting git grep and git blame to be denied for that role. The invariant is that issue_review can inspect repository content while retaining its read-only command boundary.

A widened search for issue_review git grep found only this issue; searching closed issues for stage_permissions.py found no related items. The fix adds ISSUE_REVIEW_ROLE only to the read-set condition. It does not add the role to REVIEW_ROLES, which would grant fetch.

Work units

ID Behaviour Paths Tests Verification Rollback
WU-1 Allow the issue review stage the existing read-only Git review subcommands, preserving executing-option and write guards scripts/stage_permissions.py, tests/test_stage_permissions.py tests/test_stage_permissions.py python3 -m unittest discover -s tests passed (1,597 tests); python3 scripts/validate-package.py passed; python3 -m unittest passed (0 tests discovered) independent

Verification environment

Local verification ran in this linked worktree with its configured Python runtime and repository files. CI will run on its configured Linux and Windows environments; local checks do not validate those platform runs.

Stage routing: profile cheap_coder; requested model openai/gpt-6-luna; effort high; resolved model ?.

Follow-up (508b772)

The round 0 review found that allowed_tool_patterns(), Claude's --allowedTools barrier, still excluded issue_review from the git search prefixes. Both barriers now read GIT_SEARCH_ROLES; new tests cover the patterns and run the exact command #268's issue review was refused through the hook and against a real repository.

Closes #270

The hook allowed git grep, ls-files, blame and merge-base for issue_review,
but allowed_tool_patterns, Claude's first barrier, still limited them to
the review and writing roles. Both now read GIT_SEARCH_ROLES, and a test
runs the command the #268 issue review was refused through both barriers.

Refs #270
@datacas

datacas commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261019-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Initial review — PR #271 (work item #270)

Verdict: CHANGES_REQUESTED — reviewed head 508b7725229632a2cdf4de5c2e9377f68802a652.

Summary and scope

Reviewed the full accumulated diff origin/main...508b772 (merge base 3091cf39efa6cdc74621cb9a0e9460b2ee9856ff, 135 lines, 2 files): scripts/stage_permissions.py and tests/test_stage_permissions.py.

The change adds GIT_SEARCH_ROLES = WRITING_ROLES | REVIEW_ROLES | {ISSUE_REVIEW_ROLE} and uses it in both barriers: the hook (_check_git) and Claude's --allowedTools patterns (allowed_tool_patterns). issue_review now gets git merge-base, ls-files, grep and blame. It still does not get fetch or any write subcommand, because issue_review stays outside REVIEW_ROLES and WRITING_ROLES. The executing-option guards (-O, bundled -iO…, abbreviated --open-files…, --exec*, global options) now also cover issue_review in the tests.

The code is correct and minimal, and the tests exercise both barriers plus a real git grep run. The only problem is documentation.

Findings

[REV-001] · low · open · - · blocks:yes — Stage permission table still lists no Git search for issue_review

docs/host-permissions.md:33

docs/host-permissions.md is the page that owns the per-stage command table. Its issue_review row still lists only gh issue list, gh pr list and gh search issues|prs. The review/rereview row (line 34) is still the only one that names git merge-base, ls-files, grep and blame.

After this PR, both _check_git and allowed_tool_patterns grant those four subcommands to issue_review. Operators reading the documented boundary of a read-only stage would therefore get the wrong answer. CONTRIBUTING.md:28 requires "When a change alters behaviour, update the page that owns that topic."

Suggested fix: add git merge-base, ls-files, grep, blame to the issue_review row (no fetch). Optionally add an Unreleased CHANGELOG.md line.

Evidence: code inspection (git grep -n "gh search issues" finds only that row; no other doc names the issue-review Git table).

Security triage and audit

.code-cycle.yml declares no security_review.always_when rule, so the default triggers applied. The rule fired: the change touches security tooling, namely the command allow-list and PreToolUse hook that confine native stages. My own reading agrees, so the audit ran.

Result: no confirmed vulnerability.

  • fetch stays denied for issue_review. The fetch branch requires REVIEW_ROLES, and fetch is not in its allowed set. Asserted by test_reads_are_shared_and_review_reads_reach_reviews (git fetch origin denied even with fetch_origin=True), and --allowedTools excludes git fetch*, push, commit, checkout and worktree list.
  • Program-running options on git grep (-O, bundled -iO, --open-files… prefixes) and global -c/-C/--exec-path remain refused for the new role (tests extended to issue_review).
  • git grep --no-index / blame --contents can read paths outside the clone, but every stage already has cat, grep and find, so this widens nothing.
  • Residual, pre-existing and not introduced here: textconv/external-diff drivers already configured in the local Git config can run under diff/log/show for every stage, and grep --textconv adds no new path for a stage that cannot write .git/config.

Verification executed (disposable clone, head 508b772)

Command Result
python3 -m unittest tests.test_stage_permissions OK — 67 tests, including the new test_every_searching_stage_gets_the_git_search_prefixes and test_issue_review_runs_the_git_search_it_was_denied
python3 scripts/validate-package.py OK — VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest OK — 0 tests discovered (as the PR states)
python3 -m unittest discover -s tests exit 1 — Ran 1599 tests, FAILED (failures=1, errors=62); environment-caused, see below

Unverified items

The full-suite failures are caused by the review sandbox, not by this change. None of them touch the changed files:

  • All 62 errors are in test_validate_package and come from shutil.copytree of the clone failing with [Errno 13] Permission denied on sandbox-masked host paths (.bashrc, .gitconfig, .claude/settings.json, …).
  • The 1 failure is test_executors.ReadOnlyVerificationTests.test_scratch_never_uses_a_temp_parent_inside_the_checkout (no temporary directory outside the dispatch checkout). The sandbox only allows writes under the dispatch TMPDIR.

Those tests were not verified locally. They passed in CI on this same head (Linux and four Windows shards).

CI (policy: parallel)

All checks of head 508b772 have completed and passed (6/6, "Validate package" workflow):

  • Skills, manifests, and Bash installer — pass
  • Windows test shard (windows-1) — pass
  • Windows test shard (windows-2) — pass
  • Windows test shard (windows-3) — pass
  • Windows test shard (windows-4) — pass
  • PowerShell installer — pass

Residual risk

Low. The behavioural change is confined to two set-membership checks, and both are covered by tests. Once REV-001 is fixed, the documented contract matches the code.

Project review verdict: CHANGES_REQUESTED (blocking: REV-001).

@datacas

datacas commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261019-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261019-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:508b7725229632a2cdf4de5c2e9377f68802a652 · schema:2

Resolve summary — PR #271 (work item #270)

Applied fix

[REV-001] · low · resolved · valid · blocks:yes — Stage permission table still lists no Git search for issue_review

Updated docs/host-permissions.md to list git merge-base, ls-files, grep, and blame among issue_review reads. The row continues to grant no writes. The fix is commit 880a7364b76e358565465059f1afda146c3088a8.

Verification

  • python3 -m unittest discover -s tests — passed, 1,599 tests.
  • python3 scripts/validate-package.py — passed.
  • python3 -m unittest — passed, 0 tests discovered.
  • Fix delta reviewed from trusted review head 508b7725229632a2cdf4de5c2e9377f68802a652; that head is an ancestor of 880a7364b76e358565465059f1afda146c3088a8.
  • GitHub reported no checks in the pushed head's status rollup ([]).

No inline review threads were present. No unresolved findings or residual risks remain in this resolve stage.

@datacas

datacas commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20261019-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261019-001] · cheap_coder · openai/gpt-6-luna→? · high · triaged:508b7725229632a2cdf4de5c2e9377f68802a652 · schema:2

[CCR-20261019-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Rereview — PR #271 (work item #270)

Verdict: REVIEW_PASSED_AWAITING_CI. The review is complete for head 880a7364b76e358565465059f1afda146c3088a8 and found no open blocking finding. This is not an approval: the required checks of this head are still running, and the cycle's CI gate decides.

What changed since the previous review

The previous review was on 508b7725229632a2cdf4de5c2e9377f68802a652, which is an ancestor of the current head. Since then, one commit (880a736) has changed one line, the issue_review row in docs/host-permissions.md. The code is unchanged.

Accumulated review

The full accumulated diff origin/main...880a736 was rereviewed: merge base 3091cf39efa6cdc74621cb9a0e9460b2ee9856ff, 148 lines, 3 files (docs/host-permissions.md, scripts/stage_permissions.py, tests/test_stage_permissions.py).

  • GIT_SEARCH_ROLES = WRITING_ROLES | REVIEW_ROLES | {ISSUE_REVIEW_ROLE} now drives both barriers: the hook's _check_git and Claude's --allowedTools in allowed_tool_patterns. The two can no longer drift apart.
  • issue_review gains git merge-base, ls-files, grep and blame. It gets no fetch, write subcommand or worktree list, because it is outside REVIEW_ROLES and WRITING_ROLES.
  • The tests cover:
  • The documented table now matches the code. No other page describes the issue_review Git permissions: git grep over docs/, README.md and CHANGELOG.md finds only docs/host-permissions.md:33.

Previous findings

[REV-001] · low · resolved · valid · blocks:yes — Stage permission table still lists no Git search for issue_review

docs/host-permissions.md:33. Verified on 880a736: the issue_review row now lists git merge-base, ls-files, grep, blame with no writes and no fetch. That matches _check_git and allowed_tool_patterns. The tests that assert the same set for issue_review (test_reads_are_shared_and_review_reads_reach_reviews, test_every_searching_stage_gets_the_git_search_prefixes) pass at this head.

New findings

None.

Security triage and audit

.code-cycle.yml declares no security_review.always_when rule, so the default triggers apply. They still fire, because the accumulated change touches the command allow-list and the PreToolUse hook that confine native stages.

The audit was repeated over the accumulated diff. The only change since the previous audit is documentation, and the earlier result stands: no confirmed vulnerability.

  • fetch and every write subcommand stay denied for issue_review.
  • Program-running Git options stay refused for the new role.
  • grep --no-index and blame --contents widen nothing, because every stage already has cat, grep and find.

Verification executed (disposable clone, head 880a736)

Command Result
python3 -m unittest tests.test_stage_permissions OK, 67 tests
python3 scripts/validate-package.py OK: VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest OK, 0 tests discovered
python3 -m unittest discover -s tests exit 1: Ran 1599 tests, FAILED (failures=1, errors=62). The sandbox causes these failures; see below

Unverified items

The full suite's failures are the same 63 as in the previous review, and none touches the changed files:

  • 62 errors in test_validate_package. shutil.copytree of the clone fails with [Errno 13] Permission denied on sandbox-masked paths such as .bashrc, .gitconfig and .claude/settings.json.
  • 1 failure in test_executors: test_scratch_never_uses_a_temp_parent_inside_the_checkout reports no temporary directory outside the dispatch checkout, because the sandbox allows writes only under the dispatch TMPDIR.

Those 63 tests were not verified locally. CI on this head runs them.

CI (policy: parallel; read once, not waited on)

These are the checks of head 880a736 in the "Validate package" workflow, run 39231937774:

  • Skills, manifests, and Bash installer — in progress
  • Windows test shard (windows-1) — in progress
  • Windows test shard (windows-2) — in progress
  • Windows test shard (windows-3) — in progress
  • Windows test shard (windows-4) — in progress
  • PowerShell installer — not yet reported in this head's rollup (it passed on 508b772)

Passed 0, failed 0, pending 5. The CI gate waits for these checks and decides.

Residual risk

Low. The behavioural change is two set-membership checks covered by unit and end-to-end tests, and the documented contract now matches the code.

Project review verdict: REVIEW_PASSED_AWAITING_CI (no blocking findings).

@datacas
datacas merged commit de2e35b into main Oct 19, 2026
6 checks passed
@datacas
datacas deleted the fix/270-issue-review-git-read branch October 19, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue_review stage cannot run git grep/ls-files/blame: the stage command table excludes it from GIT_REVIEW_READ

1 participant