Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "run_root_review_pipeline の final-review readback を reviewer_transport V2 artifact SSOT と一致させ、producer が生成した canonical artifact を canonical consumer が正常に検証できる状態へ戻す"
change_kind: codeRuntime Verification Applicability
- decision: not_applicable
- reason: 本 Issue の検証はすべて pytest 単体テスト(tempfile 経由の artifact 書き込み/読み取りを含む)と ruff 静的検査で完結し、実プロセス起動・ネットワーク通信・外部 I/O を伴う動作検証を必要としない。
Background
Issue #2231 の refinement 中に run_root_review_pipeline.py gate-final-review を実行したところ、fresh producer artifact に対しても body_sha256_mismatch / verdict_mismatch が恒常的に発生した(参照: #2231 issuecomment-5315427655 / issuecomment-5316915493)。
#2054 / PR #2142 では、reviewer transport と persisted semantic artifact の V2 contract を reviewer_transport.py に集約し、producer / validator / artifact verifier / router / root pipeline が同じ SSOT を利用する設計を確立している。本件はその contract の新設ではなく regression として扱う。
Current-main defect(source-level確認済み)
readback_persisted_artifact()(.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py:760,764)は persisted JSON を独自に parse した後、
actual_body_sha256 = payload.get("body_sha256") # line 760
actual_verdict = payload.get("verdict") # line 764を直接参照する。
一方、canonical V2 writer write_semantic_artifact()(.claude/skills/issue-refinement-loop/scripts/reviewer_transport.py:704-735)は artifact を次の top-level key で永続化する。
schema
repository
issue_number
reviewed_body_sha256 # not "body_sha256"
invocation_id
attempt
semantic_result # nested dict; "verdict" lives INSIDE this, not top-level
body_sha256 という top-level key は存在せず、verdict も top-level ではなく semantic_result.verdict にしか存在しない。したがって readback_persisted_artifact() は canonical writer が生成した あらゆる fresh V2 artifact に対して常に payload.get("body_sha256") is None / payload.get("verdict") is None となり、expected_body_sha256 / expected_verdict と一致し得ないため、gate-final-review は恒常的に body_sha256_mismatch / verdict_mismatch を返す。
既存テストがこの regression を検出できていない理由
.claude/skills/issue-refinement-loop/tests/test_issue_reviewer_contract_static.py:273-339 の readback_persisted_artifact() 向けテスト(test_readback_rejects_actual_nan_json_token 等4件)は、hand-written fixture として旧・V1時代のフラット schema
{"body_sha256": "sha256:aa", "verdict": "approve", ...}を直接 tmp_path に書き込んでテストしている。これは production writer (write_semantic_artifact()) が実際に生成する V2 schema と一致しておらず、writer/reader drift を検出できない false-green になっている。
Outcome
canonical producer が fresh に生成した persisted V2 artifact を、canonical readback/final-review gate が追加の変換・手動照合なしで正常に consume できる。
malformed / stale / wrong-body / wrong-repository / wrong-issue / wrong-invocation / wrong-attempt / wrong-hash / semantic wire mismatch は従来どおり fail-closed する。
Required design
単純に payload.get("body_sha256") を payload["semantic_result"]["body_sha256"] へ置換するだけの修正は禁止する。理由: semantic_result が実際に body_sha256 というキーを持つとは限らず(semantic_result は REVIEW_ISSUE_RESULT_V1 形状のペイロードで、body 束縛は reviewed_body_sha256(top-level)が正本)、また schema knowledge の重複が残り、次の schema 変更で再度 drift するため。
優先設計:
reviewer_transport.verify_artifact()(同ファイル:671-701)を readback から利用する。body binding は canonical artifact binding fieldreviewed_body_sha256を verifier に検証させる(.get()による緩い一致ではなく、verify_artifact()のartifact_binding_mismatchfail-closed 判定を再利用する)。- verdict の semantic projection は
reviewer_transport.project_compact_v2_from_artifact()/_semantic_verdict_and_count()相当の shared accessor を経由し、run_root_review_pipeline.py自身がsemantic_resultの内部 key layout を再実装しない。 - wire ↔ artifact cross-binding が必要な箇所は PR 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する #2142 で確立した
verify_wire_matches_artifact()を再利用する。 - shared accessor が不足している場合は
reviewer_transport.pyに最小の純粋関数を追加し、producer/readback 双方がそれを利用する。
In Scope
.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py.claude/skills/issue-refinement-loop/scripts/reviewer_transport.py(shared accessor が必要な場合のみ).claude/skills/issue-refinement-loop/tests/test_issue_reviewer_contract_static.py(既存 readback テストの fixture を production writer 出力へ更新)- root review / artifact consumer 関連の他 regression tests(必要な範囲のみ)
Out of Scope
- V3 schema の新設
- V2 field layout の不要な変更
- downgrade fallback
- malformed artifact の permissive acceptance
- 実装: worktree-agent-runtime-smoke の Claude-GPT launcher 経由 live causal-evidence 検証を実施し native Claude Code との比較 receipt を記録する #2231 の live runtime implementation
- reviewer semantic policy自体の変更
- transport retry/deadline policy の変更
Acceptance Criteria
- AC1: canonical producer(
write_semantic_artifact())→ persisted V2 artifact →readback_persisted_artifact()→gate_final_review()の real roundtrip が freshapproveartifact でfinal_review_allowed: trueに到達する。 - AC2:
needs-fixartifact でも expected verdict identity が正しく検証される。 - AC3: wrong
reviewed_body_sha256はverdict_identity: falseで fail-closed する。 - AC4: wrong repo / issue / invocation / attempt / artifact SHA は fail-closed する。
- AC5: artifact
semantic_resultと compact wire の改ざん不一致は fail-closed する(verify_wire_matches_artifact()経路)。 - AC6: malformed JSON / duplicate key / non-finite JSON / symlink / non-regular artifact の既存 security regression(
test_readback_rejects_actual_nan_json_token等)が維持される。 - AC7:
run_root_review_pipeline.pyが canonical V2 persisted artifact layout(semantic_result内部構造を含む)の第二の field-map を独自に持たない。 - AC8: implement: recover reviewer transport failures and cryptographically bind compact verdicts to artifacts #2054 AC8 / PR 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する #2142 の SSOT contract(
reviewer_transport.pyが artifact schema の唯一の owner)が regression test で明示的に固定される。 - AC9:
gate-final-reviewの CLI E2E test が、canonical producer が生成した artifact に対してfinal_review_allowed: trueへ到達する。 - AC10:
test_issue_reviewer_contract_static.pyの既存 hand-written flat-schema fixture({"body_sha256": ..., "verdict": ...})が production writer 出力形状へ更新され、修正前は fail・修正後は pass することを示す(この regression の再現と解消の直接証拠)。
Required regression test
特に以下のテストを追加する。
GIVEN reviewer_transport.write_semantic_artifact() が実際に書き込んだ artifact
WHEN run_root_review_pipeline.readback_persisted_artifact() がその exact artifact を consume する
THEN writer と reader が test 側の payload reshaping なしで一致する
hand-written JSON fixture だけでこのテストを満たさないこと(production writer を実際に呼び出す)。これにより writer/reader の片側だけを同じ誤った fixture に合わせて false-green にすることを防ぐ。
Verification Commands
実装時に current test inventory を確認して正確な command を固定すること。最低限:
uv run pytest .claude/skills/issue-refinement-loop/tests/test_issue_reviewer_contract_static.py -q
uv run pytest .claude/skills/issue-refinement-loop/tests/test_reviewer_transport_e2e.py -q
uv run pytest .claude/skills/issue-refinement-loop/tests/ -q
uv run ruff check .claude/skills/issue-refinement-loop/scripts/Allowed Paths
.claude/skills/issue-refinement-loop/scripts/run_root_review_pipeline.py.claude/skills/issue-refinement-loop/scripts/reviewer_transport.py.claude/skills/issue-refinement-loop/tests/
追加 path が必要なら勝手に拡張せず Stop Condition として報告する。
Related
- implement: recover reviewer transport failures and cryptographically bind compact verdicts to artifacts #2054
- PR 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する #2142
- 実装: read-only issue-reviewer の producer I/O を root-owned に分離し、0-byte stdout も validator-first で分類する #2049
- 実装: worktree-agent-runtime-smoke の Claude-GPT launcher 経由 live causal-evidence 検証を実施し native Claude Code との比較 receipt を記録する #2231 / issuecomment-5315427655 / issuecomment-5316915493
Stop Conditions
- V2 schema 自体を変更する必要がある
- backward compatibility のため downgrade fallback が必要になる
- reviewer transport の semantic authority 境界変更が必要になる
- Allowed Paths 外への変更が必要になる
Activity
[-]修正: root review pipeline の persisted artifact readback を V2 SSOT に再接続し gate-final-review の恒常 mismatch を解消する[/-][+]実装: root review pipeline の persisted artifact readback を V2 SSOT に再接続し gate-final-review の恒常 mismatch を解消する[/+]squne121 commentedon Aug 17, 2026
implement-issue: 実装完了 (2026-08-17T15:07:29Z)
.claude/worktrees/issue-2242-root-review-readback-v2-ssotworktree-issue-2242-root-review-readback-v2-ssotsqune121 commentedon Aug 17, 2026
impl-review-loop: 完了 (2026-08-18T00:00:00Z)
fix: root review pipeline readback の OWNER adversarial review 4 block…
fix: root review pipeline readback を reviewer_transport V2 SSOT へ再接続する (