Repository navigation
Closed
Labels
phase/implementationImplementation phase
Description
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: mixedParent 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 判定を出す
review-issue/ 実装: contract_readiness_check.py の --mode execute を review-issue の通常経路に組み込み、unexpected_pass を refinement ループ内で検出可能にする #502: refinement 中の通常レビューでunexpected_passを検出しneeds-fixに戻す(実装済み)issue-refinement-loop/ 実装: issue-refinement-loop の完了条件に issue-contract-review gate を追加し VC 差分性違反を refinement 中に検出する #560:approve後、最新 body に対するCONTRACT_REVIEW_RESULT_V1.status == "go"がある場合だけ完了とする(本 Issue の Scope)issue-contract-review: final contract gate。snapshot comment idempotency・handoff 制御・body freshness を明示する必要がある
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 のため残存:
pr_review_onlyVC の reviewer-side verification 実装(issue-reviewerchecklist 追加)issue-contract-reviewの gate-only / idempotent mode の execution-level 実装- formatter / linter による preflight-scope marker 自動検出・補正
issue-reviewerchecklist への VC 差分性チェック横展開- 実装: 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 で以下の連鎖が発生した:
- issue-refinement-loop が独自の review 判断で「修正完了・approve」とした
- impl-review-loop preparation の
baseline_vc_preflight.pyが初めて AC1 の VC を実行しunexpected_passを検出 - 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 後に latestCONTRACT_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 を返した後に latestCONTRACT_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
- issue-refinement-loop の SKILL.md 本体の書き換え(参照先の termination-policy.md の更新で完結する)
- issue-contract-review / baseline_vc_preflight.py のロジック変更
- 既存 Issue の VC 修正(Issue 実装: agent-session-manifest-check テストが生成する temp fixture を afterAll で後始末する #559 は別途 Option B で修正済み)
- issue-reviewer / review-issue checklist への追記(別 Issue)
- formatter / linter による preflight-scope marker の自動補正(別 Issue)
Acceptance Criteria
- AC1:
termination-policy.mdに「reviewer approve 後に latestCONTRACT_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 buildAllowed Paths
.claude/skills/issue-refinement-loop/references/termination-policy.mddocs/dev/dor.mddocs/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"Metadata
Metadata
Assignees
Labels
phase/implementationImplementation phase
Activity
squne121 commentedon Jun 2, 2026
人間からのコメントです。
「.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 内に作業コンテクストが残っていたらワーカーサブエージェントに移行してほしいし、そのために不足しているサブエージェント定義ファイルやエージェントスキルがあれば作成を提案してほしい。
squne121 commentedon Jun 2, 2026
#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-loopmain thread はREVIEW_ISSUE_RESULT_V1の parsing とnext_action決定のみ保持する、としており、今回の gate 責務は reviewer-side に置く方が整合します。([GitHub]2)推奨方針
#560 は REQUEST_CHANGES 相当です。変更方針はこれです。
issue-refinement-loopのtermination-policy.mdに gate 手順を増やさない。issue-reviewerがreview-issueの approve だけでなく、issue-contract-reviewまたは同一の deterministic gate 基準を確認してからapproveを返す。issue-refinement-loopはissue-reviewerの structured output のverdict/status/next_actionのみを読む。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 案
Issue A:
issue-reviewerに contract gate を統合するIssue B:
issue-contract-reviewerSubAgent を新設する場合実装上の注意
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-loopmain thread はREVIEW_ISSUE_RESULT_V1の parsing とnext_action決定のみ保持する、としており、今回の gate 責務は reviewer-side に置く方が整合します。([GitHub]2)推奨方針
#560 は REQUEST_CHANGES 相当です。変更方針はこれです。
issue-refinement-loopのtermination-policy.mdに gate 手順を増やさない。issue-reviewerがreview-issueの approve だけでなく、issue-contract-reviewまたは同一の deterministic gate 基準を確認してからapproveを返す。issue-refinement-loopはissue-reviewerの structured output のverdict/status/next_actionのみを読む。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 案
Issue A:
issue-reviewerに contract gate を統合するIssue B:
issue-contract-reviewerSubAgent を新設する場合実装上の注意
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 は、人間コメントの意図と合っていません。
squne121 commentedon Jun 2, 2026
判定: REQUEST_CHANGES / BLOCK
#560 は方向性としては正しいですが、このまま実装 Issue として流すと「docs に書いたが実行経路は変わらない」「#502/#509 と責務が二重化する」「
issue-contract-reviewの副作用付き処理を refinement 完了ゲートに流用する」の3点で、再発防止として弱いです。#560 は #559 の post-mortem 由来で、VC 差分性違反、
preflight-scopemarker の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-reviewfinal 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 本文に次を入れるべきです。
それが保証できないなら、
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-issuehandoff を起動してよいのか、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)文言は次のように固定した方がよいです。
さらに body freshness も含めるなら、
まで書くべきです。
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 を弱める必要があります。
修正案:
逆に本当に再発防止を実装するなら、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_onlyverification や CI 統合は follow-up / out of scope として残っています。(GitHub)#560 も formatter/linter autofix、
issue-reviewerchecklist 追加、issue-contract-reviewlogic 変更を Out of Scope にしています。(GitHub)したがって
Remaining Parent Gaps: noneは不正確です。最低限、次を残ギャップとして明記すべきです。pr_review_onlyVC の reviewer-side verification は未完了issue-contract-reviewの gate-only/idempotent mode は未定義docs formatter / linter による自動検出は未実装
issue-reviewerchecklist への横展開は未実装技術仕様面の補強
rg/grep系 VC を扱うなら、exit code の意味を docs に明記してください。ripgrep は match があれば0、match がなければ1、error は2です。GNU grep も同じく selected lines があれば0、なければ1、error は2です。(Debian Manpages)したがって、DoR にはこう書くのが妥当です。
また、pytest 系 VC では
0が success、1が test failure、4が usage error、5が no tests collected なので、5を expected baseline fail と混同しないルールが必要です。(pytest 文書)shell 実行については、#502 の
shell=False方針と整合させるべきです。Pythonsubprocessdocs でも shell injection risk が明記されており、VC preflight は compound shell やshell=Trueに寄せない方が安全です。(Python documentation)#560 本文への修正案
Scope の再定義
現在の「refinement 中に検出する」は #502 と重なるので、こう直すのが安全です。
AC 草案
[ ] AC7: pnpm build passes, if build remains in Outcome.
VC 草案
結論
#560 は 実装前に Issue 本文を修正すべきです。
特に必須修正はこの4点です。
実装: 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 との責務分界を明記する
approve後の final gate をlatest CONTRACT_REVIEW_RESULT_V1.status == "go"として定義するbody edit 後の stale contract-review result を body hash / updated_at で無効化する
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-scopemarker の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/ #502unexpected_passを検出しneeds-fixに戻すissue-refinement-loop/ #560approve後、最新 body に対するCONTRACT_REVIEW_RESULT_V1.status == "go"がある場合だけ完了issue-contract-review#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-reviewfinal 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 本文に次を入れるべきです。
それが保証できないなら、
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の完了判定内で呼ぶなら、次を明示しないと危険です。go時にimplement-issuehandoff を起動してよいのか、gate-only として抑止するのかblocked/human_judgmentをneeds_second_passに戻すのか、人間承認停止にするのか現状の #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 から削除する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)文言は次のように固定した方がよいです。
さらに body freshness も含めるなら、
まで書くべきです。
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 を弱める必要があります。
修正案:
逆に本当に再発防止を実装するなら、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_onlyverification や CI 統合は follow-up / out of scope として残っています。([GitHub]6)#560 も formatter/linter autofix、
issue-reviewerchecklist 追加、issue-contract-reviewlogic 変更を Out of Scope にしています。([GitHub]1)したがって
Remaining Parent Gaps: noneは不正確です。最低限、次を残ギャップとして明記すべきです。pr_review_onlyVC の reviewer-side verification は未完了issue-contract-reviewの gate-only/idempotent mode は未定義issue-reviewerchecklist への横展開は未実装技術仕様面の補強
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 にはこう書くのが妥当です。
また、pytest 系 VC では
0が success、1が test failure、4が usage error、5が no tests collected なので、5を expected baseline fail と混同しないルールが必要です。([pytest 文書]8)shell 実行については、#502 の
shell=False方針と整合させるべきです。Pythonsubprocessdocs でも shell injection risk が明記されており、VC preflight は compound shell やshell=Trueに寄せない方が安全です。([Python documentation]9)#560 本文への修正案
Scope の再定義
現在の「refinement 中に検出する」は #502 と重なるので、こう直すのが安全です。
AC 草案
VC 草案
結論
#560 は 実装前に Issue 本文を修正すべきです。
特に必須修正はこの4点です。
approve後の final gate をlatest CONTRACT_REVIEW_RESULT_V1.status == "go"として定義するpnpm buildの Outcome/AC/VC drift を解消するこのままだと、#559 の直接原因を説明する docs は増えますが、再発防止の実効性は限定的です。
squne121 commentedon Jun 2, 2026
issue-refinement-loop 完了
変更サマリ(iteration 0〜2 で適用):
goal_ref: final gate 中心の表現に更新Parent Goal Ref: 実装: 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 との責務分界を追記Outcome: 6 箇条の具体的な確立事項に書き換え(Note: unexpected_pass 検出は 実装: 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 の担当)In Scope: termination-policy.md 行を 1 行 → 3 行に拡張(normative reference 明記・idempotency/handoff/body_sha256 定義を追加)Remaining Parent Gaps: 「なし」→ 5 項目の残存ギャップ列挙AC: 5 件 → 9 件(AC1〜AC9)VC: AC9 対応の 9 コマンド(pr_review_only×7 / runtime_only×2)# AC<N>形式に修正squne121 commentedon Jun 2, 2026
Contract Snapshot (2026-06-02T02:45:00Z)
termination-policy.md・dor.md・workflow.mdの 3 ファイルを更新し、issue-refinement-loop の final gate・VC 差分性・preflight-scope per-command・human_escalation 後の再レビュー要否を確立する.claude/skills/issue-refinement-loop/references/termination-policy.mddocs/dev/dor.mddocs/dev/workflow.md.claude/worktrees/issue-560-issue-refinement-loop-issue-contract-revworktree-issue-560-issue-refinement-loop-issue-contract-revsqune121 commentedon Jun 2, 2026
implement-issue: 実装完了 (2026-06-02T02:48:44Z)
.claude/worktrees/issue-560-issue-refinement-loop-issue-contract-revworktree-issue-560-issue-refinement-loop-issue-contract-revfix(#560): address PR #563 blockers in termination-policy.md
squne121 commentedon Jun 2, 2026
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→doneverdict == 'approve' and contract_review.status != 'go'→rerun_issue_contract_reviewcontract_review.body_sha256 != issue.body_sha256→rerun_issue_contract_reviewBlocker 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_atvsupdated_at比較を使用する旨も記載しました。また Final Gate セクションを修正し:
status: blocked→ 継続(blocker 解消後に再実行)next_action: human_judgment→human_escalationCONTRACT_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 として起票します(以下参照)。docs(#560): establish final gate, VC diff rules, preflight-scope per-…
squne121 commentedon Jun 2, 2026
post-merge-cleanup: 完了 (2026-06-02T03:28:00Z)
cleanup 実施内容
.claude/worktrees/issue-560-issue-refinement-loop-issue-contract-rev削除済みworktree-issue-560-issue-refinement-loop-issue-contract-rev削除済み(PR マージ済み)