Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "impl-review-loop に already_satisfied terminal route を実 production routing として追加し、behavioral AC が既に current main で満たされている no-op/obsolete な実装サイクルを、実装着手・PR作成前の early-exit と、ループ途中の main drift に対する Step 5 recovery route の両方で機械的に検出・構造化推奨できるようにする"
change_kind: workflowParent Issue
none
Parent Goal Ref
- Goal: N/A(単独改善)
- Desired Destination: N/A(単独改善)
Current Validated Scope
.claude/skills/impl-review-loop/steps/preparation.mdの Step 1 起動前の choke point(IMPL_REVIEW_INTAKE_CAPSULE_V1.next_action.route == proceed_to_step_1判定の直前)に、実装未着手・PR未作成の場合の already-satisfied early-exit を追加する.claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.pyに Step 5 recovery 用の新規 terminal route(ROUTE_ALREADY_SATISFIED)を追加する.claude/skills/impl-review-loop/SKILL.mdの終了条件表・LOOP_STATEtermination_reasonenum にalready_satisfiedを追加する
Remaining Parent Gaps
- なし
Outcome
impl-review-loop に already_satisfied terminal route が 実 production routing として 接続され、以下の2経路で機能する。
- 主経路(early-exit,
preparation.md): Issue に紐づく PR がまだ存在せず、かつ current main(evidence_base_sha)に対して独立実行した test-runner のTEST_VERDICT_MACHINE/v2(.claude/agents/test-runner.md既存契約)が Issue の全 Verification Commands を PASS する場合、implementation-worker dispatch および PR 作成の前に no-op 判定を出し、実装サイクルに進まない。 - recovery 経路(Step 5,
route_loop_verdict_v2.py): 既に PR が存在するループの Step 5 において、pr-reviewer の verdict がREQUEST_CHANGESであり、かつ current main(evidence_base_sha)に対する test-runner の独立TEST_VERDICT_MACHINE/v2が全 AC PASS(base_ac_satisfied: true)であり、かつその base 実行のruntime_ac_resultsの PASS 集合が、同一 PR head に対して直近に実行済みのTEST_VERDICT_MACHINE/v2の PASS 集合と完全一致する(meaningful_pr_delta: false)場合に限り、CONTINUE_LOOPではなくROUTE_ALREADY_SATISFIEDに route する。
いずれの経路も 判定と recommendation の構造化のみを担い、PR/Issue の無条件 auto-close は実行しない。recommendation は以下の形(route_loop_verdict_v2.py の RouteDecision に相乗りする形で構造化する。新規 schema ではなく既存 RouteDecision フィールド ── route / reason_code / errors 等 ── の値として表現する):
result:
status: no_change_required
termination_reason: already_satisfied
merge_ready: false
recommendation:
pr:
action: none | close
reason: no_pr_created | no_meaningful_delta
issue:
action: close
state_reason: completed
reason: requirement_already_deliveredpr.action: noneは PR 未作成の early-exit 経路(preparation.md)でのみ出力する。pr.action: closeは PR が既に存在しmeaningful_pr_delta: falseの recovery 経路(Step 5)でのみ出力する。issue.action.state_reasonは既存 GitHubstate_reason値(completed/not_planned/duplicate)を再利用し、独自 enum を新設しない。要求自体を放棄したnot_plannedとは明確に区別し、要求が current main で既に実現済みの場合のみcompletedを使う。
Evidence producers(判定根拠の生成元。新規 ledger / digest protocol / publisher は作らない)
base_ac_satisfied:.claude/agents/test-runner.mdが既に定義するTEST_VERDICT_MACHINE/v2(read-only report)を、PR head ではなくevidence_base_sha(current main HEAD)に対する checkout に対して独立実行した結果として定義する。runtime_ac_resultsに含まれる Issue 自身の Verification Commands が全てstatus: passの場合のみtrue。test-runner がこの用途で呼び出される際も、既存のTEST_VERDICT_MACHINE/v2schema・identity / run binding要件(contract_body_sha256等)をそのまま満たす(head_shaフィールドには base の commit SHA を記録する。新規 schema field は追加しない)。evidence_base_shaの値はgit rev-parse HEAD等のローカル checkout 由来の値であってはならず、.claude/skills/issue-refinement-loop/scripts/root_entry_router.pyのfetch_live_issue()が使用するgh api repos/{repo}/git/refs/heads/{base_ref} --jq '.object.sha'と同じ方法で liverefs/heads/mainの SHA を取得した値を用いる。既存のreviewed_base_sha/observed_base_sha(Issue 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102 main-drift semantics)と同一の取得パターンを踏襲し、新規の SHA 取得機構を発明しない。PR head の TEST_VERDICT が PASS したことから current main の AC 充足を推論すること(禁止事項)とは明確に異なる。meaningful_pr_delta(PR が既に存在する場合のみ評価。PR 未作成なら評価自体を行わない): 同一 Issue に対する2つの独立TEST_VERDICT_MACHINE/v2((a) 直近の PR head に対する実行、(b) 上記base_ac_satisfied算出時の base 実行)を比較し、両者のruntime_ac_resultsの PASS 集合(AC 単位)が完全一致する場合のみfalse。一方にのみ PASS する AC が1件でもあればtrue。pr-reviewer のblockers[]自由文の文字列検索、またはbase_ac_satisfied単独からの推論は行わない。pr-reviewer の既存4-field 契約(verdict/reviewed_head_sha/blockers/warnings、.claude/skills/pr-review-judge/references/loop-verdict-v2-schema.md)は変更しない。この比較は対象 Issue 自身の AC/VC 契約(runtime_ac_resultsが被覆する範囲)に限定された比較であり、PR diff 全体の監査ではない(.claude/agents/test-runner.mdのruntime_ac_results定義は「Issue の全 Verification Commands」の結果であって任意の PR diff 内容ではない)。対象 Issue の AC/VC 範囲外で PR が独立した価値(無関係な bug fix、AC に紐付かない invariant/test 追加等)を持つ場合、この比較だけでは no-op PR と区別できない。そのためpr.action: closerecommendation は常に「対象 Issue の AC/VC 範囲に限定した判定であり、PR 全体の診断ではない」ことを consumer 向けに明記し、#2041等の将来の consumer は本 recommendation だけを根拠に無条件で PR close を実行してはならず、独立した diff review を経由すべきことを明記する(recommendation は判定の構造化のみであり、それ自体は無条件 auto-close 実行権限を持たない、という既存の Out of Scope 制約と整合する)。この注記は本 Issue 本文だけでなくSKILL.mdの recommendation 構造記述箇所(AC8 対応箇所)にも記載し、#2041実装時に本文書を読まなくても参照できる durable な場所に残す。evidence_base_sha:route_loop_verdict_v2()は pure function であり自ら git 参照を取得しない。「現在の main HEAD」の唯一の既存キャリアはlive_mergeability.main_drift.current_base_sha(Issue 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102)であるため、already_satisfied_evidence.evidence_base_shaの freshness 判定はlive_mergeability.main_drift.current_base_shaをそのまま比較対象として再利用する(新規 SHA 取得・照合ロジックは追加しない)。したがってlive_mergeabilityにalready_satisfied_evidenceキーが存在する場合、同じlive_mergeabilityにmain_driftキーも co-occur することを要求する(main_driftが欠落している場合は freshness 判定不能として stale evidence 扱いにする)。base 実行時点で記録したevidence_base_shaが、判定消費時点のmain_drift.current_base_shaと一致しない場合は stale evidence としてalready_satisfiedを成立させない(既存 main-drift fail-closed 挙動を流用)。- scope 限界(fail-closed):
TEST_VERDICT_MACHINE/v2はhead_shaを「PR current head_sha」として定義し、pr_review_only分類の VC は実 PR への live CI workflow/CheckRun/artifact 束縛を要求する(.claude/agents/test-runner.md)。対象 Issue 自身の Verification Commands にpr_review_only分類の VC が含まれる場合、PR 未作成の early-exit 経路(preparation.md)では PR に束縛できないためbase_ac_satisfiedは構造的にtrueになり得ず、この early-exit は常に不発(fail-closed、誤判定ではなく単なる scope 外)である。これは意図した安全側の挙動であり、対象 Issue 設計時に明示しておく。 no_linked_pr_ever(PR未作成の判定定義): 「PR未作成」とは、対象 Issue に対して GitHub 上で構造化リンクされた PR が all-state(open/closed/merged)で一件も存在しないことを指す。判定にはgh pr list --search "<issue_number> in:body"のような自由文検索を用いず、gh pr list --state all --json number,closingIssuesReferences等で取得できるclosingIssuesReferences(構造化リンク情報)を用いる。これは.claude/skills/impl-review-loop/scripts/build_intake_capsule.pyが既に採用している既存パターンと同一の判定方法であり、preparation.md側の手順記述として同じ構造化判定方法を独立に踏襲する(build_intake_capsule.py自体は本 Issue の Allowed Paths 外であり変更しない)。already_satisfied_evidenceの canonical producer:route_loop_verdict_v2.py内にbuild_already_satisfied_evidence()(名称は実装者の裁量)という pure function を新設し、(a) base(live main SHA)に対する独立TEST_VERDICT_MACHINE/v2、(b) PR head に対するTEST_VERDICT_MACHINE/v2、(c) 現在の live main SHA、(d) 現在の PR head SHA を入力として、already_satisfied_evidence(base_ac_satisfied/meaningful_pr_delta/evidence_base_sha)の3値を導出する。caller(LLM/control-plane)が3値を自由に組み立ててlive_mergeabilityに渡す設計を許容しない。route_loop_verdict_v2(reviewer_verdict, live_mergeability)の public two-input signature は変更しない(この pure function はlive_mergeability構築を補助する別関数として追加するのであって、route_loop_verdict_v2()自体のシグネチャには影響しない)。- early-exit 判定ロジックの実装場所: PR 未作成時の early-exit 判定ロジック(
base_ac_satisfiedとno_linked_pr_everから early-exit 可否を導出する純粋関数)はroute_loop_verdict_v2.pyに production 関数として実装し、テストファイル内で再定義・複製してはならない。AC12 の runtime verification はこの production 関数を import または subprocess 経由で直接呼び出して検証しなければならず、テストローカルな decision helper のコピーを検証対象にしてはならない。preparation.mdの choke point(In Scope 参照)は、この production 関数の出力に従うことを明記し、判定ロジック自体をpreparation.md内やテストファイル内で再実装しない。
Runtime Verification Applicability
- decision: immediate
- reason:
docs/dev/extension-surface-runtime-policy.yamlの risk-trigger(skill-invocation-procedure-or-contract-change:.claude/skills/**/SKILL.mdが hard enforcement、.claude/skills/**/scripts/**が advisory /subagent-lifecycle-start-stop-delegation-fallback:.claude/skills/**/SKILL.mdを含む)に本 Issue の Allowed Paths(SKILL.md/preparation.md/route_loop_verdict_v2.py)が抵触し、両 rule のdefault_decisionがimmediateである。route_loop_verdict_v2.py単体の純粋関数レベルは pytest で検証できるが、preparation.mdの choke point が実際の dispatch chain(build_intake_capsule.pyのnext_action.route判定)から到達可能であることは、mock なしの real subprocess 実行でのみ確認できるため、AC12 を動作検証 AC とする。
applicable_acs: AC12
execution_environment: uv 管理下の repo ローカル python3 subprocess(build_intake_capsule.py等の既存 production script を実際に subprocess 起動できる環境。外部ネットワーク・GitHub API 到達は不要、repo ローカル git checkout のみで完結する)
skip_conditions:uv/ repo ローカル python3 が利用不可、またはbuild_intake_capsule.pyの依存(repo 内 git checkout)が破損している場合はSKIP: <理由>を stdout 先頭に出力し exit code 77 を返す
fallback_policy: 結果 JSON に_*_fallback: trueが含まれる場合は PASS ではなく FAIL(exit code 1)として扱う。fallback 経由の「成功」は PASS と判定しない
artifact_requirements: worktree-localartifacts/runtime-verification-AC12-<timestamp>.logに実行ログを保存する
動作検証 AC の SKIP / fallback 実装要件(immediate 決定に伴う必須事項)
AC12 に対応する VC スクリプトは、以下を満たす real subprocess harness として実装する(本文書の Out of Scope で挙げた新規機構ではなく、test_adjudicate_vc_result_e2e_runtime_only.py が既に確立している「real production script を subprocess 実行し、real git repository 上の fixture に対して判定する」既存パターンをそのまま踏襲する)。
- 実行環境が不可(
build_intake_capsule.py等の依存が利用できない)の場合はSKIP: <理由>を stdout 先頭に出力し exit code 77 を返す - JSON 結果に
_*_fallback: trueが含まれる場合は PASS ではなく FAIL(exit code 1)として扱う - 証跡は worktree-local
artifacts/runtime-verification-AC12-<timestamp>.logに保存する
In Scope
route_loop_verdict_v2.pyにROUTE_ALREADY_SATISFIED(新規 route 定数)を追加する。判定に必要なalready_satisfied_evidence(base_ac_satisfied/meaningful_pr_delta/evidence_base_sha)は、route_loop_verdict_v2()の公開シグネチャに新規パラメータを追加するのではなく、既存のmain_drift(Issue 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102)と同じパターンでlive_mergeability内の optional キーとして渡す(route_loop_verdict_v2(reviewer_verdict, live_mergeability)という「public two-input signature は変更しない」という同ファイル内の既存 Design Invariant コメント(Issue 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102)をそのまま維持する)。既存test_verdict非受理の制約(Issue 実装: 通常レビューの evidence authority を TEST_VERDICT lane 非依存へ切替える (#1856) #1870/実装: 通常レビューの evidence authority を TEST_VERDICT 非依存の CI/merge_state_status 正本へ切替える(Phase 1: authority cutover) #1856)は変更しない。reviewer_verdictの既存意味論も変更しないpreparation.mdの Step 1 起動前 choke point に、PR 未作成時の early-exit 判定ステップを追加する。この判定はbuild_intake_capsule.py::_next_action_route()が生成するnext_action.routeの実際の値(request_readiness_check/proceed_to_step_1/run_contract_blocker_triage/human_review_requiredの4値。refresh_contract_snapshotはnext_action.routeの実装済み値ではない)による分岐より 前、かつevaluate_product_spec_gate.pyが生成する別経路のproduct_spec_preflight.routing_action(refresh_contract_snapshotを含む)による Step 1 継続(preparation.md該当箇所参照)にも共通して適用される、単一の共通 choke point として実装する。特定の分岐内にのみ nest してはならない(next_action.routeがproceed_to_step_1以外の値でも、またproduct_spec_preflight.routing_action経由でも、現状 Step 1 へ継続する既存経路が複数存在するため)。この choke point はroute_loop_verdict_v2.pyの production 関数(early-exit 判定ロジック。上記 Evidence producers 参照)の出力に従うことを明記し、判定ロジック自体をpreparation.md内や test ファイル内で再実装しないstep-5-mergeability-handling.md/step-5-feedback-and-termination.mdに、上記2経路(early-exit と recovery route)の責務分離・呼び出し順序を明文化するSKILL.mdの終了条件表・LOOP_STATEtermination_reasonenum にalready_satisfiedを追加する- 上記の positive / negative / regression 挙動を検証する focused pytest を既存テスト資産に追加する
base_ac_satisfied/meaningful_pr_delta/evidence_base_shaの生成元・判定条件を本文書のとおり明文化する
Out of Scope
- PR/Issue の自動 close 実行権限の新設(本 Issue は recommendation の構造化のみを担う)
- pr-reviewer / pr-review-judge の既存4-field 出力契約の変更
.claude/agents/test-runner.md自体の契約変更(既存TEST_VERDICT_MACHINE/v2をそのまま異なる checkout 対象に対して呼び出すだけであり、schema・producer 契約は変更しない)issue-contract-review/ implementation preflight 側への同等 early-exit route 追加(別 Issue で検討する)#2041が所有する machine-readable phase-status / final-report publisher・comment marker・ledger の新設(本 Issue は core の判定・routing・result 構造化のみを所有し、GitHub コメント publication 自体は既存の#2041consumer 境界に委ねる)- unknown optional check policy の再設計
- Workflow Job → CheckRun ID provenance モデルへの変更
Acceptance Criteria
- AC1:
route_loop_verdict_v2.pyにalready_satisfiedを表す新規 terminal route 定数(ROUTE_ALREADY_SATISFIED)が追加されている - AC2: 新規 route は
verdict == REQUEST_CHANGESかつlive_mergeability内のalready_satisfied_evidence.base_ac_satisfied == trueかつalready_satisfied_evidence.meaningful_pr_delta == falseかつalready_satisfied_evidence.evidence_base_shaが現在の main HEAD と一致する場合にのみ選択され、それ以外の全ての組み合わせでは既存のCONTINUE_LOOP等の既存 route を維持する。route_loop_verdict_v2(reviewer_verdict, live_mergeability)の public two-input signature 自体は変更しない - AC3:
base_ac_satisfiedは test-runner のTEST_VERDICT_MACHINE/v2を current main(evidence_base_sha)に対して独立実行した結果として定義され、PR head の TEST_VERDICT PASS から推論されていない。AC3 の VC(focused pytest)は、evidence_base_shaをgit rev-parse HEADではなく liverefs/heads/mainの SHA 取得パターン(上記 Evidence producers 参照)で得た値を前提にした fixture/mock で検証する - AC4:
meaningful_pr_deltaは base 実行と PR head 実行、両方のTEST_VERDICT_MACHINE/v2のruntime_ac_resultsPASS 集合比較として定義され、blockers[]の自由文文字列検索を用いていない - AC5:
preparation.mdに、PR 未作成かつbase_ac_satisfied == trueの場合に implementation-worker dispatch 前で no-op 終了する early-exit 分岐が、next_action.routeの実装済み4値(request_readiness_check/proceed_to_step_1/run_contract_blocker_triage/human_review_required)やproduct_spec_preflight.routing_action(refresh_contract_snapshotを含む)の値によらず共通に評価される単一の choke point として追加されている(特定の分岐内にのみ nest されていない) - AC6:
SKILL.mdの終了条件表にalready_satisfiedの行が追加されている - AC7:
SKILL.mdのtermination_reasonenum(## LOOP_STATE YAMLセクション)にalready_satisfiedが追加されている - AC8:
already_satisfiedroute の recommendation 構造(pr.action/issue.action.state_reason等)がSKILL.mdに明文化されており、meaningful_pr_deltaの判定が対象 Issue の AC/VC 範囲に限定されること・pr.action: closerecommendation だけを根拠に無条件 close を実行してはならないことが同じ箇所に明記されている - AC9:
already_satisfiedroute 自身は PR/Issue の close 等の mutation を直接実行しないことが明記されている - AC10: 既存の
continue_loop/fail_closed/ conflict-hard-stop / main-drift の既存意味論を変更していない(既存 regression test が green のまま) - AC11: 新規 focused pytest が以下を全てカバーしている: (1) PR 存在 + base_ac_satisfied=true + meaningful_pr_delta=false → already_satisfied、(2) PR 未作成 + base_ac_satisfied=true → 実装/PR作成前の no-op early-exit、(3) base_ac_satisfied=false → 通常 implementation route、(4) meaningful_pr_delta=true → PR close recommendation にならない、(5) evidence_base_sha 不一致/stale → already_satisfied にならない、(6) already_satisfied と無関係な通常の REQUEST_CHANGES → 既存 continue_loop 維持、(7) 既存 conflict/fail-closed/main-drift regression が維持されている、(8) already_satisfied route が auto-close mutation を直接実行しない
- AC12: mock なしの real subprocess 実行で、
base_ac_satisfied=trueかつ PR 未作成の fixture Issue に対する dispatch chain が Step 1 実装着手(implementation-worker dispatch)に到達しないことを、next_action.routeがproceed_to_step_1になる fixture と、product_spec_preflight.routing_actionがrefresh_contract_snapshotになる fixture(evaluate_product_spec_gate.py経由で実際に生成可能な値)の双方で確認できる。resolve_already_satisfied_early_exit_decision()に相当する decision 関数はroute_loop_verdict_v2.py内の production 関数として実装されていなければならず、test ファイル内のみに存在する場合は AC12 を満たさない - AC13:
already_satisfied_evidenceの3値(base_ac_satisfied/meaningful_pr_delta/evidence_base_sha)がroute_loop_verdict_v2.py内の production pure function(build_already_satisfied_evidence()相当)によって、2つの独立TEST_VERDICT_MACHINE/v2・live main SHA・live PR head SHA から導出されており、caller が3値を自由構築する経路が存在しないことを focused pytest で確認できる - AC14: 「PR未作成」(
no_linked_pr_ever)の判定が、自由文検索(in:body等)ではなく GitHub の構造化リンク情報(gh pr list --state all --json number,closingIssuesReferences等で取得できるclosingIssuesReferences)を用いて行われることがpreparation.mdに明記されている
Verification Commands
AC1: 新規 route 定数の存在確認
# AC1
$ rg -n "ROUTE_ALREADY_SATISFIED" .claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.pyAC2: 新規 route の選択条件(正常系)の focused pytest(新規未作成ファイルのため baseline は collection error 想定)
# AC2
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_already_satisfied_routing.py::test_already_satisfied_requires_all_four_conditions -vAC3: base_ac_satisfied の定義確認(PR head 推論禁止の focused pytest、新規未作成ファイルのため baseline は collection error 想定)
# AC3
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_already_satisfied_routing.py::test_base_ac_satisfied_derived_from_independent_base_checkout_not_pr_head -vAC4: meaningful_pr_delta の定義確認(blockers[] 自由文検索禁止の focused pytest、新規未作成ファイルのため baseline は collection error 想定)
# AC4
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_already_satisfied_routing.py::test_meaningful_pr_delta_derived_from_runtime_ac_results_comparison_not_blockers_text -vAC5: preparation.md の early-exit 分岐確認
# AC5
$ rg -n "already_satisfied" .claude/skills/impl-review-loop/steps/preparation.mdAC6: SKILL.md 終了条件表への追加確認
# AC6
$ rg -n "already_satisfied" .claude/skills/impl-review-loop/SKILL.mdAC7: SKILL.md termination_reason enum への追加確認(intake_gate_failed の後続に already_satisfied が追加されていることを確認する)
# AC7
$ rg -n "intake_gate_failed.*already_satisfied" .claude/skills/impl-review-loop/SKILL.mdAC8: recommendation 構造の明文化確認
# AC8
$ rg -n "requirement_already_delivered" .claude/skills/impl-review-loop/SKILL.md# AC8
$ rg -n "独立した diff review" .claude/skills/impl-review-loop/SKILL.mdAC9: auto-close mutation を実行しないことの明記確認(既存 docstring に既に同文言があり、本 Issue はこの既存不変条件を維持するだけのため baseline 時点で pass する)
# AC9
# baseline-expect: pass
$ rg -n "no gh, git, network, or subprocess" .claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.pyAC10: 既存 regression 全体の green 維持
# AC10
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_termination_gate.py -vAC11: positive / negative / regression 8ケースの focused pytest(新規未作成ファイルのため baseline は collection error 想定)
# AC11
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_already_satisfied_routing.py -v# AC11
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/fixtures/step5_routing_consumer/test_route_loop_verdict_v2.py -vAC12: 動作検証(real subprocess・SKIP exit 77・fallback FAIL 実装必須。未作成のため baseline は collection error 想定)
# AC12
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_already_satisfied_early_exit_e2e_runtime_only.py -vAC13: build_already_satisfied_evidence() production pure function の存在確認
# AC13
$ rg -n "build_already_satisfied_evidence" .claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.pyAC14: preparation.md の PR存在判定が構造化リンク情報を用いることの確認
# AC14
$ rg -n "closingIssuesReferences" .claude/skills/impl-review-loop/steps/preparation.mdAllowed Paths
- .claude/skills/impl-review-loop/SKILL.md
- .claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.py
- .claude/skills/impl-review-loop/steps/preparation.md
- .claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
- .claude/skills/impl-review-loop/tests/test_termination_gate.py
- .claude/skills/impl-review-loop/tests/fixtures/step5_routing_consumer/test_route_loop_verdict_v2.py
- .claude/skills/impl-review-loop/tests/test_already_satisfied_early_exit_e2e_runtime_only.py
- .claude/skills/impl-review-loop/tests/test_already_satisfied_routing.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合(特に
.claude/agents/test-runner.mdや pr-reviewer 側の契約変更が避けられないと判明した場合) - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合(
base_ac_satisfied/meaningful_pr_deltaの定義を、本文書が明示する既存TEST_VERDICT_MACHINE/v2二重実行比較以外の新規機構〈新規 ledger / digest / publisher 等〉に変更する必要が生じた場合を含む) - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合(
#2041の publisher/ledger と競合する新規 comment publication 機構が必要と判明した場合を含む) - nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- .claude/skills/impl-review-loop/SKILL.md
- .claude/agents/test-runner.md
- .claude/skills/pr-review-judge/references/loop-verdict-v2-schema.md
- docs/dev/agent-skill-boundaries.md
Scope Delta(任意)
N/A
Notes for Reviewer
- Scope Collision (C1) advisory:
.claude/skills/impl-review-loop/SKILL.mdは他の複数 OPEN Issue(実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602, 実装: Codex/Claude 共通の phase status・final report publisher を実装する #2041, 実装: SubAgent 発火前に bounded local context bundle を生成し Claude/Codex の両 loop で consume する #1909, feat(agent-ops): agent ops / impl-review-loop 用 context budget を導入する #1117, ドキュメント: impl-review-loop に contract_snapshot_url 未指定時の fallback 手順を明記する #266, 実装: LOOP_VERDICT / TEST_VERDICT_MACHINE の YAML キー名を snake_case に統一する #56, 実装: impl-review-loop に APPROVE 時 PR Draft 解除の --auto-ready-on-approve フラグを追加する #51)とも Allowed Paths が重複するが、いずれも別セクション・別 route への追記であり、本 Issue のalready_satisfiedterminal route 追加とは非衝突(advisory のみ、起票停止理由にしない。導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 Owner Decision)。 - 本 Issue は当初
change_kind: docs/ Allowed Paths がSKILL.mdのみの docs-only 契約として起票されたが、OWNER のアドバーサリアルレビュー(下記 Source 参照)により「Outcome が主張する機械判定 terminal route が、SKILL.md のテキスト追記だけでは実 production routing(route_loop_verdict_v2())に接続されない false-green である」ことが指摘され、read-only investigation による現行コード fact-check(route_loop_verdict_v2()がtest_verdictを受理しない事実、既存 route 定数一覧、既存 main-drift/evidence_base_sha束縛パターンの存在、TEST_VERDICT_MACHINE/v2の read-only report 契約、Issue 実装: Codex/Claude 共通の phase status・final report publisher を実装する #2041 の publisher 所有範囲、PR fix: classify conditional close evidence publication #2597 の実マージ履歴を含む)を経て、change_kind: workflowの実 workflow behavior 契約へ reframe した。 test-runnerのTEST_VERDICT_MACHINE/v2は既存 schema を変更せず、呼び出し対象の checkout(PR head か base か)を変えるだけでbase_ac_satisfied/meaningful_pr_deltaの両方の証拠を賄える(read-only investigation で確認済み)。pr-reviewer の4-field契約・.claude/agents/test-runner.md自体は変更対象に含めていない。issue-contract-review/ implementation preflight への同等 route 追加は Out of Scope としたが、必要であれば本 Issue 完了後に follow-up Issue で扱う。- severity: 中期的な運用改善(緊急ではない)。
Source
- kind: impl_review_loop_followup
- url: fix: classify conditional close evidence publication #2597 (comment)
- note_id: already-satisfied-terminal-route
- dedupe_key: follow-up:squne121/loop-protocol:impl-review-loop:already-satisfied-terminal-route
- reframe_source_comment: 実装: impl-review-loop に already_satisfied terminal route を追加する #2607 (comment)
Activity
squne121 commentedon Sep 10, 2026
[create-issue] post-create ready tuple validation FAILED: title prefix or phase/implementation label missing. Manual fix required.
squne121 commentedon Sep 10, 2026
[create-issue] Recovered: labels reconciled via create_issue_txn.py reconcile (phase/implementation, agent/implementer, enhancement). Post-create ready tuple validation now passes.
squne121 commentedon Sep 10, 2026
結論
判定は
REQUEST_CHANGES相当です。already_satisfiedという状態そのものは有用です。#2587 / PR #2597 で実際に「currentmainが既に要求を満たしているのに、別の実装 PR が作られた」という無駄が発生しており、問題設定は妥当です。#2587 の最終報告でもno behavioral deltaと fresh reviewer のREQUEST_CHANGESが記録されています。ただし #2607 の現在の契約では、AC が全部 PASS しても
already_satisfiedは実際の deterministic routing に存在しない false-green になります。 ここは実装前に reframe した方がよいです。Issue は「機械的に判定できる terminal route」を Outcome に掲げながら、change_kind: docs、Allowed Paths はSKILL.md1 ファイル、Runtime Verification はnot_applicableとしています。敵対的レビュー findings
[P0 / blocker]
SKILL.md追記だけでは production route が増えません。現行設計では Step 5 の routing authority は
route_loop_verdict_v2()で、repository の境界仕様も「pr-reviewer の4フィールド + live mergeability の2系統を router に渡す」と固定しています。 現行 contract ではREQUEST_CHANGES → continue_loopが明示され、termination gate の regression test までそれを固定しています。したがって
SKILL.mdの終了条件表とtermination_reasonenum に文字を足しても、router はalready_satisfiedを返しません。Outcome と Allowed Paths が矛盾しています。推奨は docs issue のまま弱めるのではなく、最小限
route_loop_verdict_v2.py、focused routing tests、Step 5、SKILL.mdまでを scope に入れて本物の route にすることです。Agent Skills 自体はSKILL.mdの instruction に加えて executablescripts/を持てる設計なので、この repo のように deterministic route を script 化する構成は標準的な Skill 構成とも整合します。([Anthropic]1)[P0 / blocker] Issue が想定している「test-runner + no-op REQUEST_CHANGES」では、
current main が既にACを満たすことを機械判定できません。test-runner が独立検証しているのは PR current head と Issue Verification Commands の binding/PASS です。これは「PR head が正しい」ことは示せても、「PR を外した current main でも同じ AC が成立する」ことは示しません。 さらに現行 Step 5 は
test_verdict自体をroute_loop_verdict_v2()に渡さない契約です。pr-reviewer 側も machine output は
verdict / reviewed_head_sha / blockers / warningsの4つだけで、no_op_reason_codeのような構造化値はありません。 GitHub ネイティブの review decision もAPPROVE / REQUEST_CHANGES / COMMENTまでであり、REQUEST_CHANGESの body は自由文です。([GitHub Docs]2)したがって
"no behavioral delta"のようなblockers[]文言を文字列判定する実装は避けるべきです。[P1] 本質的な検出ポイントは Step 5 より前です。
実装: impl-review-loop に already_satisfied terminal route を追加する #2607 の source になった失敗は、不要な PR を作った後に no-op と気付いたことです。実際、PR fix: AC3 canary の親子因果証跡を bindする #2561 は
close-evidence-publicationを既に current behavior に取り込んでいました。したがって最も有用なのは二段構えです。Step 1 の implementation 開始前に
already_satisfiedを検出して「PRを作らない」経路を優先し、Step 5 の terminal route は「作業中に別PRが先に merge された」場合などの recovery として残すべきです。実装: impl-review-loop に already_satisfied terminal route を追加する #2607 が implementation preflight を Out of Scope にしているため、今のままだと同種の無駄な branch/worktree/PR 作成を防げません。個人開発用途なら、ここで新しい ledger・署名・provenance control-plane を作る必要はありません。導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 の方針どおり、live
main、実コード、focused test、独立 review を根拠にする程度で十分です。[P1]
#2041との「非衝突」判定は誤っています。実装: impl-review-loop に already_satisfied terminal route を追加する #2607 は structured fields を「LOOP_STATE / 終了コメント」に出すとしています。一方、open 実装: Codex/Claude 共通の phase status・final report publisher を実装する #2041 はまさに
impl-review-loopの implementation / verification / review / final phase の machine-readable status schema と final-report publisher を所有しています。これは単なる
SKILL.mdの行競合ではなく output ownership の semantic collision です。実装: impl-review-loop に already_satisfied terminal route を追加する #2607 側で新しい publication mechanism や marker を作るべきではありません。already_satisfiedの core route/result だけ 実装: impl-review-loop に already_satisfied terminal route を追加する #2607 が所有し、GitHub comment rendering/publishing は 実装: Codex/Claude 共通の phase status・final report publisher を実装する #2041 の consumer に渡す、という境界にするのがよいです。[P1] Structured recommendation の schema が未定義です。
現在は「PR close 推奨」「Issue close 推奨(理由)」とだけ書かれています。フィールド名・enum・
merge_readyとの整合がありません。一方で Stop Conditions は「固定契約のキー集合・スキーマ変更が必要なら停止」としており、自分自身の Outcome とも衝突します。最小 schema を先に固定すべきです。特に Issue 側は GitHub が
completed / not_planned / duplicateのstate_reasonを正式に持つため、それをそのまま recommendation に利用できます。([GitHub Docs]3)satisfied_by_existing_mainなら通常はcompleted、要求自体を捨てたならnot_plannedです。[P2]
already_satisfied = PR closeと強く結び付けすぎない方がよいです。source の PR fix: classify conditional close evidence publication #2597 では「no behavioral delta なので close 推奨」という判断が明示されていました。 しかし live state では、その PR は最終的に 2026-09-10 03:27:50 UTC に実際に merge されています。
つまり「behavioral AC が main に存在する」だけでは PR が無価値とは限りません。明示的 invariant、回帰テスト、可読性改善などに meaningful delta があれば merge する選択もあります。route 条件は最低でも
base_satisfies_ac && pr_has_no_meaningful_deltaにすべきで、単なるbase_satisfies_acでは弱すぎます。[P2] 現在の Verification Commands は presence test に過ぎません。
rg "already_satisfied"は table、コメント、例示のどこかに文字列が存在するだけで PASS します。production router の挙動を一切保証しません。特に現在の regression suite はREQUEST_CHANGES → continue_loopを固定しているので、新 route を作るならそこを条件付きに変える regression が必須です。推奨する reframe
大規模な control-plane は不要です。#2607 を次の程度までだけ広げるのが最も費用対効果が高いです。
そして実装位置は、(A) implementation 前の early-exit を主経路、(B) Step 5
already_satisfiedを競合 merge 等への recovery 経路とします。PR が既に存在する場合だけmeaningful_pr_deltaを評価すればよく、PR 未作成時はpr.action: noneです。Allowed Paths は少なくとも
SKILL.md、steps/step-5-feedback-and-termination.md、scripts/route_loop_verdict_v2.py、既存 focused routing/termination tests を含めるべきです。pre-Step1 prevention を同一 Issue に入れられるなら preparation/implementation-entry の既存ファイルも追加します。逆に 新規 ledger、digest protocol、独自 publisher、hook は追加しません。#2041 と重なる final-comment publication はそちらに委譲します。最終評価
アイデア: 採用推奨。現在の Issue contract: implementation-ready ではない。
最大の問題はセキュリティではなく、「docs-only のACを全件満たしても実 router が何も変わらない」ことです。ここだけは実装前に直すべきです。そのうえで preflight early-exit を加えれば、#2587/#2597 で実際に起きた無駄な実装・PR作成を直接減らせる、かなり有用な改善になります。
squne121 commentedon Sep 10, 2026
推奨は、#2607 を現状の docs-only contract のまま進めず、指定コメントを trusted human-context として in-place reframe することです。
current main を再確認しても、
route_loop_verdict_v2()は依然としてreviewer_verdict + live_mergeabilityの2入力で、test_verdictを routing input として拒否し、REQUEST_CHANGESは無条件にcontinue_loopへ送っています。したがって、SKILL.md にalready_satisfiedを追記するだけでは production route は生えない、というコメントの P0 は現在も有効です。一方、現在の router には #2102 由来の
main_drift/evidence_base_sha/ base SHA 再束縛機構が既にあります。#2607 では新しい ledger/provenance 系を作らず、この既存機構を再利用する方向を優先すべきです。 また、#2041 は現在も open で、impl-review-loop の phase/final report publisher を明示的に所有しています。#2607 は core routing/result を所有し、publication/upsert mechanism は増設しない境界が妥当です。指定コメントは、今回の対話でユーザーが明示的に選択しているため、current skill の Accepted Trust Model に従って
operator_asserted_human_contextとして扱わせるのが適切です。current skill はこの lane について、exact path が足りない場合もcodebase-investigatorで導出し、それでも section-bound patch にできなければissue_editor_requiredに進むため、追加の人間入力を要求する必要はありません。以下を、既に auto mode で動いている Claude Code にそのまま渡すのを推奨します。
squne121/loop-protocolの Issue #2607#2607
および、今回ユーザーが明示的に refinement の根拠として選択した次の Issue comment
#2607 (comment)
を対象に、current HEAD の
.claude/skills/issue-refinement-loopを実行してください。このセッションは既に Claude Code の auto mode で起動済みです。通常の in-scope 操作、controlled GitHub mutation、Issue 本文更新、deterministic repair、review/rewrite iteration ごとに人間の承認を求めず、自律的に完走してください。
今回の human-context authority
この対話上の指示そのものが、上記 comment URL を human context として使用する operator assertion です。
したがって、comment の物理的な作成主体を GitHub metadata や文体から推測しないでください。current
issue-refinement-loopの Accepted Trust Model に従い、この URL はoperator_asserted_human_contextとしてwith_human_contextlane にのみ投入してください。preflight.run.with_human_context/ current command registry の正規経路を使用するwith_agent_reportと二重投入しないwith_anchorに downgrade しないSKILL.md、command_registry.py、controlled executor を正本とするこの human-context selection のために、人間へ
ANCHOR_SCOPE_REFRAME_V1、追加 YAML、追加承認コメント等の再入力を要求しないでください。最初に行うこと
Issue #2607 の live body、指定 comment の snapshot、current
main、関連 Issue/PR、対象 repository assets を fresh に取得し、指定 comment の主張を独立に fact-check してください。特に少なくとも以下を current main で再確認してください。
.claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.py.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/steps/step-1-implementation.md.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.md.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md指定 comment の結論を盲目的に採用せず、current implementation と tests を正本として再検証してください。
推奨する refinement direction
現在の #2607 は
change_kind: docs、Allowed Paths がほぼSKILL.mdのみ、Runtime Verificationnot_applicableですが、「production で機械判定されるalready_satisfiedterminal route」という Outcome と整合していません。fact-check で反証されない限り、docs-only issue に弱めるのではなく、#2607 自体を in-place で実際の workflow behavior を実装できる contract に reframe してください。
目標 semantics は概ね以下です。
change_kind: workflowalready_satisfiedを実 production routing に接続するbase_ac_satisfied == trueだけでは terminal にしないmeaningful_pr_delta == falseも必要pr.action: nonepr.action: closerecommendation を許可するstate_reasonは原則completednot_plannedと混同しないanchor comment にある次の意味論は有力な starting point としますが、既存 repository schema と重複する場合は既存 schema を再利用し、並行した新 schema を作らないでください。
base_ac_satisfiedmeaningful_pr_deltaevidence_base_shastatus: no_change_requiredtermination_reason: already_satisfiedmerge_ready: falsePR close/none recommendation
Issue close/state_reason/reason recommendation
重要: evidence producer を未定義のままにしない
今回の refinement では、route 名を追加するだけでなく、
base_ac_satisfiedmeaningful_pr_deltaを誰が、どの evidence から、どの時点で生成するのかを contract 上で明確にしてください。
current
route_loop_verdict_v2()がtest_verdictを routing input にしていないことや、pr-reviewer の machine-readable result convention が限定されていることを無視してはいけません。特に禁止します。
blockers[]自由文から"no behavioral delta"等を文字列検索して route を決めるREQUEST_CHANGES本文を reason-code 代わりに parse するbase_ac_satisfiedだけから PR を obsolete と判定する既存 #2102 の main-drift/base-SHA evidence epoch 等で再利用できるものは優先的に再利用してください。
meaningful_pr_deltaの producer が deterministic に定義できない場合は、それを隠して「機械判定可能」と書かないでください。current architecture に適合する bounded semantic assessment または既存 structured result の再利用を検討し、Step 2.5 の semantic design review でも妥当性を検証してください。pr-reviewer の既存4-field convention を変更せず実現できるなら、それを優先してください。変更が不可避なら、その事実を refinement で明示し、必要な既存 asset を Allowed Paths に正しく含めてください。blocker 自由文 parsing で scope expansion を回避することは禁止します。
#2041 との ownership boundary
Issue #2041 は impl-review-loop の machine-readable phase status / final report publisher を所有しています。
したがって #2607 では、
already_satisfiedの core decision/routingまでを所有対象とし、
は追加しない方向を優先してください。
必要な表示/publication integration は #2041 の consumer boundary と整合するよう記述してください。
Allowed Paths の再構成
anchor comment と read-only investigation を根拠に、実 production behavior と focused regression を実装できる最小の exact path set に更新してください。
候補には少なくとも次を検証してください。
.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.py.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.mdearly-exit の正確な挿入位置は comment の推測ではなく current code から導出してください。
「implementation-worker と不要な PR の作成を防ぐ」という目的を満たす最も早い既存 choke point を選び、新しい parallel control-plane は作らないでください。
Verification Contract
現在の
rg "already_satisfied"のような presence check だけで AC を PASS させないでください。refined Issue の Verification Commands には、少なくとも次の behavioral regression を機械検証できるものを含めてください。
base_ac_satisfied=true、PR がある場合meaningful_pr_delta=false→already_satisfiedbase_ac_satisfied=false→ 通常 implementation routemeaningful_pr_delta=true→ PR close recommendation にしないalready_satisfiedにしないREQUEST_CHANGESは従来のcontinue_loopsemantics を維持already_satisfiedroute が auto-close mutation を直接実行しない既存 focused test fixture / test module が使える場合はそこへ追加し、同義の新テスト基盤を作らないでください。
SubAgent execution — 必須
SubAgent を積極的に使用してください。ただし current
issue-refinement-loopの ownership を壊さないでください。少なくとも今回の trusted reframe の fact-check / exact path 導出には、適用可能な
codebase-investigatorSubAgent を使用してください。planner が Web research required とした場合は
web-researcherを使用してください。Step 2.5 が applicable の場合は current semantic-review contract に従い
issue-design-reviewerSubAgent を fresh に起動してください。Issue body rewrite が必要な場合は current Step 4 contract に従い
issue-editorSubAgent を使用してください。canonical Step 2 は current skill の root-owned
run_root_review_pipeline.py produceが authority です。ここで legacyissue-reviewerSubAgent を勝手に追加して routing authority を二重化しないでください。Completion join barrier
すべての SubAgent について、起動しただけで完了扱いにしてはいけません。
main/root thread が所有する controlled mutation、final classification、canonical routing を SubAgent に丸投げしないでください。
人間承認不要の運用
通常の refinement iteration では、人間への承認問い合わせを行わないでください。
対象には以下を含みます。
issue_editor_requiredへの handoffNEXT_ACTION: issue_editor_requiredの場合、同じcontract_update.run.with_human_contextを no-progress retry せず、current skill が定める existing issue-editor/edit-issue controlled transaction route に自律的に進んでください。exact path 不足や freeform comment であることだけを理由に人間へ戻さず、current #2086 route の read-only investigation → exact path derivation → full rewrite fallback を先に使ってください。
ただし、current repository/skill が明示する genuine hard stop を捏造した承認で迂回してはいけません。identity mismatch、environment/integrity failure、実 conflict、秘密情報や権限境界、回復不能な external dependency、canonical
human_judgment_required、max iteration/no-progress 上限などに最終的に到達した場合だけ停止し、取得済み evidence と reason code を明示してください。「承認を取りたいから停止」は禁止ですが、「current SSOT が hard stop と定義している状態を無視して進む」ことも禁止です。
完了条件
Issue body の更新だけで成功扱いにしないでください。
current
issue-refinement-loopcontract に従い、investigation
→ trusted reframe/contract update
→ readback
→ fresh deterministic review
→ applicable な fresh semantic design review
→ 必要なら rewrite iteration
→ final readiness
→ termination
まで完走してください。
最終 Issue contract が少なくとも次を満たすことを確認してください。
approved 終端後の implementation handoff については current HEAD の
issue-refinement-looptermination/root-entry SSOT にそのまま従ってください。過去のLOOP_HANDOFF_RESULT_V1コメントを authorization として再利用せず、必要なら fresh root-owned entry transition を使用してください。このプロンプトから独自に別の implementation workflow を先回りして起動せず、current skill が mandatory に dispatch する範囲だけを実行してください。
最後に、実行した SubAgent と completion join の結果、Issue body の最終 SHA/主要変更点、fresh review/readiness の verdict、termination reason、未解決 blocker の有無を短く報告してください。
特に今回は、**「指定コメントを agent report 扱いして human escalation」「Allowed Paths 拡張なので即停止」「文字列
already_satisfiedを足して green」**の3パターンを避けるのが重要です。current skill には trusted reframe を自律消費する経路が既にあります。squne121 commentedon Sep 10, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 10, 2026
implement-issue: 実装完了 (2026-09-10T11:39:20Z)
.claude/worktrees/issue-2607-already-satisfied-terminal-routeworktree-issue-2607-already-satisfied-terminal-routefix: PR Body Japanese Check の per-block 日本語比率不足を解消する
squne121 commentedon Sep 10, 2026
impl-review-loop: 完了 (2026-09-10T21:00:00Z)
fix: already_satisfied early-exit dec定義をproduction関数化しevidence produc…
feat: impl-review-loop に already_satisfied terminal route を追加する (#2626)