Skip to content

実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "owner_reaction.decide / owner_reaction.decide.fixture を skill_runtime_exec.py の exact dispatch へ実配線し、production-shaped / fixture 両 profile で real executor subprocess を入口とした runtime reachability を成立させる"
change_kind: code

Parent Issue

none

Parent Goal Ref

  • Goal: owner_reaction.decide が registry entry として command_registry.py に存在するだけの状態を解消し、実行時に呼び出し可能な状態にする
  • Desired Destination: N/A(単独改善のため親 Issue なし)

Current Validated Scope

Remaining Parent Gaps

なし(単独改善のため親 Issue なし)

Outcome

owner_reaction.decide(および owner_reaction.decide.fixture)が、root/control-plane から canonical skill_runtime_exec.py invocation を通して実行可能になり、registry rendering・正しい first-hop child・structured stdout(owner_reaction_decision_result/v1)まで end-to-end に到達できる状態。actual workflow/mutation consumer への接続(selected_option_id を mutation gate に接続する処理)は本 Issue の Outcome に含まない(別スコープ、#2689 等)。

Runtime Verification Applicability

decision: immediate
reason: "acceptance target は静的 registry presence ではなく executor から child CLI までの runtime reachability であり、全 AC は local repository checkout 上で uv run pytest により network 非依存・認証不要で即時実行可能なため"
applicable_acs:
  - AC1
  - AC2
  - AC3
  - AC4
  - AC5
  - AC6
  - AC7
  - AC8
  - AC9
  - AC10
execution_environment:
  cli_tools:
    - python3
    - uv
  auth_required: false
  network_required: false
skip_conditions:
  - "local repository checkout が存在しない場合は SKIP ではなく environment blocked として扱う"
fallback_policy:
  fallback_success_is_pass: false
  notes: "live GitHub API 呼び出しの fallback は不要。fixture/fake-backed の実 skill_runtime_exec.py subprocess 経由でのみ検証し、fallback 経由の成功を PASS に変換しない"
artifact_requirements:
  - "pytest output"
  - "skill_runtime_exec.py subprocess の structured stdout capture"

In Scope

  • owner_reaction.decide / owner_reaction.decide.fixture を skill_runtime_exec.py の exact dispatch として実行時に呼び出せるようにする実装(skill_runtime_command_policy.py への execution class / exact parser・checker 追加を含む)
  • 上記 dispatch chain(下記 AC3 参照)を production-shaped / fixture 両 profile で real executor entrypoint から検証するテストの追加

Out of Scope

Acceptance Criteria

  • AC1: owner_reaction.decide と owner_reaction.decide.fixture が scripts/agent-guards/skill_runtime_exec.py の exact dispatch に接続されている。
  • AC2: production-shaped profile と fixture profile が同一の owner-reaction dispatcher 実装を利用する。
  • AC3: outer argv から少なくとも次の全鎖が real executor test で通る: skill_runtime_exec.py → exact command policy/parser → command_registry.render_command() → owner_reaction_decision.py → owner_reaction_decision_result/v1 structured stdout。
  • AC4: owner-user-id と preview-binding-file の各フラグ、および fixture 用 gh-fixture-file フラグの required/forbidden combination が exact に検証される。
  • AC5: executor の first-hop script integrity/readback 対象と、registry が render する実 first-hop script が、owner reaction の場合 owner_reaction_decision.py で一致する。
  • AC6: 既存 registry entry(owner_reaction.decide / owner_reaction.decide.fixture)の argv / placeholders / stdout_contract は変更しない。
  • AC7: owner_reaction.decide.fixture が実 skill_runtime_exec.py subprocess 経由で structured result を返す。
  • AC8: production-shaped dispatch と fixture dispatch の正常系を実 executor entrypoint から検証する。live GitHub API は不要で、fixture/fake/stub で閉じてよい。
  • AC9: child の non-zero exit または malformed structured result の少なくとも一方を実 executor 境界から検証し、outer executor が false success に変換しないことを確認する。
  • AC10: 既存 owner_reaction_decision.py / command registry / skill runtime 関連の relevant regression tests が PASS する。

Verification Commands

  • (補助 evidence。acceptance の正本にはしない)dispatch エントリの存在確認:
$ rg -n "owner_reaction.decide" scripts/agent-guards/skill_runtime_exec.py
  • AC1: dispatch wiring が新規テストで検証される(テストファイルは実装時に新規作成):
# AC1
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q
  • AC2: production-shaped / fixture 両 profile が同一 dispatcher 実装を利用することを新規テストで検証する:
# AC2
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q
  • AC3: outer argv から structured stdout までの全鎖を real executor test で検証する:
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q
  • AC4: 必須/禁止フラグの組み合わせを新規テストで検証する(テストファイルは実装時に新規作成):
# AC4
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py -q
  • AC5: first-hop script integrity/readback の一致を新規テストで検証する:
# AC5
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q
  • AC6: 既存 registry entry の argv / placeholders / stdout_contract が変更されていないことを既存テストで確認する:
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py -q
  • AC7: fixture profile が実 subprocess 経由で structured result を返すことを新規テストで検証する:
# AC7
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q
  • AC8: production-shaped / fixture 両 dispatch の正常系を実 executor entrypoint から検証する:
# AC8
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q
  • AC9: child の non-zero exit または malformed structured result で false success に変換されないことを新規テストで検証する(テストファイルは実装時に新規作成):
# AC9
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py -q
  • AC10: 既存 owner_reaction_decision.py / command registry / skill runtime 関連の regression tests が PASS することを確認する:
# AC10
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py -q

Allowed Paths

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

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

なし

Required Design References

  • .claude/skills/issue-refinement-loop/references/anchor-comment-handling.md
  • .claude/skills/issue-refinement-loop/scripts/command_registry.py(owner_reaction.decide / owner_reaction.decide.fixture エントリの現状 argv / placeholders / stdout_contract。read-only design reference、変更対象外)
  • scripts/agent-guards/skill_runtime_exec.py 内の repair_action.apply / structural_repair_action.apply の dispatch precedent(exact parser/checker 関数、execution_class 定数、first-hop script integrity/readback パターン)
  • scripts/agent-guards/skill_runtime_command_policy.py 内の scope_rollup.run の execution_class 定義(構造比較用の precedent。dispatch 方式自体は不採用)

Scope Delta(任意)

N/A

Notes for Reviewer

Source

Activity

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

    @squne121
    OwnerAuthor

    #2688、関連する #1975 / #2086 / #2689、PR #2683、現在の main 上の skill_runtime_exec.py / skill_runtime_command_policy.py / command_registry.py / owner reaction テストまで追いました。現状の Issue は方向性自体は正しいですが、このまま実装着手すると「dispatch を直したつもりの第二の false-green」を作る余地があります。REQUEST_CHANGES 相当です。

    特に、#2086 で既に踏んだ失敗パターンを #2688 の AC/Allowed Paths が十分に取り込めていません。

    敵対的レビュー

    1. P0-1 — Runtime Verification: not_applicable は Issue の目的と矛盾しています。
      実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 の目的は静的な registry 定義ではなく、skill_runtime_exec.py から実 CLI までの実到達性です。しかし現在の Verification は rg "owner_reaction.decide" skill_runtime_exec.py と pytest です。rg はコメントや未到達 branch が1行追加されるだけでも PASS します。これは 実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086 AC10 が明示的に潰した「registry/policy/dispatcher false-green」と同型です。PR feat: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/selection resolver として実装する #2683 の既存テスト自身にも「skill_runtime_exec.py generic dispatch wiring is still never exercised」と明記されています。
      修正案: Runtime Verification Applicability を immediate にし、live GitHub API は使わず、fixture-backed の実 skill_runtime_exec.py subprocessを1本だけ必須にしてください。趣味開発なら巨大なハーネスは不要です。skill_runtime_exec.py -> command_registry.render_command() -> owner_reaction_decision.py -> structured stdout の1本を通せば十分です。

    2. P0-2 — Allowed Paths が canonical な実装に必要な skill_runtime_command_policy.py を欠いています。
      現在の policy には owner_reaction.decide が登録されていますが、コメントで明示的に「policy declaration only」「skill_runtime_exec.py の hardcoded dispatch branch ではない」「exact-match parser もない」とされています。また通常の parse_exact_skill_runtime_command() は execution_class == SKILL_RUNTIME_EXECUTION_CLASS の command しか受理しません。owner_reaction.decide は exact_owner_reaction_decide なので対象外です。
      つまり skill_runtime_exec.py に branch だけ足すと、registry と executor と exact-command policy の3者が食い違います。実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086 ではまさにこのため skill_runtime_command_policy.py まで Allowed Paths に入れていました。
      修正案: scripts/agent-guards/skill_runtime_command_policy.py を Allowed Paths に追加し、owner reaction 用 outer command shape の parser/classifier と既存コメントを同期させるべきです。これはセキュリティ強化というより、SSOT の自己矛盾を残さないためです。

    3. P1-1 — 「scope_rollup.run 型の独立 exact executor」という選択肢は、現在の Allowed Paths では実装できません。
      実際の scope_rollup.run は単に別 branch があるだけではありません。専用の scripts/agent-guards/run_scope_rollup_preflight.py、skill_runtime_command_policy.py の専用 parser/class、guard 側 classifier、専用テストを持っています。一方 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 は新規 scripts/agent-guards/* executor や policy を Allowed Paths に含めていません。
      したがって AC1 は「owner が二択から選ぶ」としていますが、一方を選ぶと即 Stop Condition です。
      修正案: この二択自体をやめ、実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 では 既存 skill_runtime_exec.py に owner-reaction exact dispatch を追加する方針に固定するのがよいです。独立 executor は、この read-only CLI にはコスト過多です。

    4. P1-2 — Issue は “generic dispatch” と呼んでいますが、現行 executor 構造では実質的に command-specific dispatch です。
      skill_runtime_exec.py は generic registry runner に見える部分もありますが、外側 argparse、command-specific required/forbidden flags、script identity、render_params が command ID ごとにハードコードされています。owner_reaction.decide には現在存在しない --owner-user-id / --preview-binding-file、fixture には --gh-fixture-file が必要です。
      したがって「dispatch table に1行追加」では成立しません。最低でも outer args、production/fixture の組合せ検証、render params、child script identity が必要です。Issue が generic と呼ぶことで実装量を過小評価しています。
      修正案: Outcome を「generic dispatch」ではなく owner_reaction.decide* exact dispatch wiring と定義する方が正確です。将来 command registry を完全 generic runner にする話とは分離した方が小さく仕上がります。

    5. P1-3 — skill_runtime_exec.py の child-script integrity check が現在 owner reaction に対応していません。
      現在は decide.run -> decide_next_loop_action.py、bare preflight.run -> workflow_start_entry.py、それ以外は run_refinement_preflight.py とみなして存在確認しています。owner_reaction.decide の本当の child は owner_reaction_decision.py です。
      単に render params を通せるようにしても、この integrity/readback 部分は誤ったファイルを検証したままになります。即座に execution failure になるとは限らないため、むしろ検出しづらい不整合です。
      AC に追加すべきこと: executor が検証する first-hop script と、registry が実際に起動する first-hop script が owner_reaction_decision.py で一致すること。

    6. P1-4 — 「actual consumer が読める」という Outcome が現状の repository evidence より強いです。
      current-main の code search では owner_reaction.decide の実参照は policy、registry、reference、implementation/test が中心で、production Python caller は見当たりません。issue-refinement-loop/SKILL.md は owner reaction implementation を reference していますが、skill_runtime_exec.py --command-id owner_reaction.decide ... という canonical invocation はまだ workflow に materialize されていません。
      したがって 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 完了後も「呼べる executor」はできますが、「workflow が実際に呼ぶ」ことまでは証明できません。実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 は mutation consumer の別問題なので代替にもなりません。
      修正案: Outcome は「root/control-plane から canonical exact invocation が可能」に狭めるか、SKILL/reference を Allowed Paths に加えて caller contract まで明記してください。個人的には前者で 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 を小さく閉じ、実 consumer 統合は 実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 側と整合させるのがよいです。

    7. P1-5 — 新規テストの合格条件が弱すぎます。
      pytest ... -k "owner_reaction and dispatch" では、テスト名さえ合えば direct function call や直接 owner_reaction_decision.py を起動するテストでも満たせます。PR feat: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/selection resolver として実装する #2683 の既存 AC7 がまさにそれで、production entry をテストしていても executor は通っていませんでした。
      最小限必要なのは2ケースです。 production と fixture を parameterize して、実 skill_runtime_exec.py プロセスを入口にする正常系。そして child の non-zero / malformed structured result のどちらか1ケースを通し、outer executor が success に化けさせないこと。この程度ならハーネス過剰にはなりません。

    8. P2-1 — architecture owner approval を実装直前の人間ゲートに残す必要性が薄いです。
      実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 は triage-required で、「generic / independent executor のどちらかを owner が選ぶまで実装しない」としています。しかし repository evidence を見る限り、この Issue では skill_runtime_exec.py 側に exact dispatch を追加する方が明らかに小さいです。独立 executor は Allowed Paths とも矛盾しています。
      自動ループを重視するなら、refinement 時点で技術判断を確定して本文へ materializeし、人間判断 Stop Condition を消す方が実用的です。

    9. P2-2 — command_registry.py は Allowed Paths にあるのに、ACでは「entry を変更しない」とされています。
      今回 registry の既存 argv / placeholders / stdout contract はかなり明確で、90秒 timeout も skill_runtime_exec.py が実際に entry["timeout_seconds"] として利用する構造になっています。変更理由は薄いです。
      修正案: command_registry.py を Allowed Paths から外して read-only design reference にする方が scope discipline が明瞭です。

    外部仕様との照合

    既存 owner_reaction_decision.py の reaction reader 設計自体は、今回触らない判断で妥当です。GitHub CLI の公式仕様では gh api --paginate は後続ページを順次すべて取得し、--slurp は各ページを外側の配列へまとめます。(GitHub CLI) GitHub REST の reaction API も +1 / -1 / rocket / eyes 等を正式な reaction content とし、reaction record に user.id を含め、ページサイズは既定30・最大100です。([GitHub Docs]2)

    したがって #2688 で pagination や reaction semantics を再設計する価値はありません。dispatch 境界だけ直すのがよいです。

    推奨する #2688 の着地点

    個人趣味開発という前提なら、独立 executor や guard の全面再構築は避けます。skill_runtime_exec.py に owner_reaction.decide / .fixture の exact branchを追加し、既存 registry entryをそのまま render_command()、既存90秒 timeout、既存 child supervisorで実行する構成が最も小さいです。

    そのため Issue を実装前に次のように直すのを推奨します。

    この形なら、#2086 で発覚した false-green を再発させず、かつ趣味開発には不要な guard/harness の拡張を最小限にできます。最優先で直すべきなのは P0-1/P0-2、次に P1-1〜P1-5 です。

  3. squne121 commented on Sep 20, 2026

    @squne121
    OwnerAuthor

    推奨は、対象コメントを OWNER が直接指定した trusted human context として扱い、preflight.run.with_human_context → controlled contract update → 必要なら issue-editor full rewrite の正規経路で #2688 を更新することです。コメント内ですでに architecture 判断が「skill_runtime_exec.py への exact dispatch」に収束しているため、generic vs. independent executor の人間判断ゲートは残す必要がありません。

    特に、① skill_runtime_command_policy.py を Allowed Paths に追加、② command_registry.py は変更対象から外して read-only reference 化、③ runtime verification を immediate に変更、④ real skill_runtime_exec.py subprocess を acceptance evidence にする、⑤ codebase-investigator を実行して完了を待ってから rewrite/review を進める、という流れが適切です。ループ途中の承認確認は不要ですが、skill が返す真正の human_judgment_required や fail-closed 条件そのものを無効化する指示にはしません。

    そのまま既存の Claude Code セッションへ貼れる形です。

    Issue #2688 を、以下の OWNER コメントを authoritative anchor として issue-refinement-loop で refinement してください。

    Target Issue:
    #2688

    Authoritative anchor:
    #2688 (comment)

    Canonical skill:
    https://github.com/squne121/loop-protocol/tree/main/.claude/skills/issue-refinement-loop

    あなたは既に auto mode で起動している root/main の対話的 Claude Code セッションです。

    実行方針

    .claude/skills/issue-refinement-loop/SKILL.md と、その progressive-disclosure references / canonical scripts を SSOT として、この Issue の refinement loop を実行してください。

    今回の anchor comment は、ユーザーが明示的に指定した Issue OWNER のコメントです。したがって unlabeled / agent-report lane には落とさず、operator-selected trusted human context として snapshot/binding を検証したうえで with_human_context lane を使用してください。

    loop iteration ごとの人間承認は不要です。

    loop_iteration_approval_gate.default_required: false に従い、needs-fix が出た場合は max_iterations の範囲で自動継続してください。途中で「続行してよいですか」「この設計でよいですか」等の確認をユーザーへ求めないでください。

    一方で Claude Code 自体の permission mode、bypassPermissions、--dangerously-skip-permissions 等は変更しないでください。リポジトリの loop approval と Claude Code permission policy を混同しないこと。

    skill が定義する genuine な fail-closed / human_judgment_required を勝手に無効化してはいけません。ただし、人間へエスカレーションする前に、trusted anchor に対して用意されている deterministic repair、controlled contract update、issue_editor_required、#2086 AC3 の investigation-derived path route、bounded retry をすべて正規手順どおり消化してください。

    SubAgent 必須指示

    canonical preflight が SubAgent dispatch を許可した後、Step 1 の repository investigation として codebase-investigator SubAgent を必ず起動してください。

    調査対象は少なくとも以下です。

    SubAgent を dispatch したら、必ずその作業完了を待ってください。
    SubAgent がまだ実行中の状態で review、Issue rewrite、termination 判定へ進んではいけません。

    SubAgent 自身に nested SubAgent delegation はさせないでください。

    planner が external claim の調査を要求した場合のみ web-researcher も使って構いません。その場合も必ず完了を待ち、その結果を canonical join/routing に反映してください。不要な外部調査を追加して loop を肥大化させないこと。

    Canonical start

    canonical main root / default branch から current live Issue と anchor comment を取得し、Issue #2688 と anchor URL の owner/repo/issue binding を検証してください。

    その後、手書き wrapper invocation ではなく registry/canonical executor を使用して、

    • preflight.run.with_human_context
    • 必要に応じて contract_update.run.with_human_context

    の順で処理してください。

    対象 anchor URL は必ずこれを使います。

    #2688 (comment)

    LOOP_PLANNED_OPERATIONS_JSON が必要な場合は、今回実際に予定している操作だけを invocation-local に宣言してください。永続 export しないでください。

    Anchor comment の技術判断を authority として反映する

    今回、以下について再度人間判断を要求してはいけません。anchor comment ですでに OWNER directive として解決済みです。

    Architecture

    #2688 の実装方式は、

    既存 skill_runtime_exec.py に owner_reaction.decide / owner_reaction.decide.fixture 用の exact dispatch wiring を追加する

    方針に固定してください。

    scope_rollup.run 型の新しい独立 executor を作る選択肢は Issue から削除してください。

    完全 generic registry runner へのリファクタリングも今回の scope に含めないでください。

    Outcome

    「actual consumer が既に利用している」ことを要求してはいけません。

    Outcome は概ね、

    owner_reaction.decide / .fixture が root/control-plane から canonical skill_runtime_exec.py invocation を通して実行可能で、registry rendering、正しい first-hop child、structured stdout まで end-to-end に到達できること

    に限定してください。

    actual workflow/mutation consumer への接続は #2689 等の別 scope と分離してください。

    既存 #2689 と同じ follow-up を重複起票しないでください。

    Runtime Verification

    現在の

    decision: not_applicable

    は撤回し、

    decision: immediate

    へ変更してください。

    理由は、今回の acceptance target が静的 registry presence ではなく executor から child CLI までの runtime reachability だからです。

    ただし live GitHub API を verification 必須条件にしてはいけません。

    fixture/fake-backed で実際の

    skill_runtime_exec.py

    subprocess を入口にした runtime verification で十分です。

    Allowed Paths

    少なくとも次を mutation 対象として成立する形に refinement してください。

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

    可能なら focused executor test file に限定してください。

    .claude/skills/issue-refinement-loop/scripts/command_registry.py は、既存 entry の argv / placeholders / stdout_contract / timeout を維持する前提なので、変更対象の Allowed Paths から外し、read-only design reference としてください。

    owner_reaction_decision.py 本体の reaction selection logic は変更対象にしないでください。

    新規独立 executor script を追加する方向へ scope expansion しないでください。

    Allowed Paths expansion の処理

    skill_runtime_command_policy.py の追加が expands_allowed_paths と判定されても、即座にユーザーへ判断を戻さないでください。

    これは今回の trusted human anchor が明示的に要求している変更です。

    issue-refinement-loop の #2086 AC3 / Operator-Selected Human-Context continuation に従い、必要なら codebase-investigator の read-only evidence から exact repository-relative path を導出してください。

    SubAgent の完了を待ち、その evidence を canonical classifier/consumer へ渡して再判定してください。

    investigation evidence transport manifest が生成された場合は、read-only preflight で使用した同一 manifest pathを直後の contract_update.run.with_human_context に渡してください。勝手に再生成しないこと。

    section-bound patch では表現できず NEXT_ACTION: issue_editor_required になった場合は、同じ contract_update を無限再試行しないでください。

    既存の issue-editor SubAgent / edit-issue controlled transaction route へ handoff し、

    reviewer_feedback_url として上記 canonical anchor URL をそのまま渡してください。

    その issue-editor SubAgent の完了も必ず待ってください。

    raw gh issue edit や raw gh issue comment で control-plane を迂回してはいけません。

    Acceptance Criteria に反映する内容

    review/investigation evidence と矛盾しない限り、少なくとも次の性質を検証可能な AC としてください。

    1. owner_reaction.decide と .fixture が skill_runtime_exec.py の exact dispatch に接続されている。

    2. production-shaped / fixture の両 profile が同じ owner-reaction dispatcher implementation を利用する。

    3. outer argv から少なくとも以下の全鎖が real executor test で通る。

      skill_runtime_exec.py
      → exact command policy/parser
      → command_registry.render_command()
      → owner_reaction_decision.py
      → owner_reaction_decision_result/v1 structured stdout

    4. --owner-user-id / --preview-binding-file と fixture 用 --gh-fixture-file の required/forbidden combination が exact に検証される。

    5. executor の first-hop script integrity/readback 対象と registry が render する実 first-hop script が、owner reaction の場合 owner_reaction_decision.py で一致する。

    6. existing registry entry の argv / placeholders / stdout_contract は変更しない。

    7. owner_reaction.decide.fixture が real skill_runtime_exec.py subprocess 経由で structured result を返す。

    8. production-shaped dispatch と fixture dispatch の正常系を実 executor entrypoint から検証する。
      live GitHub API は不要で、fixture/fake/stub で閉じてよい。

    9. child non-zero または malformed structured result の少なくとも一方を実 executor 境界から検証し、outer executor が false success に変換しないことを確認する。

    10. 既存 owner_reaction_decision.py / command registry / skill runtime 関連の relevant regression tests が PASS する。

    単なる

    rg "owner_reaction.decide" scripts/agent-guards/skill_runtime_exec.py

    は補助 evidence としては残して構いませんが、acceptance の正本にしないでください。コメントや dead branch だけで PASS できる verification に依存しないこと。

    Scope / Out of Scope

    以下は明示的に Out of Scope のまま維持してください。

    GitHub CLI / GitHub reaction semantics は今回の dispatch boundary 修正に必要な範囲を越えて再検討しないでください。

    Review / rewrite loop

    Issue body mutation 後は、その body を成功と仮定しないでください。

    必ず fresh readback を行い、

    1. fresh preflight.run
    2. canonical Step 2 root review pipeline
    3. readiness/routing

    を再実行してください。

    review が needs-fix / request_changes の場合は、ユーザー承認を求めず Step 4 rewrite へ進み、loop policy の範囲で自動反復してください。

    各 iteration で必要な SubAgent が dispatch された場合は、必ず全員の完了を待ってから次へ進んでください。

    issue-reviewer legacy SubAgent を canonical Step 2 の代わりに使用しないでください。Step 2 は current SKILL.md が指定する root-owned review pipeline を使ってください。

    prose で独自に routing を再判定せず、planner / canonical reviewer / decide_next_loop_action.py / decide_rewrite_route.py 等の SSOT 出力を consume してください。

    Termination

    最終的に #2688 が current body に対して approved / implementation-ready になるまで、承認問い合わせなしで canonical refinement loop を進めてください。

    approved termination では skill が要求する fresh body hash、termination report、handoff marker、dependency gate 等を省略しないでください。

    ユーザーが今回依頼している主目的は Issue refinement です。downstream のコード実装を独自判断で scope に追加しないでください。ただし issue-refinement-loop の canonical Step 5 が同一 invocation 内で必須とする handoff/routing bookkeeping は省略しないでください。

    どうしても terminal な human_judgment_required / environment failure / skill-defined fail-closed に到達した場合だけ停止してください。その場合も先に、自動で許されている deterministic repair、controlled contract update、issue-editor rewrite、investigation-derived path 解決、bounded retry をすべて実施してください。

    停止時は「人間判断が必要」とだけ書かず、

    • canonical termination reason / cause
    • blocker code
    • どの自動 recovery route を実施済みか
    • SubAgent の完了結果
    • 最後に成功した gate
    • 次に必要な最小 action

    を GitHub termination report と最終応答に明示してください。

    作業中はユーザーへ承認を求めず、この指示を受けたら直ちに開始してください。

    この版では、単に「承認不要」とするのではなく、#2688 の anchor が解決済みの設計判断を authority にして、現在の skill にある with_human_context / #2086 AC3 / issue_editor_required の自律経路を使い切るようにしています。これにより、Allowed Paths の変更だけで再度 operator intervention に落ちる可能性を抑えられます。

  4. squne121 commented on Sep 20, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  5. squne121 commented on Sep 20, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: "https://github.com/squne121/loop-protocol/issues/2688#issuecomment-5749738718"
        generated_at: "2026-09-20T12:16:26Z"
        body_sha256: "sha256:37e8f4788ac86c48a9e28afd71941c70a92ffcc48e81aeb8fa1329df59443f63"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "既存ラベル(実装: prefix / phase/implementation / agent/implementer)は変更不要"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-20T12:18:46Z"
      checked_body_sha256: "sha256:37e8f4788ac86c48a9e28afd71941c70a92ffcc48e81aeb8fa1329df59443f63"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []

    Note: contract_review.latest_comment_url は root_entry_router.py::run_root_transition() が同一継続 turn 内で実行した current-run issue-contract-review(status: go, readiness_status: go, vc_preflight_status: pass)と live body/base SHA equality(ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1.route: invoke_impl_review_loop, reason: fresh_review_go_live_equality)の audit comment を指す。root-owned synchronous entry transition(Issue #2272 正本)に基づき、この route 自体が impl-review-loop Step 1 起動の独立した authority である。

  6. squne121 commented on Sep 20, 2026

    @squne121
    OwnerAuthor

    確認結果では、#2688 は refinement 済みで、最新 handoff は status: impl_ready / routing_action: run_impl_review_loop、blocker なしです。さらに現行 main の skill_runtime_exec.py にはまだ owner_reaction.decide の dispatch がなく、skill_runtime_command_policy.py も #1975 時点の「declaration only / exact parser なし」の状態なので、実装対象は残っています。([Issue #2688](https://github.com/squne121/loop-protocol/issues/2688)、[[refinement 完了コメント](https://github.com/squne121/loop-protocol/issues/2688#issuecomment-5749752412)](https://github.com/squne121/loop-protocol/issues/2688#issuecomment-5749752412))

    推奨アクションは次のとおりです。

    • 過去の LOOP_HANDOFF_RESULT_V1 や root-entry-audit を再利用可能な authorization と見なさず、現在の root/main セッションから fresh な Root-Owned Synchronous Entry Transition を同一 continuous turn で実行する。
    • implementation-worker → test-runner → pr-reviewer を canonical SubAgent として使用し、各 agent ごとに final result の取得と list_agents 上の terminal completed の両方を確認するまで次工程へ進まない。これは impl-review-loop の Common Completion Protocol そのものです。
    • REQUEST_CHANGES は人間確認を挟まず max_iterations=3 の範囲で自動修正。BEHIND や stale-head も canonical route に従って更新→再検証→再レビューする。
    • 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 の実装は skill_runtime_exec.py の exact dispatch、policy の exact parser/checker、real executor subprocess テストに限定する。command_registry.py は read-only、実装: owner_reaction_decision.py の出力を既存 heavy mutation gate へ統合する(#1975 の Out of Scope) #2689 の mutation consumer integration は吸収しない。
    • APPROVE + blockers=[] + live mergeability CLEAN/HAS_HOOKS まで到達したら終了。merge / auto-merge は実行しない。ここが今回の「マージ直前」です。[impl-review-loop](https://github.com/squne121/loop-protocol/tree/main/.claude/skills/impl-review-loop) 自身もこの状態を draft_pr_ready として人間の merge 判断に残す設計です。(impl-review-loop)

    そのまま既に auto mode で起動している Claude Code に貼れるプロンプトです。

    Issue #2688 を対象に、canonical impl-review-loop を使用して、実装 → 独立検証 → PRレビュー → 必要な修正ループを自律実行し、マージ直前の approved / mergeable 状態まで進めてください。

    Target Issue:
    #2688

    Canonical skill:
    https://github.com/squne121/loop-protocol/tree/main/.claude/skills/impl-review-loop

    Relevant OWNER architecture anchor:
    #2688 (comment)

    Latest refinement handoff:
    #2688 (comment)

    あなたは既に auto mode で起動している root/main の対話的 Claude Code セッションです。

    最終目的

    Issue #2688 の live contract を満たす実装を行い、PR を作成し、Verification Commands と relevant regressions を独立検証し、pr-review-judge の APPROVE と live mergeability の成立まで、通常のループ途中で人間承認を求めず進めてください。

    最終地点は以下です。

    • reviewer verdict: APPROVE
    • blockers: []
    • review が current PR head SHA に binding されている
    • Verification Commands が current head で PASS
    • Allowed Paths compliant
    • live mergeability が canonical approved route を満たす
    • IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

    PR の merge は実行しないでください。
    gh pr merge、GitHub API merge、auto-merge enable 等も実行しないでください。
    マージ直前で停止し、PR URL と最終 evidence を報告してください。

    0. canonical entry を fresh に実行する

    過去コメントの

    • LOOP_HANDOFF_RESULT_V1.status: impl_ready
    • ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1.route: invoke_impl_review_loop
    • root-entry-audit comment
    • contract snapshot
    • digest / body SHA

    を、Step 1 の再利用可能な authorization token として扱ってはいけません。

    .claude/skills/impl-review-loop/SKILL.md と
    .claude/skills/impl-review-loop/steps/preparation.md
    の Root-Owned Synchronous Entry Transition を SSOT としてください。

    現在の root/main thread から、単一の continuous control flow / continuous turn の中で、

    1. capability preflight
    2. live Issue 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 fetch
    3. current-run issue-contract-review
    4. 直後の live Issue 再取得
    5. decide_root_entry_route() / canonical root entry routing
    6. route が invoke_impl_review_loop なら、その同じ継続 turn の中で Step 1 を起動

    まで実行してください。

    過去 handoff comment は telemetry / background evidence として参照して構いませんが、それ単独で Step 1 を authorize しないでください。

    fresh live state が過去コメントと異なる場合は、必ず fresh live state と canonical router を優先してください。

    1. 人間承認ポリシー

    今回、通常の loop iteration ごとの人間承認は不要です。

    以下について途中確認を求めず、そのまま canonical loop を継続してください。

    • worktree / branch 作成
    • Issue contract 内の実装
    • Allowed Paths 内の編集
    • commit / push
    • PR 起票・更新
    • Verification Commands 実行
    • relevant regression test 実行
    • pr-reviewer 実行
    • REQUEST_CHANGES に対する bounded fix
    • branch update
    • stale-head rereview
    • CI / mergeability 再確認

    max_iterations は canonical default の 3 としてください。

    REQUEST_CHANGES の場合は、blockers を fix_delta に materialize して次 iteration の implementation-worker に渡し、自動継続してください。

    ただし以下は無効化しないでください。

    • genuine HUMAN_REVIEW_REQUIRED
    • actual conflict hard-stop
    • Allowed Paths violation
    • max_iterations exhaustion
    • live Issue に存在する明示的 human stop directive
    • その他 canonical skill が hard safety boundary として定義する停止条件

    Claude Code の permission mode は現在の auto mode のまま使用してください。
    --dangerously-skip-permissions、permission configuration、bypass mode 等を変更してはいけません。

    「承認不要」は repository loop の routine approval を省略する意味であり、permission system や canonical hard-stop の無効化ではありません。

    2. SubAgent を必ず使用する

    root thread 自身が implementation / independent verification / review judgment を抱え込まず、impl-review-loop が定義する canonical SubAgent を使用してください。

    少なくとも以下を使用します。

    Step 1

    implementation-worker

    .claude/skills/implement-issue/SKILL.md を使用して、

    • worktree / branch
    • 実装
    • targeted verification
    • commit / push
    • open-pr 経由の PR 起票

    まで担当させてください。

    Step 2

    test-runner

    implementation-worker と独立した agent とし、current PR head SHA に対して Issue #2688 の literal Verification Commands を実行させてください。

    Step 4

    pr-reviewer

    .claude/skills/pr-review-judge/SKILL.md に従い、current head に対する review verdict を取得してください。

    必要な update_branch 等も canonical routing が要求する場合は、skill が指定する worker delegation を使用してください。

    root thread は control-plane、state tracking、binding 検証、routing に専念してください。

    3. SubAgent の完了を必ず待つ

    これは必須です。

    各 spawn_agent ごとに canonical task_name を保存してください。

    SubAgent を起動しただけで次の Step に進んではいけません。

    .claude/skills/impl-review-loop/steps/step-4-pr-review.md の
    Common Completion Protocol
    をそのまま適用してください。

    各 SubAgent について必ず、

    1. spawn_agent
    2. 必要なら wait_agent で mailbox activity を待つ
    3. agent の final result を取得・消費
    4. list_agents で同じ canonical task name が terminal completed であることを確認
    5. final result と terminal completed の両方が揃った後だけ次の routing / Step に進む

    という順序にしてください。

    wait_agent timeout、途中 mailbox update、steer response は完了ではありません。

    以下は成功として扱わず fail-closed にしてください。

    • errored
    • interrupted
    • shutdown
    • not_found

    特に、

    • implementation-worker 完了前に test-runner を開始しない
    • test-runner の final result + terminal completed 確認前に pr-reviewer を開始しない
    • pr-reviewer の final result + terminal completed 確認前に Step 5 routing を行わない

    ことを厳守してください。

    ad-hoc な nested SubAgent delegation を追加しないでください。
    canonical skill が明示する root-owned delegation 構造を維持してください。

    4. Issue #2688 の技術的実装方針

    live Issue body を contract の正本としてください。

    今回の architecture は既に OWNER 判断済みです。
    再度 architecture 選択を人間へ質問してはいけません。

    採用方式は、

    既存 scripts/agent-guards/skill_runtime_exec.py に
    owner_reaction.decide /
    owner_reaction.decide.fixture
    用の command-specific exact dispatch wiring を追加する

    です。

    新しい scope_rollup.run 型独立 executor は作成しないでください。

    完全 generic command runner へのリファクタリングも行わないでください。

    5. Allowed Paths を厳守する

    変更可能なのは live Issue に記載された次の範囲だけです。

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

    .claude/skills/issue-refinement-loop/scripts/command_registry.py
    は read-only design reference です。

    registry の

    • argv
    • placeholders
    • stdout_contract
    • execution class contract

    を今回変更しないでください。

    .claude/skills/issue-refinement-loop/scripts/owner_reaction_decision.py
    も reaction semantics の再設計対象ではありません。

    Allowed Paths 外の変更が本当に必要だと判明した場合は、勝手に scope を拡大せず canonical hard-stop / routing に従ってください。

    6. implementation-worker への technical recommendation

    implementation-worker には、Issue body の AC と repository evidence に加えて、少なくとも以下の derived guidance を渡してください。

    exact dispatch

    owner_reaction.decide と
    owner_reaction.decide.fixture
    の両方を skill_runtime_exec.py の exact dispatch に接続する。

    production-shaped と fixture の両 profile が同じ owner-reaction dispatcher implementation を共有する。

    policy

    skill_runtime_command_policy.py に、

    • owner reaction 用 exact execution class handling
    • outer command parser / checker
    • required / forbidden argument combination validation

    を current repository precedent と整合する形で実装する。

    特に以下を正確に扱う。

    • --owner-user-id
    • --preview-binding-file
    • fixture の --gh-fixture-file

    production と fixture で required / forbidden combination を曖昧にしない。

    render / first hop

    canonical chain は最低でも

    skill_runtime_exec.py
    → exact command policy/parser
    → command_registry.render_command()
    → owner_reaction_decision.py
    → owner_reaction_decision_result/v1

    まで real subprocess で到達させる。

    executor が integrity/readback する first-hop script と registry が実際に render する first-hop script を、
    owner_reaction_decision.py
    で一致させる。

    scope boundary

    以下は実装しない。

    7. テストを「本物の executor 境界」で行う

    単なる unit test や command_registry.render_command() の direct invocation だけで AC を満たしたことにしないでください。

    Issue の Verification Commands に対応するテストとして、少なくとも live contract が要求する、

    • test_owner_reaction_decide_dispatch.py
    • test_owner_reaction_decide_flag_validation.py
    • test_owner_reaction_decide_failure_boundary.py

    を実装してください。

    正常系は production-shaped / fixture の両方で、
    実 skill_runtime_exec.py subprocess を entrypoint
    にしてください。

    確認対象には、

    • exact dispatch
    • common dispatcher
    • registry render
    • real first-hop child
    • structured stdout
    • required / forbidden flags
    • first-hop integrity/readback

    を含めてください。

    failure boundary は少なくとも、

    • child non-zero
      または
    • malformed structured result

    の一方を real outer executor 境界から発生させ、
    outer executor が false success に変換しないことを確認してください。

    既存

    .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py

    および relevant skill-runtime regressions も実行してください。

    8. independent Verification を省略しない

    Step 1 worker 自身のテスト PASS を Step 2 の代用にしてはいけません。

    test-runner は PR current head に対して independent に Issue #2688 の literal Verification Commands を実行してください。

    Step 4 起動前に root が、

    • test-runner final result
    • canonical task terminal completed
    • report の head SHA が current PR head と一致
    • current contract binding
    • per-AC adjudication

    を確認してください。

    head が変化した場合、古い verification evidence を再利用せず、canonical route に従って再検証してください。

    9. PR review と自動修正ループ

    pr-reviewer が REQUEST_CHANGES を返した場合、

    • blocker を構造化して保存
    • fix_delta として次の implementation-worker に渡す
    • Allowed Paths 内だけを修正
    • current head で Step 2 を再実行
    • current head で Step 4 を再実行

    してください。

    routine fix ごとにユーザーへ承認を求めてはいけません。

    reviewed_head_sha != current PR head の場合は stale review を APPROVE として扱わず、
    route_stale_head_rereview
    で current head を再レビューしてください。

    live merge state が BEHIND の場合は
    route_to_update_branch
    に従って branch update を worker に委譲し、その後 Verification と Review を再実行してください。

    artifact / snapshot / launch ledger が stale・missing であるだけではループを止めず、canonical skill の advisory artifact policy に従ってください。

    10. 終了条件

    以下が成立するまで bounded loop を継続してください。

    • reviewer verdict = APPROVE
    • blockers = []
    • reviewed head = current PR head
    • current-head Verification PASS
    • Allowed Paths compliant
    • live mergeability が route_loop_verdict_v2() の approved 条件を満たす

    成立したら、

    IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

    として終了してください。

    ここで停止してください。PR は merge しないでください。

    最終報告には最低限、

    を構造化して含めてください。

    途中経過の散文報告よりも、canonical structured result と evidence binding を優先してください。

    このプロンプトでは、#2688 の既存 refinement を尊重しつつ、過去 handoff を authorization として誤再利用しないことと、各 SubAgent の final result + terminal completed を待つことを明示的に強化しています。

  7. squne121 commented on Sep 20, 2026

    @squne121
    OwnerAuthor

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

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2694"
      head_sha: "d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a"
      issue_number: 2688
      termination_reason: approved
      merge_ready: false
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "pr2694-hy001-closes-keyword-standalone-block"
          source_url: "https://github.com/squne121/loop-protocol/pull/2694"
          source_note_id: "pr-reviewer-iteration3-warning"
          summary: "validate_pr_body_hygiene.py (non-canonical, not wired into open-pr/SKILL.md Procedure or docs/dev/github-ops.md) flags HY001 on the standalone '- Closes #2688' line in ## Notes. Pre-existing pattern, identical in merged precedent PR #2683 ('- Closes #1975'). Canonical validate_pr_body.py passes. Non-blocking, note-only."
  8. squne121 commented on Sep 21, 2026

    @squne121
    OwnerAuthor

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

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2694"
      head_sha: "2f612ce5220b95d4b194a7ed33b31955a1331bb6"
      issue_number: 2688
      termination_reason: approved
      merge_ready: false
      iteration: 1
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