Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#626"
goal_ref: "impl-review-loop の終了条件を APPROVE && merge_ready && required_auto_actions == [] に統一し、required_auto_actions が残る限り termination_reason: approved にしない gate を実装する(C5 vs C6 競合の解消)"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal: 各 skill の既定完了条件を goal まで引き上げる。
/impl-review-loop <N>は追加オプションなしで、成功時にIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readyかつmerge_ready: trueを返す。 - Desired Destination:
impl-review-loop_default_completion.terminal_success_state: draft_pr_ready。PR review loop reaches APPROVE with merge_ready == true。human is left with merge / close / request-changes decision only。
Current Validated Scope
step-5-feedback-and-termination.mdのAPPROVE即終了ロジックをrequired_auto_actionsgate 付きに変更するstep-5-mergeability-handling.mdの BEHIND 分岐との競合(C5 vs C6 conflict)を解消し、required_auto_actions未消化状態ではtermination_reason: approvedに到達しないことを保証する- 終了条件を
APPROVE && merge_ready == true && required_auto_actions == []に統一した判定ブロックをドキュメントに記述する - 上記 gate に対応する決定論的なユニットテストまたは fixture ベーステストを追加する
Remaining Parent Gaps
- child-3 (実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630):
pr-review-judge出力にmerge_ready/required_auto_actions/auto_fix_appliedを追加(LOOP_VERDICT_V2)— 本 child の gate が参照するフィールドの定義元 - child-4:
implementation-workerへのrequired_auto_actions委譲 mode 追加 - child-1 / child-2 / child-6 / child-7: 他の gap(SSOT / refinement-loop terminal / autonomy policy / 回帰テスト全般)
Outcome
step-5-feedback-and-termination.md および step-5-mergeability-handling.md が更新され、required_auto_actions が空でない限り termination_reason: approved に到達しない終了条件 gate が実装されて、関連テストが PASS している状態。
In Scope
step-5-feedback-and-termination.mdの終了条件マトリクス(APPROVE 即終了ブロック)を以下ロジックに書き換える:if verdict == APPROVE and required_auto_actions is not empty: route required_auto_actions to implementation-worker; rerun verification if head changed; rerun pr-reviewer; do not terminate if verdict == APPROVE and merge_ready == true and required_auto_actions == []: terminate approved if required_auto_actions exists but executor/skill is unknown: human_escalationstep-5-mergeability-handling.mdとの整合性確認(BEHIND 分岐がrequired_auto_actionsに統合されることを明記、または現行 BEHIND 分岐がrequired_auto_actionsの一形態として扱われることを記述)- 終了判定 gate に対応するテスト:
required_auto_actionsが残る状態でtermination_reason: approvedにならないことを fixture / assert で検証 Refs #626をコミットメッセージまたは PR 本文に含めるrequired_auto_actions実行後の rerun ルーティング:
required_auto_action_result_routing:
update_pr_body_hygiene:
head_change_expected: false
rerun: { verification: false, pr_review: true }
ensure_closing_keyword:
head_change_expected: false
rerun: { verification: false, pr_review: true }
update_branch:
head_change_expected: true
rerun: { verification: true, pr_review: true }
worker_status_failed: { route: human_escalation }
worker_status_blocked: { route: human_escalation }
worker_status_permission_blocked: { route: human_escalation }APPROVE && merge_ready == true && required_auto_actions == []の終了 gate において、merge_ready: trueはmergeability.merge_state_status == CLEANを要件とする。UNSTABLEの場合は人間判断(human_escalation)または repo policy 証跡による明示的な許可を必要とする
Out of Scope
LOOP_VERDICT_V2スキーマ(merge_ready/required_auto_actionsフィールド定義)の追加 — child-3 (実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630) のスコープimplementation-workerへのapply_pr_review_fix_delta/update_branchmode 追加 — child-4 のスコープAUTONOMY_POLICY_V1policy ドキュメントの追加 — child-6 のスコープissue-refinement-loopの terminal contract 変更 — child-2 (実装: issue-refinement-loop の terminal contract を LOOP_HANDOFF_RESULT_V1.status: impl_ready に固定する #628) のスコープ--auto-ready-on-approveフラグ実装 — 実装: impl-review-loop に APPROVE 時 PR Draft 解除の --auto-ready-on-approve フラグを追加する #51 のスコープ(Allowed Paths 重複するが異なる機能)- snake_case 統一 — 実装: LOOP_VERDICT / TEST_VERDICT_MACHINE の YAML キー名を snake_case に統一する #56 のスコープ(Allowed Paths 重複するが異なる機能)
Acceptance Criteria
- AC1:
step-5-feedback-and-termination.mdにAPPROVE即終了ブロック(verdict: APPROVEのみを条件とする旧ロジック)が残っていない(rgで検証) - AC2:
step-5-feedback-and-termination.mdにrequired_auto_actions == []を終了条件とする記述が追加されている(rgで検証) - AC3:
step-5-feedback-and-termination.mdにrequired_auto_actionsが空でない場合はimplementation-workerへ委譲して終了しないルーティングが記述されている(rgで検証) - AC4:
required_auto_actionsが残る状態でtermination_reason: approvedにならないことを決定論的に検証するテストが存在し PASS する(uv run pytestで検証) - AC5:
step-5-mergeability-handling.mdの BEHIND 分岐とstep-5-feedback-and-termination.mdの終了条件の間に矛盾(C5 vs C6 競合)が解消されており、APPROVE + BEHIND の場合にtermination_reason: approvedが立たないことが本文から読み取れる - AC6:
impl-review-loop/SKILL.mdのトップレベル終了条件がLOOP_VERDICT.verdict: APPROVE単独での終了ではなく、APPROVE && merge_ready == true && required_auto_actions == []に更新されている(rgで検証) - AC7:
step-5-mergeability-handling.mdがLOOP_VERDICT_V2の fenced YAML のみを parse し、V2 consumer path では top-levelmergeStateStatus/recommendationsを参照しない(rgで検証) - AC8: body-only な required_auto_actions(
ensure_closing_keyword/update_pr_body_hygiene)は head SHA 不変でも PR review を再実行する(fixture テストで検証) - AC9:
update_branchauto action は worker の successful head SHA 変更後に verification と PR review の両方を再実行する(fixture テストで検証) - AC10: worker result の
failed/blocked/permission_blockedはtermination_reason: approvedに到達しない(fixture テストで検証) - AC11:
reviewed_head_shaが現在 head と不一致の場合、dispatch 前に PR review を再実行する(fixture テストで検証) - AC12: 最終 approved 終了時に
IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readyかつmerge_ready: trueを emit する(rgで検証)
Verification Commands
# AC1
# preflight-scope: pr_review_only
$ rg -c "verdict.*APPROVE" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md# AC2
# preflight-scope: pr_review_only
$ rg -n "required_auto_actions" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md# AC3
# preflight-scope: pr_review_only
$ rg -n "implementation-worker" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md# AC4
$ uv run pytest .claude/skills/impl-review-loop/tests/ -v# AC5
# preflight-scope: pr_review_only
$ rg -n "termination_reason.*approved" .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md# AC6
# preflight-scope: pr_review_only
$ rg -n "LOOP_VERDICT.*APPROVE\|verdict.*APPROVE.*終了" .claude/skills/impl-review-loop/SKILL.md# AC7
# preflight-scope: pr_review_only
$ rg -n "mergeStateStatus\|recommendations" .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md# AC8
# AC9
# AC10
# AC11
# preflight-scope: pr_review_only
$ uv run pytest .claude/skills/impl-review-loop/tests/ -v -k "loop_verdict_v2 or required_auto_actions or termination_gate"# AC12
# preflight-scope: pr_review_only
$ rg -n "IMPL_REVIEW_LOOP_RESULT_V1|draft_pr_ready|merge_ready" .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.mdAllowed Paths
.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md.claude/skills/impl-review-loop/tests/(テスト追加時).claude/skills/impl-review-loop/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
LOOP_VERDICT_V2のスキーマ(child-3 / 実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630 のスコープ)への変更が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Runtime Verification Applicability
本 Issue の変更対象はワークフロー文書・スクリプトのみです。ゲームの実行時動作には影響しません。
decision: not_applicable
reason: "Workflow documentation and script changes only. No runtime game behavior changed."Delivery Rule
1 Issue = 1 PR- Draft PR 既定
Refs #626を PR 本文に含める- Depends on 実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630(child-3):
LOOP_VERDICT_V2のmerge_ready/required_auto_actionsフィールドが追加されてから本 Issue の実装が機能するため、child-3 のマージ後に本 Issue を実装する(または child-3 と合意した仮スキーマで先行実装し、child-3 マージ後に整合性を確認する)
依存関係:
- 実装: pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加する #630 / PR feat(#630): pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / required_auto_actions を追加 #637: LOOP_VERDICT_V2 producer(
merge_ready/required_auto_actionsフィールド定義元) - 実装: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる(#626 child-4) #631 / PR feat: implementation-worker に IMPLEMENTATION_WORKER_REQUEST_V2 mode を追加し PR repair executor として機能させる (#631) #638: IMPLEMENTATION_WORKER_REQUEST_V2 executor(
required_auto_actionsdispatch 実行元)
この Issue は 両依存がマージされるまで functional dispatcher 実装を行わない。どちらかが未マージの場合、実装はドキュメント専用の parser 準備に限定し、dispatch 実行コードは追加しない。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jun 3, 2026
判定: REQUEST_CHANGES
Issue #632 の方向性は正しいです。
APPROVEだけで終了せず、APPROVE && merge_ready == true && required_auto_actions == []を唯一の成功終了条件にする方針は、親 Issue #626 の termination enforcement と一致しています。親 Issue でも、required_auto_actionsが残る場合はimplementation-workerに委譲し、検証・PR review を再実行して、空になって初めて approved 終了すると定義されています。([GitHub]1)ただし、#632 の現行 contract はまだ実装安全ではありません。このまま実装すると、旧
LOOP_VERDICTparser が残ったまま grep ベースの AC だけ通り、mergeStateStatus/recommendations/verdict: APPROVEの旧系統とLOOP_VERDICT_V2の新系統が混在して、誤終了する余地があります。重大ブロッカー
1. 依存関係が #630 のみになっているのは誤り
#632 は Delivery Rule で #630 依存だけを明記していますが、#632 の in-scope は
required_auto_actionsをimplementation-workerに委譲することを含みます。これは #631 / PR #638 が定義するIMPLEMENTATION_WORKER_REQUEST_V2と worker mode が存在して初めて成立します。#631 側はupdate_pr_body_hygiene、update_branch、apply_pr_review_fix_deltaの mode と、expected_head_shaを使う stale verdict 防止を定義しています。([GitHub]2)修正案: #632 の
Delivery RuleにDepends on #630 and #631を明記してください。さらに「#630/#631 が未マージなら parser-only 変更に限定し、dispatch 実行は blocked」とするか、「#630/#631 マージ後のみ着手」としてください。2. Allowed Paths に
impl-review-loop/SKILL.mdがない現行 main の
.claude/skills/impl-review-loop/SKILL.mdには、トップレベルの終了条件としてLOOP_VERDICT: APPROVEなら終了、という旧記述が残っています。#632 の Allowed Paths はstep-5-feedback-and-termination.md、step-5-mergeability-handling.md、tests のみなので、step ファイルを直しても SKILL.md の入口説明と矛盾します。([GitHub]3)修正案: Allowed Paths に以下を追加してください。
AC も追加するべきです。
3. 旧 parser の除去条件が弱い
現在の
step-5-mergeability-handling.mdはmergeStateStatusとrecommendationsを grep で読む旧設計です。一方、#630 / PR #637 のLOOP_VERDICT_V2は snake_case 専用で、mergeStateStatusとrecommendationsを V2 では廃止し、mergeability.merge_state_statusとrequired_auto_actionsに寄せています。([GitHub]4)修正案: #632 の AC に以下を追加してください。
grep ではなく、fixture YAML を Python で parse するテストにしてください。
rg -c "verdict.*APPROVE"は「記述が残っているか」を見るだけで、制御フローの安全性を証明しません。4.
required_auto_actions実行後の再実行条件が雑#632 は「head changed なら verification rerun、pr-reviewer rerun」と書いていますが、
ensure_closing_keyword/update_pr_body_hygieneは PR body を変えるだけで head SHA は変わりません。それでもrequired_auto_actionsが消えたか確認するため、PR review は再実行必須です。逆にupdate_branchは head SHA が変わるので、verification と PR review の両方が必須です。#631 / PR #638 は worker result にrerun_required、before_head_sha、after_head_sha、wrapper_used、statusを返す設計を置いています。([GitHub]5)修正案: #632 に dispatch result matrix を追加してください。
5. GitHub API の実装仕様を Issue に落とし込めていない
GitHub の
Update a pull request branchREST API は、base branch の HEAD を PR branch に merge して更新する endpoint です。GitHub App で実行する場合は head repository contents への write 権限も必要で、fine-grained token には Pull requests write 権限が必要です。expected_head_shaが PR HEAD と一致しない場合は422 Unprocessable Entityになり、レスポンスは202 / 403 / 422を取り得ます。([GitHub Docs]6)修正案: #632 の Step 5 consumer 側に、#631 worker result の
permission_blocked/blocked/failedを retry し続けない fail-closed ルールを追加してください。特に 403 は「自動継続」ではなく、人間判断または権限確認に落とすべきです。6.
merge_readyがUNSTABLEを許可する設計は危険#630 の V2 定義では
merge_state_status in [CLEAN, UNSTABLE]ならmerge_ready: trueにできる設計です。GitHub GraphQL のMergeStateStatusではUNSTABLEは merge 可能だが commit status が passing ではない状態として扱われます。([GitHub]7)これは repo の「人間が merge 判断だけを行える状態」と衝突する可能性があります。required checks が branch protection で必須なら
UNSTABLEは実質 merge-ready ではありません。修正案はどちらかです。
#632 の終了 gate は consumer 側なので、この判断を #630 に丸投げせず、少なくとも
merge_ready=trueを受け取った後にmergeability.merge_state_statusを再検査する防御を入れるべきです。追加すべきテスト
#632 の AC4 は「required_auto_actions が残る状態で approved にならない」だけでは不足です。最低限、以下の fixture テストを追加してください。
GitHub closing keyword の判定も、公式仕様に合わせて
close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved、大文字、コロン付き、同一 repo / cross repo syntax を扱うべきです。GitHub docs は PR description または commit message の supported keyword による issue auto-close と、default branch 以外では keyword が無視される点を明記しています。([GitHub Docs]8)Issue #632 に入れるべき具体修正
rg -n "LOOP_VERDICT: APPROVE|verdict: APPROVE.*終了|termination_reason: approved" \ .claude/skills/impl-review-loop/SKILL.md \ .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md \ .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.mdrg -n "mergeStateStatus|recommendations" \ .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.mdsqune121 commentedon Jun 3, 2026
issue-refinement-loop 完了: 実装準備完了状態に移行しました (2026-06-03T11:38:00Z)
issue-refinement-loop が iteration 2 で approve となり、実装準備完了状態に移行しました。
今回の refinement で適用された主な改善点は以下の通りです。依存関係の明記、Allowed Paths の拡張、AC の追加と VC のアノテーション付与を行いました。
feat(#630): pr-review-judge の出力を LOOP_VERDICT_V2 に拡張し merge_ready / r…
squne121 commentedon Jun 3, 2026
Contract Snapshot (2026-06-03T12:08:52Z)
step-5-feedback-and-termination.mdおよびstep-5-mergeability-handling.mdが更新され、required_auto_actionsが空でない限りtermination_reason: approvedに到達しない終了条件 gate が実装されて、関連テストが PASS している状態。pr_review_only.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md.claude/skills/impl-review-loop/tests/.claude/skills/impl-review-loop/SKILL.md.claude/worktrees/issue-632-impl-review-loop-approve-merge-ready-reqworktree-issue-632-impl-review-loop-approve-merge-ready-reqsqune121 commentedon Jun 3, 2026
Issue #632 Contract Review: go
全チェック通過。実装着手可能です。
チェック結果サマリー:
state/needs-humanなし)注意事項(warnings):
step-5-feedback-and-termination.mdおよびstep-5-mergeability-handling.mdが更新され、required_auto_actionsが空でない限りtermination_reason: approvedに到達しない終了条件 gate が実装されて、関連テストが PASS している状態。.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md・.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md・.claude/skills/impl-review-loop/tests/・.claude/skills/impl-review-loop/SKILL.md.claude/worktrees/issue-632-impl-review-loop-approve-merge-ready-reqworktree-issue-632-impl-review-loop-approve-merge-ready-reqfeat(#632): impl-review-loop 終了条件を APPROVE && merge_ready && required…
squne121 commentedon Jun 3, 2026
impl-review-loop 完了: Draft PR 準備完了 (2026-06-03)
impl-review-loop が iteration 1 で APPROVE となり、Draft PR が準備完了状態になりました。
ループ結果
実装内容
次のアクション
PR #640 を確認し、マージの判断をしてください: #640
非ブロッカー: impl-review-loop/tests/ を CI python-test の実行対象に追加する(現在は未対象)
squne121 commentedon Jun 3, 2026
implement-issue: 実装完了
.claude/worktrees/issue-632-impl-review-loop-approve-merge-ready-reqworktree-issue-632-impl-review-loop-approve-merge-ready-reqfix(#632): iteration 2 — B1-B6 blockers resolved in impl-review-loop …
squne121 commentedon Jun 3, 2026
impl-review-loop 完了: Draft PR 準備完了 (2026-06-04)
impl-review-loop が iteration 2(計 3 回)で APPROVE となり、Draft PR が準備完了状態になりました。
ループ結果
実装内容(最終版)
イテレーション履歴
次のアクション
PR #640 を Draft から準備完了に移行してマージをご判断ください: #640
実装: impl-review-loop 終了条件を APPROVE && merge_ready && required_auto_ac…
実装: pr-reviewer/pr-review-judge の重複を削減し preload を追加する (#1991)