Skip to content

実装: issue-refinement-loop の完了条件に issue-contract-review gate を追加し VC 差分性違反を refinement 中に検出する #560

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "issue-refinement-loop の approve 後に latest CONTRACT_REVIEW_RESULT_V1.status == \"go\" の final gate を追加し、docs-only 変更で実効性を持たせる"
change_kind: mixed

Parent Issue

なし(単独改善 / Issue #559 impl-review-loop 停止の post-mortem 由来)

Parent Goal Ref

  • Goal: issue-refinement-loop が「承認完了」とした後でも impl-review-loop の preparation で CONTRACT_REVIEW_RESULT_V1 status: blocked が返り、無駄な往復が発生する状況を解消する
  • Desired Destination: issue-refinement-loop の終了条件として latest CONTRACT_REVIEW_RESULT_V1.status == "go" を必須とし、STATUS: go を確認してから complete 判定を出す

責務分界(#502/#509 との区別):

Current Validated Scope

  • .claude/skills/issue-refinement-loop/references/termination-policy.md に「reviewer が approve を返しても issue-contract-review が STATUS: go を返すまで complete としない」ルールを追記する
  • docs/dev/dor.md に VC baseline 差分性ルールを追記する: 「VC は実装前 baseline で fail し実装後に pass する変化を確認するコマンドを使う。既存コードに既出の文字列・パスへの grep は baseline_fail_expected にならないため VC として使えない(pr_review_only に振るか、実装後にのみ存在するシンボル・パターンを対象にする)」
  • docs/dev/dor.md に preflight-scope marker は各 $ コマンド直前 1 行に必要という規約を追記する(block 先頭の 1 個のマーカーが block 全体に効くという誤認を防止する)
  • docs/dev/workflow.md に「human_escalation 後に Issue 本文を 1 文字でも変更した場合は issue-contract-review を最初から再実行する」ルールを追記する

Remaining Parent Gaps

本 Issue で以下のポリシーを確立するが、下記は Out of Scope のため残存:

  1. pr_review_only VC の reviewer-side verification 実装(issue-reviewer checklist 追加)
  2. issue-contract-review の gate-only / idempotent mode の execution-level 実装
  3. formatter / linter による preflight-scope marker 自動検出・補正
  4. issue-reviewer checklist への VC 差分性チェック横展開
  5. 実装: contract_readiness_check.py の --mode execute を review-issue の通常経路に組み込み、unexpected_pass を refinement ループ内で検出可能にする #502/feat(#502): wire --mode execute into review-issue / issue-reviewer for unexpected_pass detection #509 との責務分界の reviewer-side 実装(unexpected_pass の review-issue 組み込み)

背景

Issue #559 の impl-review-loop で以下の連鎖が発生した:

  1. issue-refinement-loop が独自の review 判断で「修正完了・approve」とした
  2. impl-review-loop preparation の baseline_vc_preflight.py が初めて AC1 の VC を実行し unexpected_pass を検出
  3. CONTRACT_REVIEW_RESULT_V1 status: blocked で impl-review-loop が停止

直接原因:

  • AC1 の VC rg 'temp-unsupported\.txt|temp-invalid-no-markers\.md' は writeFileSync による既存パス参照に match するため、実装前後で区別できない(baseline 差分性なし)
  • # preflight-scope: pr_review_only マーカーが AC1 ブロック先頭の 1 コマンドにしか効かず、2 行目・3 行目に継承されなかった
  • human_escalation → 手動 1 行修正 → issue-contract-review 再実行なしで impl-review-loop へ移行した

Outcome

.claude/skills/issue-refinement-loop/references/termination-policy.md、docs/dev/dor.md、docs/dev/workflow.md の 3 ファイルが更新され、pnpm test および pnpm build が PASS した状態でコミットされている。以下が確立される:

  • Final gate: termination-policy.md に「Step 2 approve 後に latest CONTRACT_REVIEW_RESULT_V1.status == "go" を確認してから complete 判定を出す」ルールが追記される
  • Normative reference 明記: issue-refinement-loop/SKILL.md が termination-policy.md を normative reference として消費するため、SKILL.md 非変更でも実効性がある旨を termination-policy.md に明記する(保証できない場合は SKILL.md を Scope に追加する)
  • Side-effect boundary: snapshot comment の idempotency、implement-issue handoff gate(go/blocked/human_judgment 各ケース)、body_sha256 による stale result invalidation を termination-policy.md に定義する
  • VC baseline 差分性: dor.md に baseline fail / post-impl pass の変化を持つコマンドのみ使用可(rg/grep の exit 0/1/2 意味・pytest exit code 0/1/4/5 を含む)を追記する
  • preflight-scope per-command: dor.md に各 $ コマンド直前 1 行に必要という規約を追記する
  • human_escalation 後の無効化: workflow.md に「human_escalation 後に Issue 本文を 1 文字でも変更した場合は body_sha256 が変わるため prior contract-review result が stale になる」ルールを追記する

Note: unexpected_pass の refinement 中検出は #502/#509 が担当する別 Issue の Scope。本 Issue は approve 後の final gate のみを扱う。

In Scope

  • termination-policy.md: Step 2 が approve を返した後に latest CONTRACT_REVIEW_RESULT_V1.status == "go" を確認してから complete 判定を出すルールを追記する
  • termination-policy.md: issue-refinement-loop/SKILL.md が本ファイルを normative reference として消費する根拠を明記する(または SKILL.md を Scope に追加する)
  • termination-policy.md: contract-review snapshot comment の idempotency・implement-issue handoff gate(go/blocked/human_judgment)・body_sha256 による stale result invalidation を定義する
  • dor.md: VC baseline 差分性ルール(baseline で fail・実装後に pass の変化を持つコマンドのみ使用可)を追記する
  • dor.md: preflight-scope marker の per-command 規約(各 $ コマンド直前 1 行に必要、block 先頭の 1 個は直後の 1 コマンドにしか効かない)を追記する
  • workflow.md: human_escalation 後の Issue 本文変更時は issue-contract-review を最初から再実行するルールを追記する

Out of Scope

Acceptance Criteria

  • AC1: termination-policy.md に「reviewer approve 後に latest CONTRACT_REVIEW_RESULT_V1.status == "go" を必須とする」記述が追加されている
  • AC2: termination-policy.md に「issue-refinement-loop/SKILL.md が本ファイルを normative reference として消費するため SKILL.md 非変更でも実効性がある」旨、または「SKILL.md も修正対象」が明記されている
  • AC3: termination-policy.md に contract-review snapshot comment の idempotency・implement-issue handoff gate(go/blocked/human_judgment 各ケース)・body_sha256 による stale result invalidation が定義されている
  • AC4: dor.md に VC baseline 差分性ルール(baseline fail / post-impl pass の変化を確認するコマンドのみ使用可)と rg/grep exit code 意味(exit 0 = unexpected_pass / exit 1 = expected fail / exit 2 = error で block)が追加されている
  • AC5: dor.md に preflight-scope marker の per-command 規約(各 $ コマンド直前 1 行に必要、block 先頭 1 個は直後の 1 コマンドにしか効かない)が追加されている
  • AC6: dor.md に pytest exit code semantics(0=success / 1=test failure / 4=usage error / 5=no tests collected — exit 5 を expected baseline fail と混同しない旨)が追加されている
  • AC7: workflow.md に「human_escalation 後に Issue 本文を 1 文字でも変更した場合は prior contract-review result が stale になり full contract review 再実行が必要」ルールが追加されている
  • AC8: pnpm test が PASS する(回帰なし)
  • AC9: pnpm build が PASS する(回帰なし)

Verification Commands

# AC1
# preflight-scope: pr_review_only
$ rg -n 'CONTRACT_REVIEW_RESULT_V1\.status == "go"|status == "go"' .claude/skills/issue-refinement-loop/references/termination-policy.md

# AC2
# preflight-scope: pr_review_only
$ rg -n 'normative.*reference|thin.*entrypoint.*termination|SKILL\.md.*非変更でも実効性' .claude/skills/issue-refinement-loop/references/termination-policy.md

# AC3
# preflight-scope: pr_review_only
$ rg -n 'idempotent|snapshot.*comment|handoff.*gate|body_sha256|stale.*result|invalidat' .claude/skills/issue-refinement-loop/references/termination-policy.md

# AC4
# preflight-scope: pr_review_only
$ rg -n 'baseline.*fail|exit.*0|exit.*1.*expected|exit.*2.*error|unexpected_pass|差分性' docs/dev/dor.md

# AC5
# preflight-scope: pr_review_only
$ rg -n 'per.*command|各.*コマンド直前|immediately.*following|must be repeated|block.*先頭' docs/dev/dor.md

# AC6
# preflight-scope: pr_review_only
$ rg -n 'pytest|exit.*5|no.*tests.*collected|exit.*4|usage.*error' docs/dev/dor.md

# AC7
# preflight-scope: pr_review_only
$ rg -n 'human_escalation.*変更|stale.*contract|body_sha256|prior.*contract.*review|再実行' docs/dev/workflow.md

# AC8
# preflight-scope: runtime_only
$ pnpm test

# AC9
# preflight-scope: runtime_only
$ pnpm build

Allowed Paths

  • .claude/skills/issue-refinement-loop/references/termination-policy.md
  • docs/dev/dor.md
  • docs/dev/workflow.md

Stop Conditions

実装中にこれらの状況が発生したら直ちに作業を停止し、Issue comment に状況を記録して人間の判断を待つ。

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

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 変更対象は docs + termination-policy.md(Markdown ファイル)のみ。pnpm test で回帰確認が完結し、プロセス起動・ネットワーク通信・外部サービス依存はない。

Required Skills

なし

Delivery Rule

  • 1 Issue = 1 PR
  • worktree: .claude/worktrees/issue-<N>-refinement-loop-contract-gate
  • Draft PR 既定

Source

dedupe_key: "workflow:issue-refinement-loop:contract-review-completion-gate"
source:
  kind: post_impl_loop_failure
  origin_issue: "https://github.com/squne121/loop-protocol/issues/559"
  note: "Issue #559 impl-review-loop での unexpected_pass 停止の post-mortem"

Activity

  1. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    人間からのコメントです。
    「.claude/skills/issue-refinement-loop/references/termination-policy.md に「reviewer が approve を返しても issue-contract-review が STATUS: go を返すまで complete としない」ルールを追記する」この内容だとissue-refinement-loop gate責務を持つように思うが、作業・成果物はワーカー側に寄せてほしい。reviewer が issue-contract-review か、同等のgate基準を持つべきでは?
    issue-refinement-loop 内に作業コンテクストが残っていたらワーカーサブエージェントに移行してほしいし、そのために不足しているサブエージェント定義ファイルやエージェントスキルがあれば作成を提案してほしい。

  2. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    #560 (comment)

    結論: 人間コメントは正しいです。#560 はそのまま進めず、issue-refinement-loop ではなく issue-reviewer / reviewer-side gate に責務を寄せるべきです。

    #560 は現在、issue-refinement-loop の終了条件として issue-contract-review STATUS: go を要求し、Step 2 approve 後に issue-contract-review を呼ぶ、と明記しています。これは「orchestrator が complete 判定 gate を持つ」設計に見えます。さらに #560 は issue-reviewer / review-issue checklist への追記を Out of Scope にしているため、今回の人間コメントとは逆向きです。([GitHub]1) ([GitHub]1)

    既存の #227 は、issue-refinement-loop 等の orchestrator が worker step で direct Skill を実行せず、domain judgment / verification / mutation を SubAgent structured output として受け取る方向を定義しています。特に issue-refinement-loop main thread は REVIEW_ISSUE_RESULT_V1 の parsing と next_action 決定のみ保持する、としており、今回の gate 責務は reviewer-side に置く方が整合します。([GitHub]2)

    推奨方針

    #560 は REQUEST_CHANGES 相当です。変更方針はこれです。

    1. issue-refinement-loop の termination-policy.md に gate 手順を増やさない。
    2. issue-reviewer が review-issue の approve だけでなく、issue-contract-review または同一の deterministic gate 基準を確認してから approve を返す。
    3. issue-refinement-loop は issue-reviewer の structured output の verdict/status/next_action のみを読む。
    4. gate 詳細、VC baseline 差分性、preflight-scope marker 判定、human_escalation 後の再レビュー要否は reviewer 側の出力契約へ移す。
    5. 既存 issue-reviewer で吸収できないなら、新規 .claude/agents/issue-contract-reviewer.md または reviewer 専用 skill を追加する Issue に分割する。

    Claude Code の公式仕様上も、Subagent は独立コンテキスト・専用ツール制限・preload skills を持てます。つまり「reviewer が review-issue と issue-contract-review を読み込み、親には summary/structured result だけ返す」構成は自然です。([Claude Code]3) ([Claude Code]3) ([Claude Code]3)

    #560 へのコメント案

    人間コメント反映として、この Issue は現状のままでは進めない方がよいです。
    
    現在の記述は `.claude/skills/issue-refinement-loop/references/termination-policy.md` に
    「reviewer approve 後も issue-contract-review STATUS: go まで complete としない」
    というルールを追加する内容になっていますが、これは issue-refinement-loop が
    contract gate 責務を持つ設計に見えます。
    
    既存の control-plane / data-plane 分離方針では、issue-refinement-loop は
    LOOP_STATE / routing / next_action のみを扱い、domain judgment / verification /
    mutation は SubAgent structured output として受け取るべきです。したがって、
    gate 条件は issue-refinement-loop の termination-policy ではなく、reviewer 側に寄せるべきです。
    
    提案:
    
    - `issue-refinement-loop` は `issue-reviewer` の structured output だけを見る
    - `issue-reviewer` は `review-issue` approve だけで approve を返さず、`issue-contract-review`
      または同等の deterministic gate 基準を満たした場合だけ approve を返す
    - `CONTRACT_REVIEW_RESULT_V1.status != go` の場合は reviewer が `needs_fix` / `blocked` /
      `human_judgment` を返す
    - VC baseline 差分性、preflight-scope marker per-command 規約、human_escalation 後の
      Issue 本文変更時の full review 再実行要否は reviewer-side output contract に含める
    - `issue-refinement-loop` 内に残っている作業コンテクスト、gate 詳細、VC 詳細の解釈は
      worker SubAgent へ移す
    
    このため #560 の Allowed Paths は現状の
    `.claude/skills/issue-refinement-loop/references/termination-policy.md`
    中心ではなく、少なくとも以下のどちらかへ変更したいです。
    
    Option A: 既存 `issue-reviewer` を拡張する
    - `.claude/agents/issue-reviewer.md`
    - `.claude/skills/review-issue/SKILL.md` または references
    - 必要なら `docs/dev/agent-skill-boundaries.md`
    
    Option B: contract gate 専用 SubAgent を追加する
    - `.claude/agents/issue-contract-reviewer.md`
    - `.claude/skills/issue-contract-review/SKILL.md` または references
    - `issue-reviewer` がその結果を合成して `ISSUE_REVIEW_GATE_RESULT_V1` を返す
    
    いずれの場合も、issue-refinement-loop の変更は「reviewer の gate 済み verdict を
    routing する」程度に留め、gate logic 自体は持たせない方がよいです。

    追加 Issue 案

    Issue A: issue-reviewer に contract gate を統合する

    Title:
    実装: issue-reviewer が issue-contract-review gate 済み verdict を返すようにする
    
    Goal:
    issue-refinement-loop が complete 判定のために issue-contract-review gate を直接保持しないようにし、
    issue-reviewer が review-issue + issue-contract-review 相当の gate 済み structured verdict を返す。
    
    Outcome:
    `issue-reviewer` は `review-issue` が approve を返しても、`issue-contract-review`
    または同等の deterministic contract gate が `status: go` でない限り approve を返さない。
    `issue-refinement-loop` は reviewer output の `verdict/status/next_action` のみで routing する。
    
    In Scope:
    - `.claude/agents/issue-reviewer.md` に contract gate 実行/確認責務を追加
    - `ISSUE_REVIEW_GATE_RESULT_V1` または既存 `REVIEW_ISSUE_RESULT_V1` 拡張として
      `contract_review_status`, `contract_review_blockers`, `next_action` を定義
    - `status: go` 以外の場合の `needs_fix` / `blocked` / `human_judgment` routing を定義
    - `issue-refinement-loop` 側は gate 詳細を解釈せず reviewer verdict のみ扱う旨を明記
    - VC baseline 差分性違反、preflight-scope marker 誤用、human_escalation 後の本文変更時の
      full review 再実行を reviewer-side gate に含める
    
    Out of Scope:
    - issue-refinement-loop が issue-contract-review を直接実行する termination-policy 追加
    - impl-review-loop の変更
    - issue-contract-review の判定ロジック自体の大幅変更
    - Issue 本文 mutation
    
    Allowed Paths:
    - `.claude/agents/issue-reviewer.md`
    - `.claude/skills/review-issue/SKILL.md`
    - `.claude/skills/review-issue/references/**`
    - 必要なら `.claude/skills/issue-refinement-loop/SKILL.md`
    - 必要なら `docs/dev/agent-skill-boundaries.md`
    
    Acceptance Criteria:
    - AC1: `issue-reviewer` は `review-issue approve` 単独では approve を返さない
    - AC2: `issue-contract-review status: go` または同等 gate pass の場合のみ approve を返す
    - AC3: `status: blocked/needs_fix/human_judgment` の場合、reviewer output に blocker と next_action が含まれる
    - AC4: `issue-refinement-loop` は gate 詳細を再解釈せず reviewer verdict/status のみ routing に使う
    - AC5: issue-refinement-loop 内に VC baseline 差分性や preflight-scope marker の domain judgment が残らない
    - AC6: 既存 #559/#560 相当の unexpected_pass ケースを regression fixture として検出できる

    Issue B: issue-contract-reviewer SubAgent を新設する場合

    Title:
    実装: issue-contract-review を SubAgent 境界で実行する issue-contract-reviewer を追加する
    
    Goal:
    issue-contract-review skill を orchestrator から直接実行せず、read-only / verification-only SubAgent として隔離する。
    
    Outcome:
    `.claude/agents/issue-contract-reviewer.md` が追加され、Issue 番号を入力として
    `CONTRACT_REVIEW_RESULT_V1` を返す。親 orchestrator は contract gate の詳細を解釈せず、
    result status と next_action のみを受け取る。
    
    In Scope:
    - `.claude/agents/issue-contract-reviewer.md` 新設
    - `issue-contract-review` skill の preload または内部呼び出し手順定義
    - `Read/Grep/Glob/Bash` 程度の verification 用 tool に制限
    - `Edit/Write/MultiEdit` と Issue mutation を禁止
    - `CONTRACT_REVIEW_RESULT_V1` の pass-through 契約を定義
    - `issue-reviewer` が `issue-contract-reviewer` 結果を合成できるようにする
    
    Out of Scope:
    - issue-refinement-loop が contract gate を直接保持すること
    - Issue 本文編集
    - PR 実装作業

    実装上の注意

    issue-contract-reviewer に Bash を許可する場合、ツール定義だけではコマンド単位の安全境界は十分に細かくありません。Claude Code の Subagent frontmatter は tools, disallowedTools, permissionMode を持てますが、親セッションの permission mode が優先される場合があります。([Claude Code]3) (Claude Code)

    決定論的に縛るなら、SubAgent 定義だけでなく command hook / wrapper script / Allowed Paths checker を併用するのが安全です。Claude Code docs でも hooks は advisory な指示ではなく特定ポイントで実行を保証する仕組みと説明されています。ただし agent hook は experimental なので、production gate は command hook または deterministic script 優先が妥当です。([Claude Code]4) ([Claude Code]5)

    最小修正なら、#560 は 「issue-refinement-loop termination-policy 追加」から「issue-reviewer gate 拡張」へ reframe してください。今の Allowed Paths と Out of Scope は、人間コメントの意図と合っていません。

    結論: 人間コメントは正しいです。#560 はそのまま進めず、issue-refinement-loop ではなく issue-reviewer / reviewer-side gate に責務を寄せるべきです。

    #560 は現在、issue-refinement-loop の終了条件として issue-contract-review STATUS: go を要求し、Step 2 approve 後に issue-contract-review を呼ぶ、と明記しています。これは「orchestrator が complete 判定 gate を持つ」設計に見えます。さらに #560 は issue-reviewer / review-issue checklist への追記を Out of Scope にしているため、今回の人間コメントとは逆向きです。([GitHub]1) ([GitHub]1)

    既存の #227 は、issue-refinement-loop 等の orchestrator が worker step で direct Skill を実行せず、domain judgment / verification / mutation を SubAgent structured output として受け取る方向を定義しています。特に issue-refinement-loop main thread は REVIEW_ISSUE_RESULT_V1 の parsing と next_action 決定のみ保持する、としており、今回の gate 責務は reviewer-side に置く方が整合します。([GitHub]2)

    推奨方針

    #560 は REQUEST_CHANGES 相当です。変更方針はこれです。

    1. issue-refinement-loop の termination-policy.md に gate 手順を増やさない。
    2. issue-reviewer が review-issue の approve だけでなく、issue-contract-review または同一の deterministic gate 基準を確認してから approve を返す。
    3. issue-refinement-loop は issue-reviewer の structured output の verdict/status/next_action のみを読む。
    4. gate 詳細、VC baseline 差分性、preflight-scope marker 判定、human_escalation 後の再レビュー要否は reviewer 側の出力契約へ移す。
    5. 既存 issue-reviewer で吸収できないなら、新規 .claude/agents/issue-contract-reviewer.md または reviewer 専用 skill を追加する Issue に分割する。

    Claude Code の公式仕様上も、Subagent は独立コンテキスト・専用ツール制限・preload skills を持てます。つまり「reviewer が review-issue と issue-contract-review を読み込み、親には summary/structured result だけ返す」構成は自然です。([Claude Code]3) ([Claude Code]3) ([Claude Code]3)

    #560 へのコメント案

    人間コメント反映として、この Issue は現状のままでは進めない方がよいです。
    
    現在の記述は `.claude/skills/issue-refinement-loop/references/termination-policy.md` に
    「reviewer approve 後も issue-contract-review STATUS: go まで complete としない」
    というルールを追加する内容になっていますが、これは issue-refinement-loop が
    contract gate 責務を持つ設計に見えます。
    
    既存の control-plane / data-plane 分離方針では、issue-refinement-loop は
    LOOP_STATE / routing / next_action のみを扱い、domain judgment / verification /
    mutation は SubAgent structured output として受け取るべきです。したがって、
    gate 条件は issue-refinement-loop の termination-policy ではなく、reviewer 側に寄せるべきです。
    
    提案:
    
    - `issue-refinement-loop` は `issue-reviewer` の structured output だけを見る
    - `issue-reviewer` は `review-issue` approve だけで approve を返さず、`issue-contract-review`
      または同等の deterministic gate 基準を満たした場合だけ approve を返す
    - `CONTRACT_REVIEW_RESULT_V1.status != go` の場合は reviewer が `needs_fix` / `blocked` /
      `human_judgment` を返す
    - VC baseline 差分性、preflight-scope marker per-command 規約、human_escalation 後の
      Issue 本文変更時の full review 再実行要否は reviewer-side output contract に含める
    - `issue-refinement-loop` 内に残っている作業コンテクスト、gate 詳細、VC 詳細の解釈は
      worker SubAgent へ移す
    
    このため #560 の Allowed Paths は現状の
    `.claude/skills/issue-refinement-loop/references/termination-policy.md`
    中心ではなく、少なくとも以下のどちらかへ変更したいです。
    
    Option A: 既存 `issue-reviewer` を拡張する
    - `.claude/agents/issue-reviewer.md`
    - `.claude/skills/review-issue/SKILL.md` または references
    - 必要なら `docs/dev/agent-skill-boundaries.md`
    
    Option B: contract gate 専用 SubAgent を追加する
    - `.claude/agents/issue-contract-reviewer.md`
    - `.claude/skills/issue-contract-review/SKILL.md` または references
    - `issue-reviewer` がその結果を合成して `ISSUE_REVIEW_GATE_RESULT_V1` を返す
    
    いずれの場合も、issue-refinement-loop の変更は「reviewer の gate 済み verdict を
    routing する」程度に留め、gate logic 自体は持たせない方がよいです。

    追加 Issue 案

    Issue A: issue-reviewer に contract gate を統合する

    Title:
    実装: issue-reviewer が issue-contract-review gate 済み verdict を返すようにする
    
    Goal:
    issue-refinement-loop が complete 判定のために issue-contract-review gate を直接保持しないようにし、
    issue-reviewer が review-issue + issue-contract-review 相当の gate 済み structured verdict を返す。
    
    Outcome:
    `issue-reviewer` は `review-issue` が approve を返しても、`issue-contract-review`
    または同等の deterministic contract gate が `status: go` でない限り approve を返さない。
    `issue-refinement-loop` は reviewer output の `verdict/status/next_action` のみで routing する。
    
    In Scope:
    - `.claude/agents/issue-reviewer.md` に contract gate 実行/確認責務を追加
    - `ISSUE_REVIEW_GATE_RESULT_V1` または既存 `REVIEW_ISSUE_RESULT_V1` 拡張として
      `contract_review_status`, `contract_review_blockers`, `next_action` を定義
    - `status: go` 以外の場合の `needs_fix` / `blocked` / `human_judgment` routing を定義
    - `issue-refinement-loop` 側は gate 詳細を解釈せず reviewer verdict のみ扱う旨を明記
    - VC baseline 差分性違反、preflight-scope marker 誤用、human_escalation 後の本文変更時の
      full review 再実行を reviewer-side gate に含める
    
    Out of Scope:
    - issue-refinement-loop が issue-contract-review を直接実行する termination-policy 追加
    - impl-review-loop の変更
    - issue-contract-review の判定ロジック自体の大幅変更
    - Issue 本文 mutation
    
    Allowed Paths:
    - `.claude/agents/issue-reviewer.md`
    - `.claude/skills/review-issue/SKILL.md`
    - `.claude/skills/review-issue/references/**`
    - 必要なら `.claude/skills/issue-refinement-loop/SKILL.md`
    - 必要なら `docs/dev/agent-skill-boundaries.md`
    
    Acceptance Criteria:
    - AC1: `issue-reviewer` は `review-issue approve` 単独では approve を返さない
    - AC2: `issue-contract-review status: go` または同等 gate pass の場合のみ approve を返す
    - AC3: `status: blocked/needs_fix/human_judgment` の場合、reviewer output に blocker と next_action が含まれる
    - AC4: `issue-refinement-loop` は gate 詳細を再解釈せず reviewer verdict/status のみ routing に使う
    - AC5: issue-refinement-loop 内に VC baseline 差分性や preflight-scope marker の domain judgment が残らない
    - AC6: 既存 #559/#560 相当の unexpected_pass ケースを regression fixture として検出できる

    Issue B: issue-contract-reviewer SubAgent を新設する場合

    Title:
    実装: issue-contract-review を SubAgent 境界で実行する issue-contract-reviewer を追加する
    
    Goal:
    issue-contract-review skill を orchestrator から直接実行せず、read-only / verification-only SubAgent として隔離する。
    
    Outcome:
    `.claude/agents/issue-contract-reviewer.md` が追加され、Issue 番号を入力として
    `CONTRACT_REVIEW_RESULT_V1` を返す。親 orchestrator は contract gate の詳細を解釈せず、
    result status と next_action のみを受け取る。
    
    In Scope:
    - `.claude/agents/issue-contract-reviewer.md` 新設
    - `issue-contract-review` skill の preload または内部呼び出し手順定義
    - `Read/Grep/Glob/Bash` 程度の verification 用 tool に制限
    - `Edit/Write/MultiEdit` と Issue mutation を禁止
    - `CONTRACT_REVIEW_RESULT_V1` の pass-through 契約を定義
    - `issue-reviewer` が `issue-contract-reviewer` 結果を合成できるようにする
    
    Out of Scope:
    - issue-refinement-loop が contract gate を直接保持すること
    - Issue 本文編集
    - PR 実装作業

    実装上の注意

    issue-contract-reviewer に Bash を許可する場合、ツール定義だけではコマンド単位の安全境界は十分に細かくありません。Claude Code の Subagent frontmatter は tools, disallowedTools, permissionMode を持てますが、親セッションの permission mode が優先される場合があります。([Claude Code]3) (Claude Code)

    決定論的に縛るなら、SubAgent 定義だけでなく command hook / wrapper script / Allowed Paths checker を併用するのが安全です。Claude Code docs でも hooks は advisory な指示ではなく特定ポイントで実行を保証する仕組みと説明されています。ただし agent hook は experimental なので、production gate は command hook または deterministic script 優先が妥当です。([Claude Code]4) ([Claude Code]5)

    最小修正なら、#560 は 「issue-refinement-loop termination-policy 追加」から「issue-reviewer gate 拡張」へ reframe してください。今の Allowed Paths と Out of Scope は、人間コメントの意図と合っていません。

  3. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES / BLOCK

    #560 は方向性としては正しいですが、このまま実装 Issue として流すと「docs に書いたが実行経路は変わらない」「#502/#509 と責務が二重化する」「issue-contract-review の副作用付き処理を refinement 完了ゲートに流用する」の3点で、再発防止として弱いです。

    #560 は #559 の post-mortem 由来で、VC 差分性違反、preflight-scope marker の1コマンド限定、human escalation 後の再 review 不足を refinement 中に検出する目的です。Scope は .claude/skills/issue-refinement-loop/references/termination-policy.md、docs/dev/dor.md、docs/dev/workflow.md の docs/policy 変更に限定されています。(GitHub)

    主要ブロッカー

    1. #502/#509 と責務が重複している

    #502 はすでに Closed で、PR #509 により contract_readiness_check.py --mode execute を review-issue 通常経路へ組み込み、unexpected_pass を refinement ループ内で needs-fix として検出する目的の Issue です。つまり「refinement 中に unexpected_pass を検出する」主経路は #502/#509 側で既に定義済みです。(GitHub)

    #560 はここを重ねて「issue-refinement-loop 完了条件に issue-contract-review gate を追加」と書いているため、責務境界が曖昧です。修正方針は、#560 を review-issue の execute 検出ではなく、approve 後の final gate / stale body invalidation / contract snapshot freshness に絞ることです。

    推奨する責務分解はこれです。

    レイヤ | 責務 -- | -- review-issue / #502 | refinement 中の通常 review で unexpected_pass を検出し needs-fix に戻す issue-refinement-loop / #560 | approve 後、最新 body に対する CONTRACT_REVIEW_RESULT_V1.status == "go" がある場合だけ完了 issue-contract-review | final contract gate。副作用と handoff をどう扱うか明示する

    #502 自身も、review-issue は preflight-static から execute に切り替わり、compound/syntax と unexpected_pass を検出する target flow を明記しています。(GitHub)

    2. docs-only では実行経路が変わらない可能性が高い

    現在の issue-refinement-loop/SKILL.md は Step 2 の approve から Step 4.5、Step 5 へ進む構造で、issue-contract-review final gate を必須条件として明示していません。(GitHub)

    一方、現在の termination-policy.md も Step 2 returns approve を approved 終了条件として扱っています。#560 はここを直す Scope ですが、SKILL.md の変更を Out of Scope にしているため、実際に orchestration entrypoint が reference doc を必ず読む設計でない限り、再発防止が prose-only になります。(GitHub)

    最低限、#560 本文に次を入れるべきです。

    issue-refinement-loop/SKILL.md は thin entrypoint であり、termination-policy を normative reference として必ず消費するため、SKILL.md 非変更でも実効性がある。

    それが保証できないなら、SKILL.md 変更を Scope に入れるべきです。

    3. issue-contract-review は副作用付きであり、final gate として安全に呼べる定義がない

    issue-contract-review は status: go の場合に contract snapshot comment を投稿し、implement-issue への handoff 準備を行います。blocked の場合もコメント投稿と refinement proposal を行います。(GitHub)

    これを issue-refinement-loop の完了判定内で呼ぶなら、次を明示しないと危険です。

    • snapshot comment は重複投稿してよいのか、idempotent に更新するのか

    • go 時に implement-issue handoff を起動してよいのか、gate-only として抑止するのか

    • blocked / human_judgment を needs_second_pass に戻すのか、人間承認停止にするのか

    • latest issue body と contract result の対応を何で保証するのか

    現状の #560 は「STATUS: go を要求」とだけ書いており、side-effect boundary が不足しています。

    4. #560 自体の契約に drift がある

    #560 の Outcome は pnpm test と pnpm build の両方が通ることを要求していますが、Acceptance Criteria と Verification Commands には pnpm test しかありません。(GitHub)

    これは #560 自身が防ぎたい「契約 drift」の小型版です。修正は二択です。

    • pnpm build を Outcome から削除する

    • AC6 / VC6 として pnpm build を追加する

    docs-only Issue だとしても、Outcome に書いた verification は AC/VC と一致させるべきです。

    5. STATUS: go 表記が実装側の status: go とずれている

    issue-contract-review 側の machine result は status: go / blocked / human_judgment のような lowercase status として扱われています。#560 の文面は STATUS: go と書いており、検索文字列や reviewer 解釈でズレる余地があります。(GitHub)

    文言は次のように固定した方がよいです。

    latest CONTRACT_REVIEW_RESULT_V1.status == "go"

    さらに body freshness も含めるなら、

    latest CONTRACT_REVIEW_RESULT_V1.status == "go" and source_body_sha == current_issue_body_sha

    まで書くべきです。

    6. AC1〜AC4 がすべて pr_review_only で、機械的な再発防止を検証していない

    #560 の VC は docs grep なので pr_review_only にする判断は理解できます。ただし、issue-contract-review 側では pr_review_only と runtime_only は baseline preflight 上 skipped/go 扱いです。(GitHub)

    つまり #560 自体は、肝心の「baseline differentiality 違反を gate が検出する」ことを機械的には検証していません。docs-only Issue として割り切るなら、本文上の claim を弱める必要があります。

    修正案:

    This issue updates normative documentation only. It does not add executable enforcement beyond existing #502/#509 and existing issue-contract-review behavior.

    逆に本当に再発防止を実装するなら、docs-only ではなく fixture/test を Scope に入れるべきです。

    7. 「4軸すべて完了」「Remaining Parent Gaps: none」は過大

    #410 は baseline_vc_preflight に baseline_fail_expected、regression_gate、pr_review_only、runtime_only を追加した Issue ですが、pr-review-judge 側の pr_review_only verification や CI 統合は follow-up / out of scope として残っています。(GitHub)

    #560 も formatter/linter autofix、issue-reviewer checklist 追加、issue-contract-review logic 変更を Out of Scope にしています。(GitHub)

    したがって Remaining Parent Gaps: none は不正確です。最低限、次を残ギャップとして明記すべきです。

    • pr_review_only VC の reviewer-side verification は未完了

    • issue-contract-review の gate-only/idempotent mode は未定義

    • docs formatter / linter による自動検出は未実装

    • issue-reviewer checklist への横展開は未実装

    技術仕様面の補強

    rg / grep 系 VC を扱うなら、exit code の意味を docs に明記してください。ripgrep は match があれば 0、match がなければ 1、error は 2 です。GNU grep も同じく selected lines があれば 0、なければ 1、error は 2 です。(Debian Manpages)

    したがって、DoR にはこう書くのが妥当です。

    For rg/grep baseline-fail VCs, exit 1 may be the expected baseline failure, exit 0 is unexpected_pass, and exit 2 is an execution error that must block rather than be treated as expected failure.

    また、pytest 系 VC では 0 が success、1 が test failure、4 が usage error、5 が no tests collected なので、5 を expected baseline fail と混同しないルールが必要です。(pytest 文書)

    shell 実行については、#502 の shell=False 方針と整合させるべきです。Python subprocess docs でも shell injection risk が明記されており、VC preflight は compound shell や shell=True に寄せない方が安全です。(Python documentation)

    #560 本文への修正案

    Scope の再定義

    現在の「refinement 中に検出する」は #502 と重なるので、こう直すのが安全です。

    Goal:
    Add a final contract-review completion gate to issue-refinement-loop after review-issue approve.
    

    This issue does not implement the primary unexpected_pass detection path.
    That path is provided by #502/#509 via review-issue contract_readiness_check --mode execute.

    This issue defines the finalization rule:
    issue-refinement-loop may complete only when the latest CONTRACT_REVIEW_RESULT_V1
    for the current issue body has status == "go".

    AC 草案

    - [ ] AC1: termination-policy.md defines that Step 2 approve is not terminal until latest CONTRACT_REVIEW_RESULT_V1.status == "go".

    • AC2: termination-policy.md defines that CONTRACT_REVIEW_RESULT_V1 must match the current issue body by body hash or updated_at snapshot.
    • AC3: dor.md defines VC baseline differentiality, including rg/grep exit 0/1/2 semantics.
    • AC4: dor.md defines that # preflight-scope applies only to the immediately following VC command and must be repeated per command.
    • AC5: workflow.md defines that any human_escalation body edit invalidates prior contract-review result unless body hash still matches.
    • AC6: pnpm test passes.
    • [ ] AC7: pnpm build passes, if build remains in Outcome.

    VC 草案

    # AC1
    
    

    preflight-scope: pr_review_only

    $ rg -n 'CONTRACT_REVIEW_RESULT_V1.status == "go"|status == "go"' .claude/skills/issue-refinement-loop/references/termination-policy.md

    AC2

    preflight-scope: pr_review_only

    $ rg -n 'body_sha|body hash|updated_at|current issue body' .claude/skills/issue-refinement-loop/references/termination-policy.md

    AC3

    preflight-scope: pr_review_only

    $ rg -n 'rg|grep|exit 0|exit 1|exit 2|unexpected_pass' docs/dev/dor.md

    AC4

    preflight-scope: pr_review_only

    $ rg -n 'immediately following command|must be repeated|per command|preflight-scope' docs/dev/dor.md

    AC5

    preflight-scope: pr_review_only

    $ rg -n 'human_escalation|body edit|invalidates|rerun|contract-review' docs/dev/workflow.md

    AC6

    preflight-scope: runtime_only

    $ pnpm test

    AC7

    preflight-scope: runtime_only

    $ pnpm build

    結論

    #560 は 実装前に Issue 本文を修正すべきです。
    特に必須修正はこの4点です。

    1. 実装: contract_readiness_check.py の --mode execute を review-issue の通常経路に組み込み、unexpected_pass を refinement ループ内で検出可能にする #502/feat(#502): wire --mode execute into review-issue / issue-reviewer for unexpected_pass detection #509 との責務分界を明記する

    2. approve 後の final gate を latest CONTRACT_REVIEW_RESULT_V1.status == "go" として定義する

    3. body edit 後の stale contract-review result を body hash / updated_at で無効化する

    4. pnpm build の Outcome/AC/VC drift を解消する

    このままだと、#559 の直接原因を説明する docs は増えますが、再発防止の実効性は限定的です。

    ## 判定: **REQUEST_CHANGES / BLOCK**

    #560 は方向性としては正しいですが、このまま実装 Issue として流すと「docs に書いたが実行経路は変わらない」「#502/#509 と責務が二重化する」「issue-contract-review の副作用付き処理を refinement 完了ゲートに流用する」の3点で、再発防止として弱いです。

    #560 は #559 の post-mortem 由来で、VC 差分性違反、preflight-scope marker の1コマンド限定、human escalation 後の再 review 不足を refinement 中に検出する目的です。Scope は .claude/skills/issue-refinement-loop/references/termination-policy.md、docs/dev/dor.md、docs/dev/workflow.md の docs/policy 変更に限定されています。([GitHub]1)

    主要ブロッカー

    1. #502/#509 と責務が重複している

    #502 はすでに Closed で、PR #509 により contract_readiness_check.py --mode execute を review-issue 通常経路へ組み込み、unexpected_pass を refinement ループ内で needs-fix として検出する目的の Issue です。つまり「refinement 中に unexpected_pass を検出する」主経路は #502/#509 側で既に定義済みです。([GitHub]2)

    #560 はここを重ねて「issue-refinement-loop 完了条件に issue-contract-review gate を追加」と書いているため、責務境界が曖昧です。修正方針は、#560 を review-issue の execute 検出ではなく、approve 後の final gate / stale body invalidation / contract snapshot freshness に絞ることです。

    推奨する責務分解はこれです。

    レイヤ 責務
    review-issue / #502 refinement 中の通常 review で unexpected_pass を検出し needs-fix に戻す
    issue-refinement-loop / #560 approve 後、最新 body に対する CONTRACT_REVIEW_RESULT_V1.status == "go" がある場合だけ完了
    issue-contract-review final contract gate。副作用と handoff をどう扱うか明示する

    #502 自身も、review-issue は preflight-static から execute に切り替わり、compound/syntax と unexpected_pass を検出する target flow を明記しています。([GitHub]2)

    2. docs-only では実行経路が変わらない可能性が高い

    現在の issue-refinement-loop/SKILL.md は Step 2 の approve から Step 4.5、Step 5 へ進む構造で、issue-contract-review final gate を必須条件として明示していません。([GitHub]3)

    一方、現在の termination-policy.md も Step 2 returns approve を approved 終了条件として扱っています。#560 はここを直す Scope ですが、SKILL.md の変更を Out of Scope にしているため、実際に orchestration entrypoint が reference doc を必ず読む設計でない限り、再発防止が prose-only になります。([GitHub]4)

    最低限、#560 本文に次を入れるべきです。

    issue-refinement-loop/SKILL.md は thin entrypoint であり、termination-policy を normative reference として必ず消費するため、SKILL.md 非変更でも実効性がある。

    それが保証できないなら、SKILL.md 変更を Scope に入れるべきです。

    3. issue-contract-review は副作用付きであり、final gate として安全に呼べる定義がない

    issue-contract-review は status: go の場合に contract snapshot comment を投稿し、implement-issue への handoff 準備を行います。blocked の場合もコメント投稿と refinement proposal を行います。([GitHub]5)

    これを issue-refinement-loop の完了判定内で呼ぶなら、次を明示しないと危険です。

    • snapshot comment は重複投稿してよいのか、idempotent に更新するのか
    • go 時に implement-issue handoff を起動してよいのか、gate-only として抑止するのか
    • blocked / human_judgment を needs_second_pass に戻すのか、人間承認停止にするのか
    • latest issue body と contract result の対応を何で保証するのか

    現状の #560 は「STATUS: go を要求」とだけ書いており、side-effect boundary が不足しています。

    4. #560 自体の契約に drift がある

    #560 の Outcome は pnpm test と pnpm build の両方が通ることを要求していますが、Acceptance Criteria と Verification Commands には pnpm test しかありません。([GitHub]1)

    これは #560 自身が防ぎたい「契約 drift」の小型版です。修正は二択です。

    • pnpm build を Outcome から削除する
    • AC6 / VC6 として pnpm build を追加する

    docs-only Issue だとしても、Outcome に書いた verification は AC/VC と一致させるべきです。

    5. STATUS: go 表記が実装側の status: go とずれている

    issue-contract-review 側の machine result は status: go / blocked / human_judgment のような lowercase status として扱われています。#560 の文面は STATUS: go と書いており、検索文字列や reviewer 解釈でズレる余地があります。([GitHub]5)

    文言は次のように固定した方がよいです。

    latest CONTRACT_REVIEW_RESULT_V1.status == "go"

    さらに body freshness も含めるなら、

    latest CONTRACT_REVIEW_RESULT_V1.status == "go" and source_body_sha == current_issue_body_sha

    まで書くべきです。

    6. AC1〜AC4 がすべて pr_review_only で、機械的な再発防止を検証していない

    #560 の VC は docs grep なので pr_review_only にする判断は理解できます。ただし、issue-contract-review 側では pr_review_only と runtime_only は baseline preflight 上 skipped/go 扱いです。([GitHub]5)

    つまり #560 自体は、肝心の「baseline differentiality 違反を gate が検出する」ことを機械的には検証していません。docs-only Issue として割り切るなら、本文上の claim を弱める必要があります。

    修正案:

    This issue updates normative documentation only. It does not add executable enforcement beyond existing #502/#509 and existing issue-contract-review behavior.

    逆に本当に再発防止を実装するなら、docs-only ではなく fixture/test を Scope に入れるべきです。

    7. 「4軸すべて完了」「Remaining Parent Gaps: none」は過大

    #410 は baseline_vc_preflight に baseline_fail_expected、regression_gate、pr_review_only、runtime_only を追加した Issue ですが、pr-review-judge 側の pr_review_only verification や CI 統合は follow-up / out of scope として残っています。([GitHub]6)

    #560 も formatter/linter autofix、issue-reviewer checklist 追加、issue-contract-review logic 変更を Out of Scope にしています。([GitHub]1)

    したがって Remaining Parent Gaps: none は不正確です。最低限、次を残ギャップとして明記すべきです。

    • pr_review_only VC の reviewer-side verification は未完了
    • issue-contract-review の gate-only/idempotent mode は未定義
    • docs formatter / linter による自動検出は未実装
    • issue-reviewer checklist への横展開は未実装

    技術仕様面の補強

    rg / grep 系 VC を扱うなら、exit code の意味を docs に明記してください。ripgrep は match があれば 0、match がなければ 1、error は 2 です。GNU grep も同じく selected lines があれば 0、なければ 1、error は 2 です。([Debian Manpages]7)

    したがって、DoR にはこう書くのが妥当です。

    For rg/grep baseline-fail VCs, exit 1 may be the expected baseline failure, exit 0 is unexpected_pass, and exit 2 is an execution error that must block rather than be treated as expected failure.

    また、pytest 系 VC では 0 が success、1 が test failure、4 が usage error、5 が no tests collected なので、5 を expected baseline fail と混同しないルールが必要です。([pytest 文書]8)

    shell 実行については、#502 の shell=False 方針と整合させるべきです。Python subprocess docs でも shell injection risk が明記されており、VC preflight は compound shell や shell=True に寄せない方が安全です。([Python documentation]9)

    #560 本文への修正案

    Scope の再定義

    現在の「refinement 中に検出する」は #502 と重なるので、こう直すのが安全です。

    Goal:
    Add a final contract-review completion gate to issue-refinement-loop after review-issue approve.
    
    This issue does not implement the primary unexpected_pass detection path.
    That path is provided by #502/#509 via review-issue contract_readiness_check --mode execute.
    
    This issue defines the finalization rule:
    issue-refinement-loop may complete only when the latest CONTRACT_REVIEW_RESULT_V1
    for the current issue body has status == "go".

    AC 草案

    - [ ] AC1: termination-policy.md defines that Step 2 approve is not terminal until latest CONTRACT_REVIEW_RESULT_V1.status == "go".
    - [ ] AC2: termination-policy.md defines that CONTRACT_REVIEW_RESULT_V1 must match the current issue body by body hash or updated_at snapshot.
    - [ ] AC3: dor.md defines VC baseline differentiality, including rg/grep exit 0/1/2 semantics.
    - [ ] AC4: dor.md defines that # preflight-scope applies only to the immediately following VC command and must be repeated per command.
    - [ ] AC5: workflow.md defines that any human_escalation body edit invalidates prior contract-review result unless body hash still matches.
    - [ ] AC6: pnpm test passes.
    - [ ] AC7: pnpm build passes, if build remains in Outcome.

    VC 草案

    # AC1
    # preflight-scope: pr_review_only
    $ rg -n 'CONTRACT_REVIEW_RESULT_V1\.status == "go"|status == "go"' .claude/skills/issue-refinement-loop/references/termination-policy.md
    
    # AC2
    # preflight-scope: pr_review_only
    $ rg -n 'body_sha|body hash|updated_at|current issue body' .claude/skills/issue-refinement-loop/references/termination-policy.md
    
    # AC3
    # preflight-scope: pr_review_only
    $ rg -n 'rg|grep|exit 0|exit 1|exit 2|unexpected_pass' docs/dev/dor.md
    
    # AC4
    # preflight-scope: pr_review_only
    $ rg -n 'immediately following command|must be repeated|per command|preflight-scope' docs/dev/dor.md
    
    # AC5
    # preflight-scope: pr_review_only
    $ rg -n 'human_escalation|body edit|invalidates|rerun|contract-review' docs/dev/workflow.md
    
    # AC6
    # preflight-scope: runtime_only
    $ pnpm test
    
    # AC7
    # preflight-scope: runtime_only
    $ pnpm build

    結論

    #560 は 実装前に Issue 本文を修正すべきです。
    特に必須修正はこの4点です。

    1. 実装: contract_readiness_check.py の --mode execute を review-issue の通常経路に組み込み、unexpected_pass を refinement ループ内で検出可能にする #502/feat(#502): wire --mode execute into review-issue / issue-reviewer for unexpected_pass detection #509 との責務分界を明記する
    2. approve 後の final gate を latest CONTRACT_REVIEW_RESULT_V1.status == "go" として定義する
    3. body edit 後の stale contract-review result を body hash / updated_at で無効化する
    4. pnpm build の Outcome/AC/VC drift を解消する

    このままだと、#559 の直接原因を説明する docs は増えますが、再発防止の実効性は限定的です。

  4. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 完了

    LOOP_TERMINATION_RESULT_V1:
      termination_reason: approved
      max_iterations: 3
      iterations_used: 3  # 0, 1, 2
      blockers_history:
        - iteration: 0
          verdict: needs-fix
          blockers:
            - "#502/#509 との責務重複(unexpected_pass 検出との分界未明記)"
            - "docs-only での実効性未保証(normative reference 明記なし)"
            - "issue-contract-review の副作用 boundary 未定義(idempotency/handoff/body_sha256)"
            - "#560 自体の契約 drift(Outcome に pnpm build あるが AC/VC になし)"
            - "STATUS: go → CONTRACT_REVIEW_RESULT_V1.status == \"go\" 統一未対応"
            - "AC1〜AC4 が全 pr_review_only で機械的再発防止未検証"
            - "Remaining Parent Gaps: none → 実際の残存ギャップ 5 件を未列挙"
        - iteration: 1
          verdict: needs-fix
          blockers:
            - "LP016: VC の AC マーカーが '# AC<N>: description' 形式(bare # AC<N> 形式に修正が必要)"
        - iteration: 2
          verdict: approve
          blockers: []
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "63edb01c31a53219"
          summary: "issue-reviewer / review-issue checklist への追記(Out of Scope 残存)"
          source: "issue_body Out of Scope"
        - dedupe_key: "4a73959b2a2d6974"
          summary: "formatter / linter による preflight-scope marker 自動補正(Out of Scope 残存)"
          source: "issue_body Out of Scope"
        - note: "anchor comment #4598133260 が提案した Issue A(issue-reviewer gate 拡張)・Issue B(issue-contract-reviewer SubAgent 新設)は未起票。#560 Remaining Parent Gaps に gap 1〜4 として記録済み。"

    変更サマリ(iteration 0〜2 で適用):

  5. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    Contract Snapshot (2026-06-02T02:45:00Z)

    • Outcome: termination-policy.md・dor.md・workflow.md の 3 ファイルを更新し、issue-refinement-loop の final gate・VC 差分性・preflight-scope per-command・human_escalation 後の再レビュー要否を確立する
    • Acceptance Criteria: AC1〜AC9
    • Verification Commands: AC1-AC7 (pr_review_only / rg 検索), AC8 pnpm test (runtime_only), AC9 pnpm build (runtime_only)
    • Allowed Paths:
      • .claude/skills/issue-refinement-loop/references/termination-policy.md
      • docs/dev/dor.md
      • docs/dev/workflow.md
    • Worktree: .claude/worktrees/issue-560-issue-refinement-loop-issue-contract-rev
    • Branch: worktree-issue-560-issue-refinement-loop-issue-contract-rev
    • VC preflight: baseline fail = 0, 想定外 pass = 0, 実行不可 = 0, skipped = 9 (7 pr_review_only + 2 runtime_only)
    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-06-02T02:45:00Z"
      generated_by: issue-contract-review
      issue_url: "https://github.com/squne121/loop-protocol/issues/560"
      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: 0
          vc_passed_unexpectedly: 0
          vc_unrunnable: 0
          vc_expected_pass: 0
          vc_skipped: 9
          classifications:
            - ac: AC1
              command: "rg -n 'CONTRACT_REVIEW_RESULT_V1\\.status == \"go\"|status == \"go\"' .claude/skills/issue-refinement-loop/references/termination-policy.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC2
              command: "rg -n 'normative.*reference|thin.*entrypoint.*termination|SKILL\\.md.*非変更でも実効性' .claude/skills/issue-refinement-loop/references/termination-policy.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC3
              command: "rg -n 'idempotent|snapshot.*comment|handoff.*gate|body_sha256|stale.*result|invalidat' .claude/skills/issue-refinement-loop/references/termination-policy.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC4
              command: "rg -n 'baseline.*fail|exit.*0|exit.*1.*expected|exit.*2.*error|unexpected_pass|差分性' docs/dev/dor.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC5
              command: "rg -n 'per.*command|各.*コマンド直前|immediately.*following|must be repeated|block.*先頭' docs/dev/dor.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC6
              command: "rg -n 'pytest|exit.*5|no.*tests.*collected|exit.*4|usage.*error' docs/dev/dor.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC7
              command: "rg -n 'human_escalation.*変更|stale.*contract|body_sha256|prior.*contract.*review|再実行' docs/dev/workflow.md"
              exit_code: null
              category: preflight_scope_pr_review_only
              scope_class: pr_review_only
              confidence: low
              decision: go
              verification_owner: pr-review-judge
              deferred_reason: "VC marked pr_review_only; verification deferred to PR review"
              runtime_verification_required: false
            - ac: AC8
              command: "pnpm test"
              exit_code: null
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: "VC marked runtime_only; verification deferred to post-implementation runtime"
              runtime_verification_required: true
            - ac: AC9
              command: "pnpm build"
              exit_code: null
              category: preflight_scope_runtime_only
              scope_class: runtime_only
              confidence: low
              decision: go
              verification_owner: impl-review-loop
              deferred_reason: "VC marked runtime_only; verification deferred to post-implementation runtime"
              runtime_verification_required: true
        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: []
    
  6. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-06-02T02:48:44Z)

  7. added a commit that references this issue on Jun 2, 2026
  8. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    PR #563 REQUEST_CHANGES 対応完了

    3つのブロッカーをすべて .claude/skills/issue-refinement-loop/references/termination-policy.md で対処しました(commit: bd3cd84)。

    Blocker 1: LOOP_POLICY_V1.routes の final gate 付きルートへの更新

    裸の verdict == "approve" → done ルートを削除し、以下の3ルートに分割しました:

    • verdict == 'approve' and contract_review.status == 'go' and contract_review.body_sha256 == issue.body_sha256 → done
    • verdict == 'approve' and contract_review.status != 'go' → rerun_issue_contract_review
    • contract_review.body_sha256 != issue.body_sha256 → rerun_issue_contract_review

    Blocker 2: body_sha256 の policy-only 制約明記と Final Gate 修正

    Contract Snapshot Idempotency セクションの末尾に Note を追加しました。producer-side 実装(issue-contract-review/SKILL.md への body_sha256 追加)は本 Issue のスコープ外であり、follow-up Issue で対応することを明記。暫定措置として generated_at vs updated_at 比較を使用する旨も記載しました。

    また Final Gate セクションを修正し:

    • status: blocked → 継続(blocker 解消後に再実行)
    • next_action: human_judgment → human_escalation

    CONTRACT_REVIEW_RESULT_V1.status の有効値が go | blocked のみであり human_judgment は next_action フィールドで表現されることを明示しました。

    Blocker 3: implement-issue Handoff Gate 表の next_action 参照修正

    表ヘッダーを CONTRACT_REVIEW_RESULT_V1 フィールド に変更し、行を以下に改訂:

    • status: go → handoff 可
    • status: blocked AND next_action: propose_refinement_loop → 継続
    • status: blocked AND next_action: human_judgment → human_escalation

    表の下に status 有効値の注釈を追記しました。

    Blocker 2 の follow-up Issue

    body_sha256 の producer-side 実装(issue-contract-review/SKILL.md の CONTRACT_REVIEW_RESULT_V1 出力への追加)は Allowed Paths 外のため別 Issue として起票します(以下参照)。

  9. added a commit that references this issue on Jun 2, 2026
  10. squne121 commented on Jun 2, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-06-02T03:28:00Z)

    • status: ok
    • 次アクション: なし(親 Issue なし)
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:pr/563:body_sha256_producer"
          status: reused_open
          issue:
            number: 566
            url: "https://github.com/squne121/loop-protocol/issues/566"
          reason: "PR #563 本文に明示済みの follow-up Issue。既に OPEN のため再起票スキップ"
    
      note_only_observations: []

    cleanup 実施内容

    • worktree .claude/worktrees/issue-560-issue-refinement-loop-issue-contract-rev 削除済み
    • branch worktree-issue-560-issue-refinement-loop-issue-contract-rev 削除済み(PR マージ済み)
    • main を origin/main に同期済み(fast-forward: 3 files, +87 lines)
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

    phase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions