Skip to content

Review stages are asked for consent to read the cycle's own evidence diff, and the grant never matches the next dispatch #563

Backlog

Description

@datacas

Priority: P0, urgent. Milestone: M1 — Safe, inspectable execution. Capability parity #450. Follow-up to #550; overlaps #561 (quoted reads), #275 (hashing the same diff), #439/#522 (grants that do not converge).

Problem and evidence

The runtime writes the accumulated diff a review must judge to ~/.config/code-cycle-toolkit/evidence/diff-<random>/accumulated.diff and hands that path to the review stage. The stage then cannot read it with ordinary read-only commands. Reviewing PR #554 (work item #503) on 2026-11-29 and 2026-11-30, four consecutive review runs (Claude executor, including after #550 merged) stopped with permission_required after 14-22 minutes of work, each on a read of that file:

  • grep -n '^diff --git' …/evidence/diff-49rcwnwm/accumulated.diff
  • printenv TMPDIR; wc -l …/evidence/diff-m55avhbq/accumulated.diff; git rev-parse HEAD
  • grep -n "^diff --git" …/evidence/diff-t4nozlck/accumulated.diff
  • grep -n "^diff --git" …/evidence/diff-nxmgoyk5/accumulated.diff

Every relaunch (--from review --pr <n>) creates a new diff-<random> directory, so a consent given for the previous operation never matches again. Before #550 the stop offered this repository, which was granted twice and never reused. Since #550, grants.py recognizes the path as unique to one dispatch and offers only this cycle or deny, but a relaunch creates another diff path, so that grant does not converge either. The review is discarded each time and the cycle cannot finish unattended. The agent can read this file directly in the same environment, so under #450 this is a toolkit-only veto.

Evidence on the owner's host: ~/.config/code-cycle-toolkit/decisions/decisions-20261129T211628Z-743427.json, decisions-20261130T075823Z-12539.json, decisions-20261130T084933Z-99072.json, decisions-20261130T150800Z-587651.json.

Cause (to confirm in source)

The read guards in scripts/stage_permissions.py treat the cycle's own evidence diff as an arbitrary path outside the stage workspace, and the quoted pattern additionally triggers the #561 complex read arguments rule. The consent key in scripts/grants.py binds the literal per-dispatch path (evidence/diff-[A-Za-z0-9_]+), so no grant scope survives a relaunch.

Scope

  1. The evidence files the runtime itself hands to a stage (the accumulated diff and its siblings in the dispatch's evidence directory) are a declared read root for that stage: read-only commands the stage table allows on workspace files (grep, wc, head, sed -n, cat, hashing per Review stages are given a diff SHA-256 to confirm but cannot run any hash command #275) run on them without consent, with the existing credential, redirect and expansion guards.
  2. Sequences of individually allowed read-only commands joined by ; or && with no redirect or expansion are judged per segment and do not ask for consent as a whole.
  3. When a consent is still needed for such a path, the stored key normalizes the per-dispatch directory to a stable placeholder, so a cycle, persistent or forever answer matches the same operation on the next dispatch and on a relaunch of the same work item.
  4. A permission stop on an optional read never discards completed review work: the stage may continue without the read and records it, as Claude's permission layer refuses read-only commands and the stage's own publication in dispatched stages, and the completed stage ends BLOCKED (regression of #524/#464) #550 requires.
  5. Update docs/capability-parity-audit.md and the owning docs/ permission page.

Acceptance criteria

  • Each of the four refused commands above runs without a consent stop in the review and rereview roles, with a regression test per form.
  • A grep, wc or sha256sum on a path outside the workspace and outside the dispatch's evidence directory still goes through the existing guards.
  • A consent recorded for an operation on evidence/diff-<a>/… matches the same operation on evidence/diff-<b>/… for the same repository and role, with a regression test.
  • A Claude-executor review of a non-trivial pull request finishes without a permission stop for reads of its own evidence diff.

Activity

  1. added
    bug
    priority: urgent
    P0
    on Nov 30, 2026
  2. added a commit that references this issue on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0bugpriority: urgent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions