Repository navigation
Evidence completeness: the runtime supplies the complete diff, and stages never cite compacted output (#88) - #107
Conversation
…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.
[CCR-20260928-001] · manual · ?/?→? · ? · schema:1SummaryReviewed PR #107 (“Evidence completeness: the runtime supplies the complete diff, and stages never cite compacted output”) at head Findings[REV-001] · medium · open · - · blocks:yes — Claude can edit the evidence artifact it receivesFile: The new Keep the evidence outside the stage’s writable boundary and verify its SHA-256 after dispatch, failing closed if the artifact changed. Security triageThe repository has no Verification
CI
Residual riskThe 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. VerdictCHANGES_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.
[CCR-20260928-001] · manual · ?/?→? · ? · schema:1[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1Resolution summaryStatus: RESOLVED. I triaged one finding against [REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receivesPaths: Decision: valid.
Verification
Post-change workflow. I ran the code-review pass inline over the fix diff: no new findings. Security triage: no Residual risk
|
[CCR-20260928-002] · manual · ?/?→? · ? · schema:1Rereview summaryRereviewed PR #107 at head The follow-up adds a read-only mode bit to the diff file, withholds Recovered review runs[CCR-20260928-001] · manual · ?/?→? · ? · schema:1[CCT-20260928-001] · manual · ?/?→? · ? · triaged:636f419b484b99a6b7b81f6f161617b10c729195 · schema:1Previous finding[REV-001] · medium · open · valid · blocks:yes — Claude can edit the evidence artifact it receivesStatus: still reproducible. The previous resolver classified it as valid and marked it resolved on 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 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 triageThere is no Verification
CICurrent Residual riskThe 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. VerdictCHANGES_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.
[CCR-20260928-001] · manual · ?/?→? · ? · schema:1[CCR-20260928-002] · manual · ?/?→? · ? · schema:1[CCT-20260928-002] · manual · ?/?→? · ? · triaged:a02c04a904c884253434d42733ccfbb999bd4b5c · schema:1Resolution summaryStatus: RESOLVED. I triaged the reopened REV-001 against [REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receivesPaths: 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":
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. Also fixed. With no change bases, no evidence directory is created. Two test modules that call Verification
Post-change workflow. I ran the code-review pass inline over the fix diff: no new findings. Security triage: no Residual risk
|
[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:1Rereview summaryRereviewed PR #107 at head 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 receivesFile: Status: still reproducible. The prior resolver marked REV-001 resolved at The resolver's claim that this can mislead only the stage itself does not hold for a review stage: There is also a gap in the new Codex location guarantee: Security triageThere is no Verification
CI
Residual riskThe review artifact can still be changed and restored during a Claude review. A Codex stage can also reach a writable temporary location when VerdictCHANGES_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.
[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:1Resolution summaryStatus: PARTIALLY_RESOLVED. I triaged REV-001 against REV-001 has now survived two claimed fixes ( [REV-001] · medium · open · valid · blocks:yes — Claude can edit the evidence artifact it receivesPaths: Fixed: a Codex-writable evidence root. A
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. Still open: a transient edit by a Claude reviewer. The toolkit runs Claude without an OS sandbox.
Verification
Post-change workflow. I ran the code-review pass inline over the fix diff: no new findings. Security triage: no Residual risk
|
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.
[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:1Owner decisionStatus: RESOLVED. The repository owner closed REV-001 by explicit decision. The disposition stays [REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receivesDecision (repository owner): accept the limit and document it.
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: Verification: Residual risk
|
[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:1Resumen de rerevisiónRerevisé el PR #107 en el HEAD El cambio rechaza crear evidencia cuando su ubicación cae dentro del workspace, Hallazgo previo[REV-001] · medium · resolved · valid · blocks:yes — Claude can edit the evidence artifact it receivesArchivo: Estado: cerrado por aceptación explícita del riesgo por parte del propietario del repositorio. Se conserva la disposición La limitación de Claude sigue siendo reproducible: una revisión programada puede alterar el diff, restaurarlo antes de terminar y devolver Revisión de seguridad
Verificación
CI
Riesgo residualUna 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. VeredictoAPPROVED — REV-001 queda |
Closes #88 — #88
What changed
Runtime guarantee (
scripts/run_cycle.py,scripts/executors.py)review,resolve, andrereviewdispatch,run_cyclewritesgit diff <merge-base>...<head>itself (subprocess,--output,--no-color --no-ext-diff). The base is the first ofchange_bases_ofthat resolves, likestage_signals.code-cycle-diff-*temporary directory outside the workspace. IfTMPDIRoverlaps the checkout, no directory is used. The directory is removed when the stage ends, even on error.NO_DIFF_FILE).read_dirsdispatch 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
## Complete evidencesection, byte-identical incc-code-review,cc-implement-issue,cc-initial-review,cc-pr-review,cc-rereview,cc-resolve-comments,cc-security-review, andcc-verify, placed right after## Output language.validate-package.py(EVIDENCE_SKILLS), so drift or a missing copy fails validation.CONTRIBUTING.mdtable,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), andCHANGELOG.md.Verification
python3 -m unittest discover -s tests: 817 tests, OKpython3 scripts/validate-package.py: VALIDclaude plugin validate .: passedCompleteDiffTestsintests/test_run_cycle.py, against a real Git repo:git diff main...HEAD, with the line count, SHA-256, and head in the prompt.ClaudeAdapterin its isolated clone, argv ends with--add-dir <dir>and the diff is outside the clone.ReadDirectoryTestsintests/test_executors.py: Claude gets--add-dirlast; without evidence it gets none; Codex read-only keeps its argv and the task last.tests/test_validate_package.py: drifted and missing## Complete evidenceboth fail.Manual host check (RTK hook active in the implementing session)
On this branch's own diff, the hooked
git diff mainprinted... (2 additions truncated)inside therun_cycle.pyhunk and ended with... (more changes truncated).git diff main --output=<file>andrtk proxy git diff mainboth 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
cwd. On a resumed cycle whosecwdisn'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.