Repository navigation
Closed
Labels
Description
修正: impl-review-loop の独立VCを Step 4 起動前の current-head gate に接続し TEST_VERDICT 旧経路を非規範化する
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "独立Issue VCの完了・束縛・adjudication前にpr-reviewerを起動しないことで、同一headの不要なREQUEST_CHANGES→再reviewを防止する"
change_kind: workflow
reframes_previous_contract: "#88"
Parent Issue
なし(単独改善・reframe)
Parent Goal Ref
- Goal: impl-review-loop の Step 2 (test-runner) と Step 4 (pr-review-judge) 間の証跡受け渡しで、同一 head に対する不要な二重 review を防止する
- Desired Destination: N/A(parent なし)
Current Validated Scope
.claude/skills/impl-review-loop/SKILL.md/steps/step-2-verification.md/steps/step-4-pr-review.md/steps/context-protocol-and-guardrails.mdに current-head independent VC gate を明記する.claude/agents/test-runner.mdを read-only report 契約(PR コメント投稿なし)に統一する.claude/skills/pr-review-judge/references/evidence-policy.mdに TEST_VERDICT_MACHINE の diagnostics-only 位置付けを明記する.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.pyの既存ロジックを Step 4 起動直前 gate として再利用する
Remaining Parent Gaps
なし(単独改善のため gap なし)
Background
PR #2310 では、実装差分・Allowed Paths・required CIに問題がなかったにもかかわらず、
独立Issue VCがStep 4初回reviewer起動前に渡されなかったため、
同一headに対して以下の2回のreviewが発生した。
- independent VC missing → REQUEST_CHANGES
- independent VC PASS追加後 → APPROVE
現行evidence policyでは以下だけがauthoritativeである。
- current-head required CI
- exact head SHA + literal command SHA256に束縛された独立Issue VC
TEST_VERDICT_MACHINEはdiagnostics-onlyであり、approval、blocking、routingを変更しない。
Outcome
linked IssueにVerification Commandsがある場合、
current-head independent VCが完了し、
VC_ADJUDICATION_RESULT_V1.blocking == false になるまで
pr-reviewerを起動できない。
happy pathでは同一binding tupleに対して、
- test-runner 1回
- pr-reviewer 1回
だけが実行される。
test-runnerはread-only reportだけを返し、PRコメントを投稿しない。
TEST_VERDICT comment/artifactは通常routingの入力にならない。
Binding Tuple
repository: <owner/repo>
issue_number: <int>
pr_number: <int>
contract_body_sha256: sha256:<hex>
head_sha: <40-hex>
literal_command_sha256_list:
- sha256:<hex>
Runtime Verification Applicability
- decision: not_applicable
- reason: AC1〜AC12 は pytest fixture / ruff / rg による静的・決定論的検証のみで完結する。impl-review-loop 自体の live 実行観測(PR 実装: worktree-agent-runtime-smoke に JSON 出力オプションを追加し claude-gpt launcher 経由の live causal-evidence 検証を行う #2310 で実際に発生した二重review自体の再現)は本 Issue のスコープではなく、fixture ベースの回帰テストで表現する。
Required Design
- Step 2でtest-runner completionとfinal resultの両方を確認する。
adjudicate_vc_result.pyの既存ロジックを再利用する。VC_ADJUDICATION_RESULT_V1をLOOP_STATEへ保持する。- Step 4起動直前にbinding tupleを再照合する。
- 次のいずれかならpr-reviewerを起動しない。
- adjudication missing
- malformed
- blocking true
- head mismatch
- body mismatch
- command mismatch
- FAIL
- SKIP
- fallback
- 同一root invocation内で同一binding tupleのvalid adjudicationが存在する場合、
test-runnerを再実行しない。 - head/body/commandのいずれかが変われば旧adjudicationをstaleにする。
- TEST_VERDICT comment検索をnormal flowから除去する。
- 新規persistent ledger、authorization packet、publisher、hook、schemaを作らない。
In Scope
.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/step-2-verification.md.claude/skills/impl-review-loop/steps/step-4-pr-review.md.claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md.claude/agents/test-runner.md.codex/agents/test-runner.toml.claude/skills/pr-review-judge/references/evidence-policy.md.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py.claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py.claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py.claude/skills/impl-review-loop/tests/test_step4_requires_current_vc.py
Allowed Paths
.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/step-2-verification.md.claude/skills/impl-review-loop/steps/step-4-pr-review.md.claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md.claude/agents/test-runner.md.codex/agents/test-runner.toml.claude/skills/pr-review-judge/references/evidence-policy.md.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py.claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py.claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py.claude/skills/impl-review-loop/tests/test_step4_requires_current_vc.py
Out of Scope
- TEST_VERDICT legacy parser/schema/materializerの物理削除
- required CI policy変更
- PR comment publisherの新設
- merge automation
- persistent run-state store
- graph policy
- 新規Custom SubAgent
- 新規Hook
Acceptance Criteria
- AC1: linked IssueにVCがある場合、current-head nonblocking adjudicationなしでpr-reviewerを起動しない。
- AC2: current head、body SHA、ordered command hashesがすべて一致した場合だけadjudicationを採用する。
- AC3: head/body/commandsのdriftで旧adjudicationがstaleになる。
- AC4: FAIL/SKIP/fallback/missing/malformedはreviewer spawn前にblockingとなる。
- AC5: 同一binding tupleのvalid adjudicationを同一loop内で再利用し、test-runnerを二重実行しない。
- AC6: happy-path fixtureでtest-runner 1回、pr-reviewer 1回になる。
- AC7: independent VC missing fixtureではpr-reviewer invocation countが0になる。
- AC8: test-runnerのactive contractがread-only/no PR commentで統一されている。
- AC9: active docsに「test-runnerが投稿するコメント」「gh pr view commentsからTEST_VERDICTを取得」がnormal routingとして残らない。
- AC10: TEST_VERDICT_MACHINEはdiagnostics-onlyとしてのみ記述される。
- AC11: Claude Code / Codex CLIで同一semantic contractを使用する。
- AC12: 新規persistent ledger、digest authority、publisher、enforcing hookを追加していない。
Verification Commands
# AC1
# AC4
# AC7
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_step4_requires_current_vc.py -q
# AC2
# AC3
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result.py -q
# AC5
# AC6
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_adjudicate_vc_result_non_regression_gate.py -q
# AC8
$ rg -q "投稿しない" .claude/agents/test-runner.md
# AC9
$ rg --files-without-match "TEST_VERDICT_MACHINE.*PR.*コメント" .claude/skills/impl-review-loop/steps/step-4-pr-review.md
# AC10
$ rg -q "diagnostics-only" .claude/skills/pr-review-judge/references/evidence-policy.md
# AC11
$ rg -q "投稿しない" .codex/agents/test-runner.toml
# AC12
$ rg -c "persistent ledger" .claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py
Negative Controls
- adjudicationを削除するとAC1/AC7 fixtureがFAILする。
- head照合を無効化するとstale-head fixtureがFAILする。
- command hash照合を無効化するとmodified-command fixtureがFAILする。
- SKIPをPASSへ変更するとnegative fixtureがFAILする。
- TEST_VERDICT commentだけを与えてもStep 4 gateが開かない。
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- Agent tool起動を強制するための新規enforcing hookが必要になる。
- persistent authorization packetが必要になる。
- evidence policy自体のauthority変更が必要になる。
- TEST_VERDICT legacy subsystemの物理削除が必要になる。
Required Skills
なし
Required Design References
.claude/skills/impl-review-loop/scripts/adjudicate_vc_result.py(既存 adjudication ロジック).claude/skills/pr-review-judge/references/evidence-policy.md(現行 evidence policy 正本)docs/dev/agent-skill-boundaries.md
Notes
- 出典: PR 実装: worktree-agent-runtime-smoke に JSON 出力オプションを追加し claude-gpt launcher 経由の live causal-evidence 検証を行う #2310 コメント 実装: worktree-agent-runtime-smoke に JSON 出力オプションを追加し claude-gpt launcher 経由の live causal-evidence 検証を行う #2310 (comment) (OWNER squne121)による本文差し替え指示。「Issue草案1 — 修正: impl-review-loop の独立VCを Step 4 起動前の current-head gate に接続し TEST_VERDICT 旧経路を非規範化する #88 本文差し替え」に基づき、旧・TEST_VERDICT_MACHINE PRコメント投稿契約から、独立VC current-head gate 契約へ reframe した。
- 関連改訂案(今回は着手しない): 実装: SubAgent 発火前に bounded local context bundle を生成し Claude/Codex の両 loop で consume する #1909(bounded SubAgent context bundle)、実装: SHA-bound evidence index と command fingerprint budget で再読・重複調査・wait polling による context churn を抑制する #2052(SHA-bound evidence index 接続)、feat(agent-ops): agent ops / impl-review-loop 用 context budget を導入する #1117(実装: agent context budget inventory を導入し AGENTS/CLAUDE/skills/hooks/subagents/rules/scripts の重複読みに上限を設ける #1093 との integration split)。推奨実装順は同コメント参照。
Activity
fix(#87): revert mergeStateStatus rename, add CI_CHECK_RUN_SCOPED pro…
docs(#87): pr-review-judge に VC証跡信頼階層・CI fallback限定条件・APPROVE禁止policy…
実装: TEST_VERDICT consumer integration(materializer + receipt-aware ad…
[-]実装: impl-review-loop の Step 2 / Step 4 で test-runner 実行と TEST_VERDICT_MACHINE 投稿の責務を明示する[/-][+]修正: impl-review-loop の独立VCを Step 4 起動前の current-head gate に接続し TEST_VERDICT 旧経路を非規範化する[/+]squne121 commentedon Aug 22, 2026
root-owned entry router audit
route: stop
reason: review_verdict_blocked
squne121 commentedon Aug 22, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Aug 22, 2026
implement-issue: 実装完了 (2026-08-23)
b78f965f14c14d5d0987ca6104bc24995a56556c.claude/worktrees/issue-88-vc-current-head-gateworktree-issue-88-vc-current-head-gateVerification Commands(Issue本文の記載通り、逐語実行):
pytest test_step4_requires_current_vc.py -qpytest test_adjudicate_vc_result.py -qpytest test_adjudicate_vc_result_non_regression_gate.py -qrg -q "投稿しない" .claude/agents/test-runner.mdrg -c "TEST_VERDICT_MACHINE.*PR.*コメント" step-4-pr-review.mdrg -q "diagnostics-only" evidence-policy.mdrg -q "投稿しない" .codex/agents/test-runner.tomlrg -c "persistent ledger" adjudicate_vc_result.py追加で impl-review-loop tests 全体(576 passed, 2 deselected, 2 xfailed)、
ruff、gemini-cli-headless-delegation の model_routing テスト(24 passed)も
regression なしを確認済み。
後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
修正: PR #2312 OWNER REQUEST_CHANGES を反映し Step4 current-head gate を LOO…