Skip to content

feat: owner_reaction.decide を skill_runtime_exec.py の exact dispatch に配線する - #2694

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-2688-owner-reaction-decide-skill-runtime-exec
Sep 21, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-2688-owner-reaction-decide-skill-runtime-exec

Conversation

@squne121

@squne121 squne121 commented Sep 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #1975 で追加された owner_reaction.decide / owner_reaction.decide.fixture の command_registry.py エントリは、これまで宣言のみで scripts/agent-guards/skill_runtime_exec.py の実 dispatch に接続されていなかった(#1975 の明示的 Out of Scope)。本 PR は Issue #2688 の契約と OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/2688#issuecomment-5749552225)の architecture 決定に従い、repair_action.apply / structural_repair_action.apply の既存 exact dispatch precedent(exact parser/checker 関数、execution_class 定数、first-hop script integrity/readback パターン)に倣って両 command_id を skill_runtime_exec.py の exact dispatch へ配線する。

  • scripts/agent-guards/skill_runtime_command_policy.py:
    • owner_reaction.decide / owner_reaction.decide.fixture 用の exact parser/checker(parse_exact_skill_runtime_owner_reaction_decide_command / is_exact_skill_runtime_owner_reaction_decide_executor_command とその fixture sibling)を追加。14 / 16 トークンの固定長 shape、--owner-user-id・--preview-binding-file・(fixture のみ)--gh-fixture-file の repo-relative path を issue 自身の artifact root に確認する。
    • validate_registry_entry() を拡張し、command_registry.py の当該 2 entry(Issue 実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 由来、本 Issue の Allowed Paths 外の read-only design reference のため変更しない)が required_cwd / required_branch / allowed_write_roots を宣言しない実際の形状に一致することを検証する分岐を追加(他の command_id の既存検証ロジックには影響しない)。
  • scripts/agent-guards/skill_runtime_exec.py:
    • --owner-user-id / --preview-binding-file / --gh-fixture-file の outer flag を追加し、required/forbidden combination を exact に検証する(production は --gh-fixture-file 禁止、fixture は必須)。
    • owner_reaction.decide / owner_reaction.decide.fixture それぞれの command_text 構築 + exact parser 呼び出し、および render_command() へ渡す render_params 分岐を追加。
    • first-hop script integrity/readback ターゲットを、両 command_id については owner_reaction_decision.py に向ける専用分岐を追加(デフォルトの run_refinement_preflight.py ではない、AC5)。
  • owner_reaction_decision.py / command_registry.py の owner_reaction.decide 系エントリ(argv・placeholders・stdout_contract)は本 PR では一切変更していない(read-only design reference として扱う)。

新規テスト(.claude/skills/issue-refinement-loop/tests/):

  • owner_reaction_dispatch_fixture.py: 実際の production ファイル(skill_runtime_exec.py / skill_runtime_command_policy.py / command_registry.py / owner_reaction_decision.py)を検証用スクラッチ git repo へ verbatim copy する共有 fixture builder(3 テストファイルが import)。production profile 用に gh バイナリを fake する(GitHub 網羅は fake、それ以外は全て実サブプロセス)。
  • test_owner_reaction_decide_dispatch.py: AC1/AC2/AC3/AC5/AC7/AC8 — 実 skill_runtime_exec.py subprocess 経由で production-shaped / fixture 両 profile が owner_reaction_decision.py の実 CLI に到達し owner_reaction_decision_result/v1 を返すこと、同一入力から同一選択結果を返すこと(AC2)、first-hop が run_refinement_preflight.py ではないこと(AC5、意図的に fixture repo からそのファイルを除外)を検証。
  • test_owner_reaction_decide_flag_validation.py: AC4 — 必須/禁止フラグの組み合わせを実 subprocess 境界から網羅的に検証(拒否ケース6件 + 各 profile の正常受理ケース各1件)。
  • test_owner_reaction_decide_failure_boundary.py: AC9 — child の non-zero exit(reaction record 整合性検証失敗、--gh-fixture-file 自体が invalid JSON、--preview-binding-file 不在の3独立ケース)が outer executor によって false success に変換されないことを実 executor 境界から検証。

Checks

  • rg -n "owner_reaction.decide" scripts/agent-guards/skill_runtime_exec.py — マッチ多数(AC1、dispatch wiring 存在確認)
  • uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q — 5 passed(AC1, AC2, AC3, AC5, AC7, AC8)
  • uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py -q — 9 passed(AC4)
  • uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py -q — 14 passed(AC6, AC10、既存 regression、無変更で PASS)
  • uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py -q — 3 passed(AC9)
  • uv run pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py -q — 41 passed(既存 policy 回帰なし確認)
  • uv run pytest scripts/agent-guards/tests/ -q — 1650 passed, 17 failed(pre-existing: uv_version_mismatch / literal_remote_url_required / detached_worktree_path_required の17件は、本 PR の変更前 main でも同一失敗数・同一失敗テスト名で再現することをローカル環境で確認済み。ローカル uv がホストツールキャッシュ外に存在する環境固有の既知事象で、本 PR 由来の regression ではない)
  • uv run pytest .claude/skills/issue-refinement-loop/tests/test_command_registry.py -q — 22 passed, 3 failed(同上の pre-existing uv_version_mismatch。TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch の3件で、owner_reaction とは無関係)
  • pnpm typecheck — success
  • pnpm lint — success(No issues found)
  • pnpm test — 108 files / 1939 tests passed
  • pnpm build — success
  • uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py — 24 passed

Schema Change Applicability

Schema Consumer Inventory

N/A(not_schema_change のため。本 PR は既存 schema の到達可能性を実配線で成立させるのみで、schema 自体の定義・consumer 追加は行っていない)

Safety Claim Matrix

scripts/agent-guards/skill_runtime_exec.py と scripts/agent-guards/skill_runtime_command_policy.py(.claude/skills/ 配下ではないが privileged executor / transport の変更)を変更しているため safety-sensitive PR として扱う。

Claim Implemented? Not controlled Evidence Follow-up
owner_reaction.decide / owner_reaction.decide.fixture は skill_runtime_exec.py の exact dispatch(repair_action.apply 等と同じ固定長 argv shape の exact parser)としてのみ配線され、汎用 generic command runner や scope_rollup.run 型の独立 executor は新設していない yes none rg -n "elif is_owner_reaction_decide_command|elif is_owner_reaction_decide_fixture_command" scripts/agent-guards/skill_runtime_exec.py — 固定 elif 分岐のみ。test_owner_reaction_decide_dispatch.py の全5テストが実 subprocess 経由で PASS -
owner_reaction.decide(production)は --gh-fixture-file を受理せず、owner_reaction.decide.fixture のみが受理する(production から GitHub network boundary をバイパスできない) yes none test_owner_reaction_decide_production_rejects_gh_fixture_file PASS(実 subprocess 経由で exit 2 + エラーメッセージ確認) -
first-hop script integrity/readback の対象は owner_reaction_decision.py であり、他の command_id のデフォルト対象 run_refinement_preflight.py にフォールバックしない yes none test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASS(fixture repo に run_refinement_preflight.py を意図的に配置せず、それでも実 dispatch が成功することを確認) -
child(owner_reaction_decision.py)の non-zero exit / malformed 結果は outer executor によって false success(status: selected 等)に変換されない yes none test_owner_reaction_decide_failure_boundary.py 全3テスト PASS(_dispatch_child_and_check_postconditions() が result.returncode を verbatim 伝播することを実 subprocess 境界から確認) -
command_registry.py / owner_reaction_decision.py の argv・placeholders・stdout_contract(Issue #1975 由来)は本 PR で一切変更していない yes none git diff で両ファイルとも無変更(Allowed Paths 外)。test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue が実ファイルから直接 REGISTRY を読み込み execution_class / stdout_contract を pin -
owner_reaction.decide の出力(selected_option_id)を既存 heavy mutation gate(_classify_heavy_mutation_gate() 等)や downstream consumer(#2689)に接続する配線は追加していない yes none rg -n "_classify_heavy_mutation_gate|selected_option_id" scripts/agent-guards/skill_runtime_exec.py — selected_option_id への参照なし(本 executor は child stdout を透過するのみ) -

Runtime Verification Evidence(動作検証証跡、AC1〜AC10)

Runtime Verification Applicability: immediate(Issue #2688 本文)。applicable_acs は AC1〜AC10(全 AC)。実行環境は GitHub network 通信なしで完結する(全テストが --gh-fixture-file または production-shaped の実 subprocess のみで完結し、live GitHub API 呼び出しは行わない)。以下は .claude/worktrees/issue-2688-owner-reaction-decide-skill-runtime-exec(本 PR head d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a の checkout)で再実行した実ログを引用する。

AC1: owner_reaction.decide と owner_reaction.decide.fixture が scripts/agent-guards/skill_runtime_exec.py の exact dispatch に接続されている。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:43Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 5 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result PASSED [ 20%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_production_real_subprocess_returns_structured_result PASSED [ 40%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_production_and_fixture_share_same_dispatcher_and_selection PASSED [ 60%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASSED [ 80%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue PASSED [100%]

============================== 5 passed in 1.78s ===============================

AC2: production-shaped profile と fixture profile が同一の owner-reaction dispatcher 実装を利用する。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:43Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、AC1 と同一 pytest 実行内の `test_production_and_fixture_share_same_dispatcher_and_selection`)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 5 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result PASSED [ 20%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_production_real_subprocess_returns_structured_result PASSED [ 40%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_production_and_fixture_share_same_dispatcher_and_selection PASSED [ 60%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASSED [ 80%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue PASSED [100%]

============================== 5 passed in 1.78s ===============================

AC3: outer argv から skill_runtime_exec.py → exact command policy/parser → command_registry.render_command() → owner_reaction_decision.py → owner_reaction_decision_result/v1 structured stdout の全鎖が real executor test で通る。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:43Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、AC1 と同一 pytest 実行内の production/fixture 両 real subprocess テスト)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 5 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result PASSED [ 20%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_production_real_subprocess_returns_structured_result PASSED [ 40%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_production_and_fixture_share_same_dispatcher_and_selection PASSED [ 60%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASSED [ 80%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue PASSED [100%]

============================== 5 passed in 1.78s ===============================

AC4: owner-user-id と preview-binding-file の各フラグ、および fixture 用 gh-fixture-file フラグの required/forbidden combination が exact に検証される。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:48Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 9 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_rejects_missing_owner_user_id PASSED [ 11%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_rejects_missing_preview_binding_file PASSED [ 22%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_fixture_rejects_missing_gh_fixture_file PASSED [ 33%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_production_rejects_gh_fixture_file PASSED [ 44%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_other_command_id_rejects_owner_user_id PASSED [ 55%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_other_command_id_rejects_gh_fixture_file PASSED [ 66%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_rejects_cross_command_flags PASSED [ 77%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_accepts_exact_production_combination PASSED [ 88%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py::test_owner_reaction_decide_fixture_accepts_exact_fixture_combination PASSED [100%]

============================== 9 passed in 1.71s ===============================

AC5: executor の first-hop script integrity/readback 対象と、registry が render する実 first-hop script が owner_reaction_decision.py で一致する。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:43Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、AC1 と同一 pytest 実行内の `test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight`)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 5 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result PASSED [ 20%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_production_real_subprocess_returns_structured_result PASSED [ 40%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_production_and_fixture_share_same_dispatcher_and_selection PASSED [ 60%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASSED [ 80%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue PASSED [100%]

============================== 5 passed in 1.78s ===============================

AC6: 既存 registry entry(owner_reaction.decide / owner_reaction.decide.fixture)の argv / placeholders / stdout_contract は変更しない。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:50Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、既存 `test_owner_reaction_decision.py` の regression 実行。argv/placeholders/stdout_contract pin を含む)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 14 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_preview_binding_primary_identity PASSED [  7%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_preview_binding_invalid_rejects_reserved_reject_all_key PASSED [ 14%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_preview_binding_invalid_dangling_option_id PASSED [ 21%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_stable_user_id_principal_resolution PASSED [ 28%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_pagination_partial_failure_fail_closed PASSED [ 35%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_selection_semantics_disambiguation PASSED [ 42%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_untrusted_and_unmapped_reaction_excluded PASSED [ 50%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_drift_detection_returns_stale PASSED [ 57%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_toctou_final_readback_happens_after_reactions_fetch PASSED [ 64%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_comment_issue_url_mismatch_is_rejected PASSED [ 71%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_anchor_comment_issue_url_mismatch_is_rejected PASSED [ 78%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_owner_user_id_mismatch_is_rejected PASSED [ 85%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_canonical_command_registry_entry_end_to_end PASSED [ 92%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_canonical_command_registry_production_entry_end_to_end PASSED [100%]

============================== 14 passed in 0.22s ==============================

AC7: owner_reaction.decide.fixture が実 skill_runtime_exec.py subprocess 経由で structured result を返す。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:43Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、AC1 と同一 pytest 実行内の `test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result`)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 5 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result PASSED [ 20%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_production_real_subprocess_returns_structured_result PASSED [ 40%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_production_and_fixture_share_same_dispatcher_and_selection PASSED [ 60%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASSED [ 80%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue PASSED [100%]

============================== 5 passed in 1.78s ===============================

AC8: production-shaped dispatch と fixture dispatch の正常系を実 executor entrypoint から検証する(live GitHub API は不要で、fixture/fake/stub で閉じる)。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:43Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、AC1 と同一 pytest 実行内の production/fixture 両テスト)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 5 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_fixture_real_subprocess_returns_structured_result PASSED [ 20%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_production_real_subprocess_returns_structured_result PASSED [ 40%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_production_and_fixture_share_same_dispatcher_and_selection PASSED [ 60%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decide_first_hop_targets_owner_reaction_decision_not_run_refinement_preflight PASSED [ 80%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py::test_owner_reaction_decision_py_argv_template_unchanged_by_this_issue PASSED [100%]

============================== 5 passed in 1.78s ===============================

AC9: child(owner_reaction_decision.py)の non-zero exit または malformed structured result が outer executor によって false success に変換されないことを実 executor 境界から検証する。

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:55Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 3 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py::test_owner_reaction_decide_fixture_malformed_reaction_record_is_nonzero_exit_not_false_success PASSED [ 33%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py::test_owner_reaction_decide_fixture_malformed_gh_fixture_json_is_nonzero_exit_not_false_success PASSED [ 66%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py::test_owner_reaction_decide_fixture_missing_preview_binding_file_is_nonzero_exit_not_false_success PASSED [100%]

============================== 3 passed in 1.02s ===============================

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

  • 判定(Result): PASS
  • 実行日時(Timestamp、UTC): 2026-09-20T19:31:50Z
  • 実行環境(Environment): Linux WSL2 6.18.33.2-microsoft-standard-WSL2 / Python 3.12.3 / uv 0.11.29 / pytest 9.0.3
  • 終了コード(Exit Code): 0
実行ログ(クリックで展開、AC6 と同一 pytest 実行。既存 `test_owner_reaction_decision.py` 全 14 テストが無変更で PASS)
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py -v
============================= test session starts ==============================
platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
collected 14 items

.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_preview_binding_primary_identity PASSED [  7%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_preview_binding_invalid_rejects_reserved_reject_all_key PASSED [ 14%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_preview_binding_invalid_dangling_option_id PASSED [ 21%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_stable_user_id_principal_resolution PASSED [ 28%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_pagination_partial_failure_fail_closed PASSED [ 35%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_selection_semantics_disambiguation PASSED [ 42%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_untrusted_and_unmapped_reaction_excluded PASSED [ 50%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_drift_detection_returns_stale PASSED [ 57%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_toctou_final_readback_happens_after_reactions_fetch PASSED [ 64%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_comment_issue_url_mismatch_is_rejected PASSED [ 71%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_anchor_comment_issue_url_mismatch_is_rejected PASSED [ 78%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_owner_user_id_mismatch_is_rejected PASSED [ 85%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_canonical_command_registry_entry_end_to_end PASSED [ 92%]
.claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py::test_canonical_command_registry_production_entry_end_to_end PASSED [100%]

============================== 14 passed in 0.22s ==============================

Not controlled(Out of Scope、Issue #2688 契約どおり)

Notes

…に配線する (#2688)

Issue #1975 で追加された owner_reaction.decide / owner_reaction.decide.fixture の
command_registry.py エントリは、これまで宣言のみで skill_runtime_exec.py の実 dispatch
に接続されていなかった(#1975 の明示的 Out of Scope)。repair_action.apply /
structural_repair_action.apply の既存 exact dispatch precedent(exact
parser/checker 関数、execution_class 定数、first-hop script
integrity/readback パターン)に倣い、両 command_id を exact dispatch として
実行時に呼び出せるよう配線する。

- skill_runtime_command_policy.py: owner_reaction.decide /
  owner_reaction.decide.fixture 用の exact parser/checker
  (parse_exact_skill_runtime_owner_reaction_decide_command /
  is_exact_skill_runtime_owner_reaction_decide_executor_command とその
  fixture sibling)を追加。validate_registry_entry() は、command_registry.py
  の当該 2 エントリ(Issue #1975 由来、本 Issue では変更しない read-only
  design reference)が required_cwd/required_branch/allowed_write_roots を
  宣言しない実際の形状に合わせて分岐する。
- skill_runtime_exec.py: --owner-user-id / --preview-binding-file /
  --gh-fixture-file の required/forbidden combination 検証、command_text
  構築 + exact parser 呼び出し、render_params 分岐、および first-hop script
  integrity/readback ターゲットを owner_reaction_decision.py に向ける
  script_name 分岐(run_refinement_preflight.py ではない)を追加。
- production-shaped / fixture 両 profile が同一 dispatcher 実装
  (script_name 分岐)を共有することを確認。

owner_reaction_decision.py / command_registry.py の owner_reaction.decide 系
エントリ(argv・placeholders・stdout_contract)は本 Issue では一切変更しない。

新規テスト(.claude/skills/issue-refinement-loop/tests/):
- test_owner_reaction_decide_dispatch.py: AC1/AC2/AC3/AC5/AC7/AC8
  (実 skill_runtime_exec.py subprocess 経由の production/fixture 両 profile
  dispatch、first-hop script 対象の検証)
- test_owner_reaction_decide_flag_validation.py: AC4
  (required/forbidden combination の網羅的検証、実 subprocess 経由)
- test_owner_reaction_decide_failure_boundary.py: AC9
  (child non-zero exit / malformed structured result が false success に
  変換されないことの実 executor 境界からの検証)
- owner_reaction_dispatch_fixture.py: 上記 3 ファイルが共有する、実際の
  production ファイル(skill_runtime_exec.py / skill_runtime_command_policy.py
  / command_registry.py / owner_reaction_decision.py)を検証用スクラッチ
  git repo へ配置する fixture builder

Closes #2688

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2694/

The preview will be removed when this PR is closed.

@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop Step 4/5: reviewer verdict

Mergeability: MERGEABLE (Draft PR; merge_state_status: BEHIND — will be reconciled via update_branch before final approval)

Evidence Check: 10/10 ACs independently verified PASS at head 4559d243e766e00fdded835bc556c5bb30ce0261 (test-runner, 16/16 literal Verification Commands). Regression gates (typecheck/lint/test/build, gemini model_routing) all PASS. Required CI checks (lint/build/typecheck/test/validate-generated-artifact) all SUCCESS at this head. Allowed Paths compliance confirmed (only the 3 declared paths touched; command_registry.py / owner_reaction_decision.py unchanged).

Blockers: none

Non-blockers / Notes: PR is Draft and BEHIND main; impl-review-loop will run update_branch next and re-verify/re-review at the new head before reaching final approved routing.

verdict: APPROVE
reviewed_head_sha: "4559d243e766e00fdded835bc556c5bb30ce0261"
blockers: []
warnings:
  - "PR is currently Draft; merge_state_status is BEHIND at review time (both non-blocking per policy; control-plane handles via live mergeability, not self-reported here)"

@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop Step 4/5: reviewer verdict (re-review at updated head)

Mergeability: MERGEABLE (Draft PR; merge_state_status: BLOCKED — CI re-run after update_branch)

Evidence Check: 10/10 ACs independently re-verified PASS at head d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a (test-runner, 11/11 literal AC Verification Commands). Regression gates (typecheck/lint/test/build, gemini model_routing) all PASS. Required CI checks (lint/build/typecheck/test/validate-generated-artifact) all SUCCESS at this head. Allowed Paths compliance re-confirmed. Diff between previously-reviewed head (4559d24) and this head is a clean merge commit only — no unexpected content changes.

Blockers:

Warnings:

  • python-test-core (non-required check) was still IN_PROGRESS at review time; not merge-blocking but should be confirmed passing.
  • PR is Draft with mergeStateStatus: BLOCKED; not a reviewer blocker per existing policy, noted for context only.
verdict: REQUEST_CHANGES
reviewed_head_sha: "d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a"
blockers:
  - "PR body is missing the required `## Runtime Verification Evidence` section (docs/dev/runtime-verification-policy.md §6/§7/§8). Issue #2688 declares Runtime Verification Applicability decision: immediate with all AC1-AC10 tagged <!-- runtime-verification: true -->, which requires a PR-body evidence section with per-AC Result/Timestamp/Environment/Exit Code and fallback-absence confirmation. The current `## Checks` section (pytest pass counts only) does not satisfy this format. Sibling PR #2683 (same feature chain, same decision: immediate) correctly included this section as precedent."
warnings:
  - "python-test-core (non-required check) was still IN_PROGRESS at review time; not merge-blocking but should be confirmed passing."
  - "PR is Draft with mergeStateStatus: BLOCKED; not a reviewer blocker per existing policy, noted for context only."

@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop Step 4/5: reviewer verdict (re-review after PR body fix)

Mergeability: MERGEABLE (Draft PR; will re-check merge_state_status for final routing)

Evidence Check: Previous blocker (missing ## Runtime Verification Evidence section) resolved — the section now covers AC1-AC10 with Result/Timestamp/Environment/Exit Code per docs/dev/runtime-verification-policy.md §7. validate_pr_body.py (canonical structural validator): status pass. Allowed Paths gate re-confirmed: ok, no violations. Required CI checks re-confirmed SUCCESS at this head (6/6: test/typecheck/build/lint/python-test/validate-generated-artifact).

Blockers: none

Non-blockers / Notes: validate_pr_body_hygiene.py (a stricter, non-canonical wrapper not wired into open-pr/SKILL.md's Procedure or docs/dev/github-ops.md) flags HY001 on the - Closes #2688 line in ## Notes. Confirmed pre-existing and identical in shape to merged precedent PR #2683 (- Closes #1975). Not treated as a blocker since the canonical validator (validate_pr_body.py) passes.

verdict: APPROVE
reviewed_head_sha: "d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a"
blockers: []
warnings:
  - "validate_pr_body_hygiene.py(非canonical wrapper)はHY001(`- Closes #2688` standalone行)をfailとして検出するが、merged precedent PR #2683の本文にも同一パターンが存在するpre-existing事象であり、本PRのblockerとはしない。canonical validator(validate_pr_body.py)はpassを返す。"

@squne121

Copy link
Copy Markdown
Owner Author

PR #2694 を current head d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a で、Issue #2688、親実装 #1975 / PR #2683、後続 #2689、OWNER anchor comment、command_registry.py、owner_reaction_decision.py、Claude-GPT launcher、既存 env-policy tests まで追いました。現行 CI は成功、merge state も clean ですが、REQUEST_CHANGES 相当です。既存 reviewer が APPROVE した後にも、production-shaped test では検出できない実運用 blocker が残っています。

[PR #2694](https://github.com/squne121/loop-protocol/pull/2694?utm_source=chatgpt.com) [[Issue #2688](https://github.com/squne121/loop-protocol/issues/2688?utm_source=chatgpt.com)](https://github.com/squne121/loop-protocol/issues/2688?utm_source=chatgpt.com) [[OWNER architecture anchor](https://github.com/squne121/loop-protocol/issues/2688?utm_source=chatgpt.com#issuecomment-5749552225)](https://github.com/squne121/loop-protocol/issues/2688?utm_source=chatgpt.com#issuecomment-5749552225)

  1. P0-1 — production owner_reaction.decide が GH_CONFIG_DIR を失い、canonical Claude-GPT 環境で認証不能になり得ます。 skill_runtime_exec.py:1184 の _sanitize_env() は GH_TOKEN / GITHUB_TOKEN は常時通しますが、GH_CONFIG_DIR は gh_config_dir_carrier_command_ids に列挙された5 command だけです。今回新たに実 gh api を呼ぶ owner_reaction.decide は追加されていません。一方 scripts/claude-gpt/launch.sh は HOME/XDG を空の隔離先へ差し替えたうえで、Native の GitHub 認証だけを export GH_CONFIG_DIR="$CLAUDE_NATIVE_GH_CONFIG_DIR_TARGET" で引き継ぐ設計です。したがって GH_TOKEN を明示せず通常の gh auth login の stored credential を使う構成では、executor が GH_CONFIG_DIR を落とした時点で child は隔離 HOME/XDG 側を見に行きます。GitHub CLI 公式仕様でも GH_CONFIG_DIR が gh の設定ディレクトリを決め、未指定時は XDG_CONFIG_HOME/gh → HOME/.config/gh にフォールバックします。また gh api は authenticated request と定義されています。(GitHub CLI)
    これを現在のテストが見逃す理由も明確です。owner_reaction_dispatch_fixture.py の production-shaped profile は本物のネットワーク/認証を使わず _FAKE_GH_SOURCE に差し替え、SKILL_RUNTIME_TEST_OWNER_REACTION_GH_STATE_FILE だけで成功します。さらに既存 test_skill_runtime_exec_env_allowlist.py:49 の carrier 一覧にも owner reaction はありません。実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 が避けようとした「real executor subprocess まで通したが production capability が欠けた第二の false-green」になっています。最小修正は production の owner_reaction.decide だけを gh_config_dir_carrier_command_ids に追加することです。fixture には不要です。新しい認証 broker や live-network CI は不要で、fake gh が期待した GH_CONFIG_DIR を受け取ったことを1ケースだけ検証すれば十分です。

  2. P1-1 — “exact dispatch” なのに unrelated flag が1本だけ silent accept されます。 skill_runtime_exec.py の owner branch(約3097行目)は fixture / anchor_comment_url / loop_state_file / review_result_verdict / max_iterations を禁止します。authority transport 系等は前段の共通検証で落ちます。しかし --investigation-evidence-transport-path は前段の cross-command rejection に含まれず、owner branch の禁止条件にもありません。そのため owner_reaction.decide ... --investigation-evidence-transport-path foo は argparse では受理され、再構築する command_text からは消え、exact parser にも見えず、render_params にも渡らず、成功し得るのに指定値は完全に無視されます。エラーメッセージの「only --owner-user-id/--preview-binding-file are allowed」とも矛盾します。修正は owner 2 branch の forbidden predicate にこの field を加え、その1ケースを flag-validation test に足すだけで十分です。generic flag framework へのリファクタは不要です。

  3. P1-2 — read-only root/control-plane command に active Issue worktree を必須化したのは、実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 の契約以上の運用制約です。 parse/is_exact_skill_runtime_owner_reaction_* は resolve_active_issue() の entry is not None を要求し、_validate_runtime_context() も owner reaction が ROOT_NO_WORKTREE_ALLOWED_COMMAND_IDS にないため active_issue_worktree_missing で停止します。新規 fixture が select_issue_worktree() を stub して必ず fake entry を返しているのも、この依存をテストで人工的に満たしている証拠です。一方 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 Outcome は「root/control-plane から canonical invocation 可能」であり、anchor-comment-handling.md でも reaction result を読む主体は root control-plane です。production command は mutation: false / allowed_write_roots: [] で、worktree のファイルを読む処理でもありません。これは安全性を高めるというより、worktree cleanup 後や worktree materialize 前に reaction を確認できなくする harness coupling です。個人開発の実用性を優先するなら、owner reaction 2 command を root-no-worktree eligible にする方が自然です。active worktree が本当に意図された業務契約なら、少なくとも Issue 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 にその precondition を明記すべきで、現状のように実装だけで追加するのは避けるべきです。

  4. P2-1 — policy の説明が実装と正反対のままです。 skill_runtime_command_policy.py:289 付近には現在も 実装: owner reaction 手順を決定論的 reaction reader/principal resolver/drift checker/mutation consumer として実装する #1975 由来の「policy DECLARATION only」「skill_runtime_exec.py の hardcoded branch ではない」「ExactSkillRuntimeCommand field / exact-match parser は追加しない」という説明があります。しかし同じファイルの約1493行目から、まさに今回その exact parser/checker を追加しています。OWNER anchor の P0-2 は「既存コメントも同期する」ことを要求していました。この stale comment は次回の refinement / codebase-investigator を誤誘導するので、今回の PR 内で消すか現行 architecture に書き換えるべきです。

外部仕様との照合では、reaction reader 自体を触る必要はありません。gh api --paginate --slurp は全ページを取得してページごとの JSON を外側の配列にまとめる公式動作で、現在の _validate_reaction_page_shape() と整合しています。また issue-comment reaction の per_page=100、+1/-1/laugh/confused/heart/hooray/rocket/eyes も現行 GitHub REST 契約どおりです。([GitHub CLI]2)

したがって修正範囲は広げない方がよいです。優先順位は P0-1 → P1-1 → P1-2 → P2-1。特に P0-1 は、現在の「fake-backed real executor test」という検証方針そのものは維持したまま、production credential carrier の1 assertion を追加すれば閉じられます。独立 executor、新規 credential broker、live GitHub API CI、reaction semantics 再設計は不要です。

既存レビューが認めた点も妥当です。first-hop を owner_reaction_decision.py に切り替えたこと、production/fixture が同じ registry/render path を使うこと、child non-zero を outer executor が success に化けさせないこと、#2689 の mutation-consumer 責務を吸収しなかったことは、そのまま維持してよいです。

@squne121

Copy link
Copy Markdown
Owner Author

指定コメントを 新しい fix_delta の起点として、既存 PR #2694 をそのまま再開するのが適切です。新規 PR や Issue body の再 refinement は不要です。

推奨アクションは次の順です。

  1. P0-1 を最優先で修正。production owner_reaction.decide だけを _sanitize_env() の GH_CONFIG_DIR carrier に追加します。fixture は local_only なので追加しません。Claude-GPT launcher は isolated HOME/XDG に切り替えつつ native の GH_CONFIG_DIR を明示的に引き継ぐ設計であり、GitHub CLI 公式仕様でも GH_CONFIG_DIR は stored credential を含む設定ディレクトリの解決に使われ、gh api は authenticated request です。したがって指定コメントの P0 は実運用 blocker として扱うべきです。([GitHub CLI]1)
  2. P1-1 は局所修正。production / fixture 両 branch で --investigation-evidence-transport-path を明示 reject し、既存 flag-validation test に focused case を追加します。generic flag framework の整理には広げません。
  3. P1-2 も今回直すのを推奨します。Issue 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 の Outcome は root/control-plane から canonical invocation 可能であることなのに、現コードは exact checker と _validate_runtime_context() の双方で active worktree を要求しています。owner_reaction.decide* を ROOT_NO_WORKTREE_ALLOWED_COMMAND_IDS と対応 invariant に追加し、両 exact checker も既存 preflight.run / decide.run precedent と同様に command_allows_root_no_worktree() を使わせるのが小さい修正です。新規 guard や独立 executor は不要です。
  4. P2-1 の stale comment を同じ差分で修正。現在の「policy declaration only / exact parser は存在しない」という説明は実装と正反対なので、実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 の exact-dispatch architecture に同期します。
  5. テスト追加は Issue 実装: owner_reaction.decide の skill_runtime_exec.py generic dispatch 配線を行う(#1975 の Out of Scope) #2688 の Allowed Paths 内だけに置きます。既存の .claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py は read-only regression evidence として実行できますが、Allowed Paths 外なので編集しない方がよいです。GH_CONFIG_DIR の新 assertion は既存の owner_reaction_dispatch_fixture.py / dispatch test 側で fake gh に carrier を観測させれば閉じられます。
  6. 以前の draft_pr_ready / APPROVE は、指定コメントより古いので最終判断として再利用しません。current head で implementation → independent Verification → PR review を再実行し、各 SubAgent の final result と terminal completed を必ず待ってから次へ進めます。Routine fix で承認を求めず、最終的に draft_pr_ready まで進め、merge は実行しません。

指定コメント: [PR #2694 comment 5753975780](#2694 (comment))
実装契約: [Issue #2688](#2688)
現時点で確認した対象 head は d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a で、CI は成功しています。ただし指定コメントはその後のレビューなので、成功済み CI を blocker 解消の証拠としては扱えません。

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

PR #2694 の既存実装を、以下の OWNER review comment を新しい fix_delta / human context として impl-review-loop で再開してください。

Target review:
#2694 (comment)

Target PR:
#2694

Source Issue:
#2688

Canonical skill:
.claude/skills/impl-review-loop/SKILL.md

このセッションは既に auto mode で起動済みです。permission mode を変更せず、routine な実装修正・検証・レビュー再実行について人間承認を求めないでください。

今回の目的は、指定 review comment の blocker を解消し、current head に対する independent Verification と PR review をやり直し、canonical impl-review-loop の draft_pr_ready 条件まで到達することです。merge は実行しないでください。

Authority / freshness

まず live state を取得してください。

指定 comment 作成時に確認された PR head は:

d522b5a9bb2d6cb96d95feb6d70aa0ddf1ef7b1a

です。ただしこれを固定値として信用せず、開始時に PR current head、base、draft state、mergeability、CI、canonical worktree/branch を再取得してください。

以前の impl-review-loop completion comment や APPROVE / draft_pr_ready は、この target review comment より古い evidence です。今回の終了判定には再利用しないでください。

target review の REQUEST_CHANGES は今回まさに解消を依頼している fix_delta です。この現在の operator instruction は、その blocker を自律的に修正してループを継続する明示的な指示です。target comment を「再度人間に判断を求めて停止する理由」として扱わず、実装入力として消費してください。

build_intake_capsule.py / canonical preparation が human-context URL を受理する場合は、target review URL を human_context_comment_urls として渡してください。

SubAgent execution contract

impl-review-loop の canonical orchestration に従い、root/control-plane から少なくとも以下を SubAgent に委譲してください。

Step 1:
implementation-worker

Step 2:
test-runner

Step 4:
pr-reviewer

重要: 各 SubAgent を起動したら、その SubAgent の作業完了を必ず待ってください。

部分ログ、途中メッセージ、tool call の終了だけを completion とみなしてはいけません。SubAgent の final structured result と、canonical task state の terminal completed を確認してから次の Step へ進んでください。

Step 1 → Step 2 → Step 4 の依存関係を壊す並列実行は禁止です。

SubAgent 内からさらに不要な nested SubAgent を増やさないでください。今回必要なのは canonical impl-review-loop が定義する worker / test-runner / reviewer delegation です。

Fix delta

指定 review comment の4項目を、current head の実コードに対して独立に再確認してください。まだ存在するものは以下の方針で修正してください。

P0-1: GH_CONFIG_DIR carrier

scripts/agent-guards/skill_runtime_exec.py::_sanitize_env() を確認してください。

production owner_reaction.decide は real gh api consumer です。

GH_TOKEN / GITHUB_TOKEN が明示されていない、通常の gh auth login stored credential を利用する canonical Claude-GPT 環境でも動作するよう、

owner_reaction.decide

のみを gh_config_dir_carrier_command_ids に追加してください。

owner_reaction.decide.fixture は local-only fixture lane なので carrier に追加しないでください。

新規 credential broker、live-network CI、新規 authentication abstraction は作らないでください。

Allowed Paths 内の既存 owner-reaction fixture/test を使い、production-shaped real executor subprocess の fake gh が期待した GH_CONFIG_DIR を受け取ることを focused assertion で証明してください。

.claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py
は Issue #2688 の Allowed Paths 外なので、必要なら read-only regression evidence として実行して構いませんが、この run では編集しないでください。

P1-1: silent unrelated flag acceptance

production / fixture の owner-reaction outer dispatch branch を確認し、

--investigation-evidence-transport-path

が指定された場合は明示的に reject してください。

値を argparse で受理してから command_text / render_params で黙って捨てる挙動を残さないでください。

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

に real skill_runtime_exec.py subprocess を使う focused negative test を追加してください。

generic flag validation framework のリファクタには広げないでください。

P1-2: unnecessary active-worktree coupling

Issue #2688 の Outcome は owner-reaction decision を root/control-plane から canonical invocation 可能にすることです。

owner_reaction.decide / owner_reaction.decide.fixture は read-only で、registry contract 上も allowed_write_roots: [] です。

current implementation が、

  • ROOT_NO_WORKTREE_ALLOWED_COMMAND_IDS に未登録
  • _ROOT_NO_WORKTREE_POLICY_INVARIANTS に未登録
  • owner reaction exact checker が resolve_active_issue(...).entry is not None を直接要求
  • _validate_runtime_context() が active_issue_worktree_missing を要求

という形で active Issue worktree を必須化しているなら、この余分な harness coupling を除去してください。

既存 preflight.run / decide.run 等の precedent を利用し、

  • production と fixture の両 command ID を root-no-worktree eligible にする
  • 対応する policy invariant を追加する
  • owner reaction の exact checker も command_allows_root_no_worktree() を canonical source として使う
  • _validate_runtime_context() の既存 generic behavior を利用し、owner reaction 専用 bypass を新設しない

という最小変更を優先してください。

active worktree が存在しない canonical-root 状態から production-shaped / fixture の exact dispatch が成立することを Allowed Paths 内の focused test で証明してください。

新規 worktree manager、new guard executable、独立 executor は作らないでください。

P2-1: stale policy documentation

scripts/agent-guards/skill_runtime_command_policy.py の #1975 由来 comment に、

  • policy declaration only
  • skill_runtime_exec.py hardcoded branch ではない
  • exact parser/checker は追加しない
  • root-no-worktree eligible ではない

という現在の実装と矛盾する説明が残っている場合、#2688 後の architecture を正確に説明する内容へ更新してください。

コメントだけの大規模整理は不要です。今回変更する owner reaction policy の周辺だけ同期してください。

Preserve existing good behavior

以下は変更しないでください。

command_registry.py と owner_reaction_decision.py は read-only design reference として扱ってください。

Allowed Paths

live Issue #2688 の Allowed Paths を正本としてください。

想定される変更範囲は以下だけです。

scripts/agent-guards/skill_runtime_exec.py

scripts/agent-guards/skill_runtime_command_policy.py

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

Allowed Paths 外の production file を変更して問題を「解決」しないでください。

Verification

implementation-worker の自己テストを Step 2 の代用にしないでください。

まず focused regression として少なくとも以下を current head で確認してください。

uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_dispatch.py -q

uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_flag_validation.py -q

uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decide_failure_boundary.py -q

uv run pytest .claude/skills/issue-refinement-loop/tests/test_owner_reaction_decision.py -q

uv run pytest scripts/agent-guards/tests/test_skill_runtime_policy_commands.py -q

uv run pytest .claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py -q

そのうえで Issue #2688 の literal Verification Commands を independent test-runner で実行し、current-head binding の TEST_VERDICT / VC_ADJUDICATION_RESULT_V1 を取得してください。

full regression で既知の baseline failure が出る場合、単に「pre-existing」と宣言しないでください。必要なら同じ command を appropriate base/main evidence と比較し、test names / failure count / failure reason が一致することを確認し、今回の差分による新規 failure がないことを独立に示してください。

head が1 commitでも変わった場合、古い Step 2 evidence を再利用しないでください。

PR review loop

Step 2 current-head verification が完了した後だけ、pr-reviewer を起動してください。

reviewer には最低限、

を渡してください。

REQUEST_CHANGES の場合は blocker を構造化して fix_delta にし、implementation-worker に戻してください。

routine fix について人間承認を求めず、bounded loop 内で修正 → independent Verification → current-head re-review を繰り返してください。

reviewed_head_sha != current PR head なら stale verdict を採用せず current head を再レビューしてください。

BEHIND なら canonical route_to_update_branch を使い、worker に branch update を委譲した後、Verification と Review をやり直してください。

actual Git conflict 以外の DRAFT / BLOCKED / UNSTABLE / artifact warning だけを理由に停止しないでください。canonical route_loop_verdict_v2() に従ってください。

Completion condition

以下が current head で成立するまで続行してください。

reviewer verdict = APPROVE

blockers = []

reviewed_head_sha = current PR head

Issue #2688 independent Verification = PASS

target review の P0-1 / P1-1 / P1-2 / P2-1 が全て current diff または evidence により解消済み

Allowed Paths compliant

current-head CI に今回由来の failure なし

live mergeability が canonical routing 上、draft_pr_ready の終了報告を生成できる状態

成立したら canonical IMPL_REVIEW_LOOP_RESULT_V1 を生成して終了してください。

PR を merge しないでください。

PR の ready-for-review 化についても独自判断で先走らず、canonical skill の現在の route が明示的に要求する場合だけ従ってください。

最終報告には少なくとも、

Issue #2688
PR #2694
final head SHA
branch/worktree
iteration count
target review 4項目それぞれの disposition
Verification result
CI result
pr-reviewer verdict / reviewed_head_sha
blockers
Allowed Paths result
live mergeability
termination reason
IMPL_REVIEW_LOOP_RESULT_V1.status
merge 未実行

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

途中の散文報告より canonical structured result と current-head evidence binding を優先してください。

このプロンプトでは特に、P1-2 を Issue 修正へ逃がさず、Allowed Paths 内の小さな runtime-policy 修正として閉じることと、古い APPROVE を再利用せず SubAgent の完了を待って current head を再検証することを強めています。

Test and others added 2 commits September 21, 2026 10:15
…2694 レビュー指摘に沿って修正する

PR #2694 review fix_delta (comment #5753975780) の4項目を対応:
- P0-1: `_sanitize_env()` の gh_config_dir_carrier_command_ids に
  `owner_reaction.decide`(production のみ)を追加し、通常の `gh auth
  login` stored credential を使う canonical Claude-GPT 環境でも認証できる
  ようにする。`owner_reaction.decide.fixture` は対象外のまま。
- P1-1: owner_reaction.decide / .fixture の forbidden-flag チェックに
  `--investigation-evidence-transport-path` を追加し、silent に無視され
  ていた未対応フラグを明示的に reject する。
- P1-2: owner_reaction.decide / .fixture を
  `ROOT_NO_WORKTREE_ALLOWED_COMMAND_IDS` / `_ROOT_NO_WORKTREE_POLICY_
  INVARIANTS` に登録し、両 exact checker が `command_allows_root_no_
  worktree()` を canonical source として使うようにする。read-only /
  local-only な command が不要に active issue worktree を必須化していた
  過剰な harness coupling を解消。
- P2-1: skill_runtime_command_policy.py の #1975 由来コメント(policy
  宣言のみ、exact parser/checker は追加しない、root-no-worktree 対象外)
  が #2688 以降の実装と矛盾していたため、現行 architecture に合わせて
  更新。

各項目に focused regression test を追加(real skill_runtime_exec.py
subprocess 経由)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121
squne121 marked this pull request as ready for review September 21, 2026 01:49
@squne121
squne121 merged commit 10bbcf8 into main Sep 21, 2026
45 of 46 checks passed
@squne121
squne121 deleted the worktree-issue-2688-owner-reaction-decide-skill-runtime-exec branch September 21, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant