Skip to content

修正: impl-review-loop の独立VCを Step 4 起動前の current-head gate に接続し TEST_VERDICT 旧経路を非規範化する #88

Closed

Description

@squne121

修正: 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が発生した。

  1. independent VC missing → REQUEST_CHANGES
  2. 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

Required Design

  1. Step 2でtest-runner completionとfinal resultの両方を確認する。
  2. adjudicate_vc_result.py の既存ロジックを再利用する。
  3. VC_ADJUDICATION_RESULT_V1をLOOP_STATEへ保持する。
  4. Step 4起動直前にbinding tupleを再照合する。
  5. 次のいずれかならpr-reviewerを起動しない。
    • adjudication missing
    • malformed
    • blocking true
    • head mismatch
    • body mismatch
    • command mismatch
    • FAIL
    • SKIP
    • fallback
  6. 同一root invocation内で同一binding tupleのvalid adjudicationが存在する場合、
    test-runnerを再実行しない。
  7. head/body/commandのいずれかが変われば旧adjudicationをstaleにする。
  8. TEST_VERDICT comment検索をnormal flowから除去する。
  9. 新規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

Activity

  1. added
    enhancement
    state/queued
    on May 19, 2026
  2. added 2 commits that reference this issue on May 29, 2026
  3. changed the title [-]実装: impl-review-loop の Step 2 / Step 4 で test-runner 実行と TEST_VERDICT_MACHINE 投稿の責務を明示する[/-] [+]修正: impl-review-loop の独立VCを Step 4 起動前の current-head gate に接続し TEST_VERDICT 旧経路を非規範化する[/+] on Aug 22, 2026
  4. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: stop
    reason: review_verdict_blocked

  5. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  6. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-23)

    Verification Commands(Issue本文の記載通り、逐語実行):

    AC コマンド 結果
    AC1/AC4/AC7 pytest test_step4_requires_current_vc.py -q 9 passed
    AC2/AC3 pytest test_adjudicate_vc_result.py -q 29 passed
    AC5/AC6 pytest test_adjudicate_vc_result_non_regression_gate.py -q 21 passed
    AC8 rg -q "投稿しない" .claude/agents/test-runner.md exit 0
    AC9 rg -c "TEST_VERDICT_MACHINE.*PR.*コメント" step-4-pr-review.md 0 matches(negative control として期待通り)
    AC10 rg -q "diagnostics-only" evidence-policy.md exit 0
    AC11 rg -q "投稿しない" .codex/agents/test-runner.toml exit 0
    AC12 rg -c "persistent ledger" adjudicate_vc_result.py 4 matches

    追加で 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

  7. added a commit that references this issue on Aug 23, 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

    enhancementstate/queued

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions