Skip to content

feat(#630): pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加 - #637

Merged
squne121 merged 3 commits into
mainfrom
worktree-issue-630-pr-review-judge-loop-verdict-v2-merge-re
Jun 3, 2026
Merged

squne121 merged 3 commits into
mainfrom
worktree-issue-630-pr-review-judge-loop-verdict-v2-merge-re

Conversation

@squne121

@squne121 squne121 commented Jun 3, 2026 •

Copy link
Copy Markdown
Owner

概要

pr-review-judge の出力スキーマを LOOP_VERDICT_V2 に拡張し、merge_ready / required_auto_actions / auto_fix_applied フィールドを追加します。Closes #N 不足・BEHIND branch update・PR body 機械的不備が required_auto_actions(executor: implementation-worker)に分類されるようになり、follow_up_issue_requests に出さないルールを SKILL.md に明記します。

主な変更点:

  • LOOP_VERDICT_V2 スキーマを SKILL.md に定義(snake_case 専用・recommendations / mergeStateStatus を V2 では廃止)
  • Step 5 の verdict 決定ロジックを更新し、required_auto_actions 分類ロジックを追加
  • merge_ready: true の充足条件(required_auto_actions==[] が必須)を明記
  • Schema Consumer Inventory(#631/#632 への依存明記)を SKILL.md に追加
  • pr-reviewer.md の参照スキーマ名を LOOP_VERDICT_V2 に更新
  • test_loop_verdict_v2.py(54 テスト)を追加し AC1-AC16 全件 PASS

この PR は Issue #630 を解決し、親 Issue #626 を参照します。
Closes #630
Refs #626

関連 Issue との調整(Related coordination)

スキーマ変更の適用範囲(Schema Change Applicability)

schema_change: LOOP_VERDICT → LOOP_VERDICT_V2 の拡張(additive 変更 + recommendations フィールドの deprecation)

スキーマ消費者インベントリ(Schema Consumer Inventory)

消費者 パス 更新状況
pr-reviewer.md .claude/agents/pr-reviewer.md 更新済み(本 PR)
impl-review-loop step-5 .claude/skills/impl-review-loop/SKILL.md pending(#631/child-5)
schema-governance docs/dev/schema-governance.md pending(#631)
test_loop_verdict_v2.py .claude/skills/pr-review-judge/scripts/tests/ 追加(本 PR)

互換性について: additive(merge_ready / required_auto_actions / auto_fix_applied フィールド追加、recommendations deprecated)。#631/child-5 完了まで consumer は旧 LOOP_VERDICT 互換読み込みを維持します。

受け入れ条件の達成状況

  • AC1: LOOP_VERDICT_V2 スキーマが SKILL.md に定義されている
  • AC2: required_auto_actions 非空 → merge_ready: false テスト追加(PASS)
  • AC3: ensure_closing_keyword 分類ルールが SKILL.md に記載
  • AC4: kind: update_branch が required_auto_actions に分類される旨を SKILL.md に記載
  • AC5: blocking_merge_ready フィールドが SKILL.md に定義
  • AC6: merge_ready テストファイルが存在
  • AC7: uv run pytest .claude/skills/pr-review-judge/scripts/tests/ -v 全件 PASS(104 テスト: 50 回帰 + 54 新規)
  • AC8: test_pr_reviewer_references_loop_verdict_v2_not_legacy_only テストが存在・PASS
  • AC9: test_no_top_level_mergeStateStatus_in_v2 テストが存在・PASS
  • AC10: test_loop_verdict_v2_schema_parses + test_required_auto_actions_force_merge_ready_false が存在・PASS
  • AC11: test_approve_with_behind_requires_update_branch テストが存在・PASS
  • AC12: test_closing_keywords_accept_fix_resolve_close_variants テストが存在・PASS(13 バリアント)
  • AC13: test_pr_body_validator_semantic_failure_remains_blocker テストが存在・PASS
  • AC14: test_auto_fix_applied_is_empty_on_initial_output テストが存在・PASS
  • AC15: test_follow_up_issue_requests_must_be_nonblocking テストが存在・PASS
  • AC16: consumer_inventory が SKILL.md に記載

検証コマンド結果

全ての標準品質ゲートが通過しました。

pnpm typecheck  : PASS (exit 0)
pnpm lint       : PASS (exit 0)
pnpm test       : PASS (339 テスト, 17 テストファイル)
pnpm build      : PASS (50ms)
uv run pytest .claude/skills/pr-review-judge/scripts/tests/ -v : PASS (104 テスト)

Allowed Paths 遵守

変更ファイルはすべて Allowed Paths 内に収まっています:

  • .claude/skills/pr-review-judge/SKILL.md
  • .claude/skills/pr-review-judge/scripts/tests/test_loop_verdict_v2.py(新規追加)
  • .claude/agents/pr-reviewer.md

動作検証適用性(Runtime Verification Applicability)

decision: not_applicable — 変更対象はスキル定義ファイル(SKILL.md)とテストファイルのみ。runtime 動作には影響しません。

Safety Claim Matrix(安全主張マトリクス)

Claim Implemented? Not controlled Evidence Follow-up
LOOP_VERDICT_V2 は additive 拡張であり既存 consumer の runtime 動作を破壊しない(recommendations は deprecated だが削除ではない) Yes impl-review-loop の step-5 routing 変更(consumer 側の V2 切り替え)は #631 待ち test_loop_verdict_v2.py 54 件 PASS + 既存 50 件回帰 PASS #631(consumer routing 更新)
required_auto_actions は mechanical: true のアクションのみを分類し、Safety Claim Matrix 不足等 mechanical: false はこの分類に含まれない Yes N/A test_pr_body_validator_semantic_failure_remains_blocker PASS(AC13) N/A
auto_fix_applied は pr-review-judge 初回出力では常に [] であり、verdict comment の事後 mutation は行わない Yes N/A test_auto_fix_applied_always_empty_on_first_output PASS(AC14) N/A

LOOP_VERDICT_V2 スキーマ(merge_ready / required_auto_actions /
auto_fix_applied フィールド)を SKILL.md に定義し、Closes #N 不足・
BEHIND branch・PR body validator failure の required_auto_actions
分類ロジックを追加。Schema Consumer Inventory を SKILL.md に記載。

- SKILL.md: LOOP_VERDICT_V2 スキーマ定義(snake_case 専用・recommendations 廃止)
- SKILL.md: Step 5 に required_auto_actions 分類ロジックを追加
- SKILL.md: merge_ready 充足条件を明記(required_auto_actions==[] が必須)
- SKILL.md: Schema Consumer Inventory(#631/#632 への依存明記)を追加
- pr-reviewer.md: 参照スキーマ名を LOOP_VERDICT_V2 に更新
- tests/test_loop_verdict_v2.py: AC1-AC16 対応のユニットテストを追加(54 件全件 PASS)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

判定結果: REQUEST_CHANGES

マージ可能状態

  • mergeable=MERGEABLE, mergeStateStatus=CLEAN

証跡確認

  • 受け入れ条件達成状況: 全16件の受け入れ条件が PR 本文で [x] 記載あり。根拠も記載されている
  • Allowed Paths 遵守: 変更ファイル3件すべてが Allowed Paths 内に収まっている
  • CI 確認: 全8チェック pass。CI run の head SHA = 17b98e3 = PR headRefOid(一致確認済み)
  • 検証コマンド結果: AC1-AC16 の VC を個別実行し確認済み。CI python-test で 104 テスト全件 PASS

Safety Claim Gate 判定

changed path .claude/skills/pr-review-judge/SKILL.md が .claude/skills/** に一致するため、SKILL.md Step 4.6 の fail-closed 条件により safety-sensitive PR と判定される。

PR 本文に Safety Claim Matrix セクションが存在しない。SKILL.md の APPROVE 禁止条件「safety-sensitive PR なのに Safety Claim Matrix セクションが存在しない」に該当する。

ブロッカー

  1. Safety Claim Matrix セクションが欠落(APPROVE 禁止): .claude/skills/** path の変更は fail-closed で safety-sensitive と判定される。PR 本文に Safety Claim Matrix(Claim / Implemented? / Not controlled / Evidence / Follow-up 列)を追加してください。変更が security boundary に影響しない場合は、その旨を Claim 列に明記し Not controlled 列を空にすることで bounded claim として APPROVE 可能になります。

Non-blockers(任意改善)

  • なし

LOOP_VERDICT

verdict: REQUEST_CHANGES
blockers:
  - safety_claim_matrix_missing
mergeable: MERGEABLE
merge_state_status: CLEAN
reviewed_head_sha: "17b98e389945d39e460b87285ec43fe4e311b03e"
merge_ready: false
required_auto_actions: []
auto_fix_applied: []
recommendations: []
follow_up_issue_requests: []

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE(承認・マージ可)

Mergeability(マージ可能性)

  • mergeable=MERGEABLE, merge_state_status=CLEAN(マージ可能・競合なし)

Evidence Check(証跡確認)

AC coverage(受け入れ条件網羅): 全 16 AC [x] 記載・根拠あり。PR 本文の ## 受け入れ条件の達成状況 が全件 PASS と一致。

Allowed Paths 遵守: 変更ファイル 3 件がすべて Allowed Paths 内。.claude/skills/pr-review-judge/SKILL.md、.claude/skills/pr-review-judge/scripts/tests/test_loop_verdict_v2.py、.claude/agents/pr-reviewer.md ✓

CI Verification(CI 証跡):
CI run 26880219334(workflow: ci, headSha: 17b98e389945d39e460b87285ec43fe4e311b03e)が conclusion: success。python-test job の Run uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/ ステップが conclusion: success。typecheck, lint, test, build, e2e もすべて conclusion: success。CI_CHECK_RUN_SCOPED の必須条件(head_sha 一致・job/step が対象 VC に対応・conclusion=success)を満たす。TEST_VERDICT_MACHINE コメントなし(#88 pending)だが CI_CHECK_RUN_SCOPED が補助証跡として有効。

検証コマンド結果(VC 照合):
AC1–AC16 の全 VC コマンドを照合済み。LOOP_VERDICT_V2 が SKILL.md に 13 箇所(AC1 ✓)、ensure_closing_keyword が 5 箇所(AC3 ✓)、kind: update_branch が 1 箇所(AC4 ✓)、blocking_merge_ready が 10 箇所(AC5 ✓)、consumer_inventory が 1 箇所(AC16 ✓)確認。テスト関数 AC8–AC15 すべて存在確認済み。pytest は CI python-test job で PASS。

Schema Change Applicability(スキーマ変更適用範囲):
schema_change(LOOP_VERDICT → LOOP_VERDICT_V2 additive 拡張)。PR 本文にスキーマ消費者インベントリが存在し、consumer 一覧・pending 状況・cutover 方針が記載済み。compatibility: additive で breaking ではなく pending consumer(#631/#632)に follow-up 参照あり。APPROVE 禁止条件に非該当。

Safety Claim Matrix(iteration 1 追加・安全主張マトリクス確認):
必須列(Claim / Implemented? / Not controlled / Evidence / Follow-up)3 件すべて存在 ✓。Claim 1 の Not controlled に impl-review-loop step-5 routing 変更(#631 OPEN)を明記し bounded claim として成立。PR title/summary に無限定の safe/isolated/complete 主張なし ✓。Evidence 列のテスト名(test_auto_fix_applied_always_empty_on_first_output → 実際は test_auto_fix_applied_is_empty_on_initial_output)に軽微な命名不一致あり。CI PASS で機能確認済みのため non-blocker。

Runtime Verification Applicability(動作検証適用性):
decision: not_applicable。変更対象は SKILL.md とテストファイルのみ(runtime 動作に影響しない)。

Closes #630: 存在 ✓

Blockers(ブロッカー)

なし

Non-blockers(任意改善)

  1. Safety Claim Matrix の Claim 3 Evidence 列に記載されたテスト名(test_auto_fix_applied_always_empty_on_first_output)が実際の関数名(test_auto_fix_applied_is_empty_on_initial_output)と不一致。マージブロックなし。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "17b98e389945d39e460b87285ec43fe4e311b03e"
merge_ready: true
mergeability:
  mergeable: MERGEABLE
  merge_state_status: CLEAN
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests:
  - title: "Safety Claim Matrix Evidence 列のテスト名表記を実際の関数名に修正する(AC14 claim 3)"
    issue_kind: implementation
    severity: optional_follow_up
    blocking_merge_ready: false
    source:
      kind: pr_review
      url: "https://github.com/squne121/loop-protocol/pull/637"
      note_id: "1"
    dedupe_key: "follow-up:squne121/loop-protocol:pr/637:1"
    desired_destination: "Safety Claim Matrix の Evidence 列が実在するテスト関数名と一致している状態"
    validated_scope_delta: ".claude/skills/pr-review-judge/scripts/tests/test_loop_verdict_v2.py または PR 本文の Safety Claim Matrix を修正し AC14 Evidence のテスト名表記を統一する"
    origin_skill: pr-review-judge
    labels:
      - triage-required
    initial_label_profile: documentation
    materialization: optional

@squne121

squne121 commented Jun 3, 2026

Copy link
Copy Markdown
Owner Author

判定: REQUEST_CHANGES

PR #637 は #630 の LOOP_VERDICT_V2 化を狙った変更で、差分は .claude/agents/pr-reviewer.md、.claude/skills/pr-review-judge/SKILL.md、test_loop_verdict_v2.py の3ファイルです。PR上では最終的に APPROVE / merge_ready: true のレビューコメントが付いていますが、現差分には V2 契約を壊す残骸が残っているため、私はマージ不可と判定します。([GitHub]1)

ブロッカー

1. Verdictテンプレートが V1 と V2 の混在状態

SKILL.md の Verdict コメントテンプレートに ## LOOP_VERDICT と ## LOOP_VERDICT_V2 が併存し、さらに V2 で禁止しているはずの mergeable、mergeStateStatus、recommendations がテンプレート内に残っています。一方で同じ差分内の V2 制約は snake_case のみ、mergeStateStatus と recommendations 禁止、と明記しています。これは自己矛盾です。([GitHub]1)

修正方針は、テンプレートから V1 ブロックを完全削除し、## LOOP_VERDICT_V2 の fenced YAML だけを残すことです。加えて、テストで実際の SKILL.md テンプレートを抽出して、禁止キーが存在しないことを検証してください。

2. required_auto_actions が #630 / #626 の契約と不一致

#630 の AC1 は required_auto_actions に {kind, executor, skill, blocking_merge_ready} を要求しています。親Issue #626 の設計でも required_auto_actions には skill が含まれ、implementation-worker が update_pr_body_hygiene / update_branch 等へ機械的に委譲する前提です。ところが PR #637 の V2 schema には skill がありません。これでは #632 側の「required_auto_actions が残っている限り終了しない」ループは作れても、どの skill に渡すかを機械判定できません。([GitHub]2)

最低限、各 action はこういう形に寄せるべきです。

required_auto_actions:
  - kind: ensure_closing_keyword
    executor: implementation-worker
    skill: open-pr.update_pr
    blocking_merge_ready: true
    mechanical: true

  - kind: update_branch
    executor: implementation-worker
    skill: implement-issue.update_branch
    blocking_merge_ready: true
    mechanical: true
    expected_head_sha: "<head sha>"

3. recommendations 廃止が実装文書上で完了していない

#630 は recommendations: [update_branch] を廃止し、required_auto_actions へ置き換える設計です。しかし SKILL.md にはまだ recommendations の決定ロジック、recommendations=[update_branch]、この recommendations を LOOP_VERDICT YAML に含める という説明が残っています。これは単なる表記ゆれではなく、エージェントが旧出力を再生成する誘因です。([GitHub]2)

修正は、recommendations という出力概念を pr-review-judge の手順・テンプレート・例から完全に削除することです。互換性の説明が必要なら「旧 consumer は移行完了まで読めるが、新規出力では emit しない」と分離して書くべきです。

4. テストが実際の欠陥を捕捉できていない

追加テストは helper dict を組み立てて recommendations がないことを確認していますが、実際の SKILL.md テンプレートに残っている recommendations や mergeStateStatus を検出できていません。さらに v2_section_match を作っている箇所でも、実質的には "kind: update_branch" の存在確認に留まっており、V2ブロックの構造検証になっていません。([GitHub]3)

追加すべきテストは次です。

def test_verdict_template_is_v2_only():
    skill = SKILL_PATH.read_text()
    verdict_template = extract_verdict_template(skill)

    assert "## LOOP_VERDICT\n" not in verdict_template
    assert "mergeStateStatus:" not in verdict_template
    assert "mergeable:" not in verdict_template
    assert "recommendations:" not in verdict_template
    assert "## LOOP_VERDICT_V2" in verdict_template
    assert "merge_state_status:" in verdict_template
    assert "required_auto_actions:" in verdict_template

5. Draft状態と merge_ready: true の意味が曖昧

PR #637 は Draft PR です。一方で PR上の最終コメントは merge_ready: true を出しています。#626 のゴールは「人間がマージ判断できる Draft PR ready 状態」なので、内部的な終端条件としての merge_ready と、GitHub上で実際にマージ可能な状態は分ける必要があります。現状の命名だと、Draftでも merge_ready: true になり得るため、将来の自動化で誤解を招きます。(GitHub)

修正案はどちらかです。

draft_pr_ready: true
merge_ready: false

または、merge_ready を「GitHub UI上の即時マージ可能性ではなく、レビュー・修正ループの終端条件」と定義し、Draft PR との関係を明文化してください。

高品質化ポイント

ensure_closing_keyword の検出は GitHub公式仕様に寄せるべきです。GitHub Docs は close/closes/closed、fix/fixes/fixed、resolve/resolves/resolved をサポートし、同一repoなら KEYWORD #ISSUE、別repoなら KEYWORD OWNER/REPO#ISSUE、コロンや大文字も許容します。現テスト helper の #\d+ 前提だけでは別repo参照や Closes: #10 系の仕様を十分に表現できません。([GitHub Docs]5)

update_branch は GitHub REST API の Update a pull request branch に寄せて、expected_head_sha を必須にする設計が妥当です。GitHub公式APIも expected_head_sha を受け取り、head SHA が一致しない場合は 422 になり得るため、stale guard として使えます。([GitHub Docs]6)

merge_state_status: UNSTABLE を merge_ready 条件に含める点は明示的なポリシーが必要です。テストでは “CI flaky but mergeable” として true を期待していますが、CI不安定状態を merge_ready に含めるなら、「required checks がない場合だけ許容」「branch protection 上は mergeable であることを優先」などの判断基準を schema に書くべきです。([GitHub]3)

PR上の既存レビューでも Safety Claim Matrix の evidence test 名ミスマッチが non-blocker として指摘されています。これは軽微ですが、V2 schema のような契約変更では証跡名のズレも検索性・監査性を落とすため、同時修正でよいです。([GitHub]4)

レビューコメント案

REQUEST_CHANGES

`LOOP_VERDICT_V2` 化の方向性は妥当ですが、現差分は V2 契約としてまだ閉じていません。

Blockers:
1. Verdict template still contains `## LOOP_VERDICT`, `mergeable`, `mergeStateStatus`, and `recommendations`, while V2 constraints explicitly forbid legacy/camelCase fields.
2. `required_auto_actions` does not include the `skill` field required by #630 AC1 and parent #626 schema, so the executor cannot dispatch mechanically.
3. `recommendations` prose and decision logic remain in `SKILL.md`, contradicting the V2 replacement.
4. Tests validate helper-generated dicts, not the actual `SKILL.md` verdict template, so they do not catch the current legacy-field regression.
5. Draft PR semantics are not modeled; `merge_ready: true` on a Draft PR needs either a separate `draft_pr_ready` field or an explicit definition.

Please remove the V1 template completely, add `skill` to `required_auto_actions`, delete all `recommendations` output guidance, and add tests that parse the actual `SKILL.md` verdict template and fail on `mergeStateStatus`, `mergeable`, `recommendations`, or `## LOOP_VERDICT`.

現時点では、PR上の APPROVE 判定は甘いです。#630 の中核である「auto-fixable hygiene を follow-up/recommendations に逃がさず、machine-readable action として閉じる」という目的に対して、schema とテンプレートがまだ一致していません。

…st coverage

- B1: Verdict template already V2-only; verified no V1 remnants
- B2: Add `skill` field to `required_auto_actions` entries in logic pseudocode and schema definition
- B3: Replace `recommendations: [update_branch]` reference with `required_auto_actions` in Step 2 BEHIND description; clarify V2 compatibility note
- B4: Add TestVerdictTemplateIsV2Only with extract_verdict_template helper to verify no V1 remnants in template
- B5: Add Draft PR / merge_ready semantics explanation — merge_ready is impl-review-loop termination signal, independent of GitHub UI merge readiness

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE(承認・判定)

Mergeability(マージ可能性)

  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check(証跡確認)

  • AC coverage: 16/16 PASS(PR 本文の受け入れ条件達成状況がすべて [x])
  • Allowed Paths: 遵守(変更ファイル 3 件すべてが Allowed Paths 内)
    • .claude/agents/pr-reviewer.md
    • .claude/skills/pr-review-judge/SKILL.md
    • .claude/skills/pr-review-judge/scripts/tests/test_loop_verdict_v2.py
  • CI Verification: CI_CHECK_RUN_SCOPED 条件を満たす。head_sha=2a4e76fab01881612775afa04fa5ee58fcb85bcc と一致するワークフロー run 26881794117(ci)の全 6 ジョブ(lint/typecheck/python-test/build/e2e/test)がすべて conclusion=success。run 26881794128(Check Japanese Content)も success。
  • 検証コマンド結果: AC1-AC16 の全 VC が PR 本文で記録済み。pytest 108 テスト(旧 50 + 新規 58)PASS。pnpm typecheck/lint/test/build PASS。

B1-B5 修正の確認(iteration 1 → 2)

  • B1(Verdict テンプレート V1 残骸): ## Verdict コメントテンプレート セクションに ## LOOP_VERDICT_V2 のみが残り、## LOOP_VERDICT(V1)・mergeStateStatus・recommendations が完全に除去されていることを SKILL.md 直接確認済み。
  • B2(skill フィールド欠落): SKILL.md Step 5 の分類ロジック・LOOP_VERDICT_V2 スキーマ定義の両方に skill: open-pr.update_pr | implement-issue.update_branch が追加されていることを確認済み。test_skill_md_skill_field_in_required_auto_actions テストが検証。
  • B3(recommendations 出力ロジック残存): Step 2 の BEHIND ハンドリングが required_auto_actions に kind: update_branch を追加する に書き換えられ、recommendations への言及が廃止注記のみに整理されていることを確認済み。
  • B4(テストが SKILL.md テンプレートを直接検証しない): test_verdict_template_is_v2_only が extract_verdict_template() で SKILL.md のテンプレートセクションを実際に抽出し、## LOOP_VERDICT\n・mergeStateStatus:・recommendations: の不在と ## LOOP_VERDICT_V2・merge_state_status:・required_auto_actions: の存在を検証していることを確認済み。
  • B5(Draft PR と merge_ready の意味が曖昧): SKILL.md Step 5 の merge_ready と Draft PR について セクションに「merge_ready: true は impl-review-loop の終端条件であり GitHub UI 上の即時マージ可能性とは独立する」と明記されていることを確認済み。test_merge_ready_draft_pr_semantics_documented が検証。

Blockers(ブロッカー)

  • なし

Non-blockers(任意改善)

  • なし

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "2a4e76fab01881612775afa04fa5ee58fcb85bcc"
merge_ready: true
mergeability:
  mergeable: MERGEABLE
  merge_state_status: CLEAN
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []

@squne121
squne121 marked this pull request as ready for review June 3, 2026 11:40
@squne121
squne121 merged commit da04435 into main Jun 3, 2026
15 checks passed
@squne121
squne121 deleted the worktree-issue-630-pr-review-judge-loop-verdict-v2-merge-re branch June 3, 2026 11:40
squne121 added a commit that referenced this pull request Jul 31, 2026
- step-5-feedback-and-termination.md: worker_status_stale_verdict now
  routes to re-review (not human_escalation), reconciling a contradiction
  with step-5-mergeability-handling.md's UPDATE_BRANCH_RESULT_V1.stale_verdict
  row and route_loop_verdict_v2()'s own route_stale_head_rereview semantics.
  Staleness alone must never be a human-escalation reason.
- pr-reviewer.md: removed a dangling reference to the removed "controlled
  review publisher" mechanism.
- Deleted .claude/skills/pr-review-judge/scripts/tests/test_loop_verdict_v2.py
  (explicitly authorized for deletion by Issue #1873's own Allowed Paths):
  a self-contained legacy #637-era LOOP_VERDICT_V2 schema test with zero
  production-code imports that pinned removed reviewer self-report fields
  (merge_ready/required_auto_actions/mergeability) as required SKILL.md
  content.
- test_handoff_pr_hygiene_regression.py / test_termination_gate.py: two
  doc-presence tests were asserting the removed field names
  (required_auto_actions / merge_ready) as things step-5-mergeability-
  handling.md must reference; flipped to assert the actual #1873 replacement
  contracts (route_to_update_branch synthesis, live_mergeability routing).
- issue-refinement-loop/SKILL.md: fixed a reference-map row pointing at the
  deleted schemas/loop_state.schema.json to the anchor_comment schema it was
  extracted into.

Also updated Issue #1873's Allowed Paths (with readback) to cover three
additional files identified by iteration-2 review:
isolation_issue_comment_bridge.py, run_refinement_preflight.py,
test_pretool_fastpath_classifier.py. Verified programmatically that all 173
files in `git diff origin/main...HEAD` are now covered by the live Allowed
Paths list.
squne121 added a commit that referenced this pull request Jul 31, 2026
…換する (#1875)

* 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する

Closes #1873
Part of #1860

issue-refinement-loop と impl-review-loop の通常経路から、replay
arbitration(reviewer_claim_replay.py 系)、parent binding digest
(parent_replay_binding.py)、review envelope V2
(emit_parent_review_envelope_v2.py)、永続 state store
(build_loop_state.py / build_refinement_phase_state.py /
save_loop_state_before_compaction.sh)、専用 termination/review
publisher(termination_report.publish / pr_review.publish command id、
publish_termination_report.py / render_termination_report.py /
pr_review_marker_archive_exec.py)を撤去し、native subagent の bounded
loop(verdict / reviewed_head_sha または reviewed_body_sha256 /
blockers / optional warnings の最小 convention)へ置換した。

- impl-review-loop: route_loop_verdict_v2.py を、reviewer 自己申告の
  merge_ready/required_auto_actions/allowed_paths_gate に依存しない
  設計へ再設計。mergeability hard-stop 不変条件(CONFLICTING/DIRTY
  のみ hard stop、#1869/PR#1871 で確立)は完全に維持。
- publisher 撤去: controlled_skill_mutation_policy.py /
  controlled_skill_mutation_exec.py から termination_report.publish /
  pr_review.publish の command id 固有 branch のみ除去(他 7
  command id と共通機構は無変更)。最終 summary は通常の
  `gh issue comment --body-file` / `gh pr comment --body-file`
  経路へ移行。
- isolation-worktree issue comment bridge(Issue #1633、
  issue_comment.publish 用)を publish_termination_report.py から
  isolation_issue_comment_bridge.py へ分離抽出し、無関係な保護対象
  機能を保持したまま termination publisher 部分のみ削除。
- ANCHOR_SCOPE_REFRAME_V1(#1869 所有)が参照する anchor_comment
  JSON Schema フラグメントを loop_state.schema.json から
  anchor_comment.schema.json へ抽出し、validation ロジック自体は
  無変更のまま schema ファイル本体を削除可能にした。
- decide_next_loop_action.py を verdict/iteration/max_iterations(3)
  のみに依存する bounded loop 判断へ縮小。
- .claude/agents/issue-reviewer.md・pr-reviewer.md(.codex/agents/
  mirror 含む)を最小 convention の read-only reviewer 定義へ整合。
- 新規 schema・digest・receipt・publisher・state machine は追加せず、
  schemas/catalog.yaml・docs/dev/schema-governance.md 等の該当行を
  削除して同期。

Verification(current head, worktree issue-1873-bounded-review-loops):
- uv run --locked pytest .claude/skills/issue-refinement-loop/ -q
  → 1096 passed
- uv run --locked pytest .claude/skills/impl-review-loop/ -q
  → 470 passed, 2 deselected, 2 xfailed
- uv run --locked pytest .claude/skills/pr-review-judge/ -q
  → 414 passed
- uv run --locked pytest scripts/agent-guards/tests/ -q
  → 1110 passed, 1 skipped, 1 deselected
- uv run --locked pytest tests/agent_guards/ tests/test_agent_parity.py
  → 291 + 49 passed
- uv run --locked pytest .claude/hooks/tests/ tests/test_hook_boundaries_doc.py
  → 899 + 33 passed
- uv run --locked ruff check(変更ファイルに新規違反なし。repo-wide
  183件は本PR対象外ファイルの既存違反で origin/main と同一)
- pnpm typecheck / pnpm lint / pnpm test(1794 passed)/ pnpm build
  → すべて成功
- git diff --check → clean

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(review): PR review指摘に対応しtest_controlled_skill_mutation_exec.pyの汎用/issue_dependency.remove専用テストカバレッジを復元する

削除された汎用executor機構テストをissue_comment.publish代表値で再構築し(レガシーな
termination_report.publish専用API廃止に伴い低レベル欠落フィクスチャのみ補完)、
issue_dependency.remove系15クラスをそのまま復元。pyproject.tomlにE402 per-file-ignore
を再登録。

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(review): command_registry.pyのdangling entry除去とIssue review出力にREVIEWED_BODY_SHA256を追加 (#1873)

decide.runエントリから撤去済みphase-state gate機能への参照(--phase-state-file)を削除し、
実際のdecide_next_loop_action.pyのargparse定義と一致することをregressionテストで検証する。
compact_review_result.pyのcompact stdoutにREVIEWED_BODY_SHA256行を追加し、
Issue #1873のOutcome規定に沿うfield名でreviewed live bodyのsha256を露出する。

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(ci): pyproject.tomlのstale E402 per-file-ignoreを除去 (#1873)

test_scope_signal_guard_termination.py はrender_termination_report.py
撤去に伴いE402を誘発するimportが既に無くなっており、
scripts/ci/verify_ruff_configuration.pyのisolated E402 probeがfail
していた(PR #1875 レビュー指摘)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(ci): PR Body/changed-md Japanese Check とcodex agent構造化出力チェックを修正 (#1873)

changed *.md の per-block 日本語比率不足5件(見出しブロックの日本語比率不足4件、
verdict-output-template.mdのnested code fence起因の未パース1件)を解消し、
.codex/agents/pr-reviewer.toml の developer_instructions に
「structured output」要件文言を明記してscripts/check-codex-agents.mjsの
必須assertionを満たすようにした。

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: address iteration-1 REQUEST_CHANGES blockers/warnings

- docs/dev/agent-skill-boundaries.md: fix stale BEHIND-authority reference
  (LOOP_VERDICT_V2.mergeability -> live_mergeability), add
  HUMAN_REVIEW_REQUIRED to the verdict enum shown in the routing_allowed_fields
  table.
- route_loop_verdict_v2.py: repoint the docstring's dangling pointer to a
  docs/dev/workflow.md section that does not exist, to the actual
  pr-review-judge references that document the minimal convention.
- step-4-pr-review.md: fix stale line claiming the pr-reviewer SubAgent posts
  the verdict comment (it cannot -- no Write/Edit tools); fix a leftover
  LOOP_VERDICT_V2.blockers reference to reviewer_verdict.blockers[].
- impl-review-loop/SKILL.md: remove stale_snapshot from the gate status
  column (it is now warnings[]-only, per allowed-paths-gate.md).
- implementation-worker.md: reframe the action-kind dispatch table heading
  away from the removed required_auto_actions reviewer field.
- verdict-output-template.md: add HUMAN_REVIEW_REQUIRED to the example
  heading.

Also updated Issue #1873's Allowed Paths / Current Validated Scope sections
(with readback) per its own "consumer discovered during implementation"
procedure, to cover the additional files touched while reconciling the
Allowed Paths gate advisory-fingerprint change with #1860/#1871.

* fix: address iteration-2 REQUEST_CHANGES blockers

- step-5-feedback-and-termination.md: worker_status_stale_verdict now
  routes to re-review (not human_escalation), reconciling a contradiction
  with step-5-mergeability-handling.md's UPDATE_BRANCH_RESULT_V1.stale_verdict
  row and route_loop_verdict_v2()'s own route_stale_head_rereview semantics.
  Staleness alone must never be a human-escalation reason.
- pr-reviewer.md: removed a dangling reference to the removed "controlled
  review publisher" mechanism.
- Deleted .claude/skills/pr-review-judge/scripts/tests/test_loop_verdict_v2.py
  (explicitly authorized for deletion by Issue #1873's own Allowed Paths):
  a self-contained legacy #637-era LOOP_VERDICT_V2 schema test with zero
  production-code imports that pinned removed reviewer self-report fields
  (merge_ready/required_auto_actions/mergeability) as required SKILL.md
  content.
- test_handoff_pr_hygiene_regression.py / test_termination_gate.py: two
  doc-presence tests were asserting the removed field names
  (required_auto_actions / merge_ready) as things step-5-mergeability-
  handling.md must reference; flipped to assert the actual #1873 replacement
  contracts (route_to_update_branch synthesis, live_mergeability routing).
- issue-refinement-loop/SKILL.md: fixed a reference-map row pointing at the
  deleted schemas/loop_state.schema.json to the anchor_comment schema it was
  extracted into.

Also updated Issue #1873's Allowed Paths (with readback) to cover three
additional files identified by iteration-2 review:
isolation_issue_comment_bridge.py, run_refinement_preflight.py,
test_pretool_fastpath_classifier.py. Verified programmatically that all 173
files in `git diff origin/main...HEAD` are now covered by the live Allowed
Paths list.

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant