Skip to content

実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: "v1"
issue_kind: "implementation"
parent_issue: "#1950"
goal_ref: "#1975"
change_kind: "integration"

Parent Issue

#1950

(多段 owner turn の chronology metadata 化と reaction decision flow の issue-refinement-loop / impl-review-loop への導入)

Parent Goal Ref

#1950 の Goal は、owner の reaction による意思決定を issue-refinement-loop / impl-review-loop の判断フローへ chronology metadata として組み込むことである。本 Issue はその一部として、#1975 で実装された owner_reaction_decision.py の出力(selected_option_id)を、実際の heavy mutation gate 実行判断へ接続する未着手区間を扱う。

Current Validated Scope

Remaining Parent Gaps

  • 本 Issue は 5 種類の heavy mutation カテゴリ(close / not_planned / replacement_issue_creation / dependency_removal / parent_child_change)のうち not_planned のみを配線対象とする。これは「今回どこまで機能を実装するか」という rollout scope の決定であり、runtime mutation の個別承認(owner reaction 自体)とは別軸である。
  • 他の heavy mutation カテゴリ(close / replacement_issue_creation / dependency_removal / parent_child_change)への解禁範囲拡張は、operation + target を表現する canonical mutation-intent contract が確立してから、別 Issue として follow-up 化する。本 Issue はそれらのカテゴリを not_planned と同じ仕組みで扱えるよう一般化しない。

Outcome

owner_reaction_decision.py(owner_reaction.decide として fresh 実行)が返す OWNER_REACTION_DECISION_RESULT_V1 の selected 判定結果を、run_refinement_preflight.py の heavy mutation gate へ、既存 gate が唯一意味を持つ not_planned(close_not_planned)ケースに限定して、exact option/target binding を維持したまま production 接続する。

接続は run_refinement_preflight.py が heavy mutation gate 評価直前に owner_reaction_decision.py を(owner_reaction.decide の canonical argv shape と同一の引数で)fresh subprocess 実行し、その invocation の結果だけを使う設計とする。この設計のため、run_refinement_preflight.py CLI に mutation_category / owner_reaction_context(owner_user_id / preview_binding_file を含む)を canonical dispatch(skill_runtime_exec.py → command_registry.render_command())から供給する transport を確立し、production 接続する(PR #2697 の OWNER レビュー comment #5755475318 で、既存 Allowed Paths 4件のみでは canonical dispatch chain が mutation_category / owner_reaction_context を運べず production 到達不能であることが確認されたため、command_registry.py / skill_runtime_exec.py / skill_runtime_command_policy.py を Allowed Paths に追加する)。この設計により、preflight.run.with_human_context / contract_update.run.with_human_context のどちらの既存 canonical entrypoint から run_refinement_preflight.py が起動されても、追加の dispatcher 変更なしに接続が到達可能になる。

authorization は既存の trusted-anchor gate(_is_approved_close_not_planned_decision())とは意味を混同しない独立した predicate(例: _is_approved_owner_reaction_not_planned_decision(...))として実装し、少なくとも以下を要求する:

  • OWNER_REACTION_DECISION_RESULT_V1.status == "selected"
  • selected_option_metadata.operation == "close_not_planned"
  • selected option の target identity が、その mutation が適用される対象 Issue と完全一致する
  • 同一 operation/category でも別 target の option は承認済みとして扱わない(test_preview_binding_primary_identity が固定する identity-binding 契約を壊さない)
  • selected を approved_by_trusted_anchor に変換しない(authority semantics を混同しない)

close / replacement_issue_creation / dependency_removal / parent_child_change は本 Issue では fail-closed のまま維持する。authorization artifact の永続保存や TTL/ledger framework は新設しない。

Runtime Verification Applicability

decision: immediate
reason: >
  `_is_approved_owner_reaction_not_planned_decision(...)` の gate 統合は subagent
  lifecycle / skill invocation procedure に影響する extension-surface
  risk-trigger(skill-invocation-procedure-or-contract-change)に該当し、かつ
  #2694 で確立した fake-gh + real scripts/agent-guards/skill_runtime_exec.py
  subprocess fixture(.claude/skills/issue-refinement-loop/tests/owner_reaction_dispatch_fixture.py)
  を再利用すれば、live GitHub Actions や実 reaction mutation なしに
  production-shaped な producer→consumer path を focused pytest で直接検証できる。
  よって deferred のままにせず immediate verification とする。
applicable_acs:
  - AC4
  - AC6
execution_environment:
  cli_tools:
    - python3
    - uv
  auth_required: false
  network_required: false
skip_conditions:
  - condition: uv または python3 venv が起動できない
    action: exit 77 SKIP とし、docs/dev/runtime-verification-policy.md の SKIP 規約に従って証跡を残す
fallback_policy: >
  fake-gh fixture を経由しない unit-only テスト(hand-crafted known_context を
  直接渡すテストのみ)での PASS は AC4 / AC6 の充足とみなさない。real
  scripts/agent-guards/skill_runtime_exec.py subprocess 経路を通したテストの
  PASS のみを正とする。
artifact_requirements:
  - pytest 実行ログを PR 本文または PR コメントに証跡として貼付する
  - 新規 fixture 出力ファイルは .claude/skills/issue-refinement-loop/tests/ 配下に置く

In Scope

  • owner_reaction_decision.py の selected 出力(OWNER_REACTION_DECISION_RESULT_V1)を fresh 実行し、run_refinement_preflight.py の heavy mutation gate 判定へ渡すための変換・受け渡しロジックの実装
  • close_not_planned + exact target binding のみを許可する、既存 trusted-anchor gate とは独立した predicate/adapter(_is_approved_owner_reaction_not_planned_decision(...) 相当)の実装
  • heavy mutation gate 評価直前に owner_reaction_decision.py を fresh subprocess 実行し、その invocation の結果だけを使う(保存済み/キャッシュ済み authorization artifact を再利用しない)freshness 境界の実装
  • run_refinement_preflight.py の既存 Allowed Paths のみで到達可能な canonical production entrypoint からの transport(scripts/agent-guards/skill_runtime_exec.py / command_registry.py / skill_runtime_command_policy.py への変更なし)
  • 既存 fail-closed 挙動(close / replacement_issue_creation / dependency_removal / parent_child_change および unresolved / stale / environment_error は必ず拒否)を壊さないことを保証する回帰テストの追加
  • feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 の fake-gh + real skill_runtime_exec.py subprocess fixture(owner_reaction_dispatch_fixture.py)を再利用した production-shaped verification の追加
  • 関連する .claude/skills/issue-refinement-loop/SKILL.md の記述更新(配線が実装された場合の docstring/コメント更新を含む)

Out of Scope

  • owner_reaction_decision.py 自体の reaction 読み取りロジックの変更(実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 で確定済み)
  • impl-review-loop 側への同種配線の実装(別スコープとして follow-up 化する)
  • close / replacement_issue_creation / dependency_removal / parent_child_change の heavy mutation カテゴリへの解禁範囲拡張(not_planned 以外は fail-closed のまま維持し、本 Issue では扱わない)
  • generic な mutation-authorization framework(5 カテゴリを一般化する共通機構)の新設
  • authorization artifact の永続保存・TTL/ledger framework の新設
  • fake/stub は GitHub network boundary(gh CLI 呼び出し)に限定すること。canonical dispatch chain(skill_runtime_exec.py → command_registry.render_command() → run_refinement_preflight.py CLI main() → run_preflight())はそれ以外は real code path を通すこと。今回開放する mutation category は引き続き not_planned のみとし、close / replacement_issue_creation / dependency_removal / parent_child_change は fail-closed のまま維持する。generic authorization framework や authorization artifact の ledger/TTL 永続化は追加しない。
  • 無関係な harness / security framework の増設

Acceptance Criteria

  • AC1: run_refinement_preflight.py に、既存の trusted-anchor gate(_is_approved_close_not_planned_decision())とは独立した predicate(_is_approved_owner_reaction_not_planned_decision(...) 相当)が実装されており、OWNER_REACTION_DECISION_RESULT_V1.status == "selected" かつ selected_option_metadata.operation == "close_not_planned" かつ selected option の target identity が対象 Issue と完全一致する場合にのみ true を返す
  • AC2: 同一 close_not_planned operation でも target が異なる option は拒否される(selected_option_id の identity を collapse しない)ことが、test_preview_binding_primary_identity の identity-binding 契約に整合する回帰テストで示されている
  • AC3: status が unresolved / stale / environment_error の場合、および close / replacement_issue_creation / dependency_removal / parent_child_change の mutation category の場合は fail-closed(gate 拒否)のままであることが回帰テストで示されている
  • AC4: heavy mutation gate 評価の直前に owner_reaction_decision.py が fresh subprocess 実行され、run_refinement_preflight.py の同一 invocation 内で得られた結果だけが gate 判定に使われる(保存済み/キャッシュ済み結果の再利用がない)ことがテストで示されている
  • AC5: selected を approved_by_trusted_anchor に変換していない(新 predicate が既存の anchor-authority 変換ロジックを呼び出さず、_is_approved_close_not_planned_decision() の既存実装を変更しない)ことがコードレベルで示されている
  • AC6: real scripts/agent-guards/skill_runtime_exec.py → exact command parser/policy(skill_runtime_command_policy.py)→ command_registry.render_command() → run_refinement_preflight.py CLI main() → cli_known_context materialization → run_preflight() → _classify_heavy_mutation_gate_with_fresh_owner_reaction() → fresh owner_reaction_decision.py subprocess → _classify_heavy_mutation_gate() という実 chain が、producer/consumer をテストコードで手動接続することなく、1本の real subprocess 起動で通ることを示す pytest が存在すること(fake は GitHub network boundary(gh CLI)に限定してよい)。加えて、_run_owner_reaction_decision_fresh() は child subprocess の non-zero returncode を明示的に fail-closed 扱いすること(returncode != 0 かつ stdout が parseable JSON であっても transport success として扱わない regression test を含む)。また _classify_heavy_mutation_gate_with_fresh_owner_reaction() 系の predicate は decision.get("schema") == "OWNER_REACTION_DECISION_RESULT_V1" 相当の schema identity を検証すること
  • AC7: 既存の _classify_heavy_mutation_gate() / _is_approved_close_not_planned_decision() の既存テストが全て継続してパスする

Verification Commands

# AC1
$ rg -n "_is_approved_owner_reaction_not_planned_decision" .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py

# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_not_planned_gate.py::test_same_category_different_target_rejected -v

# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_not_planned_gate.py::test_unresolved_stale_environment_error_and_unsupported_category_fail_closed -v

# AC4
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_not_planned_gate.py::test_gate_uses_fresh_invocation_result_only -v

# AC5
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_not_planned_gate.py::test_new_predicate_does_not_convert_to_approved_by_trusted_anchor -v

# AC6
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_not_planned_gate_production_shaped.py::test_selected_not_planned_reaches_gate_via_real_subprocess -v

# AC7
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py -v

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/scripts/owner_reaction_decision.py
  • .claude/skills/issue-refinement-loop/tests/
  • .claude/skills/issue-refinement-loop/SKILL.md
  • .claude/skills/issue-refinement-loop/scripts/command_registry.py
  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/skill_runtime_command_policy.py
  • scripts/agent-guards/tests/(関連テストのみ)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合(scripts/agent-guards/skill_runtime_exec.py / .claude/skills/issue-refinement-loop/scripts/command_registry.py / scripts/agent-guards/skill_runtime_command_policy.py への変更は、PR feat: owner_reaction_decision.py の selected 出力を not_planned heavy mutation gate へ限定接続する #2697 OWNER レビュー comment #5755475318 を受けて本 Issue については上記 Allowed Paths 拡張により解消済み。以後の Allowed Paths 拡張が必要になった場合は改めて判断する)
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python(pytest ベースの契約テスト設計)
  • GitHub Actions ワークフロー上での reaction ベース owner 判断の運用理解

Required Design References

Delivery Rule

  • 1 Issue = 1 PR を原則とする。worktree は .claude/worktrees/issue-2689-* 命名規約に従う。
  • run_refinement_preflight.py / .claude/skills/issue-refinement-loop/tests/ を Allowed Paths に含む他の OPEN Issue(例: 実装: run_refinement_preflight.py の結果に decisions フィールドを出力しSKILL.mdとのSSOT乖離を解消する #1556、Outcome は decisions フィールド出力で本 Issue とは edit_intent が異なる)と並行実装する場合は、マージコンフリクトに注意し、後着手側が rebase する。
  • Draft PR を既定とし、impl-review-loop の APPROVE 判定を経てから ready for review にする。

Notes for Reviewer

Scope Collision (C1, overlap preflight check_issue_overlap.py): run_refinement_preflight.py および .claude/skills/issue-refinement-loop/tests/ を Allowed Paths に含む OPEN Issue が現時点(2026-09-21、origin/main = 10bbcf85c0bd7c33fc25f07617488d27b254703d)で存在する(例: #1556、Outcome は decisions フィールド出力で本 Issue とは異なる edit_intent のため重複ではない)。#2688 と #2678 は同様の Scope Collision 候補として以前挙げられていたが、いずれも現在は CLOSED であり本 Issue の着手を妨げない。並行実装する場合の直列化方針は上記 ## Delivery Rule を参照する。

Production wiring 設計(PR #2697 OWNER レビュー comment #5755475318 を受けた修正): owner_reaction.decide / owner_reaction.decide.fixture は #2694(Issue #2688)で既に scripts/agent-guards/skill_runtime_exec.py の exact dispatch に接続済みである。ただし当初想定していた「既存 4 パスの Allowed Paths だけで production 到達可能」という設計は、canonical dispatch chain(skill_runtime_exec.py → command_registry.py → run_refinement_preflight.py CLI main() → run_preflight())が mutation_category / owner_reaction_context を運ばないため成立しないことが判明した(初期 adversarial review comment #5754526086 の懸念が再発)。そのため command_registry.py / skill_runtime_exec.py / skill_runtime_command_policy.py を Allowed Paths に追加し、これらを経由する transport を確立したうえで、run_refinement_preflight.py が owner_reaction_decision.py を fresh subprocess として直接呼び出す設計(## Outcome 参照)により production entrypoint(preflight.run.with_human_context / contract_update.run.with_human_context のいずれの既存 canonical dispatch からでも)から到達可能にする。

owner allowlist 判断: 本 Issue の対象コメント(issuecomment-5754526086、operator-selected human context)により、5 種類の heavy mutation カテゴリのうち今回配線するのは not_planned のみであることが OWNER により明示的に確定している。他カテゴリへの解禁は別 Issue の follow-up 判断に委ねる。

Source

Activity

  1. added
    enhancement
    phase/implementation
    agent/implementer
    triage-required
    on Sep 20, 2026
  2. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    結論

    Issue #2689 は必要な統合ですが、現状の契約のまま実装するのは REQUEST_CHANGES 相当です。特に、selected_option_id を heavy mutation gate へ接続する経路が canonical production path に存在しない点と、「特定 option への owner 承認」を「mutation category 全体の承認」に拡大し得る点が大きな問題です。

    2026-09-21 11:04 JST 時点の fresh read では、#2689 のコメントは 0件で、要求されている owner allowlist 判断もまだありません。一方、#2688 は PR #2694 で完了し、現在の main は 10bbcf85c0bd7c33fc25f07617488d27b254703d です。つまり #2689 の本文は既に一部 stale です。Issue #2689 PR #2694

    敵対的レビュー

    1. P0 — 現在の Allowed Paths では production wiring が成立しません。 owner_reaction.decide 自体は feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 により skill_runtime_exec.py から実行可能になりました。しかし run_refinement_preflight.py の CLI は、owner_reaction_decision_result も selected_option_id も mutation_category も受け取りません。CLI が known_context に投入するのは現状 human_context_comment_urls / agent_report_comment_urls だけです。一方 heavy gate は known_context["mutation_category"] と scope_delta_decision が存在して初めて動きます。したがって、Python テストから hand-crafted known_context を渡せば green にできますが、canonical skill_runtime_exec.py → registry → run_refinement_preflight.py 経路では到達できません。これは 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 が潰した「実装は存在するが production entrypoint から到達不能」という false-green の再発です。実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 の Allowed Paths に command_registry.py / skill_runtime_exec.py / skill_runtime_command_policy.py を含めるか、別の既存 canonical transport を明記する必要があります。

    2. P0 — selected_option_id を category に潰すと owner の承認範囲を拡大します。 実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 の test_preview_binding_primary_identity は、同じ operation: close_not_planned でも target #100 と #200 は別 option であり、同一操作としてcollapseしてはいけないことを明示的にテストしています。ところが現 heavy gate が見るのは実質 mutation_category だけです。たとえば parent_child_change の option A を owner が選んだ後、「parent_child_change が allowlist」という理由だけで option B の別 target を通せば、reaction の identity binding を破壊します。実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 の設計意図そのものへの回帰です。Issue #1975

    3. P1 — Issue コメントで決める「category allowlist」は authority と rollout policy が混ざっています。 親 実装: multi-turn anchor の owner turn を chronology metadata として扱い、reaction decision flow を issue-refinement-loop と impl-review-loop へ導入する #1950 は、chronology・technical recommendation・mutation authorization を分離し、decision preview に束縛された owner reaction 自体を明示的 authorization の一形態として定義しています。したがって 実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 の着手前コメントは runtime authorization ではなく、「今回どこまで実装するか」という feature scope に限定すべきです。さらに現在の5分類では close と not_planned が並列ですが、既存 gate が唯一理解するのは decision=close_not_planned + authorized_mutation_category=not_planned です。generic close の具体的意味はまだ gate contract にありません。Parent Issue #1950

    4. P1 — reaction result の freshness 境界が不足しています。 owner_reaction_decision.py 自体は reaction 全ページ取得後に comment / anchor / Issue を readback するよう PR feat: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/selection resolver として実装する #2683 で改善されています。しかし、その selected result を後続 invocation が保存・再利用する設計にすると、その間に owner が reaction を削除しても旧 authorization を消費できます。GitHub API は issue-comment reaction の削除を正式にサポートしています。(GitHub Docs) 新しい ledger や TTL framework は不要で、heavy gate を評価する直前に owner_reaction.decide を fresh 実行し、その invocation の結果だけ使う程度で十分です。

    5. P1 — Runtime Verification: deferred は feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 マージ後には弱すぎます。 live GitHub Actions や実 reaction mutation は不要です。feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 には既に fake gh を network boundary にだけ置き、real skill_runtime_exec.py subprocess を通す fixture infrastructure があります。これを再利用して owner_reaction.decide.fixture → selected result → consumer adapter → heavy gate の1本だけ production-shaped に通せます。これなら workflow を肥大化させず、unit-only false-green を防げます。PR feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 のレビューでも、read-only command に不要な active-worktree coupling を外すなど、過剰な harness を削る方向が採られています。PR #2694 の adversarial review

    6. P2 — Verification Commands が acceptance を証明していません。 AC1 の rg "owner_reaction_decision" は import やコメント1行だけでも通ります。AC3 の credentialless transport test は今回の「reaction selection → mutation gate」の wiring を直接証明しません。必要なのは、同一 category・別 target の拒否、unresolved/stale/environment_error の拒否、unsupported category の拒否、exact selected option の許可、production-shaped producer→consumer の5ケース程度です。巨大なテストハーネスは不要です。

    7. P2 — Issue body の factual freshness と contract hygiene も更新が必要です。 Current Validated Scope は origin/main 33a6ffbf を基準にしていますが、現在の main は feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 マージ後の 10bbcf85... です。また Notes では 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 / 実装: contract_update.run.with_human_context の mutation phase に investigation evidence transport (#2086 AC3) を配線する #2678 を OPEN Issue の例にしていますが、両方とも現在は closed です。さらに Notes は「## Delivery Rule の直列化推奨」を参照していますが、実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 本文に ## Delivery Rule セクション自体がありません。実装前に一度 refinement し直すべき状態です。

    外部仕様については、reaction reader 自体を再設計する必要はありません。GitHub CLI の gh api --paginate は全ページを順次取得し、--slurp はページ単位の JSON を外側の配列にまとめる仕様です。(GitHub CLI) Issue-comment reaction API も現在 +1/-1/laugh/confused/heart/hooray/rocket/eyes と user.id を返すので、現行 principal resolver と pagination 方針は妥当です。(GitHub Docs) また issue-comment readback には issue_url が含まれるため、PR #2683 で追加された Issue binding も公式 API と整合しています。(GitHub Docs)

    最小構成での推奨 reframe

    項目 | 推奨 -- | -- 今回解禁する mutation | not_planned のみに固定。5カテゴリの owner allowlist 選択を着手条件にしない Authorization | status == selected だけでなく、selected_option_metadata.operation == "close_not_planned" と target が今回の対象 Issue に完全一致することを要求 Gate integration | selected を偽って approved_by_trusted_anchor に変換するより、_is_approved_owner_reaction_not_planned_decision(...) のような別 predicate を追加し、既存 anchor authority と意味を混ぜない 他4カテゴリ | close / replacement_issue_creation / dependency_removal / parent_child_change は fail-closed のまま。operation + target を表現する canonical mutation-intent contract ができてから拡張 Freshness | 保存済み authorization artifact を信用せず、gate 直前に既存 owner_reaction.decide を fresh 実行 Production wiring | canonical CLI から届く実経路を定義するため、必要なら #2694 で確立した exact-dispatch 関連3ファイルを Allowed Paths に追加。新規 generic runner / ledger / publisher は作らない Runtime verification | deferred から immediate に変更。ただし fake gh の focused real-subprocess test 1本で十分

    この形なら、#2689 は「5種類の mutation authorization framework」を新設する Issue ではなく、既に十分成熟している owner reaction reader を、まず not_planned という既存 gate の唯一の実装済みケースへ正しく接続する Issueになります。品質を落とさず、ハーネス増加もかなり抑えられます。

    ## 結論

    Issue #2689 は必要な統合ですが、現状の契約のまま実装するのは REQUEST_CHANGES 相当です。特に、selected_option_id を heavy mutation gate へ接続する経路が canonical production path に存在しない点と、「特定 option への owner 承認」を「mutation category 全体の承認」に拡大し得る点が大きな問題です。

    2026-09-21 11:04 JST 時点の fresh read では、#2689 のコメントは 0件で、要求されている owner allowlist 判断もまだありません。一方、#2688 は PR #2694 で完了し、現在の main は 10bbcf85c0bd7c33fc25f07617488d27b254703d です。つまり #2689 の本文は既に一部 stale です。[Issue #2689](https://github.com/squne121/loop-protocol/issues/2689?utm_source=chatgpt.com) [PR #2694](https://github.com/squne121/loop-protocol/pull/2694?utm_source=chatgpt.com)

    敵対的レビュー

    1. P0 — 現在の Allowed Paths では production wiring が成立しません。 owner_reaction.decide 自体は feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 により skill_runtime_exec.py から実行可能になりました。しかし run_refinement_preflight.py の CLI は、owner_reaction_decision_result も selected_option_id も mutation_category も受け取りません。CLI が known_context に投入するのは現状 human_context_comment_urls / agent_report_comment_urls だけです。一方 heavy gate は known_context["mutation_category"] と scope_delta_decision が存在して初めて動きます。したがって、Python テストから hand-crafted known_context を渡せば green にできますが、canonical skill_runtime_exec.py → registry → run_refinement_preflight.py 経路では到達できません。これは 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 が潰した「実装は存在するが production entrypoint から到達不能」という false-green の再発です。実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 の Allowed Paths に command_registry.py / skill_runtime_exec.py / skill_runtime_command_policy.py を含めるか、別の既存 canonical transport を明記する必要があります。

    2. P0 — selected_option_id を category に潰すと owner の承認範囲を拡大します。 実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 の test_preview_binding_primary_identity は、同じ operation: close_not_planned でも target #100 と #200 は別 option であり、同一操作としてcollapseしてはいけないことを明示的にテストしています。ところが現 heavy gate が見るのは実質 mutation_category だけです。たとえば parent_child_change の option A を owner が選んだ後、「parent_child_change が allowlist」という理由だけで option B の別 target を通せば、reaction の identity binding を破壊します。実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 の設計意図そのものへの回帰です。[Issue #1975](https://github.com/squne121/loop-protocol/issues/1975?utm_source=chatgpt.com)

    3. P1 — Issue コメントで決める「category allowlist」は authority と rollout policy が混ざっています。 親 実装: multi-turn anchor の owner turn を chronology metadata として扱い、reaction decision flow を issue-refinement-loop と impl-review-loop へ導入する #1950 は、chronology・technical recommendation・mutation authorization を分離し、decision preview に束縛された owner reaction 自体を明示的 authorization の一形態として定義しています。したがって 実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 の着手前コメントは runtime authorization ではなく、「今回どこまで実装するか」という feature scope に限定すべきです。さらに現在の5分類では close と not_planned が並列ですが、既存 gate が唯一理解するのは decision=close_not_planned + authorized_mutation_category=not_planned です。generic close の具体的意味はまだ gate contract にありません。[Parent Issue #1950](https://github.com/squne121/loop-protocol/issues/1950?utm_source=chatgpt.com)

    4. P1 — reaction result の freshness 境界が不足しています。 owner_reaction_decision.py 自体は reaction 全ページ取得後に comment / anchor / Issue を readback するよう PR feat: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/selection resolver として実装する #2683 で改善されています。しかし、その selected result を後続 invocation が保存・再利用する設計にすると、その間に owner が reaction を削除しても旧 authorization を消費できます。GitHub API は issue-comment reaction の削除を正式にサポートしています。([GitHub Docs]1) 新しい ledger や TTL framework は不要で、heavy gate を評価する直前に owner_reaction.decide を fresh 実行し、その invocation の結果だけ使う程度で十分です。

    5. P1 — Runtime Verification: deferred は feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 マージ後には弱すぎます。 live GitHub Actions や実 reaction mutation は不要です。feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 には既に fake gh を network boundary にだけ置き、real skill_runtime_exec.py subprocess を通す fixture infrastructure があります。これを再利用して owner_reaction.decide.fixture → selected result → consumer adapter → heavy gate の1本だけ production-shaped に通せます。これなら workflow を肥大化させず、unit-only false-green を防げます。PR feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 のレビューでも、read-only command に不要な active-worktree coupling を外すなど、過剰な harness を削る方向が採られています。[PR #2694 の adversarial review](feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694)

    6. P2 — Verification Commands が acceptance を証明していません。 AC1 の rg "owner_reaction_decision" は import やコメント1行だけでも通ります。AC3 の credentialless transport test は今回の「reaction selection → mutation gate」の wiring を直接証明しません。必要なのは、同一 category・別 target の拒否、unresolved/stale/environment_error の拒否、unsupported category の拒否、exact selected option の許可、production-shaped producer→consumer の5ケース程度です。巨大なテストハーネスは不要です。

    7. P2 — Issue body の factual freshness と contract hygiene も更新が必要です。 Current Validated Scope は origin/main 33a6ffbf を基準にしていますが、現在の main は feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 マージ後の 10bbcf85... です。また Notes では 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 / 実装: contract_update.run.with_human_context の mutation phase に investigation evidence transport (#2086 AC3) を配線する #2678 を OPEN Issue の例にしていますが、両方とも現在は closed です。さらに Notes は「## Delivery Rule の直列化推奨」を参照していますが、実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 本文に ## Delivery Rule セクション自体がありません。実装前に一度 refinement し直すべき状態です。

    外部仕様については、reaction reader 自体を再設計する必要はありません。GitHub CLI の gh api --paginate は全ページを順次取得し、--slurp はページ単位の JSON を外側の配列にまとめる仕様です。(GitHub CLI) Issue-comment reaction API も現在 +1/-1/laugh/confused/heart/hooray/rocket/eyes と user.id を返すので、現行 principal resolver と pagination 方針は妥当です。([GitHub Docs]1) また issue-comment readback には issue_url が含まれるため、PR #2683 で追加された Issue binding も公式 API と整合しています。([GitHub Docs]3)

    最小構成での推奨 reframe

    項目 推奨
    今回解禁する mutation not_planned のみに固定。5カテゴリの owner allowlist 選択を着手条件にしない
    Authorization status == selected だけでなく、selected_option_metadata.operation == "close_not_planned" と target が今回の対象 Issue に完全一致することを要求
    Gate integration selected を偽って approved_by_trusted_anchor に変換するより、_is_approved_owner_reaction_not_planned_decision(...) のような別 predicate を追加し、既存 anchor authority と意味を混ぜない
    他4カテゴリ close / replacement_issue_creation / dependency_removal / parent_child_change は fail-closed のまま。operation + target を表現する canonical mutation-intent contract ができてから拡張
    Freshness 保存済み authorization artifact を信用せず、gate 直前に既存 owner_reaction.decide を fresh 実行
    Production wiring canonical CLI から届く実経路を定義するため、必要なら #2694 で確立した exact-dispatch 関連3ファイルを Allowed Paths に追加。新規 generic runner / ledger / publisher は作らない
    Runtime verification deferred から immediate に変更。ただし fake gh の focused real-subprocess test 1本で十分

    この形なら、#2689 は「5種類の mutation authorization framework」を新設する Issue ではなく、既に十分成熟している owner reaction reader を、まず not_planned という既存 gate の唯一の実装済みケースへ正しく接続する Issueになります。品質を落とさず、ハーネス増加もかなり抑えられます。

  3. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    推奨アクションは、対象コメント #5754526086 を operator-selected human context として扱い、#2689 をその推奨 reframe に沿って refinement し直すことです。現行 main は確認時点で 10bbcf85c0bd7c33fc25f07617488d27b254703d で、#2694 の owner_reaction.decide exact dispatch は既に入っています。したがって、#2689 の古い前提を維持したまま実装フェーズへ送るのは避けるべきです。

    方向性としては、5種類の heavy mutation を一般化するのではなく、今回は not_planned のみへ絞るのが妥当です。status == selected だけで許可せず、selected_option_metadata.operation == "close_not_planned" と target identity の完全一致を要求し、approved_by_trusted_anchor への偽装変換もしない。他カテゴリは fail-closed のままにします。また、#2694 後の production path を実際に通すために必要な Allowed Paths は codebase-investigator に current main から導出させ、手書きの追加判断を人間へ戻さない構成が適しています。

    以下を、既に auto mode で起動済みの Claude Code にそのまま渡す想定です。

    Issue #2689 を対象に、repository の canonical issue-refinement-loop を使って refinement を実行してください。

    対象:

    このセッションは既に auto mode です。repository の loop_iteration_approval_gate.default_required: false に従い、各 iteration・Issue 本文 rewrite・再レビューのたびに私へ承認確認を求めず、許可された範囲で自律的に最後まで進めてください。

    ただし、repository-owned の fail-closed / environment / integrity / genuine semantic hard-stop を捏造した承認で迂回してはいけません。人間承認のためだけに任意停止するのは禁止ですが、canonical contract が本当に terminal route を返した場合は、その前に repository が定義する deterministic repair、trusted human-context continuation、issue-editor rewrite 等の自動経路をすべて使い切ってください。

    Human-context の扱い

    今回の #issuecomment-5754526086 は、私が明示的に選択した human context です。

    URL や投稿者情報から origin を再推測せず、issue-refinement-loop の Accepted Trust Model に従い operator-selected human-context lane として扱ってください。必要な preflight は unlabeled with_anchor ではなく canonical preflight.run.with_human_context 相当の経路を使用してください。

    このコメントに含まれる adversarial review と「最小構成での推奨 reframe」を、今回の refinement における owner/operator direction として反映してください。

    今回採用する設計方向

    #2689 を「5種類すべての heavy mutation authorization framework を実装する Issue」にはしないでください。

    今回の実装対象は原則として not_planned のみへ narrow してください。

    owner reaction による authorization は少なくとも次を満たす契約にしてください。

    • OWNER_REACTION_DECISION_RESULT_V1.status == "selected"
    • selected_option_metadata.operation == "close_not_planned"
    • selected option の target identity が、その mutation が適用される対象 Issue と完全一致する
    • 同一 operation/category でも別 target の option は承認済みとして扱わない
    • selected を approved_by_trusted_anchor に変換して authority semantics を混同しない
    • 必要なら _is_approved_owner_reaction_not_planned_decision(...) 等の独立した predicate / adapter として設計し、既存 trusted-anchor gate の意味を変更しない
    • close / replacement_issue_creation / dependency_removal / parent_child_change は今回 fail-closed のまま維持する
    • authorization artifact の長期保存や TTL/ledger framework は新設しない
    • heavy mutation gate の評価直前に既存 canonical owner_reaction.decide を fresh 実行し、その invocation の結果だけを使用する方向を優先する

    この direction は「runtime mutation の個別承認」と「今回どこまで機能を実装するかという rollout scope」を混同しないよう Issue 本文へ明示してください。

    Current-main freshness

    作業開始時に origin/main を fresh fetch/read し、SHA を記録してください。

    確認済み参考値は 10bbcf85c0bd7c33fc25f07617488d27b254703d ですが、これを盲信せず作業開始時点の current main を再確認してください。

    特に以下を fresh read してください。

    #2688 / #2678 が既に closed なら、#2689 の Notes に残る「OPEN Issue」の stale 記述を修正してください。

    存在しない ## Delivery Rule を参照しているなら、参照を除去するか、実際に必要な contract として追加するかを repository evidence に基づき決めてください。

    SubAgent を必ず使用すること

    main/root thread 自身だけで調査を済ませないでください。

    まず read-only の codebase-investigator SubAgent を起動し、少なくとも次を独立調査させてください。

    1. feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 後の canonical skill_runtime_exec.py → command registry → owner_reaction.decide production path
    2. OWNER_REACTION_DECISION_RESULT_V1 の exact result shape と identity-binding semantics
    3. run_refinement_preflight.py の現在の heavy mutation gate producer/consumer 境界
    4. selected result を実際の canonical consumer へ届けるために必要な最小 repository-relative path 集合
    5. current 実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 Allowed Paths だけで production wiring が成立するか
    6. test_preview_binding_primary_identity が固定している同一 operation / 別 target の非 collapse 契約
    7. feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 の fake-gh + real skill_runtime_exec.py subprocess fixture を今回の production-shaped verification に再利用できるか

    SubAgent には mutation をさせないでください。

    SubAgent を起動したら、必ずその完了を待って結果を join してから判断を進めてください。background launch や Agent invocation を「完了」とみなして先へ進んではいけません。

    複数の独立調査を並列化してよいですが、全 SubAgent の完了を待ってから統合してください。SubAgent からさらに nested SubAgent を起動させないでください。

    対象コメント中の GitHub CLI / GitHub reaction API 等の外部仕様が Issue contract の判断に dispositive なら、repository の web-research routing に従って web-researcher SubAgent も使ってください。その場合も完了を必ず待ち、repository evidence だけで十分なら不要な外部調査・ハーネス追加は避けてください。

    Allowed Paths の expansion

    対象コメントでは production wiring のために現在の Allowed Paths が不足している可能性が指摘されています。

    特に候補として以下があります。

    • .claude/skills/issue-refinement-loop/scripts/command_registry.py
    • scripts/agent-guards/skill_runtime_exec.py
    • scripts/agent-guards/skill_runtime_command_policy.py

    ただし、この3つを機械的に追加するのではなく、上記 codebase-investigator の結果から actual canonical transport に必要な exact path を導出してください。

    references/anchor-comment-handling.md 等に #1975 時点の「heavy gate へは接続しない」という stale normative text があり今回の実装後に矛盾するなら、その更新要否も調査してください。

    operator-selected human-context による Allowed Paths expansion が必要になった場合、私へ exact path の再入力や手書き ANCHOR_SCOPE_REFRAME_V1 を要求しないでください。

    SKILL.md / #2086 / #2678 の canonical route に従い、必要なら codebase-investigator の read-only investigation evidence から exact repository-relative path を導出し、investigation_evidence_transport を使って preflight.run.with_human_context → contract_update.run.with_human_context の authorized continuation を進めてください。

    NEXT_ACTION: issue_editor_required が返った場合は、同じ contract-update mutation をループ再試行せず、対象 human-context URLを reviewer_feedback_url として既存 issue-editor / edit-issue controlled transaction へ handoffし、full rewrite を実行してください。

    Issue contract の更新要件

    refinement 後の #2689 は少なくとも次を明確にしてください。

    Outcome:
    既存の owner reaction reader を、まず既存 gate が意味を持つ not_planned case に exact option/target binding を維持して production 接続する。

    In Scope:

    • fresh owner_reaction.decide result の consumption
    • close_not_planned + exact target binding
    • anchor authority と owner-reaction authority を混ぜない dedicated gate/predicate
    • canonical production entrypoint から到達可能な transport
    • focused regression / production-shaped verification

    Out of Scope:

    • generic close
    • replacement_issue_creation
    • dependency_removal
    • parent_child_change
    • generic mutation-authorization framework
    • persistent authorization ledger / TTL framework
    • owner reaction reader 自体の不要な再設計
    • unrelated harness/security framework の増設

    Acceptance Criteria / Verification Commands は、単なる rg presence check で wiring 成功としないよう更新してください。

    最低限、次の behavior を直接証明できるようにしてください。

    • exact selected option + exact target の not_planned は gate へ到達できる
    • 同一 close_not_planned でも別 target は拒否される
    • unresolved / stale / environment_error 等は fail-closed
    • unsupported mutation category は fail-closed
    • real skill_runtime_exec.py subprocess と既存 fake-gh boundary を用いた production-shaped producer→consumer path が1本通る

    巨大な新規 test harness は作らず、#2694 の fixture infrastructure を優先的に再利用してください。

    Runtime Verification Applicability は、現在の #2694 後の実装状況を踏まえて再評価してください。対象コメントの推奨どおり focused real-subprocess test が成立するなら deferred のままにせず immediate verification としてください。

    Refinement loop の実行

    .claude/skills/issue-refinement-loop/SKILL.md を thin entrypoint として読み、必要な references/ だけ progressive disclosure で読んでください。判定を独自 prose で再実装しないでください。

    対象 human-context URLを指定した canonical preflight から開始し、planner result、investigation、review、rewrite、fresh review、final contract readiness の順で repository contract に従って進めてください。

    canonical Step 2 の run_root_review_pipeline.py produce は SKILL.md の execution contract どおり、Claude Code Bash から run_in_background: true で起動し、background task の完了通知を必ず join して実際の JSON 結果を取得してから canonical_step2_route を consume してください。

    background 起動しただけで Step 2 完了扱いにしてはいけません。

    canonical_step2_route は producer JSON の値をそのまま routing authority として使い、status / verdict / next_action から独自に再導出しないでください。

    needs-fix の場合、max_iterations の範囲では承認を求めず自動 rewrite → fresh review を続行してください。

    issue-editor やその他 SubAgent を起動した場合も、その invocation の完了を待って結果を取得してから次フェーズへ進んでください。

    人間へ戻さず自動処理してよい事項

    以下については私へ確認を求めず、repository evidence と対象コメントの direction に基づいて決定・実行してください。

    • not_planned のみに scope を narrow すること
    • stale factual statements の更新
    • obsolete OPEN/closed 記述の修正
    • Verification Commands の強化
    • Runtime Verification を focused immediate test に変更すること
    • production reachability のための最小 Allowed Paths expansion
    • exact path 導出のための read-only investigation
    • contract-update / issue-editor の canonical rewrite
    • review blocker の自動修正
    • refinement iteration の自動継続

    今回、5 mutation category のどれを選ぶかを私に再質問してはいけません。今回の operator direction は not_planned のみです。

    禁止事項

    • selected_option_id を mutation category だけへ collapse する
    • selected を approved_by_trusted_anchor に偽装変換する
    • target identity を捨てる
    • stale authorization result を後続 invocation で再利用する
    • unit test 内の hand-crafted known_context だけで production wiring 成功と判定する
    • feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 以前の repository state を前提に contract を書く
    • raw gh issue edit 等で controlled mutation lane を迂回する
    • iteration ごとに私へ「続行しますか」と聞く
    • background/SubAgent の完了を待たず先へ進む
    • terminal canonical result を人為的に approve へ書き換える

    完了条件

    Issue #2689 の本文が対象コメントの P0/P1/P2 finding を反映して rewrite され、fresh canonical Step 2 review が approve 相当へ収束し、最新 Issue body に対する final CONTRACT_REVIEW_RESULT_V1.status == "go" と freshness が確認できるところまで進めてください。

    issue_kind: implementation の approved termination/handoff が成立する場合は、repository の canonical termination / handoff flow に従って終了してください。

    この依頼は Issue refinement が対象です。refinement 完了後に implementation が自動 handoff されることを repository contract が明示的に要求する場合を除き、#2689 の実装そのものを独自判断で先行開始しないでください。

    最終報告では、少なくとも以下を簡潔に示してください。

    • 使用した current-main SHA
    • 使用した human-context URL
    • SubAgent と background task をすべて join 済みであること
    • Issue body の主要 reframe
    • Allowed Paths の変更
    • Verification Commands / Runtime Verification の変更
    • 最終 review / contract-readiness 結果
    • terminal route または handoff state

    このプロンプトでは、対象コメントを単なる「参考レビュー」ではなく、スキルが既に持つ with_human_context 継続経路へ明示的に載せています。そのため、Allowed Paths 拡張のたびに人間へ戻るより、codebase-investigator → investigation evidence → controlled rewrite → fresh review で収束させる構成です。

  4. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 完了報告

    対象コメント #issuecomment-5754526086(operator-selected human context)の P0/P1/P2 finding と「最小構成での推奨 reframe」を反映し、Issue 本文を rewrite しました(fix_delta 2 iteration)。

    • canonical Step 2(run_root_review_pipeline.py produce)は iteration 1 で needs-fix(C11: decision: immediate に対する runtime-verification: true タグ欠落)、iteration 2 で approve(canonical_step2_route: step_2_5、deterministic checks 全 pass)に収束しました。
    • Step 2.5 semantic design review applicability 判定(semantic_review_trigger.py)は semantic_review_applicable: false のため skip し、直接 approved 終了へ進みました。
    • 最終 body(sha256:b96b75a19f846fb7f38bb42477569aba58713144c26b9dc83951e23af0f747b3)に対して run_contract_review_once.py --mode static を再実行し、CONTRACT_REVIEW_ONCE_RESULT_V1.status == "go"(readiness: go、VC baseline preflight: pass、全 VC が baseline で期待通り fail)を fresh に確認しました。

    Final Gate: passed(status: go を実際に確認した通常経路)

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: "2026-09-21T02:58:00Z"
        body_sha256: "sha256:b96b75a19f846fb7f38bb42477569aba58713144c26b9dc83951e23af0f747b3"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "presentation label 変更は本 refinement サイクルでは行っていない"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-21T02:58:00Z"
      checked_body_sha256: "sha256:b96b75a19f846fb7f38bb42477569aba58713144c26b9dc83951e23af0f747b3"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  5. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  6. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    確認した時点では、#2689 は refinement 完了済みで impl_ready、直後の root audit も invoke_impl_review_loop です。ただし、そのコメントを再利用して Step 1 を開始するのではなく、impl-review-loop 現行契約どおり Root-Owned Synchronous Entry Transition を今回の invocation 内で fresh に再実行する必要があります。

    また、refinement 時の main 10bbcf85... から既に進んでおり、現在確認できた main は 001ced10bb34f610f68fb6459936123630d6839e です。したがって、Claude Code 側ではこの SHA すら固定値として信頼せず、開始時に fresh fetch/read させる構成がよいです。

    推奨は次です。max_iterations=3 の標準ループを承認確認なしで使い、implementation-worker → test-runner → pr-reviewer → route_loop_verdict_v2 を厳守します。各 SubAgent は 起動しただけで完了扱いにせず、final result と list_agents の terminal completed の両方を確認させます。REQUEST_CHANGES は fix_delta として自動修正へ戻し、BEHIND は worker に update-branch を委譲、stale head は再レビューします。最終的に approved / draft_pr_ready まで到達させますが、merge 自体は実行させません。

    そのまま Claude Code に投入するプロンプトです。

    Issue #2689 を対象に、repository の canonical impl-review-loop を使って、実装 → 独立検証 → PR review → 修正ループを マージ直前まで自律実行してください。

    対象:

    この Claude Code セッションは既に auto mode で起動済みです。

    各 iteration、実装、テスト、commit、push、PR 作成・更新、review blocker 修正、CI 再確認、branch update、再レビューのたびに私へ承認を求めず、repository contract が許す範囲で自律的に進めてください。

    ただし merge は実行しないでください。

    目標は impl-review-loop の canonical termination である IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready、すなわち人間が最終 merge 判断できる状態まで到達することです。

    現在確認済みの状態

    Issue #2689 は既に issue-refinement-loop を完了しています。

    最新の refinement 完了報告:

    その直後の root-owned audit:

    ただし、これら既存コメントを Step 1 authorization packet として再利用してはいけません。

    .claude/skills/impl-review-loop/SKILL.md の
    Root-Owned Synchronous Entry Transition
    を正本として、今回の invocation 自身で fresh な entry transition を実行してください。

    参考として、外部確認時点の current main は:

    001ced10bb34f610f68fb6459936123630d6839e

    です。

    これは参考値に過ぎません。作業開始時に必ず origin/main / live GitHub main を fresh read し、最新 SHA を使ってください。

    0. Root-Owned Synchronous Entry Transition を今回 fresh に実行する

    過去の LOOP_HANDOFF_RESULT_V1 や root-entry-audit-marker だけを根拠に implementation-worker を直接起動しないでください。

    root/main thread 自身が、単一の継続した invocation / control flow の中で、repository canonical implementation に従い少なくとも次を実行してください。

    1. capability preflight
    2. live Issue 実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 fetch
    3. current-run issue-contract-review
    4. review 直後の live Issue 再取得
    5. decide_root_entry_route() / run_root_transition() による fresh routing
    6. fresh route が invoke_impl_review_loop の場合だけ、同一 continuous invocation 内で Step 1 を開始

    .claude/skills/issue-refinement-loop/scripts/root_entry_router.py
    および
    .claude/skills/issue-refinement-loop/references/termination-policy.md
    の Root-Owned Synchronous Entry Transition を正本として使用してください。

    body drift があれば canonical route に従って current-run contract review をやり直し、過去コメントの stale go を無理に再利用しないでください。

    一方で contract snapshot / scope rollup / launch ledger / body SHA 等の advisory artifact の欠落だけを独自の hard stop に昇格させないでください。

    1. impl-review-loop を正本どおり読む

    .claude/skills/impl-review-loop/SKILL.md を thin entrypoint として読み、必要な以下の step document を progressive disclosure で参照してください。

    • steps/preparation.md
    • steps/step-1-implementation.md
    • steps/step-2-verification.md
    • steps/step-4-pr-review.md
    • steps/step-5-feedback-and-termination.md
    • steps/step-5-mergeability-handling.md
    • 必要な場合のみ steps/conflicting-pr-escalation-runbook.md
    • steps/context-protocol-and-guardrails.md

    また着手前に docs/dev/workflow.md の通常 workflow safety boundary を確認してください。

    自然言語で独自の簡易版 loop を再実装せず、repository scripts / routing functions / output contracts をそのまま使ってください。

    2. Live Issue contract を実装の正本にする

    Issue #2689 の 現在の live body を fresh read し、以下を抽出してください。

    • Outcome
    • In Scope
    • Out of Scope
    • Acceptance Criteria
    • Verification Commands
    • Allowed Paths
    • Stop Conditions
    • Runtime Verification Applicability
    • Delivery Rule
    • Required Design References

    refinement 時点のコピーではなく live body を正本にしてください。

    特に今回の設計境界は維持してください。

    • 対象 mutation は not_planned のみ
    • OWNER_REACTION_DECISION_RESULT_V1.status == "selected" が必要
    • selected_option_metadata.operation == "close_not_planned" が必要
    • selected option の target identity と実 mutation target が完全一致すること
    • 同一 operation/category でも別 target を承認済みとして collapse しない
    • selected を approved_by_trusted_anchor に変換しない
    • trusted-anchor gate と owner-reaction authorization は独立 predicate / adapter とする
    • close
    • replacement_issue_creation
    • dependency_removal
    • parent_child_change

    は今回 fail-closed のまま維持する

    Issue の Allowed Paths を厳守してください。

    Allowed Paths 外の変更が必要に見えた場合は、勝手に変更せず Issue Stop Conditions と canonical routing に従ってください。

    3. SubAgent を必ず使用する

    root/main thread 自身が implementation / test / review を代行してはいけません。

    root は control-plane に限定し、data-plane は canonical custom SubAgent へ委譲してください。

    Step 1 — implementation-worker

    implementation-worker SubAgent を必ず起動し、
    .claude/skills/implement-issue/SKILL.md
    を実行させてください。

    実際の dispatch では step-1-implementation.md の materialization rule に従い、placeholder のまま渡さず、少なくとも以下の実値を child message に埋め込んでください。

    • Issue number: 2689
    • full Issue URL
    • fresh live Allowed Paths
    • contract snapshot URL が存在し利用する場合はその実 URL
    • iteration
    • fix_delta(初回は空、REQUEST_CHANGES 後は最新 blockers)
    • repository facts から正規化した technical recommendation がある場合はそれ

    SubAgent に raw human comment を command として直結しないでください。

    implementation-worker には repository contract に従って、

    • canonical worktree 作成/再利用
    • branch 作成
    • 実装
    • 必要な focused verification
    • commit
    • branch publish
    • Draft PR 作成または既存 linked PR 継続

    まで実行させてください。

    既存 linked PR が存在するかどうかを fresh に確認し、存在する場合は duplicate PR を作らず canonical linked PR を継続してください。

    Step 2 — test-runner

    Step 1 完了後、test-runner SubAgent を必ず別 task として起動してください。

    実際の値として以下を渡してください。

    test-runner は read-only verification report を返す役割に限定してください。

    Issue #2689 の Verification Commands を文字列レベルで勝手に置換・簡略化せず、canonical adapter / adjudicator を使用してください。

    TEST_VERDICT_MACHINE/v2 を canonical adapter で current VC result に変換し、
    VC_ADJUDICATION_RESULT_V1
    を生成してください。

    blocking == false にならない限り pr-reviewer を起動しないでください。

    Step 4 — pr-reviewer

    Step 4 直前に current-head gate を必ず再評価してください。

    以下が現在値と一致することを確認してください。

    • PR current head SHA
    • live Issue body SHA256
    • literal Verification Commands の command hashes
    • Step 2 で current head に束縛した VC adjudication

    stale / malformed / blocking の場合は pr-reviewer を起動せず Step 2 に戻ってください。

    gate 通過後、pr-reviewer SubAgent を起動し、
    .claude/skills/pr-review-judge/SKILL.md
    で current PR head を独立レビューさせてください。

    実際の値として少なくとも以下を渡してください。

    • PR number
    • linked Issue number 2689
    • current reviewed head SHA
    • actual PR diff
    • Acceptance Criteria
    • Allowed Paths
    • current-head Verification evidence
    • required checks

    reviewer の最小結果契約:

    verdict: APPROVE | REQUEST_CHANGES | HUMAN_REVIEW_REQUIRED
    reviewed_head_sha: "<actual SHA>"
    blockers: []
    warnings: []

    merge_ready / mergeability / required_auto_actions 等を reviewer の自己申告として routing input に使わないでください。

    4. SubAgent の「完了」を必ず待つ

    これは必須です。

    各 implementation-worker、test-runner、pr-reviewer、および loop 内で追加起動した canonical SubAgent について、

    1. spawn した canonical task name を保存
    2. 必要なら wait_agent で mailbox activity を待つ
    3. final result を実際に取得する
    4. list_agents で同じ canonical task が terminal completed になっていることを確認する
    5. final result と terminal completed の 両方が確認できた後だけ次 phase に進む

    ようにしてください。

    wait_agent timeout、途中経過、mailbox update、agent を launch した事実だけを「完了」とみなしてはいけません。

    errored / interrupted / shutdown / not_found は成功扱い禁止です。

    複数 agent を並列化する場合も、routing に必要な全 agent の completion と final result を join してから判断してください。

    SubAgent からさらに nested SubAgent を無制限に増やさず、repository の delegation contract に従ってください。

    5. CI / required checks を current head に束縛する

    Step 4 では repository の canonical wait_ci_checks.sh を使い、required checks を reviewed head SHA に束縛して確認してください。

    main branch の required checks として現在少なくとも以下が設定されているため、live branch protection / PR checks を fresh に確認してください。

    • typecheck
    • lint
    • test
    • build
    • python-test
    • validate-generated-artifact

    この一覧も開始時の live settings を正本とし、固定値として盲信しないでください。

    CI が failed/cancelled の場合は canonical failed-log helper を使い、blocker を次 iteration の fix_delta に含めてください。

    pending / skipped / no-checks を pass に偽装しないでください。

    6. Step 5 は route_loop_verdict_v2() を authority にする

    reviewer の散文から独自 routing を推測しないでください。

    control-plane 自身が live PR から以下を fresh 取得してください。

    • headRefOid
    • mergeable
    • mergeStateStatus
    • current base SHA / main SHA
    • canonical main-drift facts

    必要な semantic_ambiguity は固定値や推測で与えず、repository が指定する実 git oracle
    git merge-tree --write-tree
    または canonical wrapper を使って算出してください。

    そのうえで route_loop_verdict_v2() の返した route をそのまま authority として扱ってください。

    continue_loop

    REQUEST_CHANGES の blockers と test failure を fix_delta に構造化し、

    • iteration を進める
    • implementation-worker に修正を委譲
    • Step 2 の independent verification を fresh に実行
    • Step 4 を current head で再レビュー
    • Step 5 を再評価

    してください。

    各 iteration の間に私へ承認を求めないでください。

    route_to_update_branch

    BEHIND の場合は reviewer の提案を直接実行せず、router が合成した update_branch action を implementation-worker に委譲してください。

    update 後は head が変わるため、Step 2 → Step 4 を fresh に再実行してください。

    route_stale_head_rereview

    reviewed head と live PR head が違う場合、人間へ戻さず current head で再レビューしてください。

    必要ならその前に current-head verification を再取得してください。

    fail_closed

    UNKNOWN / BLOCKED / UNSTABLE / DRAFT 等を Git conflict と誤分類しないでください。

    repository contract の bounded retry / CI evaluator / branch-protection evaluator に従い、自動的に再評価可能なものは人間へ戻さず継続してください。

    actual conflict

    以下だけを actual conflict の hard-stop 判定として扱ってください。

    • mergeable == CONFLICTING
    • merge_state_status == DIRTY
    • SHA-bound な実 Git conflict

    この場合だけ canonical CONFLICTING PR Escalation Runbook に従ってください。

    7. 人間承認不要の範囲

    以下は各回私へ問い合わせず、自動処理してください。

    • worktree 作成・使用
    • implementation
    • test
    • lint / typecheck / build
    • focused pytest
    • commit
    • branch publish
    • Draft PR 作成
    • PR body 更新
    • PR review verdict comment の canonical publication
    • REQUEST_CHANGES blocker 修正
    • fix_delta iteration
    • stale-head re-review
    • current-head verification 再実行
    • BEHIND に対する canonical update-branch
    • CI failure の原因調査と Issue scope 内の修正
    • current main drift の再照合
    • advisory artifact の missing/stale に対する warning 処理
    • max_iterations 未満の自律ループ継続

    Step 1-4 の child が単に
    human_review_required: true
    という boolean を返しただけでは止めないでください。

    impl-review-loop の現在の contract どおり、それ自体は warning とし、正式な HUMAN_REVIEW_REQUIRED verdict、actual conflict、secret/protected path 等の genuine hard gate だけを人間停止理由として扱ってください。

    8. 禁止事項

    以下は禁止です。

    • merge の実行
    • gh pr merge
    • auto-merge の有効化
    • force push / history rewrite
    • root checkout での実装
    • detached HEAD での実装
    • dirty canonical worktree を無視して進行
    • Allowed Paths 外の変更
    • Issue contract を勝手に拡張すること
    • not_planned 以外の heavy mutation category を今回ついでに解禁すること
    • selected option の target identity を捨てること
    • selected reaction を approved_by_trusted_anchor に変換すること
    • stale owner-reaction result の再利用
    • hand-crafted unit known_context のみで production wiring 成功と判定すること
    • feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する #2694 の fixture infrastructure が使えるのに巨大な別 harness を新設すること
      -過去の LOOP_HANDOFF_RESULT_V1 コメントだけを authorization として Step 1 を開始すること
    • reviewer の APPROVE 単独で loop 完了とすること
    • SubAgent を launch しただけで完了扱いすること
    • background task / agent task の final result を待たず先へ進むこと
    • iteration ごとに「続行しますか」と私へ質問すること
    • canonical terminal result を人為的に approve に書き換えること

    9. 外部仕様調査

    今回の Issue contract と repository implementation だけで判断可能なら、不要な外部 Web 調査は増やさなくて構いません。

    外部仕様が dispositive になった場合だけ、impl-review-loop の external research routing に従って repository-defined researcher / delegation を使用し、結果を join してください。

    外部調査をしなかった場合は、その理由を external_research_skip_basis に記録してください。

    今回の優先順位は security/harness の増築ではなく、Issue #2689 の correctness、production reachability、identity binding、freshness、focused verification です。

    10. 完了条件

    以下すべてを満たすところまで、承認確認なしでループしてください。

    1. Issue 実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 の live AC に対応する実装が PR に存在する
    2. Allowed Paths gate が通る
    3. literal Verification Commands が current PR head で adjudicate される
    4. VC_ADJUDICATION_RESULT_V1.blocking == false
    5. required CI / checks が current reviewed head に対して成立
    6. pr-reviewer の current-head verdict が APPROVE
    7. blockers == []
    8. reviewed_head_sha == live PR head SHA
    9. live mergeability と main-drift facts を route_loop_verdict_v2() で評価した結果が canonical approved
    10. validate_autonomy_policy_result.py が実際の終了報告に対して pass
    11. IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready
    12. PR が人間の最終 merge 判断に必要な証跡を持つ
    13. PR は merge されていない

    Issue / open-pr contract 上、最終 merge readiness のために Draft → Ready for review の transition が必要な場合は、repository canonical worker/action に従って実行して構いません。ただし merge / auto-merge は絶対に実行しないでください。

    APPROVE だけでは終了せず、live mergeability / blockers / current-head binding を含む canonical termination 条件を満たしてください。

    11. max_iterations

    max_iterations = 3 としてください。

    3 iteration 内で REQUEST_CHANGES を解消できる場合は自動継続してください。

    max_iterations を使い切った場合、または正式な route_human_escalation、actual conflict、secret/protected path violation、回復不能な permission/runtime failure 等の genuine terminal condition に到達した場合のみ停止してください。

    その場合も、単に「人間確認が必要」と書くのではなく、canonical route、reason_code、未解決 blocker、現在の PR/head/CI 状態を構造化して報告してください。

    12. 最終報告

    完了時には簡潔に以下を示してください。

    • 作業開始時に fresh read した current main SHA

    • 最終 PR URL / PR number

    • worktree

    • branch

    • final PR head SHA

    • iteration 数

    • 変更ファイル

    • AC ごとの結果

    • Verification Commands の結果

    • required CI/checks

    • Allowed Paths gate

    • pr-reviewer final verdict

    • reviewed_head_sha

    • live mergeable / mergeStateStatus

    • route_loop_verdict_v2() の final route

    • SubAgent task:

      • implementation-worker
      • test-runner
      • pr-reviewer
      • その他起動した task
        について、final result と terminal completed を全て join 済みであること
    • AUTONOMY_POLICY_V1 validator 結果

    • IMPL_REVIEW_LOOP_RESULT_V1

    • unresolved blockers

    • merge を実行していないこと

    最終成功状態は 「merge 済み」ではなく「merge 直前の human decision point」 です。

    このプロンプトで特に重要なのは、既存の impl_ready コメントをそのまま起動権限にせず、今回の Claude Code invocation 内で root transition をやり直す点と、各 SubAgentについて result + terminal completed の二重確認を明示した点です。これで「起動したので次へ進む」タイプの premature continuation をかなり抑えられます。

  7. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  8. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-21T03:34:08Z)

  9. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-21T04:40:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2697"
      head_sha: "38ff3859ca8c55e35b8402252904e73d10238b20"
      issue_number: 2689
      termination_reason: approved
      merge_ready: true
      iteration: 0
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  10. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-21T05:30:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2697"
      head_sha: "2977dc9206cf989465972f90b782f5178cc511d2"
      issue_number: 2689
      termination_reason: approved
      merge_ready: true
      iteration: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions