Skip to content

Evidence completeness: the runtime supplies the complete diff, and stages never cite compacted output (#88) - #107

Merged
datacas merged 6 commits into
mainfrom
issue-88-complete-evidence
Sep 28, 2026
Merged

datacas merged 6 commits into
mainfrom
issue-88-complete-evidence

Conversation

@datacas

@datacas datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Closes #88 — #88

What changed

Runtime guarantee (scripts/run_cycle.py, scripts/executors.py)

  • Before each review, resolve, and rereview dispatch, run_cycle writes git diff <merge-base>...<head> itself (subprocess, --output, --no-color --no-ext-diff). The base is the first of change_bases_of that resolves, like stage_signals.
  • The file goes in a fresh code-cycle-diff-* temporary directory outside the workspace. If TMPDIR overlaps the checkout, no directory is used. The directory is removed when the stage ends, even on error.
  • The prompt names the path, base, merge base, head SHA, line count, and SHA-256. It also says that the file doesn't describe the change if the change request's head differs or the file can't be read.
  • With no resolvable base, no file is written and the prompt says so (NO_DIFF_FILE).
  • New read_dirs dispatch kwarg, forwarded only to native adapters. Claude gets --add-dir <dir>, placed last because the flag takes several values; in print mode it reads only inside cwd without asking. Codex's read-only and workspace-write sandboxes already read the whole filesystem (:root = read), so its argv is unchanged. Orca and scripted adapters never receive the kwarg.

Instruction layer

  • A new shared ## Complete evidence section, byte-identical in cc-code-review, cc-implement-issue, cc-initial-review, cc-pr-review, cc-rereview, cc-resolve-comments, cc-security-review, and cc-verify, placed right after ## Output language.
  • Registered in validate-package.py (EVIDENCE_SKILLS), so drift or a missing copy fails validation.
  • CONTRIBUTING.md table, docs/verification.md (rule 6 and a Complete evidence section with the measured example, kept separate from Evidence levels from Verification results carry their evidence level: claimed, agent-reported, runtime-observed, externally verified #85), and CHANGELOG.md.

Verification

  • python3 -m unittest discover -s tests: 817 tests, OK
  • python3 scripts/validate-package.py: VALID
  • claude plugin validate .: passed
  • New tests:
    • CompleteDiffTests in tests/test_run_cycle.py, against a real Git repo:
      • Review, resolve, and rereview each read a file equal byte for byte to git diff main...HEAD, with the line count, SHA-256, and head in the prompt.
      • The file is outside the checkout and gone after the stage.
      • With the real ClaudeAdapter in its isolated clone, argv ends with --add-dir <dir> and the diff is outside the clone.
      • With no base, no file is written and the prompt says so.
      • The implement stage is given no diff.
      • A temp dir inside the workspace is refused.
    • ReadDirectoryTests in tests/test_executors.py: Claude gets --add-dir last; without evidence it gets none; Codex read-only keeps its argv and the task last.
    • tests/test_validate_package.py: drifted and missing ## Complete evidence both fail.

Manual host check (RTK hook active in the implementing session)

On this branch's own diff, the hooked git diff main printed ... (2 additions truncated) inside the run_cycle.py hunk and ended with ... (more changes truncated). git diff main --output=<file> and rtk proxy git diff main both gave the full 895 lines.

A complete review stage run by the runtime under the hook hasn't been run. It's left for the review cycle of this PR.

Residual risk

  • The runtime diff comes from the runtime's cwd. On a resumed cycle whose cwd isn't at the PR head, the prompt's head SHA won't match. The prompt tells the agent to treat the file as not describing the change and fall back to the instruction layer.
  • Orca workers don't get the file directory granted, so they rely on the instruction layer.

…put (#88)

Host hooks can compact an agent's `git diff`, so a review could approve a diff
it never fully read. Two layers close that:

- Runtime: `run_cycle` writes `git diff <base>...HEAD` itself for every
  review, resolve, and rereview stage, via subprocess and `--output`, into a
  fresh temporary directory outside the workspace and the review clone. The
  prompt names the file, base, merge base, head, line count, and SHA-256; a
  Claude stage gets `--add-dir` for it. The file is removed after the stage.
  With no resolvable base, no file is written and the prompt says so.
- Skills: a shared `## Complete evidence` section in the eight skills that
  read diffs or cite output, registered in the validator so drift fails.
@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

Summary

Reviewed PR #107 (“Evidence completeness: the runtime supplies the complete diff, and stages never cite compacted output”) at head 636f419b484b99a6b7b81f6f161617b10c729195, against main (merge base ae36991fef78ad8f65090074a130176dd9b10718). The accumulated diff contains 17 files, 607 insertions, and 7 deletions. It adds complete-diff artifacts for review stages, shared evidence-completeness guidance, validator coverage, and documentation for issue #88.

Findings

[REV-001] · medium · open · - · blocks:yes — Claude can edit the evidence artifact it receives

File: scripts/executors.py, line 1052.

The new --add-dir argument grants Claude Code access to the directory holding accumulated.diff. Claude Code’s current documentation says added directories follow the same permission rules as the working directory and grant read and edit access. The runtime also launches Claude writing stages with --permission-mode acceptEdits (line 1079). A resolver can therefore change the very diff supplied as review evidence; the review result may then be based on altered evidence, defeating the complete-diff guarantee. Claude Code CLI reference

Keep the evidence outside the stage’s writable boundary and verify its SHA-256 after dispatch, failing closed if the artifact changed.

Security triage

The repository has no security_review.always_when rule, and PR #107 has no labels. Reviewer judgment activated the security audit because the change modifies subprocess handling, adapter permissions, and review/security tooling. The audit found no additional confirmed vulnerabilities; REV-001 is the permission/integrity issue above.

Verification

  • python3 -m unittest discover -s tests -p 'test_run_cycle.py' -q: 117 tests passed.
  • python3 -m unittest discover -s tests -p 'test_executors.py' -q: 140 tests passed.
  • python3 scripts/validate-package.py: VALID (14 skills, shared sections in sync, manifests aligned).
  • python3 -m unittest discover -s tests -v: 823 tests passed.
  • Subprocess boundary smoke: the real ClaudeAdapter dispatch ran /bin/echo with the added directory and observed --add-dir; it succeeded. A /bin/false run was classified as failed. This checks argument delivery and nonzero-exit handling, not Claude Code’s permission enforcement.
  • No database, service, migration, or application runtime configuration was required for these checks.
  • The PR description reports claude plugin validate . as passed; I did not independently rerun it. The full RTK-hooked runtime review described in the PR remains unverified.

CI

gh pr checks 107 reports all four listed checks passing: two PowerShell installer runs and two Skills, manifests, and Bash installer runs. The configured Validate package workflow is present; no expected check is missing or pending.

Residual risk

The full runtime review under a host output-compaction hook has not been exercised. The unit tests verify the artifact bytes, metadata, cleanup, no-base fallback, and Claude argument construction, but they do not prove that a live review session cannot alter the added directory.

Verdict

CHANGES_REQUESTED — REV-001 is open and blocks approval.

…nged file (REV-001)

Claude's `--add-dir` grants editing as well as reading, and a writing stage
(`acceptEdits`, or Codex's writable temporary directory) could alter the diff
later stages judge. `dispatch()` now grants the directory only to non-writing
stages, the file is written read-only, and the runtime rechecks its SHA-256
after every stage: a changed or removed file stops the cycle as
`stage_not_completed` before the stage's verdict is read.
@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1

Resolution summary

Status: RESOLVED. I triaged one finding against 636f419b484b99a6b7b81f6f161617b10c729195 before editing. It is fixed in a02c04a904c884253434d42733ccfbb999bd4b5c.

[REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receives

Paths: scripts/executors.py, scripts/run_cycle.py, docs/verification.md, CHANGELOG.md, tests/test_executors.py, tests/test_run_cycle.py.

Decision: valid. --add-dir grants editing as well as reading, and a Claude stage under acceptEdits could reach the file. So could a Codex workspace-write stage, whose writable roots include the temporary directory. A permission flag alone cannot keep the evidence intact, so the fix has three layers:

  • Outside the writable boundary. executors.dispatch() forwards read_dirs only when the dispatch doesn't write. A writing Claude stage gets no --add-dir. When it can't read the file, its prompt already tells it to fall back to the skill's Complete evidence rules.
  • Read-only file. The diff is chmod 0o444 after Git writes it. This guards against accidental edits only; the hash check is the boundary.
  • Fail closed on the hash. After every diff stage, run_cycle rereads the file and compares its SHA-256 with the one it put in the prompt. A changed or missing file stops the cycle as stage_not_completed before the stage's verdict or findings are read or recorded. The directory is then removed with the read-only-aware cleanup.

Verification

  • New regression tests:
    • test_a_writing_stage_is_never_granted_the_evidence_directory: a real ClaudeAdapter dispatch with writes=True shows acceptEdits and no --add-dir.
    • test_a_stage_that_changes_its_evidence_stops_the_cycle: a resolver that undoes the permission bit and rewrites the file stops the cycle, and no rereview runs.
    • test_a_stage_that_removes_its_evidence_stops_the_cycle
    • test_the_diff_file_is_read_only
  • I reproduced the finding: with the fix stashed, those 4 tests fail; with it, they pass.
  • python3 -m unittest discover -s tests: 827 tests, OK.
  • python3 scripts/validate-package.py: VALID.
  • gh pr checks 107 on a02c04a: 4/4 pass (two PowerShell installer, two Skills, manifests, and Bash installer).

Post-change workflow. I ran the code-review pass inline over the fix diff: no new findings. Security triage: no security_review.always_when rule and no labels. My own judgement: the change only narrows permissions and adds an integrity check, so no further audit is needed. No services, database, or migrations are involved.

Residual risk

  • A live Claude session hasn't been run to show that it can't edit an added directory. The fix no longer depends on that: writing stages get no grant, and any change is caught by the hash.
  • Orca stages are asynchronous. Their file is checked and removed when the dispatch returns, so an Orca worker relies on the instruction layer (unchanged from the original PR).

@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-002] · manual · ?/?→? · ? · schema:1

Rereview summary

Rereviewed PR #107 at head a02c04a904c884253434d42733ccfbb999bd4b5c against main; merge base remains ae36991fef78ad8f65090074a130176dd9b10718. The accumulated diff is 17 files, 734 insertions, and 10 deletions. Since the prior reviewed head 636f419b484b99a6b7b81f6f161617b10c729195, six files changed (140 insertions, 16 deletions).

The follow-up adds a read-only mode bit to the diff file, withholds read_dirs from writing stages, and checks the SHA-256 after each diff stage. It adds tests for a writing-stage grant, persistent edits/removal, and file permissions.

Recovered review runs

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1

Previous finding

[REV-001] · medium · open · valid · blocks:yes — Claude can edit the evidence artifact it receives

Status: still reproducible. The previous resolver classified it as valid and marked it resolved on a02c04a904c884253434d42733ccfbb999bd4b5c; its disposition remains valid.

The follow-up catches an artifact that remains changed or removed when a stage exits. It does not protect the evidence while the stage is running. At scripts/run_cycle.py:853, the runtime hashes the file only after dispatch. I reproduced a review stage that changed the mode, wrote alternate diff bytes, restored the original bytes, and returned APPROVED. The post-stage hash passed and the runtime returned READY_FOR_MANUAL_MERGE after the review stage. The artifact was altered during the review even though the after-check matched.

The new persistent-edit and removal regression tests pass, but they do not cover a temporary edit followed by restoration. A digest checked only after dispatch cannot establish which bytes the agent read. The stage needs an evidence view that it cannot change for the duration of its run, enforced by the execution boundary.

Security triage

There is no security_review.always_when rule in .code-cycle.yml, and PR #107 has no labels. Reviewer judgment activated the security audit because the change modifies evidence-file permissions, adapter access, and the runtime integrity boundary. REV-001 remains the confirmed permission/integrity issue; no separate new vulnerability was found.

Verification

  • python3 -m unittest discover -s tests -p 'test_run_cycle.py' -q: 120 tests passed.
  • python3 -m unittest discover -s tests -p 'test_executors.py' -q: 141 tests passed.
  • python3 scripts/validate-package.py: VALID (14 skills, shared sections in sync, manifests aligned).
  • python3 -m unittest discover -s tests -q: 827 tests passed.
  • Reproduction on the current head: a scripted review stage changed the evidence file and restored its original bytes before returning. The runtime accepted the review and reached READY_FOR_MANUAL_MERGE. This demonstrates the gap in the post-stage hash check; it does not exercise a live Claude CLI session.
  • No database, service, migration, or application runtime configuration was needed.

CI

Current gh pr checks 107 output shows all four listed checks passing: two PowerShell installer runs and two Skills, manifests, and Bash installer runs. The configured Validate package workflow has no missing, pending, failed, cancelled, or skipped check.

Residual risk

The artifact can be changed temporarily by a stage that can reach it and restored before the post-stage digest check. The current tests cover persistent changes and deletion, not temporary alteration. The finding therefore remains open and blocks approval.

Verdict

CHANGES_REQUESTED — REV-001 remains open and blocks approval.

Codex's `workspace-write` sandbox may write `/tmp` and `$TMPDIR`, so a Codex
stage could alter evidence kept there during its run. The diff now lives under
`evidence/` beside the telemetry database, which every Codex sandbox reads and
none may write, enforced by the operating system. Claude has no sandbox in this
toolkit; docs/verification.md states per executor what is enforced and what
only the post-stage hash covers. With no change bases, no evidence directory is
created at all.
@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCR-20260928-002] · manual · ?/?→? · ? · schema:1

[CCT-20260928-002] · manual · ?/?→? · ? · triaged:a02c04a904c884253434d42733ccfbb999bd4b5c · schema:1

Resolution summary

Status: RESOLVED. I triaged the reopened REV-001 against a02c04a904c884253434d42733ccfbb999bd4b5c before editing. Its disposition stays valid, as frozen by CCT-20260928-001. The enforceable part is fixed in 4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98. The rest is closed with the justification below. The repository owner chose this approach.

[REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receives

Paths: scripts/run_cycle.py, docs/verification.md, tests/test_run_cycle.py.

What changed. The rereview showed that a stage could change the file and restore it before the post-stage hash. I split the finding by executor, because only one of them has an execution boundary that can enforce "cannot change during the run":

  • Codex: now enforced by the OS sandbox. Codex's workspace-write sandbox may write /tmp and $TMPDIR, which is where the diff used to live. The diff now lives under evidence/ beside the telemetry database (CODE_CYCLE_HOME, or the user configuration directory). Every Codex sandbox reads the whole file system and none may write there, so a Codex stage can't change the file even temporarily. This covers reviews (already read-only) and resolves (workspace-write). A CODE_CYCLE_HOME inside the workspace is refused, as before.
  • Claude: no enforceable boundary exists, so none is claimed. The toolkit runs Claude without an OS sandbox. executors.py already documents that a Claude reviewer "is confined by the directory it is given, not by an argument", and that a disallowed edit tool still wrote a file in a live probe. A publishing Claude stage keeps Bash(git:*), and git diff --output=<path> alone can write anywhere. No flag can make the file unchangeable for a Claude stage, so the mechanism stays detection after the stage (read-only bit, no grant to writing stages, SHA-256 recheck), as for the implementer checkout.

Why the remaining case is closed rather than left open. Only the stage that receives the file reads it, and it is deleted when the stage ends. A Claude stage that alters and restores its own file has misled only itself. That can't be told apart from a stage that never opened the file, and no runtime can prove which bytes an agent read. The guarantee this PR makes is that the runtime supplied the complete diff and nothing downstream sees an altered one. Both hold. docs/verification.md now states, per executor, what is enforced and what is only detected, and names this case explicitly.

Also fixed. With no change bases, no evidence directory is created. Two test modules that call run_cycle without bases created an empty evidence/ in the real user configuration directory. RunCycleTestCase now isolates CODE_CYCLE_HOME.

Verification

  • New tests:
    • test_evidence_lives_beside_host_state_not_in_the_temporary_directory
    • test_an_evidence_directory_inside_the_workspace_is_not_used
  • With the fix stashed, both fail; with it, both pass.
  • python3 -m unittest discover -s tests: 828 tests, OK. After the run, no evidence/ directory is left in the real host state directory.
  • python3 scripts/validate-package.py: VALID.
  • gh pr checks 107 on 4c9255b: 4/4 pass (two PowerShell installer, two Skills, manifests, and Bash installer).
  • Not verified: the Codex OS sandbox refusing a write to evidence/ was not exercised live. It rests on Codex's documented writable roots (workspace, /tmp, $TMPDIR).

Post-change workflow. I ran the code-review pass inline over the fix diff: no new findings. Security triage: no security_review.always_when rule and no labels. My own judgement: the change narrows where evidence lives and adds no permission, so no further audit is needed.

Residual risk

  • A Claude stage can change and restore its own evidence file during its run. That stage alone is affected, and the case is documented in docs/verification.md.
  • Orca stages rely on the instruction layer, unchanged from the original PR.

@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-003] · manual · ?/?→? · ? · schema:1

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1

[CCR-20260928-002] · manual · ?/?→? · ? · schema:1

[CCT-20260928-002] · manual · ?/?→? · ? · triaged:a02c04a904c884253434d42733ccfbb999bd4b5c · schema:1

Rereview summary

Rereviewed PR #107 at head 4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98 against main; merge base remains ae36991fef78ad8f65090074a130176dd9b10718. The accumulated diff is 17 files, 783 insertions, and 10 deletions. Since the previous reviewed head a02c04a904c884253434d42733ccfbb999bd4b5c, three files changed (78 insertions, 29 deletions), covering evidence storage, its tests, and documentation.

The latest change moves stage evidence beside host-local state and adds tests for the default evidence location and for refusing an evidence directory inside the workspace. This protects the artifact from Codex's ordinary workspace and temporary writable roots, subject to the finding below.

Previous finding

[REV-001] · medium · open · valid · blocks:yes — Claude can edit the evidence artifact it receives

File: scripts/run_cycle.py, line 873.

Status: still reproducible. The prior resolver marked REV-001 resolved at 4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98; its disposition remains valid. I reran the transient-tamper case against this head: a scripted Claude reviewer changed the evidence bytes, restored the original bytes before returning APPROVED, and the runtime's post-dispatch digest check passed. The cycle returned READY_FOR_MANUAL_MERGE with verdict APPROVED.

The resolver's claim that this can mislead only the stage itself does not hold for a review stage: run_cycle consumes its verdict downstream. A verdict based on altered evidence can therefore approve the change even though the runtime supplied a different diff. The post-dispatch hash at line 873 proves only that the file was restored by the time the stage returned; it cannot prove which bytes the stage read. The stage must be unable to write the evidence for the duration of review, or its result must not be treated as a verified review.

There is also a gap in the new Codex location guarantee: diff_directory() rejects a location overlapping the checkout, but does not reject a custom CODE_CYCLE_HOME under /tmp or $TMPDIR. I set CODE_CYCLE_HOME=/tmp/cc-review-evidence-probe and confirmed the evidence root remained under /tmp and a diff directory was created. Codex workspace-write can write there, so this configuration still permits transient edits.

Security triage

There is no security_review.always_when rule in .code-cycle.yml and PR #107 has no labels. Reviewer judgment activated a scoped security audit because the change handles review evidence and executor write boundaries. REV-001 remains the confirmed evidence-integrity issue; no separate confirmed vulnerability was found.

Verification

  • python3 -m unittest discover -s tests -p 'test_run_cycle.py': 121 tests passed.
  • python3 -m unittest discover -s tests -p 'test_executors.py': 141 tests passed.
  • python3 scripts/validate-package.py: VALID (14 skills, shared sections in sync, manifests aligned).
  • python3 -m unittest discover -s tests: 828 tests passed.
  • Transient evidence edit/restore reproduction on the current head: runtime accepted the review as APPROVED and returned READY_FOR_MANUAL_MERGE.
  • Custom CODE_CYCLE_HOME probe under /tmp: the evidence directory was created under the writable temporary root.
  • No database, service, migration, or application runtime setup was needed.

CI

gh pr checks 107 reports all four listed checks passing: two PowerShell installer runs and two Skills, manifests, and Bash installer runs. No listed check is pending or failing.

Residual risk

The review artifact can still be changed and restored during a Claude review. A Codex stage can also reach a writable temporary location when CODE_CYCLE_HOME is configured there. Tests cover persistent edits and removal, but not a stage that restores the original bytes before returning.

Verdict

CHANGES_REQUESTED — REV-001 remains open and blocks approval.

…rectory (REV-001)

A `CODE_CYCLE_HOME` under `/tmp` or `$TMPDIR` put the diff back where Codex's
`workspace-write` sandbox may write it. `diff_directory()` now refuses any
evidence root that overlaps the workspace or those temporary roots, before
creating anything, and the stage is told no file was written. The docs no
longer claim a transient edit by a Claude stage misleads only that stage: a
review's verdict drives the cycle, and for Claude this remains an open limit.
@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1

[CCR-20260928-002] · manual · ?/?→? · ? · schema:1

[CCT-20260928-002] · manual · ?/?→? · ? · triaged:a02c04a904c884253434d42733ccfbb999bd4b5c · schema:1

[CCR-20260928-003] · manual · ?/?→? · ? · schema:1

[CCT-20260928-003] · manual · ?/?→? · ? · triaged:4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98 · schema:1

Resolution summary

Status: PARTIALLY_RESOLVED. I triaged REV-001 against 4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98 before editing. Its disposition stays valid, frozen by CCT-20260928-001. Fix commit: 71c42d44134e8a3451c7cd5884d6551a45909d5f.

REV-001 has now survived two claimed fixes (a02c04a, 4c9255b), so it is contested. The toolkit's repeated-findings ladder (SURVIVALS_BEFORE_STOP = 2) stops the resolution loop at this point. I have fixed the part that can be fixed and left the finding open for a human decision instead of claiming a third resolution.

[REV-001] · medium · open · valid · blocks:yes — Claude can edit the evidence artifact it receives

Paths: scripts/run_cycle.py, docs/verification.md, tests/test_run_cycle.py.

Fixed: a Codex-writable evidence root. A CODE_CYCLE_HOME under /tmp or $TMPDIR put the evidence back inside Codex's workspace-write roots.

  • diff_directory() now refuses any evidence root that overlaps the workspace or those temporary roots. It checks before creating anything. The stage's prompt says that no file was written, and the stage falls back to the skill's Complete evidence rules.
  • I reproduced the reviewer's probe with CODE_CYCLE_HOME=/tmp/.... Before the fix it created /tmp/.../evidence/diff-*; after the fix it returns None and creates nothing.
  • New tests:
    • test_an_evidence_root_in_a_writable_temporary_directory_is_refused: no directory is made, and a review stage receives the no-file prompt.
    • test_the_real_writable_roots_are_the_temporary_directories

Corrected: my earlier justification. I wrote that a Claude stage that alters and restores its file "has misled only itself". That was wrong for review stages, because the cycle acts on their verdict. docs/verification.md now says so. For Codex, the OS sandbox makes the transient edit impossible. For Claude, it is an open limit, not a guarantee.

Still open: a transient edit by a Claude reviewer. The toolkit runs Claude without an OS sandbox. executors.py records that a disallowed edit tool still wrote in a live probe, and publishing stages keep Bash(git:*), which can write any path (git diff --output=<path>). No argument-level change closes this. Each option below is a design decision beyond this finding's fix:

  1. Don't treat a Claude review's verdict as backed by runtime evidence, for example by recording it and requiring a Codex or human confirmation before READY_FOR_MANUAL_MERGE.
  2. Deliver the diff inside the prompt through stdin, which the agent cannot alter. This is bounded by context size and falls back to the file for large diffs.
  3. Run Claude stages under an enforced sandbox, such as Claude Code's own sandboxing or an OS-level one. That has to be verified live before anything relies on it.
  4. Accept and document the limit. REV-001 would then be closed by an explicit decision from the repository owner, not by this resolver.

Verification

  • python3 -m unittest discover -s tests: 830 tests, OK. No evidence/ directory is left in the real host state directory.
  • python3 scripts/validate-package.py: VALID.
  • gh pr checks 107 on 71c42d4: 4/4 pass (two PowerShell installer, two Skills, manifests, and Bash installer).
  • Not verified live: that Codex's OS sandbox refuses a write to the evidence root.

Post-change workflow. I ran the code-review pass inline over the fix diff: no new findings. Security triage: no security_review.always_when rule and no labels. My own judgement: the change only narrows where evidence may live, so no further audit is needed.

Residual risk

  • A Claude review stage can change and restore its evidence file during its run, and the cycle acts on its verdict. This is REV-001, open.
  • Orca stages rely on the instruction layer, unchanged from the original PR.

The repository owner accepted the limit: Claude reviews remain trusted, keep
their capabilities, and need no secondary confirmation, but are not
runtime-verifiable against a transient edit to their evidence file.
@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1

[CCR-20260928-002] · manual · ?/?→? · ? · schema:1

[CCT-20260928-002] · manual · ?/?→? · ? · triaged:a02c04a904c884253434d42733ccfbb999bd4b5c · schema:1

[CCR-20260928-003] · manual · ?/?→? · ? · schema:1

[CCT-20260928-003] · manual · ?/?→? · ? · triaged:4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98 · schema:1

Owner decision

Status: RESOLVED. The repository owner closed REV-001 by explicit decision. The disposition stays valid, as frozen by CCT-20260928-001.

[REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receives

Decision (repository owner): accept the limit and document it.

  • Claude reviews remain trusted.
  • They are not cryptographically or runtime-verifiable against a transient edit to their evidence file.
  • Claude's capabilities are not reduced, and no secondary confirmation is required.

This closes the remaining case, a Claude review stage that changes and restores the diff file during its run. Everything enforceable stays in place: an evidence root outside Codex's writable roots, no grant to writing stages, a read-only file, and a SHA-256 recheck after each stage.

Documentation: docs/verification.md records the accepted limit in d655cf7e4996209c84ff65731373ad31f49feeed. This is a docs-only change.

Verification: python3 scripts/validate-package.py: VALID. gh pr checks 107 on d655cf7: see the check run for this head. No code changed since 71c42d4, where the 830 tests passed.

Residual risk

  • By owner decision: a Claude review can be misled by a transient edit to its own evidence file, and this is not detected.
  • Orca stages rely on the instruction layer.

@datacas

datacas commented Sep 28, 2026

Copy link
Copy Markdown
Owner Author

[CCR-20260928-004] · manual · ?/?→? · ? · schema:1

[CCR-20260928-001] · manual · ?/?→? · ? · schema:1

[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1

[CCR-20260928-002] · manual · ?/?→? · ? · schema:1

[CCT-20260928-002] · manual · ?/?→? · ? · triaged:a02c04a904c884253434d42733ccfbb999bd4b5c · schema:1

[CCR-20260928-003] · manual · ?/?→? · ? · schema:1

[CCT-20260928-003] · manual · ?/?→? · ? · triaged:4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98 · schema:1

Resumen de rerevisión

Rerevisé el PR #107 en el HEAD d655cf7e4996209c84ff65731373ad31f49feeed, contra main; el merge base es ae36991fef78ad8f65090074a130176dd9b10718. El diff acumulado contiene 17 archivos, 833 inserciones y 10 eliminaciones. Desde el último HEAD revisado (4c9255b9ac37f58e6b882b3cbbff5053bfcf5e98), dos commits modificaron tres archivos: scripts/run_cycle.py, sus pruebas y docs/verification.md.

El cambio rechaza crear evidencia cuando su ubicación cae dentro del workspace, /tmp o $TMPDIR. La documentación también aclara que las revisiones de Claude siguen siendo de confianza y que el runtime no detecta una edición temporal restaurada antes de que termine la etapa.

Hallazgo previo

[REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receives

Archivo: scripts/run_cycle.py, línea 886.

Estado: cerrado por aceptación explícita del riesgo por parte del propietario del repositorio. Se conserva la disposición valid. La protección nueva contra ubicaciones temporales escribibles está verificada: con CODE_CYCLE_HOME=/tmp/cc-review-root-proof, diff_directory() devuelve None y no crea el directorio; también pasan las nuevas pruebas relacionadas.

La limitación de Claude sigue siendo reproducible: una revisión programada puede alterar el diff, restaurarlo antes de terminar y devolver APPROVED; el runtime acepta el resultado como READY_FOR_MANUAL_MERGE. La repetí en el HEAD actual. El propietario aceptó explícitamente este riesgo en el comentario #issuecomment-5873821062, y docs/verification.md ahora lo define como una limitación aceptada. Por tanto, el hallazgo queda cerrado por decisión de producto y documentación, no porque Claude tenga una barrera técnica contra esa edición.

Revisión de seguridad

.code-cycle.yml no define security_review.always_when y el PR no tiene etiquetas. Aun así, ejecuté la auditoría porque el cambio protege la integridad de la evidencia y delimita ubicaciones escribibles. La revisión de seguridad confirmó la limitación conocida de Claude; no encontró vulnerabilidades adicionales en la comprobación de raíces temporales ni en el flujo del artefacto. Las pasadas cc-pr-review y cc-security-review se hicieron de forma delegada; la verificación se ejecutó directamente.

Verificación

  • python3 -m unittest discover -s tests -p 'test_run_cycle.py': 123 pruebas pasaron.
  • python3 -m unittest discover -s tests -p 'test_executors.py': 141 pruebas pasaron.
  • python3 scripts/validate-package.py: VALID (14 skills; secciones compartidas y manifests alineados).
  • python3 -m unittest discover -s tests: 830 pruebas pasaron.
  • Prueba de edición temporal y restauración en el HEAD actual: el runtime aceptó APPROVED y devolvió READY_FOR_MANUAL_MERGE; confirma la limitación aceptada.
  • Prueba de CODE_CYCLE_HOME dentro de /tmp: no se creó un directorio de evidencia.
  • No ejecuté sesiones reales de Claude Code ni una prueba en vivo del sandbox de Codex; la comprobación de la etapa se hizo con un adaptador programado y las pruebas locales.

CI

gh pr checks 107 muestra las cuatro comprobaciones listadas como satisfactorias: dos ejecuciones de PowerShell installer y dos de Skills, manifests, and Bash installer. No hay comprobaciones listadas pendientes ni fallidas.

Riesgo residual

Una etapa de revisión de Claude puede editar y restaurar la evidencia antes de salir, y el ciclo confiará en su veredicto. El propietario aceptó esta limitación y la documentación del PR ya la declara. No queda ningún hallazgo abierto que bloquee la aprobación.

Veredicto

APPROVED — REV-001 queda resolved por aceptación explícita del riesgo; conserva la disposición valid.

@datacas
datacas merged commit 305c09d into main Sep 28, 2026
4 checks passed
@datacas
datacas deleted the issue-88-complete-evidence branch October 6, 2026 07:53
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.

Evidence completeness: the runtime supplies the complete diff, and stages never cite compacted output

1 participant