Skip to content

実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#626"
goal_ref: "pr-review-judge / pr-reviewer の出力(LOOP_VERDICT)に merge_ready / required_auto_actions / auto_fix_applied を追加し、auto-fixable な現在 PR hygiene を follow_up_issue_requests に分類できない構造(LOOP_VERDICT_V2)にする"
change_kind: workflow

Parent Issue

#626

Parent Goal Ref

  • Goal: 各スキルの既定完了条件を goal まで引き上げ、既知の機械的補正を既存 worker SubAgent に委譲して人間の Y 承認連鎖をなくす
  • Desired Destination: /impl-review-loop <N> が追加の Y なしで IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready かつ merge_ready: true まで到達できる。Closes #N 不足 / mergeStateStatus=BEHIND 等の auto-fixable hygiene が follow_up_issue_requests ではなく required_auto_actions として既存 implementation-worker に委譲される。

Current Validated Scope

  • .claude/skills/pr-review-judge/SKILL.md: LOOP_VERDICT スキーマを LOOP_VERDICT_V2 に拡張(merge_ready / required_auto_actions / auto_fix_applied フィールド追加)
  • .claude/skills/pr-review-judge/SKILL.md: Step 5 の verdict 決定ロジックを更新し required_auto_actions が空でない限り merge_ready: true にしない制約を明記
  • .claude/skills/pr-review-judge/SKILL.md: Closes #N 不足 / PR body validator failure / BEHIND branch update を required_auto_actions(executor: implementation-worker)に分類し follow_up_issue_requests に出さないルールを記載
  • .claude/agents/pr-reviewer.md: 参照先スキーマ名を LOOP_VERDICT_V2 に更新(DRY に準拠し SKILL.md 参照のみ)
  • .claude/skills/pr-review-judge/scripts/tests/: LOOP_VERDICT_V2 スキーマ検証と分類ルールのユニットテストを追加
  • pr-review-judge/SKILL.md に Schema Consumer Inventory(impl-review-loop, pr-reviewer.md, 関連テスト, 実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631/実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 への依存明記)を追加する
  • required_auto_actions の mechanical: true precondition フィールドを SKILL.md に定義する
  • V2 スキーマを snake_case のみで定義し、mergeStateStatus/recommendations を V2 では禁止することを SKILL.md に明記する

Remaining Parent Gaps

  • child-1: issue_kind allowlist / normalization の単一 SSOT 集約(未起票)
  • child-2: issue-refinement-loop の terminal contract を LOOP_HANDOFF_RESULT_V1.status: impl_ready に固定(未起票)
  • child-4: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 の mode 追加(未起票)
  • child-5: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一(未起票)
  • child-6: AUTONOMY_POLICY_V1 共通 policy / result schema 追加(未起票)
  • child-7: 回帰テスト追加(未起票)

Outcome

.claude/skills/pr-review-judge/SKILL.md が LOOP_VERDICT_V2 スキーマ(merge_ready / required_auto_actions / auto_fix_applied フィールドを含む)に更新され、Closes #N 不足・PR body validator failure・BEHIND branch update が required_auto_actions(executor: implementation-worker)に分類されることを検証するユニットテストが追加・全件 PASS している状態。

In Scope

  • pr-review-judge/SKILL.md の Verdict コメントテンプレート内の LOOP_VERDICT ブロックを LOOP_VERDICT_V2 フォーマットに更新する(merge_ready / required_auto_actions / auto_fix_applied フィールドを追加する)
  • Step 5(verdict 決定)に required_auto_actions の分類ロジックを追記する
    • Closes #N 不足 → required_auto_actions に kind: ensure_closing_keyword(executor: implementation-worker)を追加
    • PR body validator failure → required_auto_actions に kind: update_pr_body_hygiene(executor: implementation-worker)を追加
    • mergeStateStatus=BEHIND && mergeable=MERGEABLE → required_auto_actions に kind: update_branch(executor: implementation-worker)を追加
  • required_auto_actions が空でない限り merge_ready: true を出力しない制約ルールを SKILL.md に明記する
  • follow_up_issue_requests は現在 PR の merge readiness に不要な恒久的改善のみ(blocking_merge_ready: false)に限定する制約を明記する
  • pr-reviewer.md の参照スキーマ名を更新する(本文は SKILL.md DRY に従い最小変更)
  • .claude/skills/pr-review-judge/scripts/tests/ に LOOP_VERDICT_V2 のスキーマ検証・分類ルール確認のユニットテストを追加する
  • pr-review-judge/SKILL.md に Schema Consumer Inventory(impl-review-loop, pr-reviewer.md, 関連テスト, 実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631/実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 への依存明記)を追加する
  • required_auto_actions の mechanical: true precondition フィールドを SKILL.md に定義する
  • V2 スキーマを snake_case のみで定義し、mergeStateStatus/recommendations を V2 では禁止することを SKILL.md に明記する

Out of Scope

  • impl-review-loop の required_auto_actions routing 処理の実装(child-4 / child-5 の責務)
  • implementation-worker への mode 追加(child-4 の責務)
  • impl-review-loop 終了条件の統一(child-5 の責務)
  • open-pr/scripts/update_pr.py / implement-issue.update_branch の実装変更
  • 既存 LOOP_VERDICT ベースの consumer(impl-review-loop/steps/step-5-*)の routing 更新(child-5 の責務)
  • LOOP_VERDICT の YAML キー名変更(実装: LOOP_VERDICT / TEST_VERDICT_MACHINE の YAML キー名を snake_case に統一する #56 の責務)
  • closingIssuesReferences API への依存(ensure_closing_keyword の判定は公式 keyword の字句解析で行い API 依存は Out of Scope)

Acceptance Criteria

  • AC1: LOOP_VERDICT_V2 スキーマが verdict / reviewed_head_sha / merge_ready / mergeability{mergeable, merge_state_status} / required_auto_actions[{kind, executor, skill, blocking_merge_ready}] / follow_up_issue_requests[{kind, blocking_merge_ready}] のフィールドを持つこと(SKILL.md 上で定義されていること)を VC で確認する
  • AC2: required_auto_actions が 1 件以上存在する場合は merge_ready: false を返すことをテストで検証する
  • AC3: Closes #N 不足の検出時に required_auto_actions に kind: ensure_closing_keyword(executor: implementation-worker)が追加され、follow_up_issue_requests には含まれないことをテストで検証する
  • AC4: mergeStateStatus=BEHIND && mergeable=MERGEABLE の検出時に required_auto_actions に kind: update_branch, executor: implementation-worker, blocking_merge_ready: true, mechanical: true, expected_head_sha: <reviewed_head_sha> が追加され、recommendations フィールドは V2 では出力されないことをテストで検証する
  • AC5: follow_up_issue_requests 内のエントリはすべて blocking_merge_ready: false であることをテストで検証する
  • AC6: required_auto_actions が空かつ blocker がない場合のみ merge_ready: true を返せること(充足条件)をテストで検証する
  • AC7: 追加したユニットテストが uv run pytest .claude/skills/pr-review-judge/scripts/tests/ で全件 PASS する
  • AC8: pr-reviewer.md の参照箇所が LOOP_VERDICT_V2 に整合していること(legacy-only な LOOP_VERDICT 文言が残存していない)を rg -rl "test_pr_reviewer_references_loop_verdict_v2_not_legacy_only" .claude/skills/pr-review-judge/scripts/tests/ で確認する
  • AC9: LOOP_VERDICT_V2 は snake_case のみを使用し、mergeStateStatus と recommendations を V2 では禁止することをテストで検証する(test_no_top_level_mergeStateStatus_in_v2 テストが PASS する)
  • AC10: merge_ready: true は verdict=APPROVE && blockers=[] && required_auto_actions=[] && mergeability.mergeable=MERGEABLE && mergeability.merge_state_status in [CLEAN, UNSTABLE] の場合のみ許可することをテストで検証する(derived invariant として fixture test で矛盾値を reject する)
  • AC11: BEHIND && MERGEABLE は required_auto_actions.kind=update_branch(blocking_merge_ready: true)に分類し、merge_ready=false かつ recommendations フィールドを出力しないことをテストで検証する
  • AC12: ensure_closing_keyword の判定は close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved の全 GitHub 公式 keyword を受け入れることをテストで検証する(closingIssuesReferences API への依存は Out of Scope とし VC で gh pr view --json closingIssuesReferences の仕様への配慮を SKILL.md に明記することで代替)
  • AC13: PR body validator failure のうち mechanical: false(Safety Claim Matrix 不足・Consumer Inventory 不足・Evidence 不足等)は required_auto_actions ではなく blockers に残ることをテストで検証する
  • AC14: pr-review-judge の初回出力では auto_fix_applied は常に [] であることをテストで検証し、implementation-worker が verdict comment を mutate しないことを SKILL.md に明記する
  • AC15: V2 の follow_up_issue_requests は現行 FOLLOW_UP_ISSUE_REQUEST_V1 の全フィールド(title/issue_kind/severity/source/dedupe_key/desired_destination/validated_scope_delta/origin_skill/labels/initial_label_profile/materialization)と互換を保ちつつ、blocking_merge_ready: false を必須フィールドとして追加する
  • AC16: LOOP_VERDICT_V2 のスキーマ定義に Schema Consumer Inventory(impl-review-loop/pr-reviewer.md/schema-governance/関連テスト)を明記し、実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631/実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 完了前は runtime behavior が変わらないことを SKILL.md に記載する

Verification Commands

# AC1 — LOOP_VERDICT_V2 スキーマ定義(merge_ready / required_auto_actions フィールド)が SKILL.md に存在することを確認
$ rg -c "LOOP_VERDICT_V2" .claude/skills/pr-review-judge/SKILL.md
# AC2 — required_auto_actions が空でない場合に merge_ready: false を強制する制約テストファイルが存在することを確認
$ rg -rl "required_auto_actions" .claude/skills/pr-review-judge/scripts/tests/
# AC3 — ensure_closing_keyword の分類ルールが SKILL.md に記載されていることを確認
$ rg -c "ensure_closing_keyword" .claude/skills/pr-review-judge/SKILL.md
# AC4 — update_branch が required_auto_actions に分類される旨が SKILL.md に記載されていることを確認
$ rg -c "kind: update_branch" .claude/skills/pr-review-judge/SKILL.md
# AC5 — blocking_merge_ready フィールドが SKILL.md に定義されていることを確認
$ rg -c "blocking_merge_ready" .claude/skills/pr-review-judge/SKILL.md
# AC6 — merge_ready: true の充足条件テストファイルが存在することを確認
$ rg -rl "merge_ready" .claude/skills/pr-review-judge/scripts/tests/
# AC7 — ユニットテストが全件 PASS することを確認
$ uv run pytest .claude/skills/pr-review-judge/scripts/tests/ -v
# AC8 — pr-reviewer.md の参照箇所が LOOP_VERDICT_V2 に整合していることをテストで確認
$ rg -rl "test_pr_reviewer_references_loop_verdict_v2_not_legacy_only" .claude/skills/pr-review-judge/scripts/tests/
# AC9 — V2 で mergeStateStatus / recommendations が禁止されていることをテストで確認
$ rg -rl "test_no_top_level_mergeStateStatus_in_v2" .claude/skills/pr-review-judge/scripts/tests/
# AC10 — merge_ready derived invariant の fixture test が存在することを確認
$ rg -rl "test_loop_verdict_v2_schema_parses|test_required_auto_actions_force_merge_ready_false" .claude/skills/pr-review-judge/scripts/tests/
# AC11 — update_branch が required_auto_actions に分類されるテストが存在することを確認
$ rg -rl "test_approve_with_behind_requires_update_branch" .claude/skills/pr-review-judge/scripts/tests/
# AC12 — GitHub closing keyword バリアントのテストが存在することを確認
$ rg -rl "test_closing_keywords_accept_fix_resolve_close_variants" .claude/skills/pr-review-judge/scripts/tests/
# AC13 — semantic validator failure が blocker に残ることのテストが存在することを確認
$ rg -rl "test_pr_body_validator_semantic_failure_remains_blocker" .claude/skills/pr-review-judge/scripts/tests/
# AC14 — auto_fix_applied 初回空の制約テストが存在することを確認
$ rg -rl "auto_fix_applied" .claude/skills/pr-review-judge/scripts/tests/
# AC15 — follow_up_issue_requests V1 互換 + blocking_merge_ready のテストが存在することを確認
$ rg -rl "test_follow_up_issue_requests_must_be_nonblocking" .claude/skills/pr-review-judge/scripts/tests/
# AC16 — Schema Consumer Inventory が SKILL.md に記載されていることを確認
$ rg -c "consumer_inventory" .claude/skills/pr-review-judge/SKILL.md

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 変更対象はスキル定義ファイル(SKILL.md)とテストファイルのみ。runtime 動作(GitHub API 実行・PR レビューコメント投稿)には影響しない。VC はすべてファイル存在確認・テスト実行で機械的に検証可能。

Allowed Paths

  • .claude/skills/pr-review-judge/SKILL.md
  • .claude/skills/pr-review-judge/scripts/tests/(テスト追加)
  • .claude/agents/pr-reviewer.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合(特に child-4 / child-5 のスコープへの侵犯)
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python / pytest(テスト追加)
  • YAML schema authoring

Delivery Rule

  • 1 Issue = 1 PR
  • Draft PR で起票し、全 AC / VC 通過後に PR ready とする
  • Refs #626 を PR 本文に含める

Notes

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jun 3, 2026
  2. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    結論

    Issue #630 は方向性は妥当ですが、このまま実装すると LOOP_VERDICT_V2 が「自動修正可能なものを follow-up に逃がさない」ための契約にならず、逆に consumer 破壊・誤判定・過剰自動修正を生む可能性が高いです。現状なら REQUEST_CHANGES 相当です。

    #630 の目的は、pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し、merge_ready と required_auto_actions を導入して、Closes #N 欠落や mergeStateStatus=BEHIND を follow_up_issue_requests に誤分類しないことです。親 #626 でも、impl-review-loop は APPROVE && merge_ready && required_auto_actions == [] だけで終了すべきとされています。([GitHub]1)

    一方で #630 自体は、consumer 更新、implementation-worker 実行モード、impl-review-loop の終了条件変更を Out of Scope にしています。関連する #631 が executor 側、#632 が termination gate 側を担当する設計なので、#630 は producer-only schema change として厳密に境界を引かないと壊れます。([GitHub]1)


    敵対的レビュー

    1. LOOP_VERDICT_V2 は現行 consumer を壊す

    現行 impl-review-loop は、最新コメントを ## LOOP_VERDICT で検出し、mergeable、mergeStateStatus / merge_state_status、recommendations を grep 的に抽出しています。#630 が nested mergeability、required_auto_actions、merge_ready に移行し、recommendations を廃止するなら、#632 が入るまで現行 loop は読めません。([GitHub]2)

    修正要求:
    #630 の成果物は以下のどちらかに限定すべきです。

    現状のように #630 単独で schema だけ変えると、pr-review-judge は正しいつもりでも impl-review-loop は停止・誤終了・human escalation に落ちる危険があります。


    2. merge_ready の定義が弱い

    #630 は「required_auto_actions が非空なら merge_ready: false」をACにしていますが、それだけでは不十分です。merge_ready は手書きフラグではなく、以下から導出されるべきです。

    merge_ready == (
      verdict == APPROVE
      && blockers == []
      && required_auto_actions == []
      && mergeability.mergeable == MERGEABLE
      && mergeability.merge_state_status in [CLEAN, UNSTABLE]
      && reviewed_head_sha == current_head_sha
    )

    現行 pr-review-judge は CONFLICTING / DIRTY / BLOCKED / UNKNOWN を blocker として扱い、BEHIND は blocker ではなく update_branch 推奨に寄せています。#630 はこの挙動を required_auto_actions に移すだけでなく、merge_ready の不変条件として明文化しないと、APPROVE + merge_ready: true + mergeStateStatus=BEHIND のような矛盾YAMLを許します。([GitHub]3)

    修正要求:
    merge_ready を schema 上の derived invariant として定義し、fixture test で矛盾値を reject してください。


    3. Closes #N 判定が GitHub 仕様に対して狭すぎる

    #630 は Closes #N 欠落を ensure_closing_keyword に分類するとしています。しかし GitHub の公式仕様では、issue closing keyword は close/closes/closed、fix/fixes/fixed、resolve/resolves/resolved を含み、大文字やコロン付きも許容されます。また PR の base が default branch でない場合、keyword はリンク・自動 close として解釈されません。([GitHub Docs]4)

    さらに gh pr view --json は closingIssuesReferences を返せます。単純な本文 grep ではなく、GitHub 側が実際に closing reference と解釈しているかを確認できます。([GitHub CLI]5)

    修正要求:
    ensure_closing_keyword の判定は少なくとも以下を区別すべきです。

    closing_issue_check:
      required_issue: 630
      body_has_supported_keyword: true | false
      github_detected_closing_reference: true | false
      base_is_default_branch: true | false
      accepted_keywords:
        - close
        - closes
        - closed
        - fix
        - fixes
        - fixed
        - resolve
        - resolves
        - resolved

    Closes #N だけを正とする仕様は GitHub 互換ではありません。


    4. PR body validator failure を全部 update_pr_body_hygiene に寄せるのは危険

    #630 は PR body validator failure を required_auto_actions に分類する方針ですが、validator failure には機械修正可能なものと、人間/実装者判断が必要なものが混在します。

    機械修正可能な例:

    • closing keyword 欠落
    • template heading 欠落
    • deterministic metadata 欠落

    機械修正すべきでない例:

    • Safety Claim Matrix の実質不足
    • Schema Consumer Inventory の不足
    • Evidence が self-report-only
    • 検証結果の欠落や虚偽の可能性

    現行 pr-review-judge には schema change 用の Consumer Inventory Gate と、.claude/skills/** 変更を safety-sensitive とみなす Safety Claim Gate があります。#630 は .claude/skills/pr-review-judge/SKILL.md を触るため、この分類を曖昧にすると「本来 blocker の証跡不足」を PR body hygiene として自動修正してしまいます。([GitHub]3)

    修正要求:
    required_auto_actions には mechanical: true または human_judgment_required: false のような precondition を入れるべきです。semantic/evidence/safety 不足は blockers に残してください。


    5. auto_fix_applied の producer が不明確

    #630 の Notes では、auto_fix_applied は implementation-worker が action 後に埋め、pr-review-judge 初回出力では [] とされています。([GitHub]1)

    これは契約として危険です。LOOP_VERDICT_V2 は pr-review-judge が特定の reviewed_head_sha に対して出す判定です。implementation-worker がその後 branch update や PR body update を行うなら、head SHA は変わり得ます。古い verdict に worker が追記すると、どの head に対する判定なのか曖昧になります。

    修正要求:
    auto_fix_applied は LOOP_VERDICT_V2 から外し、worker 側の result schema に分離する方が安全です。

    IMPLEMENTATION_WORKER_RESULT_V2:
      source_verdict_schema: LOOP_VERDICT_V2
      source_reviewed_head_sha: abc123
      actions_applied:
        - kind: update_branch
          status: success
          before_head_sha: abc123
          after_head_sha: def456

    #630 のAC都合で残すなら、pr-review-judge の初回出力では常に auto_fix_applied: [] とし、worker が同じ verdict comment を mutate しないことを明記してください。


    6. follow_up_issue_requests の schema が壊れそう

    #630 は follow_up_issue_requests[].blocking_merge_ready: false を要求しています。しかし現行 template の follow_up_issue_requests は title / issue_kind / severity / source / dedupe_key / rationale / suggested_scope / acceptance_criteria_seed を持つ構造です。([GitHub]3)

    ここに blocking_merge_ready だけを雑に足すと、既存の follow-up issue materialization 側が期待する項目とズレます。

    修正要求:
    V2 では以下のどちらかにしてください。

    1. 現行 FOLLOW_UP_ISSUE_REQUEST_V1 を内包し、追加で blocking_merge_ready: false を必須化する。
    2. follow-up schema も V2 として明示し、consumer 側の migration issue を 実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 または別Issueに追加する。

    7. #56 との衝突リスクが高い

    #56 は LOOP_VERDICT / TEST_VERDICT_MACHINE の YAML key を snake_case に統一する issue です。現行では mergeStateStatus と merge_state_status の混在が既に問題化されています。([GitHub]6)

    #630 は LOOP_VERDICT_V2 を新設するので、ここで camelCase を再導入すると #56 と逆行します。

    修正要求:
    V2 は最初から snake_case のみで定義してください。

    mergeability:
      mergeable: MERGEABLE
      merge_state_status: BEHIND

    mergeStateStatus は legacy read compatibility のみに限定し、V2 schema では禁止すべきです。


    8. Verification Criteria が弱すぎる

    #630 のVCは rg -c 系が多く、特に pr-reviewer.md の更新確認が LOOP_VERDICT の出現数を見るだけになっています。現行 pr-reviewer.md には既に LOOP_VERDICT 文言があるため、このVCは変更なしでも通り得ます。([GitHub]1)

    これは #630 の目的と矛盾しています。構造化出力の誤判定を防ぐIssueで、検証が文字列カウント中心なのは弱いです。

    修正要求:
    最低限、以下の fixture/parser test を追加してください。現在の tests 配下は test_check_pr_review_gates.py 程度なので、V2 schema 専用テストを足す余地があります。([GitHub]7)

    test_loop_verdict_v2_schema_parses
    test_required_auto_actions_force_merge_ready_false
    test_approve_with_behind_requires_update_branch
    test_missing_closing_keyword_requires_ensure_closing_keyword
    test_closing_keywords_accept_fix_resolve_close_variants
    test_pr_body_validator_semantic_failure_remains_blocker
    test_follow_up_issue_requests_must_be_nonblocking
    test_no_top_level_mergeStateStatus_in_v2
    test_pr_reviewer_references_loop_verdict_v2_not_legacy_only
    

    改善後の最小 schema 案

    <!-- LOOP_VERDICT_V2 -->
    schema_version: 2
    producer: pr-review-judge
    reviewed_head_sha: "<40-char sha>"
    verdict: APPROVE # APPROVE | REQUEST_CHANGES | HUMAN_JUDGMENT_REQUIRED | BLOCKED
    
    merge_ready: false
    
    mergeability:
      mergeable: MERGEABLE
      merge_state_status: BEHIND
      source: gh_pr_view
      checked_at_head_sha: "<same as reviewed_head_sha>"
    
    blockers: []
    
    required_auto_actions:
      - kind: update_branch
        executor: implementation-worker
        blocking_merge_ready: true
        expected_head_sha: "<reviewed_head_sha>"
        reason: "merge_state_status is BEHIND"
        preconditions:
          mechanical: true
          current_head_sha_must_equal_reviewed_head_sha: true
    
    follow_up_issue_requests:
      - title: "Durable improvement, not required for this PR"
        issue_kind: enhancement
        severity: optional_follow_up
        blocking_merge_ready: false
        source: pr-review-judge
        dedupe_key: "..."
        rationale: "..."
        suggested_scope: "..."
        acceptance_criteria_seed:
          - "..."

    update_branch 実行は GitHub API 的にも expected_head_sha を持つのが妥当です。GitHub REST API の update branch endpoint は expected_head_sha 不一致で 422 を返し、成功時は 202 を返します。([GitHub Docs]8)


    Issue #630 に追加すべき AC

    1. LOOP_VERDICT_V2 は snake_case のみを使用し、mergeStateStatus と recommendations を V2 では禁止する。
    2. merge_ready: true は verdict=APPROVE && blockers=[] && required_auto_actions=[] && mergeable=MERGEABLE && merge_state_status in [CLEAN, UNSTABLE] の場合のみ許可する。
    3. BEHIND && MERGEABLE は required_auto_actions.kind=update_branch に分類し、merge_ready=false にする。
    4. closing keyword 判定は GitHub supported keywords と closingIssuesReferences を考慮する。([GitHub Docs]4)
    5. PR body validator failure は mechanical と semantic/evidence/safety に分け、後者は blocker に残す。
    6. auto_fix_applied は初回 pr-review-judge verdict では常に []、または worker result schema に分離する。
    7. follow_up_issue_requests は既存 schema と互換にし、blocking_merge_ready: false を必須追加する。
    8. pr-reviewer.md の検証は rg -c LOOP_VERDICT ではなく、legacy-only 文言が残っていないことを parser/fixture で確認する。
    9. Schema Consumer Inventory に impl-review-loop、pr-reviewer.md、schema-governance、関連 tests、実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631/実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 の依存を明記する。
    10. 実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630 単独では親 導入: issue-refinement-loop → impl-review-loop 遷移の自動化(スキル間 handoff contract 欠落の統合修正) #626 の destination を満たさないことを明記し、実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631/実装: impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し終了 gate を実装する #632 完了前に runtime behavior が変わったと主張しない。

    最終判定

    REQUEST_CHANGES。

    #630 は親 #626 の child issue として必要ですが、現状の仕様は「V2 schema を足す」ことに寄りすぎており、consumer migration、GitHub closing keyword 仕様、semantic validator failure、merge_ready invariant、auto_fix_applied の所有権が詰め切れていません。

    特に危険なのは、required_auto_actions を入れたことで自動化が安全になるのではなく、機械修正してはいけない evidence/safety 不足まで PR hygiene として処理されることです。#630 は「自動修正可能な blocker の明示」に絞り、semantic blocker と durable follow-up を厳密に分離する設計へ修正すべきです。

  3. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-06-03T10:38:41Z) — 全チェック PASS・実装着手可能

    issue-contract-review の全チェックが PASS しました。実装着手可能な状態です。

    • Outcome: .claude/skills/pr-review-judge/SKILL.md が LOOP_VERDICT_V2 スキーマ(merge_ready / required_auto_actions / auto_fix_applied フィールドを含む)に更新され、Closes #N 不足・PR body validator failure・BEHIND branch update が required_auto_actions(executor: implementation-worker)に分類されることを検証するユニットテストが追加・全件 PASS している状態。
    • 受け入れ条件: AC1〜AC16(16 件)
    • 検証コマンド: 16 コマンド(rg × 14、pytest × 1、rg -rl × 1)
    • 変更対象パス:
      • .claude/skills/pr-review-judge/SKILL.md
      • .claude/skills/pr-review-judge/scripts/tests/(テスト追加)
      • .claude/agents/pr-reviewer.md
    • Worktree: .claude/worktrees/issue-630-pr-review-judge-loop-verdict-v2-merge-re
    • Branch: worktree-issue-630-pr-review-judge-loop-verdict-v2-merge-re
    • VC preflight: baseline で期待通り fail = 15、想定外 pass = 0、実行不可 = 0、regression gate (pass) = 1
    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-06-03T10:38:41Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/630
      checks:
        template_compliance: pass
        state_label: ok
        allowed_paths_present: pass
        vc_present: pass
        stop_conditions_complete: pass
        vc_preflight:
          passed: true
          vc_failed_as_expected: 15
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 1
          vc_skipped: 0
          classifications:
            - ac: AC1
              command: "rg -c \"LOOP_VERDICT_V2\" .claude/skills/pr-review-judge/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC2
              command: "rg -rl \"required_auto_actions\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC3
              command: "rg -c \"ensure_closing_keyword\" .claude/skills/pr-review-judge/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC4
              command: "rg -c \"kind: update_branch\" .claude/skills/pr-review-judge/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC5
              command: "rg -c \"blocking_merge_ready\" .claude/skills/pr-review-judge/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC6
              command: "rg -rl \"merge_ready\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC7
              command: "uv run pytest .claude/skills/pr-review-judge/scripts/tests/ -v"
              exit_code: 0
              category: regression_gate
              scope_class: regression_gate
              confidence: low
              decision: go
            - ac: AC8
              command: "rg -rl \"test_pr_reviewer_references_loop_verdict_v2_not_legacy_only\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC9
              command: "rg -rl \"test_no_top_level_mergeStateStatus_in_v2\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC10
              command: "rg -rl \"test_loop_verdict_v2_schema_parses|test_required_auto_actions_force_merge_ready_false\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC11
              command: "rg -rl \"test_approve_with_behind_requires_update_branch\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC12
              command: "rg -rl \"test_closing_keywords_accept_fix_resolve_close_variants\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC13
              command: "rg -rl \"test_pr_body_validator_semantic_failure_remains_blocker\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC14
              command: "rg -rl \"auto_fix_applied\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC15
              command: "rg -rl \"test_follow_up_issue_requests_must_be_nonblocking\" .claude/skills/pr-review-judge/scripts/tests/"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
            - ac: AC16
              command: "rg -c \"consumer_inventory\" .claude/skills/pr-review-judge/SKILL.md"
              exit_code: 1
              category: expected_baseline_fail
              scope_class: baseline_fail_expected
              confidence: high
              decision: go
        ac_verifiability: pass
        product_spec_check:
          applicability: not_applicable
          decision: pass
          triggers:
            docs_product_allowed_paths: false
            tasks_md_mentioned: false
            specify_artifact_mentioned: false
            generated_task_mentioned: false
            product_spec_context_present: false
          blocked_reasons: []
        worktree_branch_collision: clear
      next_action: implement_issue
      blocked_reasons: []
      warnings:
        - "VC markers use '# ACN — description' format; baseline_vc_preflight classified as AC_UNKNOWN but all commands correctly classified as go"
      body_sha256: "sha256:96bbcfd4dcbe2cf68373f978d1f9a0fa220b58a23ac319579b02a8a52b9c4a3b"
  4. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了

    PR を起票しました: #637

    • Worktree: .claude/worktrees/issue-630-pr-review-judge-loop-verdict-v2-merge-re
    • Branch: worktree-issue-630-pr-review-judge-loop-verdict-v2-merge-re
    • 検証結果: pnpm typecheck / lint / test / build 全 PASS、pytest 104 テスト全件 PASS
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  5. added a commit that references this issue on Jun 3, 2026
  6. squne121 commented on Jun 3, 2026

    @squne121
    OwnerAuthor

    PR #637 ブロッカー修正完了

    commit 2a4e76f を PR #637 ブランチに push しました。

    対応したブロッカー

    B1: Verdict template V1/V2 混在
    確認の結果、## Verdict コメントテンプレート セクションは既に ## LOOP_VERDICT_V2 のみでした(V1 残骸なし)。B4 のテストで機械的に保証します。

    B2: required_auto_actions に skill フィールドがない
    Step 5 の pseudocode ロジック(ensure_closing_keyword / update_pr_body_hygiene / update_branch)と LOOP_VERDICT_V2 スキーマ定義の両方に skill フィールドを追加しました。

    B3: recommendations 廃止が SKILL.md に完全反映されていない

    B4: テストが実際の SKILL.md テンプレートを検証していない
    TestVerdictTemplateIsV2Only クラスと extract_verdict_template ヘルパーを追加。Verdict コメントテンプレートを直接抽出して V1 残骸(## LOOP_VERDICT\n, mergeStateStatus:, recommendations:)がないことを検証します。

    B5: Draft PR と merge_ready: true の意味が曖昧
    merge_ready 決定ルールセクションに「merge_ready: true は impl-review-loop の終端条件であり GitHub UI 上の即時マージ可能性とは独立する。Draft PR でも終端条件を満たせば merge_ready: true を出力できる。実際のマージは人間が Draft を外して実行する」という説明を追加しました。

    検証結果

    uv run pytest .claude/skills/pr-review-judge/scripts/tests/ -v
    108 passed in 0.08s
    
    pnpm typecheck && pnpm lint && pnpm test && pnpm build — all passed
    
  7. added a commit that references this issue on Jun 3, 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

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions