Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "producer/trusted-consumer 間の live PR body acquisition parity(同一 REST endpoint・同一 jq filter・canonicalization を変えない直接 persistence)を regression test で固定する"
change_kind: codeParent Issue
none(#2093 の closure contract が明示する Child Issues は #2099 / #2100 / #2101 / #2230 のみであり、本 Issue はその closure set に含まれないため #2093 の child にはしない。related: #2093, #2145, PR #2137)
Parent Goal Ref
N/A(親 Issue なし。#2093 は visual-impact-policy-trusted の TS import graph reachability・CheckRun identity・reusable workflow pinning を対象とする別スコープの delivery-rollup であり、本 Issue の PR body acquisition parity はその closure 条件を構成しない)
参考: #2145(producer/consumer 間の改行差異という前提で起票されたが、PR #2137 が producer 側 .github/workflows/ci.yml を github.event.pull_request.body の event-time snapshot から live gh api pulls/{num} 取得へ変更したことで実装前提が supersede され、superseded_by_decision として close 済み)が対象にしていた「改行差異」は PR #2137 で producer 側が live fetch に統一されたことで解消済みだが、その parity を固定するテストが無い、という gap を本 Issue が引き続き対象にする。
Current Validated Scope
.github/workflows/ci.yml(producer, 2555 行目付近)と.github/workflows/visual-impact-trusted-consumer.yml(trusted consumer, 242 行目付近)は、現在ともに以下の acquisition semantics を満たしている:- 同一の live Pull REST endpoint パターン(
repos/{repo}/pulls/{pr_number})を使用する - 同一の jq filter(
.body // "")を使用する gh api/gh_apiの stdout を command substitution 等の canonicalization を変え得る intermediate(shell 変数束縛・printf等)を経由せず、直接ファイルへ persist する- producer が
github.event.pull_request.body(event-time snapshot)へ回帰していない
- 同一の live Pull REST endpoint パターン(
- この現状の acquisition semantics を固定する regression test を
scripts/agent-ops/tests/test_pr_body_acquisition_parity.pyとして追加する - 追加テストは workflow YAML を
yaml.safe_load()で構造的にパースし、該当run:step から上記の acquisition spec(endpoint pattern・jq filter・intermediate の有無)を抽出した上で、producer/consumer 間の一致を assert する(exact shell 文字列全体への coupling は避ける) - 上記 semantic invariant のいずれかを片側だけに与えた synthetic negative fixture(producer が event snapshot に戻る/command substitution +
printfを挟む/jq filter を変える、のいずれか)を extractor/parity assertion が reject することを確認する。この negative case を確認する pytest テスト自体は PASS(exit 0)で完了する契約とし、意図的な red test を completion 契約に持ち込まない
Remaining Parent Gaps
なし(本 Issue は #2093 の子ではない独立 follow-up。#2093 の Closure には影響しない)
Outcome
scripts/agent-ops/tests/test_pr_body_acquisition_parity.py が追加され、producer(.github/workflows/ci.yml)と trusted consumer(.github/workflows/visual-impact-trusted-consumer.yml)の live PR body acquisition が上記 semantic invariant を満たすことを検証する positive test と、片側だけの semantic drift を reject する negative test の両方が pytest として PASS する状態。scripts/agent-ops/tests/ は .github/ci/python-test-plan.json の targets に既に登録済みのため、追加の CI plan 変更は不要。
Runtime Verification Applicability
decision: immediate
reason: >-
Allowed Path が scripts/agent-ops/** の extension-surface risk-trigger に
mechanically match するため immediate rank を宣言する。
ただし本 Issue は test-only regression file の追加のみであり、
SubAgent lifecycle / runtime-loaded execution semantics は変更しない。
実質的な verification は local hermetic pytest のみで完結する。
applicable_acs:
- AC1
- AC2
execution_environment:
cli_tools:
- python3
- uv
auth_required: false
network_required: false
skip_conditions: []
fallback_policy:
fallback_success_is_pass: false
notes: >-
live Claude runtime / network / external service fallback は使用しない。
artifact_requirements:
- focused pytest outputdecision: immediate は scripts/agent-ops/** に対する docs/dev/extension-surface-runtime-policy.yaml の subagent-lifecycle-start-stop-delegation-fallback ルール(hard enforcement, default_decision: immediate)が Allowed Paths と mechanically match するために宣言する mechanical rank であり、実際に SubAgent の delegation/fallback/start-stop signal ロジックを変更するという判断ではない。本 Issue の verification artifact は focused hermetic pytest(uv run --locked pytest ...)の実行結果のみであり、live Claude Code runtime smoke、worktree-agent-runtime-smoke 追加、SubAgentStart/SubagentStop causal evidence、network / GitHub Actions live run / external auth、新規 runtime harness・security harness・schema・receipt・persistent artifact のいずれも要求しない(Issue #2499 に限定した direct human semantic disposition)。
In Scope
.github/workflows/ci.ymlの PR body 取得ステップ(2555 行目付近)をyaml.safe_load()で構造的にパースし、該当run:step 文字列から acquisition spec(REST endpoint pattern・jq filter・command-substitution/printf 等の intermediate の有無)を抽出するロジックの追加.github/workflows/visual-impact-trusted-consumer.ymlの PR body 取得ステップ(242 行目付近、gh_apiwrapper 経由)についても同様の acquisition spec 抽出ロジックの追加- 両者の acquisition spec が一致することを assert する positive test(
test_live_pr_body_acquisition_parity) - producer/consumer の一方だけに次のいずれかの semantic drift を与えた synthetic fixture で、parity checker がそれを reject することを確認する negative test(
test_acquisition_parity_rejects_semantic_drift):- producer が
github.event.pull_request.body(event-time snapshot)に戻る - endpoint/jq filter は同じだが、片側だけ
$(...)command substitution → shell 変数 →printfの intermediate を挟む - jq filter を片側だけ変える
(上記 3 パターンを 1 つの focused negative-test contract にまとめる。個別 AC に分割しない)
- producer が
Out of Scope
.github/workflows/ci.yml/.github/workflows/visual-impact-trusted-consumer.ymlの実装ロジック自体の変更(現状のロジックは既に一致しているため、変更ではなく固定用テストの追加のみ).github/ci/python-test-plan.jsonの変更(scripts/agent-ops/tests/は既に targets 登録済みのため不要。Issue 実装: run_worktree_agent_runtime_smoke.py に skill-invocation-runtime-smoke profile を実装し causal-evidence 既定強制を opt-out 可能にする #2498 も同じ事実を前提にしている)- shell AST parser、汎用 workflow analyzer、新しい security harness、production abstraction の新設
- transport abstraction、provenance/attestation の仕組み
- TS import graph reachability・CheckRun identity・reusable workflow pinning 等、Issue 実装: visual-impact-policy-trusted の残存検証ギャップ(TS import graph 到達可能性・CheckRun identity・reusable workflow pinning)を縮小する #2093 の残存ギャップ(本 Issue はその closure set に含まれない)
- Issue 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 の close 作業そのもの(既に
superseded_by_decisionとして close 済み)
Acceptance Criteria
- AC1:
.github/workflows/ci.ymlと.github/workflows/visual-impact-trusted-consumer.ymlの該当run:step を構造的にパースして抽出した acquisition spec(live Pull REST endpoint・jq filter.body // ""・stdout→file の直接 persistence・event snapshot への非回帰)が producer/consumer 間で一致することを検証する pytest テスト関数test_live_pr_body_acquisition_parityが追加されている。verification artifact は focused hermetic pytest 実行結果のみ(live runtime smoke 不要) - AC2: producer が event snapshot に戻る/command substitution +
printfintermediate を片側だけに挟む/jq filter を片側だけ変える、のいずれかを模した synthetic negative fixture で parity checker がそれを reject することを確認する pytest テスト関数test_acquisition_parity_rejects_semantic_driftが追加されている(この pytest テスト自体は PASS/exit 0 で完了する)。verification artifact は focused hermetic pytest 実行結果のみ(live runtime smoke 不要)
Verification Commands
# AC1
# baseline-expect: fail
$ uv run --locked pytest scripts/agent-ops/tests/test_pr_body_acquisition_parity.py::test_live_pr_body_acquisition_parity -q# AC2
# baseline-expect: fail
$ uv run --locked pytest scripts/agent-ops/tests/test_pr_body_acquisition_parity.py::test_acquisition_parity_rejects_semantic_drift -qAllowed Paths
- scripts/agent-ops/tests/test_pr_body_acquisition_parity.py(新規作成)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
.github/workflows/ci.ymlまたは.github/workflows/visual-impact-trusted-consumer.ymlの実装ロジック自体を変更する必要が生じた場合(本 Issue はテスト追加のみが Scope であるため).github/ci/python-test-plan.jsonの変更が必要になった場合(既に対象登録済みのため、必要になった場合はスコープ外の別問題を意味する)
Required Skills
なし
Required Design References
- docs/dev/workflow.md
- .github/ISSUE_TEMPLATE/implementation.yml
- .github/workflows/ci.yml(read-only 参照・test input。実装ロジックの変更は不可)
- .github/workflows/visual-impact-trusted-consumer.yml(read-only 参照・test input。実装ロジックの変更は不可)
Delivery Rule
1 Issue = 1 PR。worktree での作業を前提とし、Draft PR を既定とする。
Notes for Reviewer
Allowed Paths は新規 test file 1件のみに縮小した。.github/workflows/ci.yml / .github/workflows/visual-impact-trusted-consumer.yml は read-only 参照として Required Design References へ移動済みのため、以前指摘されていた Allowed Paths overlap(policy_class C1)は解消される。.github/ci/python-test-plan.json は scripts/agent-ops/tests/ を既に targets 登録済み(Issue #2498 も同じ前提)であるため、本 Issue では変更しない。parent_issue は #2093 の明示 Child Issues(#2099/#2100/#2101/#2230)に本 Issue が含まれないことを repository evidence(gh issue view 2093)で確認した上で "none" とし、Parent Issue セクションで #2093/#2145/PR #2137 を tracking reference として保持する。
なお scripts/agent-ops/tests/test_pr_body_acquisition_parity.py(新規テストファイルのみ)は docs/dev/extension-surface-runtime-policy.yaml の subagent-lifecycle-start-stop-delegation-fallback ルールの path_globs: ["scripts/agent-ops/**"] と静的に重複するため、contract_readiness_check.py の EXTSURF001(extension_surface_risk_trigger)が機械的に一致し得る。本 Issue はこれを理由とした direct human semantic disposition(repository owner 承認済み)として Runtime Verification Applicability.decision: immediate を採用し、applicable_acs: [AC1, AC2] に <!-- runtime-verification: true --> タグを付与して mechanical rank を満たす。これは test-only file が実際に SubAgent lifecycle semantics を変更するという判断ではなく、live Claude Code runtime smoke・worktree-agent-runtime-smoke 追加・SubAgentStart/SubagentStop causal evidence・network/external auth・新規 runtime harness/security harness/schema/receipt/persistent artifact のいずれも要求しない。verification artifact は AC1/AC2 の focused hermetic pytest 実行結果のみで完結する。
Activity
squne121 commentedon Sep 5, 2026
判定
REQUEST_CHANGES。ただし Issue #2499 の目的自体は妥当で、別 Issue 化や新しいハーネスは不要です。推奨は、#2499 を「workflow の現在の文字列を固定するテスト」から、PR body の取得 authority と canonicalization/persistence semantics の parity を固定する、小さな test-only Issue に修正することです。
PR #2137 の最終レビューでは、producer を event-time の
github.event.pull_request.bodyから livegh api pulls/{num}取得へ変えたことがpr_body_digest_mismatchの genuine fix として独立確認され、visual-impact-policy-trustedも SUCCESS になっています。つまり #2499 が守るべきものは historical な newline 説そのものではなく、「producer と trusted consumer が同一の live PR metadata epoch と同等の byte-producing path を使う」ことです。敵対的レビュー
Severity | Finding | 判定 -- | -- | -- P0 | endpoint + jq filter の一致だけでは本来の regression を防げない | false-green が成立する P1 | AC3 の python-test-plan.json 追記は current repo と矛盾 | 不要な shared-config churn P1 | AC2 が「pytest 自体が fail」と読め、VC と矛盾 | completion contract が曖昧 P1 | exact workflow 文字列への coupling が強すぎる | repo 自身の「behavior を assert」に逆行 P2 | read-only workflow を Allowed Paths に入れている | overlap preflight の不要ノイズを生む P2 | parent_issue: #2093 が parent closure contract と一致しない | tracking relation が stale/ambiguous P2 | .body // \"\"\" の typo | literal contract と実装が不一致P0 — 現在の AC1 は「守りたい事故」を通してしまう
#2499 は現在、producer/consumer から REST endpoint と
.body // ""だけを抽出して一致を確認する設計です。しかし current producer は直接、
と stdout をファイルへ流しています。trusted consumer も
gh_api ... --jq '.body // ""' > artifacts/trusted/pr_body.txtという同型です。PR #2137 がまさにこの live REST parity を導入しました。例えば将来 consumer だけが次のように変わった場合を考えます。
endpoint も jq filter も同じなので、現行 #2499 の AC1 は PASS し得ます。ところが生成 byte は同一とは限りません。 Bash の command substitution は trailing newline を削除すると仕様で明記されています。 (GNU) また jq の raw-output 系 semantics でも通常 output と
--join-outputは末尾 newline の扱いが明示的に異なります。 (jqLang) GitHub CLI の--jqは API response を jq syntax で選択して出力する formatter であって、REST response の raw bytes をそのまま保存する契約ではありません。 (GitHub CLI)つまり固定すべき normalized contract は最低限、
live REST pull.body+ endpoint + jq filter + direct stdout→file persistenceです。さらに producer 側で
github.event.pull_request.bodyへ戻らないことを直接 negative case にした方が、PR #2137 で実際に起きた事故を最も直接的に防げます。これは production abstraction を作れ、という話ではありません。test file 内だけの小さな extractor で十分です。
P1 — AC3 は削除すべき
.github/ci/python-test-plan.jsonはすでに"scripts/agent-ops/tests/"を target に持っています。そのため、このディレクトリへtest_pr_body_acquisition_parity.pyを作れば CI 対象になります。plan loader も directory target 配下を coverage 対象として認識し、その target list を pytest argv に展開しています。
さらに直前の Issue #2498 はまさに同じ事実を正しく扱っており、「
scripts/agent-ops/tests/は既に target なので、新規テスト追加のための python-test-plan 更新は不要」と明記しています。したがって #2499 だけ個別ファイルを追加登録するのは current repo convention とも不整合です。pytest 自体も duplicate path の重複除去 semantics を持つため、親 directory と子 file の重複指定をわざわざ増やす実益はありません。 (pytestドキュメント)
Outcome / In Scope / AC3 / AC3 VC / Allowed Paths から
.github/ci/python-test-plan.jsonを丸ごと削除するのがよいです。これで write scope は実質 新規 test file 1個だけになります。
P1 — AC2 の negative test 契約が逆
現在は、
となっています。一方 VC は通常の
pytest ...なので、completion 時には exit 0 が必要です。ここは、
と書くべきです。
例えば「
extract_acquisition_spec()の結果が不一致になることを assert」あるいは「parity validator がFalse/例外を返すことを assert」で十分です。意図的 red test を completion VC に持ち込む必要はありません。P1 — exact shell string ではなく narrow semantic invariant を読む
リポジトリの canonical workflow.md は「実装詳細でなく入出力の振る舞いをアサーションする」をテスト方針にしています。
#2499 の二つの
rg -nFは、GITHUB_REPOSITORYとREPO、shell quoting、wrapper 名など、事故と関係ない refactor に結合します。一方で前述の command-substitution regression は見逃します。この repository には workflow を
yaml.safe_load()して構造的に読む既存 test pattern があります。 PyYAML も既存 dependency です。したがって高品質かつ小さい実装は、YAML を構造 parse → relevant
run:step を取り出す → test-local extractor で意味的 invariant だけを見る方式です。shell AST parser や汎用 workflow analyzer を作る必要はありません。P2 — Allowed Paths が harness friction を自分で増やしている
repository の implementation Issue template では Allowed Paths は「編集可の具体パス」です。
それに対して #2499 は二つの workflow を「read-only 参照」と明記しながら Allowed Paths に含めています。 その結果 Notes for Reviewer では C1 overlap の説明まで必要になっています。
個人開発の minimal harness 方針ではこれは逆効果です。#1860 も、live Issue/PR・実 diff・実 test・current-head CI を authority として、過剰な control-plane を増やさないことを明示しています。
workflow 2ファイルは Required Design References / test input に移し、Allowed Paths から外すのが自然です。
最終的な Allowed Paths は、
だけでよいでしょう。
Parent #2093 も整理した方がよい
#2499 は
parent_issue: #2093ですが、#2093 の closure contract は #2099 / #2100 / #2101 / #2230 を明示的な子としており、目的も TS reachability / CheckRun binding / reusable workflow・attestation の delivery rollup です。#2499 の PR-body acquisition parity はその closure set にありません。最小運用を優先するなら、私は
parent_issue: "none"にしてRelated: #2093, #2145, PR #2137とする方を選びます。#2093 の完了条件を後付けで広げる価値は薄いです。推奨する修正版 contract
Issue 自体は維持し、AC を 2つか3つに縮めるのがよいです。
AC1 は、producer と trusted consumer がともに live Pull REST endpoint から
.body // ""を取得し、取得 stdout を command substitution 等の canonicalization-changing intermediate を経由せず直接ファイルへ保存する同等 acquisition semantics を持つこと。producer にgithub.event.pull_request.bodyが再導入されていないことも含めます。AC2 は test-local synthetic fixtures で、少なくとも「event payload snapshot へ戻す」「同じ endpoint/filter だが
$()+printfを挟む」「jq filter を変える」のいずれかを片側だけへ与えた場合に parity checker が reject すること。pytest test 自体は PASS させます。AC3 を残すなら単に「新規 test file が通常の repository python-test selection で収集されること」にします。ただし
scripts/agent-ops/tests/は既登録なので、私は AC 自体を削除します。Verification Commands も、
程度で十分です。現在の exact-string
rg、python-test-plan.jsonのrg、live GitHub Actions run、actionlint、追加 schema、provenance artifact は不要です。また Current Validated Scope の
.body // """は単純な typo なので.body // ""に修正すべきです。結論
#2499 は close/supersede ではなく reframe が適切です。 #2145 と違って、回帰テストという残存 gap 自体は実在しています。ただし現状の contract は「守る対象が少し弱く、CI 登録と overlap 管理は逆に少し重すぎる」状態です。
最も費用対効果が高い形は、1 test file / production change なし / CI plan change なし / live runtime verification なしで、PR #2137 が確立した live REST + direct persistence parity だけを固定することです。これなら品質を上げながら、#1860 の minimal-harness 方針にもかなり素直に整合します。
## 判定REQUEST_CHANGES。ただし Issue #2499 の目的自体は妥当で、別 Issue 化や新しいハーネスは不要です。推奨は、#2499 を「workflow の現在の文字列を固定するテスト」から、PR body の取得 authority と canonicalization/persistence semantics の parity を固定する、小さな test-only Issue に修正することです。
PR #2137 の最終レビューでは、producer を event-time の
github.event.pull_request.bodyから livegh api pulls/{num}取得へ変えたことがpr_body_digest_mismatchの genuine fix として独立確認され、visual-impact-policy-trustedも SUCCESS になっています。つまり #2499 が守るべきものは historical な newline 説そのものではなく、「producer と trusted consumer が同一の live PR metadata epoch と同等の byte-producing path を使う」ことです。敵対的レビュー
python-test-plan.json追記は current repo と矛盾parent_issue: #2093が parent closure contract と一致しない.body // \"\"\"の typoP0 — 現在の AC1 は「守りたい事故」を通してしまう
#2499 は現在、producer/consumer から REST endpoint と
.body // ""だけを抽出して一致を確認する設計です。しかし current producer は直接、
と stdout をファイルへ流しています。trusted consumer も
gh_api ... --jq '.body // ""' > artifacts/trusted/pr_body.txtという同型です。PR #2137 がまさにこの live REST parity を導入しました。例えば将来 consumer だけが次のように変わった場合を考えます。
endpoint も jq filter も同じなので、現行 #2499 の AC1 は PASS し得ます。ところが生成 byte は同一とは限りません。 Bash の command substitution は trailing newline を削除すると仕様で明記されています。 ([GNU]1) また jq の raw-output 系 semantics でも通常 output と
--join-outputは末尾 newline の扱いが明示的に異なります。 ([jqLang]2) GitHub CLI の--jqは API response を jq syntax で選択して出力する formatter であって、REST response の raw bytes をそのまま保存する契約ではありません。 ([GitHub CLI]3)つまり固定すべき normalized contract は最低限、
live REST pull.body+ endpoint + jq filter + direct stdout→file persistenceです。さらに producer 側で
github.event.pull_request.bodyへ戻らないことを直接 negative case にした方が、PR #2137 で実際に起きた事故を最も直接的に防げます。これは production abstraction を作れ、という話ではありません。test file 内だけの小さな extractor で十分です。
P1 — AC3 は削除すべき
.github/ci/python-test-plan.jsonはすでに"scripts/agent-ops/tests/"を target に持っています。そのため、このディレクトリへtest_pr_body_acquisition_parity.pyを作れば CI 対象になります。plan loader も directory target 配下を coverage 対象として認識し、その target list を pytest argv に展開しています。
さらに直前の Issue #2498 はまさに同じ事実を正しく扱っており、「
scripts/agent-ops/tests/は既に target なので、新規テスト追加のための python-test-plan 更新は不要」と明記しています。したがって #2499 だけ個別ファイルを追加登録するのは current repo convention とも不整合です。pytest 自体も duplicate path の重複除去 semantics を持つため、親 directory と子 file の重複指定をわざわざ増やす実益はありません。 ([pytestドキュメント]4)
Outcome / In Scope / AC3 / AC3 VC / Allowed Paths から
.github/ci/python-test-plan.jsonを丸ごと削除するのがよいです。これで write scope は実質 新規 test file 1個だけになります。
P1 — AC2 の negative test 契約が逆
現在は、
となっています。一方 VC は通常の
pytest ...なので、completion 時には exit 0 が必要です。ここは、
と書くべきです。
例えば「
extract_acquisition_spec()の結果が不一致になることを assert」あるいは「parity validator がFalse/例外を返すことを assert」で十分です。意図的 red test を completion VC に持ち込む必要はありません。P1 — exact shell string ではなく narrow semantic invariant を読む
リポジトリの canonical workflow.md は「実装詳細でなく入出力の振る舞いをアサーションする」をテスト方針にしています。
#2499 の二つの
rg -nFは、GITHUB_REPOSITORYとREPO、shell quoting、wrapper 名など、事故と関係ない refactor に結合します。一方で前述の command-substitution regression は見逃します。この repository には workflow を
yaml.safe_load()して構造的に読む既存 test pattern があります。 PyYAML も既存 dependency です。したがって高品質かつ小さい実装は、YAML を構造 parse → relevant
run:step を取り出す → test-local extractor で意味的 invariant だけを見る方式です。shell AST parser や汎用 workflow analyzer を作る必要はありません。P2 — Allowed Paths が harness friction を自分で増やしている
repository の implementation Issue template では Allowed Paths は「編集可の具体パス」です。
それに対して #2499 は二つの workflow を「read-only 参照」と明記しながら Allowed Paths に含めています。 その結果 Notes for Reviewer では C1 overlap の説明まで必要になっています。
個人開発の minimal harness 方針ではこれは逆効果です。#1860 も、live Issue/PR・実 diff・実 test・current-head CI を authority として、過剰な control-plane を増やさないことを明示しています。
workflow 2ファイルは Required Design References / test input に移し、Allowed Paths から外すのが自然です。
最終的な Allowed Paths は、
だけでよいでしょう。
Parent #2093 も整理した方がよい
#2499 は
parent_issue: #2093ですが、#2093 の closure contract は #2099 / #2100 / #2101 / #2230 を明示的な子としており、目的も TS reachability / CheckRun binding / reusable workflow・attestation の delivery rollup です。#2499 の PR-body acquisition parity はその closure set にありません。最小運用を優先するなら、私は
parent_issue: "none"にしてRelated: #2093, #2145, PR #2137とする方を選びます。#2093 の完了条件を後付けで広げる価値は薄いです。推奨する修正版 contract
Issue 自体は維持し、AC を 2つか3つに縮めるのがよいです。
AC1 は、producer と trusted consumer がともに live Pull REST endpoint から
.body // ""を取得し、取得 stdout を command substitution 等の canonicalization-changing intermediate を経由せず直接ファイルへ保存する同等 acquisition semantics を持つこと。producer にgithub.event.pull_request.bodyが再導入されていないことも含めます。AC2 は test-local synthetic fixtures で、少なくとも「event payload snapshot へ戻す」「同じ endpoint/filter だが
$()+printfを挟む」「jq filter を変える」のいずれかを片側だけへ与えた場合に parity checker が reject すること。pytest test 自体は PASS させます。AC3 を残すなら単に「新規 test file が通常の repository python-test selection で収集されること」にします。ただし
scripts/agent-ops/tests/は既登録なので、私は AC 自体を削除します。Verification Commands も、
程度で十分です。現在の exact-string
rg、python-test-plan.jsonのrg、live GitHub Actions run、actionlint、追加 schema、provenance artifact は不要です。また Current Validated Scope の
.body // \"\"\"は単純な typo なので.body // \"\"に修正すべきです。結論
#2499 は close/supersede ではなく reframe が適切です。 #2145 と違って、回帰テストという残存 gap 自体は実在しています。ただし現状の contract は「守る対象が少し弱く、CI 登録と overlap 管理は逆に少し重すぎる」状態です。
最も費用対効果が高い形は、1 test file / production change なし / CI plan change なし / live runtime verification なしで、PR #2137 が確立した live REST + direct persistence parity だけを固定することです。これなら品質を上げながら、#1860 の minimal-harness 方針にもかなり素直に整合します。
squne121 commentedon Sep 5, 2026
推奨は、指定コメントを direct human context の anchor として canonical
issue-refinement-loopに渡し、最大3 iteration を承認確認なしで自動継続させる形です。canonical loop 自体が通常 iteration の approval gate をdefault_required: falseとしているため、独自の--no-approval相当ロジックを追加する必要はありません。Claude Code の permission mode とは分離して扱うのが正しいです。今回の refinement では OWNER の
REQUEST_CHANGESをほぼそのまま設計軸にしてよいです。特に、scripts/agent-ops/tests/は既に Python test plan の target なのでpython-test-plan.json更新は不要で、現在の producer / trusted consumer はともに live Pull REST 取得結果を直接ファイルへ redirect しています。 また #2093 の closure contract は #2099/#2100/#2101/#2230 を明示しているため、#2499 をその child として扱い続けるかも refinement 中に再検証する価値があります。そのまま Claude Code の対話セッションへ貼れる形です。
Issue #2499 を、現在の repository に定義されている canonical
issue-refinement-loopで refinement してください。Target:
squne121/loop-protocol#2499https://github.com/squne121/loop-protocol/issues/2499#issuecomment-55492832003目的は、指定 OWNER comment の
REQUEST_CHANGESを Issue 本文へ反映し、Issue #2499 を implementation-ready な live contract にすることです。これは Issue refinement のみ です。
実装、実装用 worktree 作成、コード変更、PR 作成、
impl-review-loop開始までは行わないでください。Issue が implementation-ready になった時点で停止してください。
Autonomous execution policy
この refinement loop の iteration 間で人間の承認を要求しないでください。
canonical
issue-refinement-loopのloop_iteration_approval_gate.default_required: falseをそのまま適用し、のような通常の継続確認は行わず、自律的に次の canonical phase へ進んでください。
ただし、これは repository loop の iteration approval を省略する指示です。
Claude Code 自体の permission mode、Auto mode、
permissions.defaultMode、bypassPermissions、--dangerously-skip-permissions等を変更する指示ではありません。現在の対話的 Claude Code Auto mode の permission policy はそのまま使用してください。
canonical contract が明示する以下の terminal condition は無視しないでください。
human_judgment_requiredenvironment_failuremax_iterations到達これら以外の通常の
needs-fixは、人間へ確認せず次 iteration へ進めてください。Step 0 — canonical entrypoint
最初に current repository の以下を読み、現在 checkout に存在する定義を authority としてください。
.claude/skills/issue-refinement-loop/SKILL.mdreferences/docs/dev/workflow.md.github/ISSUE_TEMPLATE/implementation.yml過去の記憶やこの prompt 内の procedure が repository の current canonical contract と衝突する場合は repository 側を優先してください。
指定 anchor comment は、この対話で人間から明示的に与えられた direct human context です。
したがって canonical root / default branch から、anchor を扱う際は repository が定義する
preflight.run.with_human_contextlane を使用してください。unlabeled anchor や agent-report lane に勝手に downgrade しないでください。
canonical planner / command registry / trusted executor を迂回して
run_refinement_preflight.py等を直接呼び出さないでください。Step 1 — repository investigation
REFINEMENT_LOOP_PLAN_V1.decisions.investigation_policy.required == trueの場合、canonicalcodebase-investigatorSubAgent を起動してください。codebase-investigator の作業完了を必ず待ってください。
SubAgent が running のまま、依存する Review / Rewrite phase へ進んではいけません。
最終 structured result を受け取り、その repository evidence を main thread が consume してから次へ進んでください。
少なくとも今回の refinement で repository evidence が必要になった場合は、以下を確認対象にしてください。
.github/workflows/ci.ymlの current producer PR-body acquisition.github/workflows/visual-impact-trusted-consumer.ymlの current trusted-consumer PR-body acquisition.github/ci/python-test-plan.jsonscripts/agent-ops/tests/の既存 test patternyaml.safe_load()等で構造的に読む既存 test patterndocs/dev/workflow.mdの testing policySubAgent は read-only investigation とし、Issue mutation をさせないでください。
SubAgent synchronization rule
SubAgent を起動した場合、必ずその Agent call の終了まで待ってください。
結果を推測して先行しないでください。
「おそらく成功した」とみなして次 phase に進まないでください。
複数の SubAgent が canonical planner により必要になった場合も、Review がそれらの結果を必要とするなら、必要な全 SubAgent の最終結果が揃うまで Review を開始しないでください。
nested SubAgent delegation は行わないでください。
Step 1b — Web research
REFINEMENT_LOOP_PLAN_V1.decisions.web_research_policy.required == trueの場合のみ、canonicalweb-researcherSubAgent を使用してください。web-researcher の作業完了を必ず待ってください。
今回外部仕様の再確認が必要になった場合の候補は、
gh api --jqの formatter semanticsです。
ただし repository evidence だけで disposition が確定する事項について、不必要に外部調査を増やさないでください。
Step 2 — canonical review
Review は current
issue-refinement-loopの canonical root-owned review pipeline を使用してください。legacy の
issue-reviewerSubAgent を手動で起動しないでください。current SKILL が
run_root_review_pipeline.pyを canonical Step 2 としている場合は、その contract に従ってください。anchor comment の raw HTML / raw snapshot を自由解釈して Rewrite へ直接渡すのではなく、canonical loop が生成する normalized feedback / structured artifacts を使ってください。
Review result の
status / verdict / next_actionを prose で再判定せず、canonical routing に従ってください。OWNER REQUEST_CHANGES の refinement intent
Issue #2499 の目的自体は維持してください。
close / supersede / 別 Issue 化を既定にはしないでください。
ただし現在の Issue contract は、単なる exact workflow string parity ではなく、
producer と trusted consumer が、同じ live Pull metadata authority を使い、canonicalization を変える intermediate を挟まず、同等の byte-producing / persistence semantics を維持することを固定する小さな test-only contract
へ reframe してください。
refinement 時には、OWNER comment の指摘を repository evidence と照合した上で、少なくとも次を解消してください。
Acquisition parity
AC は endpoint と jq filter の一致だけで終わらせないでください。
守る semantic invariant は概ね、
live Pull REST body acquisition+
equivalent endpoint+
equivalent .body // "" selection+
direct stdout -> file persistenceです。
同じ endpoint/filter であっても、
$(...)command substitution → shell variable →printfのような trailing-newline / byte semantics を変え得る intermediate を片側だけに導入した場合に false-green にならない contract にしてください。
producer が
github.event.pull_request.bodyの event-time snapshot へ戻る regression も検出対象として扱ってください。production abstraction、shell AST parser、汎用 workflow analyzer、新しい security harness を要求しないでください。
test-local な狭い extractor / validator で足りる contract にしてください。
Negative test semantics
現在の「negative fixture でテストが fail する」という曖昧な表現を修正してください。
negative synthetic fixture を parity checker が reject することを test し、
pytest test process 自体は PASS / exit 0
する completion contract にしてください。
negative fixture は repository evidence と設計上妥当なら、少なくとも以下の semantic drift をカバーできる形を検討してください。
printfを片側だけ挟む全部を別々の AC に増やす必要はありません。
1つの focused negative-test contract にまとめて構いません。
Avoid brittle exact-string coupling
現在の exact
rg -nFworkflow string を主要 AC/VC にする設計は再検討してください。repository の既存 pattern と整合するなら、
YAML を構造 parse
→ relevant
run:step を取得→ test-local extractor で semantic invariant を抽出
という narrow behavior-oriented contract を優先してください。
shell variable 名、wrapper 名、quoting といった regression 本体と無関係な refactor へ過剰 coupling しないでください。
python-test-plan
.github/ci/python-test-plan.jsonの current contentsを確認してください。scripts/agent-ops/tests/が既に target として登録されているなら、新規 test file のためだけにpython-test-plan.jsonを変更する AC / Outcome / In Scope / Verification Command / Allowed Path を削除してください。shared CI config churn を増やさないでください。
Allowed Paths
read-only reference は Allowed Paths に混ぜないでください。
Allowed Paths が implementation Issue template 上「編集可能な具体パス」を意味するなら、最終 write scope は原則、
scripts/agent-ops/tests/test_pr_body_acquisition_parity.pyだけへ縮小してください。
二つの workflow file は Required Design References / test input / read-only evidence として扱ってください。
Parent relation
parent_issue: "#2093"が #2093 の current closure contract と本当に整合するか repository evidence で再確認してください。#2093 の explicit child closure set に #2499 が含まれず、parent goal の完了条件を #2499 が構成していないことが確認できるなら、
parent_issue: "none"とし、
Related: #2093, #2145, PR #2137のような tracking/reference relation に落とす案を優先してください。
ただし native relationship や current repository contract に別の authoritative evidence がある場合は、それを優先し、推測で relationship mutation を行わないでください。
Other cleanup
Current Validated Scope にある
.body // "\""相当の typo が残っているなら修正してください。Runtime Verification Applicability は、この Issue が static workflow parsing + synthetic fixture のみで完結するなら
not_applicableを維持してください。新しい runtime harness、provenance artifact、schema、control-plane、外部サービス依存を追加しないでください。
Step 4 — Rewrite
Review / trusted contract update が rewrite を要求した場合は、current canonical
issue-refinement-loopの Rewrite lane に従ってください。canonical flow が
issue-editorSubAgent を要求する場合は、issue-editorを起動してください。issue-editor の作業完了を必ず待ってください。
issue-editor の終了を待たずに body readback、次 iteration、final review へ進んではいけません。
issue-editor 自身に nested SubAgent を起動させないでください。
Issue mutation は repository が定義する controlled transaction / trusted contract update 経路を使用し、main thread から raw
gh issue edit等で bypass しないでください。OWNER feedback の severity や意味を弱めるために AC/VC を曖昧化してはいけません。
Iteration rule
各 rewrite 後は必ず fresh Issue body を read back してください。
その fresh body を入力として、
fresh preflight
→ required investigation/web research
→ canonical review
を行ってください。
過去 iteration の approval や stale body hash を再利用しないでください。
needs-fixかつ iteration budget が残っている場合は、人間へ確認せず次 iteration を開始してください。最大
3iteration までです。途中で canonical verdict が
approve / proceedになった場合はそこで refinement loop を完了してください。human_judgment_requiredまたは canonical fail-closed terminal condition になった場合のみ、人間判断へ停止してください。Completion condition
終了時に、Issue #2499 の live body が implementation-ready であることを確認してください。
少なくとも、
が相互矛盾していないことを確認してください。
特に AC と Verification Commands が、
「negative behavior を検出する pytest 自体が exit 0 で完了する」
という contract と一致していることを確認してください。
Hard boundary
Issue refinement が完了しても、実装へ移行しないでください。
以下は禁止です。
test_pr_body_acquisition_parity.pyの実装implement-issueimpl-review-loop最終状態は、
「Issue #2499 の refinement 完了。implementation-ready。実装未開始」
です。
Final response
作業完了後は長い transcript を貼らず、以下だけ簡潔に報告してください。
REQUEST_CHANGESの主要 finding がどう disposition されたかこの形なら、自律継続は強く指示しつつ、canonical planner/root review を上書きしない構成です。特に
issue-reviewerを無理に SubAgent 起動させず、planner が要求するcodebase-investigator/web-researcherと Rewrite 時のissue-editorに completion wait を明示している点が重要です。canonical 定義上、codebase-investigatorは planner のrequired == trueの場合のみ起動する契約です。squne121 commentedon Sep 5, 2026
推奨は、「承認不要化」をさらに強めるのではなく、前回の停止原因だった EXTSURF001 を今回の direct human context で先に disposition してから canonical loop を再実行することです。
現行
issue-refinement-loop自体はすでにloop_iteration_approval_gate.default_required: falseで、通常のneeds-fixiteration は人間確認なしで継続する契約です。Claude Code の Auto mode / permission policy とは明確に分離されています。 前回 #2499 が止まったのは承認 gate ではなく、scripts/agent-ops/tests/...が extension-surface policy のscripts/agent-ops/**に機械的に一致し、Runtime Verification Applicability: not_applicableと衝突して controlled transaction が fail-closed したためです。 現在の #2499 本文もまだ未更新です。推奨アクションは次の3点です。
immediateにする一方、実際の verification artifact は focused hermetic pytest のみに限定すると先に明示する。これは repository 内にも「EXTSURF001 を満たすためimmediateを宣言するが、live external process は要求せず pytest のみ」とする先例があります。scripts/agent-ops/tests/**の例外追加、新 runtime harness、worktree-agent-runtime-smokeは今回行わない。OWNER の 実装: producer/trusted-consumer 間の PR body 取得ロジック parity を固定する regression test を追加する #2499 レビューが求めているのも、1 test file / production change なし / CI plan change なし、という小さい reframe です。codebase-investigator、必要ならweb-researcher、rewrite が必要ならissue-editorを canonical 条件で起動し、各 SubAgent の最終結果が返るまで依存 phase に絶対進まない。現行 Step 2 は root-owned review pipeline なので、legacyissue-reviewerSubAgent を無理に起動しない。その前提で、そのまま Auto mode の対話的 Claude Code に貼れる形です。
Issue #2499 を、現在の repository に定義されている canonical
issue-refinement-loopで refinement してください。Target:
squne121/loop-protocol#2499https://github.com/squne121/loop-protocol/issues/2499#issuecomment-55492832003目的は、指定 OWNER comment の
REQUEST_CHANGESを Issue 本文へ反映し、Issue #2499 を implementation-ready な live contract にすることです。これは Issue refinement のみ です。
実装、実装用 worktree 作成、コード変更、branch 作成、commit、push、PR 作成、
implement-issue、impl-review-loop、merge は行わないでください。Issue が implementation-ready になった時点で停止してください。
Autonomous execution policy
この refinement loop の iteration 間で人間の承認を要求しないでください。
current repository の canonical
issue-refinement-loopが定義するloop_iteration_approval_gate.default_required: falseをそのまま適用してください。
したがって、通常の continuation について、
のような人間確認は行わず、canonical routing に従って自律的に進んでください。
これは repository loop の iteration approval を省略する指示です。
Claude Code 自体の現在の interactive Auto mode / permission policy は変更しないでください。
特に、
permissions.defaultModebypassPermissions--dangerously-skip-permissions--allow-dangerously-skip-permissions--permission-mode等を変更・追加してはいけません。
現在の Auto mode の permission handling をそのまま利用してください。
Direct human semantic disposition for Issue #2499
前回の refinement attempt は、Issue mutation 前の static readiness check で
EXTSURF001により fail-closed しました。今回、この点について repository owner / human user から以下を Issue #2499 に限定した direct human semantic disposition として明示します。
Issue #2499 の唯一の write scope とすべき
scripts/agent-ops/tests/test_pr_body_acquisition_parity.pyは
scripts/agent-ops/**配下にあるため、current deterministic extension-surface risk-trigger が path-based にsubagent-lifecycle-start-stop-delegation-fallback等へ一致する場合があります。この mechanical policy rank を満たすため、Issue #2499 の
Runtime Verification Applicability.decisionを
immediateとすることを明示的に承認します。ただし、この判断は以下を意味しません。
worktree-agent-runtime-smokeを追加するという判断この Issue は test-only regression のまま維持してください。
decision: immediateを current deterministic checker が必要とする classification/rank として宣言しつつ、実質的な verification artifact は focused hermetic pytest の実行結果のみ としてください。Runtime Verification Applicability は current repository schema/checker に従って、概ね以下の semantics になるよう構成してください。
current checker が
<!-- runtime-verification: true -->tag を要求する場合は、focused hermetic pytest が直接検証する AC1 / AC2 に必要最小限付与してください。この disposition を理由に新しい live runtime VC を作らないでください。
これは今回の direct human context です。
global policy override には拡張しないでください。
Step 0 — current canonical authority
最初に current checkout の canonical definition を読み、その内容を authority としてください。
最低限、
.claude/skills/issue-refinement-loop/SKILL.mdおよびそこから現在参照される必要な
references/、planner、command registry、trusted executor contract を確認してください。過去の記憶、この prompt 内の古い procedure、前回 session の手順が current repository と衝突する場合は、current repository を優先してください。
ただし、上記の
は今回の human input として planner / trusted contract update に渡してください。
anchor comment は direct human context なので、current canonical contract が引き続きその lane を定義している場合は、
preflight.run.with_human_context相当の canonical profile を使用してください。
unlabeled / agent-report lane に downgrade しないでください。
canonical planner / command registry / trusted executor を迂回して internal wrapper を直接実行しないでください。
Step 1 — repository investigation and SubAgent wait discipline
REFINEMENT_LOOP_PLAN_V1の current decisions に従ってください。investigation_policy.required == trueの場合は canonicalcodebase-investigatorSubAgent を起動してください。codebase-investigator の作業完了を必ず待ってください。
具体的には、SubAgent の final structured result が main control-plane に返るまでは、
のいずれにも進んではいけません。
SubAgent が backgrounded 状態になった場合も同様です。
「起動した」ことを完了扱いしてはいけません。
child の final result / completion が確認されるまで依存処理を開始しないでください。
待機のために malformed な tool invocation や無意味な shell polling を作らず、Claude Code が提供する Agent task の正常な completion mechanism を使用してください。
Step 1b — web research
current planner が
web_research_policy.required == trueと判定した場合のみ、canonicalweb-researcherSubAgent を起動してください。起動した場合は、
web-researcher の作業完了を必ず待ってください。
final structured result を受け取る前に Review / Rewrite へ進まないでください。
planner が web research 不要と判定した場合は、prompt の都合で強制起動しないでください。
Step 2 — canonical review
current canonical Step 2 をそのまま使用してください。
現行 repository が root-owned
run_root_review_pipeline.pyを canonical review として定義し、issue-reviewerSubAgent を legacy 扱いしている場合は、issue-reviewerを追加で起動しないでください。review result の
を prose で再判定せず、canonical routing に従ってください。
通常の
needs-fix / request_changesは、人間確認なしで rewrite → fresh readback → next iteration へ進めてください。Rewrite target — OWNER REQUEST_CHANGES
anchor comment の OWNER finding を Issue #2499 の live contract に反映してください。
特に以下を満たしてください。
1. Protect semantic acquisition/persistence parity
単なる
だけの test にしないでください。
守る semantic invariant は少なくとも、
live Pull REST .body+
canonical endpoint semantics
+
.body // ""+
direct stdout -> file persistence
です。
producer / trusted consumer の一方だけが、
のような command substitution / intermediate canonicalization を導入して byte-producing path を変えた場合、parity checker が reject できるようにしてください。
producer が event-time snapshot
github.event.pull_request.bodyへ戻る regression も検出対象にしてください。
production abstraction や shell parser framework は作らず、test-local な narrow extractor で十分です。
2. Negative tests must make pytest PASS
negative fixture は「意図的に pytest を red にする」契約にしないでください。
semantic drift fixture に対し parity checker / extractor / validator が mismatch を reject することを pytest が assert し、
pytest test 自体は exit 0 / PASS
になる contract にしてください。
Acceptance Criteria と Verification Commands の意味を一致させてください。
3. Remove python-test-plan churn
current repository evidence で
.github/ci/python-test-plan.jsonがすでに
scripts/agent-ops/tests/を target としていることを再確認してください。
事実が current main でも維持されている場合、
から
.github/ci/python-test-plan.json更新要求を削除してください。個別 test file の target 登録を追加しないでください。
4. Structural workflow parsing
workflow の shell command exact string を
rg -nFで固定する方式を主契約にしないでください。既存 dependency / repository pattern が current main でも成立するなら、
yaml.safe_load()等で workflow YAML を構造 parseし、relevant
run:step を取得したうえで test-local extractor が semantic invariant を読む設計にしてください。shell variable 名、wrapper 名、quoting style など事故と無関係な refactor に不必要に coupling しないでください。
5. Narrow Allowed Paths
read-only input は Allowed Paths に入れないでください。
最終的な write-capable Allowed Paths は、current evidence が OWNER review と整合する限り、
scripts/agent-ops/tests/test_pr_body_acquisition_parity.pyのみとしてください。
.github/workflows/ci.yml.github/workflows/visual-impact-trusted-consumer.ymlは Required Design References / test inputs として扱ってください。
6. Parent / relations
current GitHub relationship を fresh に確認してください。
#2093 の closure child set に #2499 が含まれていないという前回 evidence が current state でも成立する場合、
parent_issue: "none"とし、
Related / references として少なくとも
を残してください。
7. Typo
.body // "\""等の malformed/extra quote が残らないよう、.body // ""へ統一してください。
Rewrite execution and issue-editor
canonical review / trusted contract update が rewrite を要求し、current flow が
issue-editorSubAgent を要求する場合は、canonicalissue-editorを起動してください。issue-editor の作業完了を必ず待ってください。
issue-editor の final result が返るまでは、
に進んではいけません。
issue-editor 自身には nested SubAgent を起動させないでください。
Issue mutation は current canonical controlled transaction / trusted contract update を使用してください。
main thread から raw
gh issue edit等で transaction を bypass してはいけません。EXTSURF001 handling in this run
前回と同じ
EXTSURF001を検出しただけで即座に人間へ戻らないでください。まず candidate Issue body が今回明示した direct human semantic disposition、
decision: immediateを current repository schema に正しく materialize しているか確認してください。
static readiness が不足フィールド、runtime tag、RVA shape 等を指摘する場合は、current canonical contract に従って Issue body 内で deterministic に修正可能なものを修正し、再評価してください。
repository-defined safe/deterministic repair lane がある場合はそれを使用してください。
ただし、
で通してはいけません。
今回の human disposition を正しく materialize した後でも current canonical machinery がなお semantic human judgment を要求し、repository evidence だけで合法的に解決できない場合のみ
human_judgment_requiredとして停止してください。Iteration rule
各 rewrite / mutation の後は必ず Issue #2499 の live body を fresh readback してください。
古い local draft を次 iteration の authority にしないでください。
fresh live body を入力に canonical review を再実行してください。
routing は以下の原則に従ってください。
「念のため確認」という理由だけでは停止しないでください。
Completion condition
終了時に Issue #2499 の live body が implementation-ready であることを確認してください。
少なくとも以下が相互矛盾していないことを確認してください。
特に、
live REST pull.body + .body // "" + direct persistenceを守るimmediateことを確認してください。
Hard boundary
refinement が完了しても implementation へ移行しないでください。
禁止:
test_pr_body_acquisition_parity.pyの実装implement-issueimpl-review-loop最終状態は、
「Issue #2499 の refinement 完了。implementation-ready。実装未開始」
です。
Final response
長い transcript は貼らず、以下だけを簡潔に報告してください。
この形なら、前回の停止原因を「Auto mode だから無視する」のではなく、必要な人間判断を最初のプロンプトで確定済みにして loop 内の通常承認をゼロにする構成になります。恒久対応するなら別 Issue で
scripts/agent-ops/tests/**を lifecycle risk selector から意味的に区別するのが筋ですが、#2499 の refinement と混ぜない方がよいです。squne121 commentedon Sep 5, 2026
推奨は、Issue #2499 を追加 refinement せず、現在の live body を正本として canonical
impl-review-loopに投入することです。Issue はすでに「新規 test file 1件のみ」「workflow 2件は read-only」「AC1/AC2 の focused hermetic pytest」という implementation-ready contract まで絞られています。実装上も現状 producer は
gh api ... pulls/... --jq '.body // ""' > pr_body.md、trusted consumer はgh_api ... pulls/... --jq '.body // ""' > artifacts/trusted/pr_body.txtで、守るべき parity が実在します。 またscripts/agent-ops/tests/は既に Python test plan 対象なので、plan 変更は不要です。実行方針は以下が適切です。
impl-review-loopを control-plane として保持し、implementation-worker → test-runner → pr-reviewerを順に使う。レビューREQUEST_CHANGESは人間確認なしで fix iteration に戻す。wait_agentの途中通知だけでは完了とせず、final result を取得し、さらにlist_agentsで canonical task が terminalcompletedであることを確認してから次工程へ進む。 特に test-runner はこの二重確認が Step 4 起動条件です。pr-reviewerを起動する。head/body/command が stale なら自動的に Step 2 へ戻す。yaml.safe_load()→ relevantrun:抽出 → endpoint / jq filter / live authority / direct stdout→file persistence を正規化する。wrapper 名、変数名、出力先パス、shell 全文には結合しない。negative test は3 drift をpytest.mark.parametrize等で一つの AC2 test function に収めるのが小さいです。APPROVE + CLEAN/HAS_HOOKS + blockers=[]まで自動継続し、そこで停止する。repository 自身がdraft_pr_ready後のマージ判断を人間に残しています。merge、auto-merge、有効化後の post-merge cleanup は行わせません。そのまま auto mode の Claude Code 対話セッションへ貼る prompt です。
Issue #2499 を、現在の repository に定義されている canonical
impl-review-loopで実装・検証・PR review してください。Target:
squne121/loop-protocol#2499https://github.com/squne121/loop-protocol/issues/24993目的は、Issue #2499 の現在の live contract を実装し、canonical
impl-review-loopを通して マージ直前の human decision point まで自律的に進めることです。実装、worktree 作成、branch 作成、commit、push、PR 作成、Verification Commands 実行、PR review、REQUEST_CHANGES の修正 iteration、必要な current-head CI/readback は、人間の逐次承認を要求せず進めてください。
ただし merge 自体は絶対に行わないでください。
gh pr merge、auto-merge の有効化、merge commit/squash/rebase merge、post-merge cleanup は行わず、canonicalimpl-review-loopが merge-ready /draft_pr_ready相当の終了条件を満たしたところで停止してください。0. Authority
最初に current checkout の canonical definitions を読み、現在の repository 内容を authority としてください。
最低限:
.claude/skills/impl-review-loop/SKILL.md.claude/skills/impl-review-loop/steps/preparation.md.claude/skills/impl-review-loop/steps/step-1-implementation.md.claude/skills/impl-review-loop/steps/step-2-verification.md.claude/skills/impl-review-loop/steps/step-4-pr-review.md.claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md.claude/skills/impl-review-loop/steps/step-5-mergeability-handling.mdreferences// scripts.claude/skills/implement-issue/SKILL.md.claude/agents/test-runner.md.claude/skills/pr-review-judge/SKILL.mddocs/dev/workflow.mdこの prompt と current repository の canonical contract が衝突した場合、current repository を優先してください。
Issue #2499 の過去コメントは historical context です。
既に live Issue body へ反映済みの古い REQUEST_CHANGES や、現在の body と食い違う過去の提案を再び実装 contract に戻さないでください。
現在の fresh live Issue body が実装 scope / AC / VC / Stop Conditions の authority です。
1. Root-owned entry
canonical
impl-review-loopが現在要求する Root-Owned Synchronous Entry Transition を使用してください。root/main thread が同一の continuous control flow 内で、
を実行してください。
過去の contract-review comment、snapshot、ledger、artifact 等だけを Step 1 authorization として使用しないでください。
Issue #2499 は refinement 済みなので、fresh live contract が implementation-ready である限り、通常は別途
issue-refinement-loopに戻らず implementation を開始してください。ただし current canonical root-entry が material な contract defect を検出して implementation を許可しない場合は、その canonical routing に従ってください。
2. Autonomous execution policy
通常の loop progression に人間の approval gate を追加しないでください。
次のような確認を挟まないでください。
Issue contract と canonical skill が許可している bounded action は auto mode で自律実行してください。
repository evidence、live Issue/PR、diff、tests、CI から deterministic に判断できることを、人間への質問へ変換しないでください。
一方、Issue #2499 自身の Stop Conditions と canonical
impl-review-loopの genuine hard stop は維持してください。特に、
.github/ci/python-test-plan.jsonの変更が必要などが発生した場合は、勝手に scope を広げず canonical stop/escalation に従ってください。
単なる advisory artifact 欠落や、SubAgent の非権威的な自己申告だけを新しい human approval gate にしないでください。
3. Issue #2499 implementation boundary
Issue #2499 の Allowed Paths を literal contract として扱ってください。
書き込み可能なのは現在の Issue body に定義された:
scripts/agent-ops/tests/test_pr_body_acquisition_parity.pyのみです。
以下は read-only test input / design reference として扱い、変更しないでください。
.github/workflows/ci.yml.github/workflows/visual-impact-trusted-consumer.yml.github/ci/python-test-plan.json新しい production abstraction、shell AST parser、general-purpose workflow analyzer、runtime harness、security harness、schema、receipt、provenance mechanism、persistent artifact を追加しないでください。
scripts/agent-ops/tests/は既に repository Python test plan の target なので、test-plan 登録を追加しないでください。4. Technical recommendation
実装は test-only の小さな semantic extractor としてください。
既存 repository tests の
yaml.safe_load()workflow parsing pattern を先に調査し、repository convention に合わせてください。推奨構造:
yaml.safe_load()で parserun:script を構造的に特定normalized spec では少なくとも次を表現してください。
repos/{repo}/pulls/{pr_number}.body // ""github.event.pull_request.bodysnapshot を使用していないこと次の irrelevant implementation detail は parity equality に含めないでください。
gh apiとgh_apiという wrapper/executable 名の差そのもの${GITHUB_REPOSITORY}と${REPO}の変数名${PR_NUMBER}等のローカル変数表記一方、次は semantic drift として reject してください。
github.event.pull_request.bodyへ戻る$(...)→ shell variable →printfのような canonicalization-changing intermediate を挟む
.body // ""の jq filter を片側だけ変更するAC2 の public test function 名は Issue contract 通り:
test_acquisition_parity_rejects_semantic_driftを維持してください。
3 drift は、必要なら
pytest.mark.parametrize等でこの一つの focused test function の中にまとめて構いません。意図的な red pytest を completion contract にしないでください。
negative fixture が parity checker に reject されることを assert し、pytest 自体は PASS / exit 0 にしてください。
過剰な shell parser を作らず、現在守る必要がある narrow invariant を明瞭に検出できる最小実装にしてください。
5. Step 1 — implementation-worker
Step 1 は canonical
implementation-workerSubAgent に委譲してください。実際の iteration を materialize した canonical task name
implementation_iNを使用し、Issue URL、fresh Allowed Paths、必要なら fix_delta を concrete value として渡してください。
root/main thread 自身で implementation worker の責務を横取りしないでください。
implementation-worker の作業完了を必ず待ってください。
Common Completion Protocol を厳守してください。
wait_agentの timeout / intermediate update / mailbox activity を completion とみなさないlist_agentsで同一 canonical task が terminalcompletedであることを確認するcompletedの 両方 が揃った後だけ次 Step へ進むerrored/interrupted/shutdown/ lifecyclenot_foundを成功扱いしないimplementation-worker の終了を待たず、Step 2 を先行起動しないでください。
worker 内から別 SubAgent を nested spawn させないでください。
SubAgent orchestration は root
impl-review-loopが所有してください。6. Step 2 — independent verification
implementation-worker が current candidate head を確定した後でのみ
test-runnerSubAgent を起動してください。canonical task name:
verification_iNを actual iteration で materializeしてください。
test-runner には Issue #2499 の fresh live AC と literal Verification Commands をそのまま渡し、current PR head SHA / contract body SHA と binding してください。
Issue #2499 の現在の Verification Commands を literal contract として実行してください。
AC1:
uv run --locked pytest scripts/agent-ops/tests/test_pr_body_acquisition_parity.py::test_live_pr_body_acquisition_parity -qAC2:
uv run --locked pytest scripts/agent-ops/tests/test_pr_body_acquisition_parity.py::test_acquisition_parity_rejects_semantic_drift -qIssue body が実行時に更新されている場合は、この prompt 内のコピーではなく fresh live body の literal commands を使用してください。
test-runner の作業完了を必ず待ってください。
特に Step 4 の pr-reviewer を起動する前に、
list_agentsでverification_iNが terminalcompletedの全てを確認してください。
terminal
completedだけ、または final result だけでは Step 2 完了とみなさないでください。test-runner の focused hermetic pytest が Issue #2499 の runtime-verification artifact の正本です。
この Issue のためだけに live Claude smoke、新しい runtime harness、外部 auth/network verification を追加しないでください。
ただし通常の PR merge-readiness として repository-required current-head CI を canonical loop が評価することは妨げないでください。
それは Issue 固有の新しい runtime verification harness を追加することとは別です。
7. Step 4 — current-head gate and pr-reviewer
Step 2 が current-head で nonblocking の場合のみ PR review へ進んでください。
pr-reviewerspawn の 直前 に canonical Step 4 current-head gate を実行し、を fresh readback して Step 2 adjudication と照合してください。
stale / malformed / blocking なら pr-reviewer を起動せず、canonical routing に従って Step 2 を再実行してください。
gate が open の場合だけ:
pr_review_iNとして
pr-reviewerSubAgent を起動してください。pr-reviewer の作業完了を必ず待ってください。
ここでも Common Completion Protocol を使い、
list_agentsで canonical task の terminalcompletedを確認した後だけ Step 5 routing を行ってください。
root/main thread が review judgment を代行しないでください。
8. REQUEST_CHANGES loop
pr-reviewer が current head に対して
REQUEST_CHANGESを返した場合、通常の blocker について人間へ確認しないでください。canonical
impl-review-loopの route がcontinue_loopなら、fix_deltaとして保存implementation-workertask を起動を max_iterations 内で自動継続してください。
前 iteration の test/review evidence を新しい head に流用しないでください。
9. BEHIND / stale head / CI
canonical routing が
route_to_update_branchを返した場合、人間承認を求めず canonical worker update-branch lane を使用してください。その worker の完了も Common Completion Protocol で待ってください。
branch/head が変わった場合、以前の verification / review evidence は stale とし、
を新しい head に対して再実行してください。
route_stale_head_rereviewの場合も、人間確認なしで fresh current head を review してください。CI failure が repository evidence から修正可能で、Issue #2499 の Allowed Paths 内の修正だけで解決可能なら loop の fix iteration として処理してください。
Allowed Paths 外の修正が必要なら Issue Stop Condition として停止してください。
10. Merge boundary
最終的に canonical
impl-review-loopが、current PR head について少なくとも、APPROVEと判断し、
approved/draft_pr_ready相当へ route した時点で停止してください。その先の merge は行わないでください。
auto-merge も設定しないでください。
Issue を手動 close しないでください。
post-merge cleanup を開始しないでください。
この時点が今回の human decision point です。
11. Final response
長い transcript は不要です。
停止時は次だけ簡潔に報告してください。
MERGE NOT EXECUTEDを明記通常の iteration 中は人間承認を求めず、canonical loop を継続してください。
この形なら、SubAgent の非同期完了を「待ったつもり」で先へ進む事故を明示的に防ぎつつ、通常の実装・テスト・review fix は完全自動、merge だけ人間という境界になります。
squne121 commentedon Sep 5, 2026
implement-issue: 実装完了 (2026-09-05T06:19:19Z)
.claude/worktrees/issue-2499-pr-body-acquisition-parityworktree-issue-2499-pr-body-acquisition-paritysqune121 commentedon Sep 5, 2026
impl-review-loop: 完了 (2026-09-05T07:00:00Z)
fix: PR body acquisition parity testにwrapper透過性/再書き込み検出とformatting許容を追加
squne121 commentedon Sep 5, 2026
impl-review-loop: 完了 (2026-09-05T08:35:00Z)
test: producer/trusted-consumer間のPR body取得ロジックparityを固定するregression t…
squne121 commentedon Sep 5, 2026
post-merge-cleanup: 完了 (2026-09-05T09:16:00Z)
fix: PR body 取得ステップの guard を acquisition parity harness と両立させる (#2594)
fix: visual-impact-policy job の PR_NUMBER 未定義時 gh api pulls/ 404 を防ぐ (#…