Repository navigation
refactor: pre-Step-1 data-plane判定をresolve_pre_step1_data_plane_action()に統合する - #2741
Conversation
…()に統合する (#2713) build_intake_capsule.py::_collect_implementation_landed_evidence() の インライン重複判定(disposition == "ordinary_dispatch_or_explicit_recovery" の素朴な分岐)を撤去し、route_loop_verdict_v2.resolve_pre_step1_data_plane_action() への単一呼び出しに置き換えた。同関数は raw evidence を再受理して landing disposition を再計算する経路を廃止し、既に解決済みの disposition mapping を直接受け取る形に変更した(中間結果の二重適用を構造的に不可能にするため)。 implementation_landed_evidence.py::apply_already_satisfied_precedence() を production entry point に実配線した。pr_exists は landing disposition が 既に解決した candidate の lifecycle から生成し(closed-unmerged は False)、 base_ac_satisfied は独立した Verification Commands 評価結果 (TEST_VERDICT_MACHINE/v2 shape)から導出する。production source が build_intake_capsule.py 内に存在しない場合(現状)は precedence を適用せず 既存 disposition をそのまま通す。 _load_route_loop_verdict_v2_module() の default loader が exec_module() 前に sys.modules[spec.name] = module を登録しておらず、route_loop_verdict_v2.py の @DataClass(frozen=True)(PEP 563 stringified annotations)が ClassVar/InitVar 解決時に AttributeError を送出して常に None を返していた 不具合を修正した。build_intake_capsule.py::_load_module() にも同種の sys.modules 登録漏れがあり同じ理由で route_loop_verdict_v2.py のロードに 失敗していたため、同様に修正した。 Closes #2713 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2741/ The preview will be removed when this PR is closed. |
impl-review-loop Step 4/5: PR Review VerdictMergeability: mergeable=MERGEABLE, merge_state_status=CLEAN (head SHA Evidence Check:
Blockers: なし Non-blockers / Warnings:
verdict: APPROVE
reviewed_head_sha: "4970fa27ad32d3143b64407567784f8fe027b7ff"
blockers: []
warnings:
- "PR is Draft (isDraft: true); not a blocker per SKILL.md, left for human final merge decision." |
結論[PR #2741](https://github.com/squne121/loop-protocol/pull/2741?utm_source=chatgpt.com) は、現状 REQUEST_CHANGES 相当です。 PR #2700 から持ち越された「data-plane 判定の重複」「default dynamic loader の実質 no-op」「最終 disposition の再計算」という問題への修正はかなり進んでいます。CI も current head ただし、[Issue #2713](https://github.com/squne121/loop-protocol/issues/2713?utm_source=chatgpt.com) の主目的である P1 —
|
|
GitHub 上の現状を確認しました。PR #2741 は open / Draft、head 推奨アクションは次のとおりです。
そのまま auto mode の Claude Code に貼れる形です。
対象:
現在確認されている PR head: Goal指定コメント PR #2741 の既存 branch/worktree を再利用し、新しい PR は作成しないでください。
となる「マージ直前」の状態まで、人間の追加承認を求めず進めてください。 実際の merge、auto-merge 有効化は行わないでください。 Operator decision / scope authorizationこのプロンプト自体を、以下の scope decision に対する明示的な operator authorization として扱ってください。 Issue #2713 の現在の goal は その実現に canonical production command の更新が必要であることを確認した場合、production wiring を別 Issue / 将来 Issue に先送りせず、Issue #2713 を最小限 amend して同じ PR #2741 で完遂してください。 具体的には、read-only 調査の結果必要性が確認できた場合に限り、Issue #2713 の 追加を明示的に許可する候補:
それ以外の Allowed Paths 拡張は、必要性を SubAgent が具体的に証明した場合だけ最小限追加してください。 Issue body を更新した場合:
#2739 の timeline pagination と #2740 の refinement→implementation handoff responsibility separation は今回の scope に混ぜないでください。 Mandatory SubAgent protocolroot orchestrator は control-plane に徹してください。 SubAgent は root から直接起動し、SubAgent 自身に nested delegation させないでください。 各 SubAgent を起動したら、必ず terminal completion まで待ってから次へ進んでください。 最低限、以下の順序で使用してください。 A. Read-only diagnosis SubAgent最初に read-only の SubAgent を起動し、以下を current PR head と live Issue #2713 に対して確認させてください。
診断 SubAgent の完了を待ち、結果を fix_delta として構造化してから implementation-worker を開始してください。 B. implementation-worker診断結果を渡して既存 PR branch/worktree 上で修正してください。 実装上の要求は以下です。 P1-1: canonical production entry から already_satisfied precedence を到達可能にする
望ましい設計:
データフローは最低限、
という一本の production chain にしてください。
canonical production route の実テストでは、private helper を直接呼ぶだけでなく、最低でも public
まで到達することを証明してください。 P1-2: TEST_VERDICT validation を既存契約へ揃える新しい独自の弱い「全 status が pass なら satisfied」という判定を増やさないでください。 可能な限り既存の
例えば {
"head_sha": "<main>",
"runtime_ac_results": [
{"status": "pass"}
]
}のような AC identity / command evidence のない partial payload が ただし unnecessary な新しい approval gate、ledger、network runtime gate、証跡ハーネスは追加しないでください。 P2: dynamic loader の sys.modules restoration
ただしロード開始前から同名 entry が存在していた場合、それを破壊しない semantics にしてください。 期待動作:
この failure/restoration path の regression test を追加してください。 Preserve existing good changes以下は指定レビューでも妥当とされているため、理由なく巻き戻さないでください。
implementation-worker が完了したら terminal result を待ち、diff / changed paths / unresolved items を root が確認してください。 C. independent test-runnerimplementation-worker 完了後、新しい test-runner SubAgent を起動し、必ず完了を待ってください。 implementation-worker 自身の「tests pass」という自己申告を verification authority にしないでください。 少なくとも:
を current head で独立確認してください。 Issue contract amend により VC を追加した場合は、新しい live Issue body の Verification Commands を source of truth にしてください。 test-runner の terminal completion を待ってください。 D. pr-reviewerverification が終了した current head に対して pr-reviewer SubAgent を起動してください。 必ず以下をレビュー入力に含めてください。
pr-reviewer の terminal completion を待ってください。 Looppr-reviewer が implementation-worker を再実行してください。 各 iteration で必ず新しい current head に evidence を bindし直してください。
base branch が進み
ただし以下は hard stop としてください。
それ以外について追加の人間承認は要求しないでください。 Completion condition次をすべて満たすまで終了しないでください。
完了時は PR を merge しないでください。 PR body / LOOP_STATE /必要な review summary を current head に更新し、最終的に 最終報告には最低限以下を含めてください。 target_pr: 2741
target_issue: 2713
target_human_context_comment: 5812953296
final_head_sha: <sha>
iterations: <n>
scope_amended: <true|false>
scope_added_paths: [...]
p1_production_reachability: <pass|fail>
p1_test_verdict_contract: <pass|fail>
p2_sys_modules_restoration: <pass|not_needed|fail>
verification: <pass|fail>
pr_review_verdict: <APPROVE|REQUEST_CHANGES|HUMAN_REVIEW_REQUIRED>
blockers: [...]
mergeability: <live status>
termination_reason: <approved|max_iterations|human_escalation|...>
merge_performed: false作業途中で「次へ進めてよいですか」「Issue scope を変更してよいですか」「修正を続けますか」等の確認は求めず、このプロンプトの operator authorization と この形なら、今回もっとも詰まりやすい 「Allowed Paths 外なので停止」→人間待ちを先に解消しつつ、#2713 の本来の goal を別 Issue に逃がさず完遂させられます。 |
…にし、TEST_VERDICT 検証を強化する Issue #2713(amend後 AC8-AC10)と PR #2741 レビューコメント (#2741 (comment)) の P1 blocker 2 件・P2 1 件に対応する。 - P1-1: build_intake_capsule.py::build_intake_capsule() / main() / build_capsule_argv() に base_ac_verification_result(CLI では --base-ac-verification-result-file)を追加し、already_satisfied precedence が canonical CLI/public API 境界から実際に到達できるようにした。 preparation.md の 0-a-0 / 0-a-1 を改訂し、0-a-1 の test-runner 評価結果を ファイル保存して 0-a-0 の呼び出しへ渡す運用を明記した。 - P1-2: implementation_landed_evidence.py::derive_base_ac_satisfied_from_ verification_result() を、独自の弱い判定ではなく adjudicate_vc_result.py::adapt_test_verdict_to_current_vc_result() の 既存 TEST_VERDICT_MACHINE/v2 検証を再利用する形に強化し、AC identity 欠落・ command_hash 欠落・exit_code != 0・fallback_detected・human_review_required・ stop_condition_triggered・SKIP/PARTIAL を base_ac_satisfied: true と 誤判定しないようにした。 - P2: implementation_landed_evidence.py::_load_route_loop_verdict_v2_module() および build_intake_capsule.py::_load_module() の両方で、exec_module() 失敗時に ロード開始前から存在していた sys.modules エントリを破壊せず復元するよう修正した。 対応するテストを test_build_intake_capsule.py / test_implementation_landed_evidence.py / test_implementation_landed_intake_integration.py / test_intake_capsule_provenance_e2e.py に追加。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Summary
PR #2700 レビューで指摘された DRY 違反(pre-Step-1 data-plane 判定の重複実装・未接続コード)を解消します。
build_intake_capsule.py::_collect_implementation_landed_evidence()のインライン素朴分岐を撤去してroute_loop_verdict_v2.resolve_pre_step1_data_plane_action()の単一呼び出しに置き換え、implementation_landed_evidence.py::apply_already_satisfied_precedence()を production entry point に実配線しました。あわせて、既定ローダーがroute_loop_verdict_v2.pyのロードに常に失敗し例外を握り潰していた不具合(sys.modules未登録)を修正しました。さらに、本 PR へのレビューコメント(#2741 review)を受けて Issue #2713 が 2026-09-24 に 2 回 amend され、以下 3 点が In Scope / AC8-AC10 として追加されました。本 iteration でこれらも実装・配線済みです。
base_ac_satisfiedの production source を canonical CLI/public API 境界(main()の--base-ac-verification-result-fileフラグ、build_intake_capsule()のbase_ac_verification_resultパラメータ)から実際に到達可能にするderive_base_ac_satisfied_from_verification_result()の判定強化(既存adjudicate_vc_result.py::adapt_test_verdict_to_current_vc_result()の TEST_VERDICT_MACHINE/v2 検証ロジックを再利用)_load_route_loop_verdict_v2_module()/build_intake_capsule.py::_load_module()のsys.modules既存 entry 破壊防止(ロード失敗時に original entry を復元)Checks
uv run --locked pytest .claude/skills/impl-review-loop/tests/test_build_intake_capsule.py .claude/skills/impl-review-loop/tests/test_build_intake_capsule_advisory_routing.py .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py -q→ 66 passed.claude/skills/impl-review-loop/tests/full suite:uv run --locked pytest .claude/skills/impl-review-loop/tests/ -q→ 762 passed, 1 skipped, 2 deselected, 2 xfaileduv run ruff check(変更ファイル5件) → クリーン受け入れ条件の達成状況
現在の head(
11e3bf3e9ace791faf74663f142b8e886895f917)に対し Issue #2713 の Verification Commands を個別に再実行して確認しました。_collect_implementation_landed_evidence()がroute_loop_verdict_v2.resolve_pre_step1_data_plane_action()を import し、最終 disposition(apply_already_satisfied_precedence()適用後の値)に対して一度だけ呼び出している。(根拠: VC PASS —rg -n "resolve_pre_step1_data_plane_action" build_intake_capsule.py)build_intake_capsule.pyにdisposition == "ordinary_dispatch_or_explicit_recovery"の素朴な分岐が残存していない(absence-check VC が exit 1 = no match)。apply_already_satisfied_precedence()が_collect_implementation_landed_evidence()から呼び出されている。pr_existsは landing disposition が既に解決した candidate のlifecycleからimplementation_landed_evidence.py::derive_pr_exists_from_landing_candidate()で生成(open/draft/merged→True、closed-unmerged/候補なし→False)。base_ac_satisfiedは独立した TEST_VERDICT_MACHINE/v2 相当の Verification-Commands 評価結果からderive_base_ac_satisfied_from_verification_result()で導出し、現行 main HEAD SHA(同一 evidence 収集ステップが取得済みのmain_head_sha)とのフレッシュネス一致を要求する。(根拠: VC PASS —rg -n "apply_already_satisfied_precedence" build_intake_capsule.py、test_pr_exists_is_generated_from_candidate_lifecycle_pr_fixtures_not_injected_booleans、test_collect_implementation_landed_evidence_applies_precedence_through_default_loader、test_collect_implementation_landed_evidence_skips_precedence_when_base_ac_undeterminable)_load_route_loop_verdict_v2_module()がexec_module()前にsys.modules[spec.name] = moduleを登録している。既定ロード経路(モジュール注入なし)でapply_already_satisfied_precedence()が実際にroute_loop_verdict_v2を正常ロードして適用できることを regression test で確認。(根拠: VC PASS —rg -n "sys.modules\[spec.name\] = module"、test_default_route_loop_verdict_v2_loader_succeeds_without_module_injection、test_apply_already_satisfied_precedence_fires_through_default_loader、test_collect_implementation_landed_evidence_applies_precedence_through_default_loader)start_data_plane/action一意導出 → capsule 投影)が単線に固定されている。resolve_pre_step1_data_plane_action()は raw evidence を再受理して landing 判定を再計算する経路自体を廃止し、既に解決済みの disposition mapping のみを受け取るよう signature を変更したため、中間結果の二重適用は構造的に不可能。(根拠:route_loop_verdict_v2.py::resolve_pre_step1_data_plane_action()docstring、test_disposition_precedes_worker_worktree_and_new_pr)pre_step1_data_planeキー集合(start_data_plane/action)は変更していない。(根拠: 上記統合テストのassert set(evidence["pre_step1_data_plane"]) == {"start_data_plane", "action"}).claude/skills/impl-review-loop/tests/配下の pytest が全件 PASS。(根拠: 下記「検証コマンド結果」)main()/build_intake_capsule())からbase_ac_verification_resultを供給でき、already_satisfied→pre_step1_data_plane.start_data_plane == falseまで到達することを、private helper への直接引数注入ではなく public API/CLI 経由の統合テストで確認した。main()は--base-ac-verification-result-file <path>を受け取り JSON を読み込んでbuild_intake_capsule()のbase_ac_verification_resultパラメータへ渡す。build_capsule_argv()もbase_ac_verification_result_filekwarg を additive に扱い(既存の--human-context-comment-url等と同じパターン)、preparation.mdの Step "0-a-0" コマンド例にも配線した。(根拠: VC PASS —rg -n "base_ac_verification_result" build_intake_capsule.py、test_public_build_intake_capsule_reaches_already_satisfied_via_base_ac_verification_result、test_cli_main_reaches_already_satisfied_via_base_ac_verification_result_file、test_cli_main_base_ac_verification_result_file_missing_is_fail_safe_not_fatal、test_build_capsule_argv_materializes_base_ac_verification_result_file_additively)derive_base_ac_satisfied_from_verification_result()が既存adjudicate_vc_result.py::adapt_test_verdict_to_current_vc_result()の TEST_VERDICT_MACHINE/v2 検証ロジック(AC identity・command_hash・exit_code・fallback_detected・human_review_required・stop_condition_triggered 等)を_load_adjudicate_vc_result_module()経由で再利用し、不完全・malformed なruntime_ac_resultspayload をbase_ac_satisfied: trueに誤判定しないことをテストで確認した。(根拠: VC PASS —rg -n -e "adapt_test_verdict_to_current_vc_result" -e "adjudicate_vc_result" implementation_landed_evidence.py、test_derive_base_ac_satisfied_from_verification_result_reuses_adjudicate_...、test_derive_base_ac_satisfied_from_verification_result_never_fabricates_a_fallback)_load_route_loop_verdict_v2_module()/_load_adjudicate_vc_result_module()(implementation_landed_evidence.py)とbuild_intake_capsule.py::_load_module()の3ローダーすべてで、exec_module()前にprior_module = sys.modules.get(spec.name)を退避し、ロード失敗時に prior entry が存在すればそれを復元、存在しなければ自身が挿入した entry のみを pop する(他コードが後から挿入した無関係 entry を誤って破壊しない)ことをテストで確認した。(根拠: VC PASS —rg -n -e "sys.modules.get\(spec.name\)" -e "prior_module"、test_route_loop_verdict_v2_loader_restores_prior_entry_on_failure、test_adjudicate_vc_result_loader_restores_prior_entry_on_failure、test_load_module_restores_prior_entry_on_failure、test_load_module_removes_only_its_own_newly_inserted_entry_on_failure)検証コマンド結果
現在の head(
11e3bf3e9ace791faf74663f142b8e886895f917)で以下を再実行し、全て PASS を確認しました。Allowed Paths 遵守
本 PR の変更ファイル一覧(
git diff --name-only origin/main...HEAD)は以下の 8 件で、Issue #2713 の## Allowed Paths(計 9 件、2026-09-24 scope amendment でpreparation.md/test_intake_capsule_provenance_e2e.pyを追加)にすべて収まっています。.claude/skills/impl-review-loop/scripts/build_intake_capsule.py.claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py.claude/skills/impl-review-loop/scripts/route_loop_verdict_v2.py.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/tests/test_build_intake_capsule.py.claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py.claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.pyAllowed Paths に含まれるが本 PR では変更していないファイル(
test_build_intake_capsule_advisory_routing.py)は、上記「検証コマンド結果」で回帰確認のみ実行し編集はしていません。Allowed Paths 外の変更はありません。Schema Change Applicability
IMPL_REVIEW_INTAKE_CAPSULE_V1のimplementation_landed_evidence.pre_step1_data_planeキー集合(start_data_plane/action)は AC6 のとおり変更していません。resolve_pre_step1_data_plane_action()の Python 関数シグネチャ(raw evidence 引数 → 既解決済み disposition mapping 引数)は変更しましたが、これは公開スキーマ/JSON 契約ではなく本 PR で唯一の production caller(build_intake_capsule.py)と唯一のテスト呼び出し元も同一 PR 内で同時に更新済みです。main()/build_capsule_argv()に追加した--base-ac-verification-result-file/base_ac_verification_result_fileは additive flag(既存--human-context-comment-url等と同じパターン)であり、既存呼び出し経路を破壊しません。Schema Consumer Inventory
N/A
reason: schema_change ではないため(Schema Change Applicability 参照)。
Safety Claim Matrix
resolve_pre_step1_data_plane_action()は最終 disposition(already_satisfied 合成後を含む)に対して一度だけ呼ばれ、raw evidence の再解釈による二重適用を構造的に排除するtest_disposition_precedes_worker_worktree_and_new_pr、test_collect_implementation_landed_evidence_applies_precedence_through_default_loaderbase_ac_satisfiedの production source が未配線の場合、固定の True/False を捏造せずapply_already_satisfied_precedence()を skip して既存 disposition をそのまま通すtest_collect_implementation_landed_evidence_skips_precedence_when_base_ac_undeterminable、test_derive_base_ac_satisfied_from_verification_result_never_fabricates_a_fallback_load_route_loop_verdict_v2_module()の既定ロード経路(モジュール注入なし)がroute_loop_verdict_v2.pyを実際にロードでき、例外を握り潰して恒常的に no-op になる状態を修正したtest_default_route_loop_verdict_v2_loader_succeeds_without_module_injection、test_apply_already_satisfied_precedence_fires_through_default_loaderpre_step1_data_planeの既存キー集合(start_data_plane/action)を変更しないset(evidence["pre_step1_data_plane"]) == {"start_data_plane", "action"}assertionbase_ac_verification_resultは production canonical CLI/public API 境界(main()の--base-ac-verification-result-file、build_intake_capsule()の同名パラメータ)から実際に到達可能であり、private helper への直接引数注入に依存しないtest_public_build_intake_capsule_reaches_already_satisfied_via_base_ac_verification_result、test_cli_main_reaches_already_satisfied_via_base_ac_verification_result_file、test_cli_main_base_ac_verification_result_file_missing_is_fail_safe_not_fatalderive_base_ac_satisfied_from_verification_result()は既存adjudicate_vc_result.pyの TEST_VERDICT_MACHINE/v2 検証を再利用し、AC identity 欠落・command_hash 欠落・非 0 exit・fallback/human_review/stop_condition フラグ・SKIP/PARTIAL 等を含む不完全 payload をTrueに誤判定しないtest_derive_base_ac_satisfied_from_verification_result_reuses_adjudicate_...、同ファイル内の隣接 negative-case tests_load_route_loop_verdict_v2_module()/_load_adjudicate_vc_result_module()/build_intake_capsule.py::_load_module()はロード失敗時、ロード開始前からsys.modulesに存在していた同名 entry を破壊せず復元し、無関係な他コードの entry を誤って削除しないtest_route_loop_verdict_v2_loader_restores_prior_entry_on_failure、test_adjudicate_vc_result_loader_restores_prior_entry_on_failure、test_load_module_restores_prior_entry_on_failure、test_load_module_removes_only_its_own_newly_inserted_entry_on_failureNotes
build_intake_capsule.py::_load_module()にも同種のsys.modules登録漏れがあり(route_loop_verdict_v2.pyのロード先として新規に使用開始したため顕在化)、Issue 実装: impl-review-loop の pre-Step-1 data-plane 判定を resolve_pre_step1_data_plane_action() に統合する #2713 の Allowed Paths 内(build_intake_capsule.py自体)で同時に修正しました。base_ac_satisfiedの実 production source(test-runner 相当の live 実行結果をbuild_intake_capsule.pyへ供給する配線)について: 当初の Issue 実装: impl-review-loop の pre-Step-1 data-plane 判定を resolve_pre_step1_data_plane_action() に統合する #2713(AC1-AC7 のみ)では本 PR のスコープ外として据え置いていましたが、本 PR refactor: pre-Step-1 data-plane判定をresolve_pre_step1_data_plane_action()に統合する #2741 へのレビュー(review comment)で「canonical production route から到達不能なままでは already_satisfied precedence が実質的に機能しない」との P1 blocker を受け、Issue 実装: impl-review-loop の pre-Step-1 data-plane 判定を resolve_pre_step1_data_plane_action() に統合する #2713 を 2026-09-24 に scope amendment(operator authorization)し、In Scope / AC8-AC10 / Verification Commands / Allowed Paths(preparation.md、test_intake_capsule_provenance_e2e.pyを追加)を拡張しました。本 iteration でこの production wiring を実装済みです(main()の--base-ac-verification-result-fileフラグ、build_intake_capsule()のbase_ac_verification_resultパラメータ、preparation.mdStep "0-a-0"/"0-a-1" 間のデータフロー新設)。「将来の Issue で接続する」という当初の記述は本 PR の実態と矛盾するため撤回します。