Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "impl-review-loop の human-context-comment-url 解決範囲を、target Issue に紐づく実装 PR の conversation issue comment にも comment-ID direct lookup で拡張する"
change_kind: codeParent Issue
none
Parent Goal Ref
- Goal: impl-review-loop の
build_intake_capsule.pyが human-supplied context comment を fail-closed で誤って弾く運用摩擦を解消する - Desired Destination: 単独改善(親 Issue なし)
Current Validated Scope
.claude/skills/impl-review-loop/scripts/build_intake_capsule.pyの_collect_issue_comments()/_resolve_context_comments()の comment 解決ロジックの拡張(comments_by_idmap への PR comment 追加ではなく、map に無い場合の comment-ID direct lookup 追加)- 対応する既存テスト
.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py/.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyへの回帰テスト追加
Remaining Parent Gaps
なし
Outcome
.claude/skills/impl-review-loop/scripts/build_intake_capsule.py が、--human-context-comment-url / --agent-report-comment-url で渡された #issuecomment-<ID> を以下の優先順で解決できるようになり、対応する回帰テストが追加された状態で完了とする。
- target Issue の既存
comments_by_idmap に ID が存在すれば、従来どおりその経路を使う。 - map に無い場合だけ、GitHub Issues API の comment-ID direct lookup 相当(
repos/{repo}/issues/comments/{comment_id})を read-only で叩き、readback したhtml_urlと入力 URL を exact binding する。/issues/N#issuecomment-IDの場合は N が target Issue と一致することを要求する。/pull/N#issuecomment-IDの場合は、そのPRがclosingIssuesReferences(gh pr view --json closingIssuesReferences相当)で target Issue を closing issue として参照していることを read-only で検証する。- 上記のどちらの binding も成立しない場合は解決失敗とし、既存の fail-closed 挙動(
human_supplied_comment_not_found:<id>相当をfatal_errorsに積み exit code 1)に合流する。
--pr-number 引数の追加、および linked PR を列挙して全 comments を取得する discovery subsystem の追加は採用しない(comment-ID direct lookup + PR→target Issue linkage check の方が変更が小さく、誤仕様のリスクが低いため)。
Runtime Verification Applicability
- decision: immediate
- reason: comment 解決ロジックは GitHub CLI / REST API のフィールド名(
closingIssuesReferences等)と実際のレスポンス形状に依存するため、fixture ベースの pytest だけでは field 名の誤認や API 挙動の思い込みを false green にし得る。実装時に既知の実例を使った 1 回の read-only runtime canary を証跡として要求する。 - if immediate: 対応 AC は下記 AC9(
<!-- runtime-verification: true -->タグ付き)。既知の実例は Issue 実装: ci-verdict-summary が conditional close-evidence-publication check を excluded として分類する #2587 に紐づく PR fix: classify conditional close evidence publication #2597 の comment #5612029072(_resolve_context_comments()が実際に解決に失敗した実運用ケース)。恒久的な live GitHub CI や新しい service integration は追加しない。runtime canary は.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py内の専用 pytest テスト 1 件として実装し、実際の GitHub API へ read-only アクセスする(既存の fixture ベーステストとは別ケースとして追加し、fixture テストの mock を差し替えない)。
applicable_acs: AC9
execution_environment:ghCLI が認証済みでapi.github.comへの network access がある実行環境(CI/ローカルどちらでも可)
skip_conditions:ghCLI が未導入・未認証、またはapi.github.comに到達できない場合はpytest.skip()で SKIP として扱う(PASS/FAILとは区別する)
fallback_policy: fallback 経路は設けない。実際の GitHub API 応答が得られない場合は SKIP のみとし、mock/fixture への切替を PASS として扱わない
artifact_requirements: 実行時の pytest stdout ログ(該当テストの出力全文)を PR 本文の Runtime Verification Evidence セクションに inline 引用する
In Scope
_resolve_context_comments()(または同等の解決ロジック)に、target Issue のcomments_by_idmap に ID が無い場合だけ発火する comment-ID direct lookup 経路を追加する- comment-ID direct lookup は GitHub Issues API の comment-ID endpoint 相当(
repos/{repo}/issues/comments/{comment_id})を read-only で使う - lookup 結果の
html_url(またはそれに相当する repo/issue-or-pull 番号)と入力 URL を exact binding する/issues/N#issuecomment-ID: N が target Issue と一致することを要求/pull/N#issuecomment-ID: そのPRがclosingIssuesReferencesで target Issue を closing issue として参照していることを read-only で検証
- 同一 repo に存在するだけの無関係な PR comment は受理しない(binding 不成立で fail-closed)
- 対象はトップレベルの PR conversation issue comment(
#issuecomment-*)のみ。PR inline review comment / review thread / review body は対象外のまま拡張しない - provenance(
human_supplied/agent_generated)は既存どおり呼び出し元の CLI flag(--human-context-comment-url/--agent-report-comment-url)で決定し、comment 解決元(Issue 側 / PR 側)には依存させない - 既存の fail-closed 挙動(該当 comment が本当に存在しない場合は
fatal_errorsに残し exit code 1)を維持する .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py/.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyに、PR 側 comment URL を human-context-comment-url / agent-report-comment-url として渡した場合の解決成功・fail-closed 双方を検証する回帰テストを追加する.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.pyに、既知の実例(Issue 実装: ci-verdict-summary が conditional close-evidence-publication check を excluded として分類する #2587 / PR fix: classify conditional close evidence publication #2597 comment #5612029072)に対する read-only runtime canary pytest(gh未認証・未導入時はpytest.skip())を1件追加する(AC9)
Out of Scope
--pr-number引数の追加- linked PR を列挙して各 PR の全 comments を取得する discovery subsystem の追加
human_supplied/agent_generatedの provenance 判定ルール自体の変更- Root-Owned Synchronous Entry Transition の契約変更
already_satisfiedterminal route の追加(別 follow-up 候補)- PR inline review comments / review threads / review body への対象拡張
Acceptance Criteria
- AC1: target Issue 自身の issue comment を human-context-comment-url / agent-report-comment-url として渡した場合、従来どおり解決に成功する(既存経路の回帰なし)
- AC2: target Issue に紐づく実装 PR の conversation issue comment(
#issuecomment-<ID>)を human-context-comment-url として渡した場合、comment-ID direct lookup 経由で解決に成功する - AC3: 同じ PR conversation issue comment を agent-report-comment-url として渡した場合も解決に成功し、既存の agent_generated provenance / schema 検証が維持される
- AC4: target Issue と無関係な(closing issue として参照していない)PR の conversation comment を渡した場合、fail-closed になる
- AC5: 存在しない comment ID を渡した場合、既存の not-found fatal error semantics(exit code 1、
human_supplied_comment_not_found:<id>相当)で失敗する - AC6: readback した comment の repo / issue-or-pull 番号 / URL binding が入力と一致しない場合は fail-closed になる
- AC7: PR inline review comment 等、今回対象外の URL shape は受理されない
- AC8: 追加した回帰テスト(
test_intake_capsule_provenance_e2e.py/test_build_intake_capsule.py)が全件 PASS する - AC9: 既知の実例(Issue 実装: ci-verdict-summary が conditional close-evidence-publication check を excluded として分類する #2587 に紐づく PR fix: classify conditional close evidence publication #2597 の comment #5612029072)を用いた read-only runtime canary pytest で、human-context-comment-url 解決が実際の GitHub 環境上で成功することを 1 回確認する(
gh未認証・未導入環境ではpytest.skip())
Verification Commands
- 追加した PR コメント解決の回帰テスト(AC1-AC7)と AC9 runtime canary(
gh未認証・未導入環境ではpytest.skip())を含め全件 PASS:
# AC1
# AC2
# AC3
# AC4
# AC5
# AC6
# AC7
# AC9
$ uv run pytest .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py- 既存 comment 収集ロジックのテストが破壊されていない:
# AC8
$ uv run pytest .claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyAllowed Paths
- .claude/skills/impl-review-loop/scripts/build_intake_capsule.py
- .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py
- .claude/skills/impl-review-loop/tests/test_build_intake_capsule.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- .claude/skills/impl-review-loop/SKILL.md
- .claude/skills/impl-review-loop/scripts/build_intake_capsule.py(
_resolve_context_comments()/_collect_issue_comments()の既存実装)
Scope Delta(任意)
N/A
Notes for Reviewer
- Source: Issue 実装: ci-verdict-summary が conditional close-evidence-publication check を excluded として分類する #2587 / PR fix: classify conditional close evidence publication #2597 の impl-review-loop 実行中に発見した tool 制約。
- severity: 中(再現性のある運用摩擦だが、
gh api直接取得での回避策が存在する)。 - 設計は issue-refinement-loop human-context anchor(comment #5612650028、rewrite 判断は comment #5612722608)のレビューに基づき、
--pr-number/ discovery subsystem 方式から comment-ID direct lookup 方式へ変更した。 - Scope Collision (C1, advisory): 同一ファイル
build_intake_capsule.py/test_build_intake_capsule.pyを Allowed Paths に含む可能性がある OPEN Issue として 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602(retrospective handoff workstream)・実装: issue-contract-review の human_judgment に対する人間 override を CONTRACT_REVIEW_HUMAN_OVERRIDE_V1 スキーマで記録・検出できるようにする #1348(human override 記録機構)が存在するが、read-only 再調査(codebase-investigator, 2026-09-10)で両 Issue に紐づく branch / 未マージ commit でbuild_intake_capsule.pyを実変更しているものは検出されなかった。両 Issue とも本 Issue とは異なる関心事であり、non_conflict_reason: 変更対象の関数・振る舞いが異なるため直接コンフリクトの見込みは低い。マージ順序に依存が生じた場合は実装時に再確認する。
Delivery Rule
1 Issue = 1 PRを原則とする。- worktree を切って作業し、Draft PR を既定とする。
Source
- kind: impl_review_loop_followup
- url: fix: classify conditional close evidence publication #2597
- note_id: build-intake-capsule-pr-comment-resolution
- dedupe_key: follow-up:squne121/loop-protocol:build-intake-capsule:pr-comment-resolution
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Sep 10, 2026
判定
REQUEST_CHANGES。Issue #2606 の問題意識は正しいですが、現状の Issue contract のまま implementation に入るのは非推奨です。
実障害は再現性があります。現在の
build_intake_capsule.pyは target Issue の/issues/{issue_number}/commentsだけを全ページ取得し、#issuecomment-{id}をその集合から引くため、PR #2597 上の human context comment のような入力を解決できません。 実際、起点となった #2597 の comment #5612029072 はhtml_urlが/pull/2597#issuecomment-...であるトップレベル PR conversation comment です。ただし、#2606 の解決案には implementation blocker が複数あります。#2606 自体には現時点でコメントはありません。
[P0 / blocker]
gh issue view --json closingIssuesReferencesは成立しません。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 は PR 自動検出案としてgh issue viewのclosingIssuesReferencesを挙げています。 しかし現在の GitHub CLI では、Issue 側のフィールド名はclosedByPullRequestsReferences、closingIssuesReferencesは PR 側のgh pr viewに存在します。(GitHub CLI) これは単なる命名ミスではなく、選択肢の一方をそのまま実装すると production command が失敗します。しかも現在のテストは_run_commandを fixture で置換するため、fixture を誤仕様に合わせれば false-green にできます。したがって Runtime Verification をnot_applicableとする判断とも矛盾します。[P0 / blocker] Verification Commands と Allowed Paths のテストパスが current main と不一致です。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 は
.claude/skills/impl-review-loop/scripts/tests/test_intake_capsule_provenance_e2e.pyとscripts/tests/test_build_intake_capsule.pyを指定しています。 実ファイルはそれぞれ.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.pyと.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyです。 現在の厳密な Allowed Paths 運用では、正しい回帰テストを変更すると scope violation、契約通り実行すると file-not-found になります。これは実装前に直すべきです。[P1]
--pr-numberを追加する案は捨てた方がよいです。 currentimpl-review-loopの正式 input はissue_numberと human/agent comment URL 群で、PR number はありません。 さらに preparation はbuild_capsule_argv()を canonical argv の single source of truth と明記しており、human/agent URL を additive flag として渡します。build_intake_capsule.pyにだけ--pr-numberを追加すると、通常の orchestrator はその値を供給できません。SKILL/preparation まで変更すれば使えますが、今度は 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 の Allowed Paths 外です。しかも URL 自体が/pull/2597#issuecomment-...と PR number を保持しています。入力を二重化する価値がありません。[P1] PR の全コメントを収集する設計自体が過剰です。comment ID の direct lookup が最小解です。 GitHub REST API は
GET /repos/{owner}/{repo}/issues/comments/{comment_id}で、Issue と PR のトップレベルコメントを comment ID 単体で取得できます。GitHub は PR も Issues API 上では issue として扱うと明記しています。(GitHub Docs) つまり明示的に#issuecomment-5612029072を渡されているのに、「linked PR を列挙 → PR ごとの comments を全取得 → ID検索」とする必要がありません。個人開発で workflow friction を減らすという前提でも、direct lookup の方が API 呼び出し、pagination、multiple-PR ambiguity、fixture 複雑化をすべて減らします。[P1] 「PR コメント」の種類を contract で限定すべきです。 今回必要なのは fix: classify conditional close evidence publication #2597 のようなトップレベル conversation comment、つまり
#issuecomment-*です。GitHub の inline review comment は別 API・別オブジェクトで、unified diff 上のコメントとして明確に区別されています。(GitHub Docs) current resolver の regex も#issuecomment-(\d+)$専用です。 「PR コメント全般」と書くと review body、inline review comment、review thread まで対応対象と誤読できます。本 Issue は “PR conversation issue comments (#issuecomment-*) only” と固定するのが妥当です。[P1] direct lookup にしても「target Issue と無関係な PR」を受理してはいけません。 実装: multi-turn anchor の owner turn を chronology metadata として扱い、reaction decision flow を issue-refinement-loop と impl-review-loop へ導入する #1950 で導入された元契約は repo/Issue/comment mismatch を fail-closed としています。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 の goal も「紐づく実装 PR」です。したがって、同一 repository の任意 PR comment を comment ID が存在するだけで通すのは scope 拡大です。PR URLなら URL から PR number を取得し、その PR の
closingIssuesReferencesに target Issue があることを確認する、という1回の read-only relation check で十分です。ここは provenance のための重い security harness ではなく、別 Issue のコメントを誤投入しないための correctness binding と考えるべきです。[P1]
Runtime Verification Applicability: not_applicableはimmediate/read-onlyに変更すべきです。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 自身が GitHub API/CLI の取得範囲を変更する Issue なのに、「外部 API を伴わないため not applicable」としています。 今回見つかったclosingIssuesReferencesの取り違えこそ mock-only test では検出しづらい failure です。ただし CI に live GitHub test を恒久追加する必要まではありません。実装 PR で既知の fix: classify conditional close evidence publication #2597/#5612029072 を使った read-only canary を1回実行して evidence として残す程度で十分です。[P2]
agent-report-comment-urlの PR 側回帰が Acceptance Criteria から抜けています。 Outcome は human と agent の両方を PR comments から解決すると読めますが、明示的 AC は human 側に偏っています。 origin は URL の所在ではなく、呼び出し元が human/agent のどちらの flag に渡したかだけで決める、という既存契約です。 したがって PR conversation comment の agent report も1ケースだけ固定すべきです。[P2] Scope Collision は hard stop にする必要はないものの、実装: issue-contract-review の human_judgment に対する人間 override を CONTRACT_REVIEW_HUMAN_OVERRIDE_V1 スキーマで記録・検出できるようにする #1348 は「変更箇所が違うから低リスク」と言い切れません。 実装: issue-contract-review の human_judgment に対する人間 override を CONTRACT_REVIEW_HUMAN_OVERRIDE_V1 スキーマで記録・検出できるようにする #1348 も
build_intake_capsule.pyの comment/snapshot consumer を直接変更する OPEN Issue です。 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602 はより handoff/interface 寄りで、こちらは直接衝突リスクが低そうです。 特にtest_build_intake_capsule.pyは_run_commandの呼び出し順を配列 fixture で固定するテストが多いため、新しい GitHub call を1つ追加しただけでも同一テスト群への mechanical conflict が起き得ます。とはいえ個人開発では、これを preflight blocker にするより 実装直前に main refresh、PR が開いていれば rebase/直列化で十分です。推奨する実装設計
#2606 はかなり単純化できます。
--pr-numberも linked PR 一括収集も追加しないことを推奨します。GitHub の comment-ID endpoint は
comment_idを必須の unique identifier として定義しているため、このモデルと自然に一致します。(GitHub Docs) 起点の #2597 comment #5612029072 も実際にこの Issues API の comment resource として取得できています。これなら、「PRを探す」という新しい discovery subsystem を足さず、明示された1コメントだけを補完取得する設計になります。セキュリティ目的の余分な ledger/schema/harness は不要です。
#2606 の contract を直すなら
Allowed Paths は次の3つだけで十分です。
種別 | 正しい path -- | -- production | .claude/skills/impl-review-loop/scripts/build_intake_capsule.py E2E | .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py unit | .claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyAcceptance Criteria は Issue comment success / linked PR conversation human success / linked PR agent-report success / unlinked PR failure / nonexistent ID failure / html_url or repo mismatch failure / inline review URL out-of-scope の7ケース程度で十分です。
また
rg "def _collect_issue_comments"は品質証拠としてほぼ価値がありません。behavioral pytest と Ruff に置換した方が有用です。結論
Issue #2606 は close ではなく rewrite → implementation が推奨です。 解消したい friction は実在しますが、「PR number を別入力にする」「linked PR の comments を丸ごと収集する」という現在の設計方向は必要以上に大きく、しかも GitHub CLI field 名と test path が間違っています。
最も小さく堅牢なのは、明示された
## 判定#issuecomment-IDを direct REST lookupし、PRだった場合だけ target Issue との linkage を検証する設計です。これなら既存 provenance semantics を変えず、今回の運用摩擦だけを低コストで除去できます。REQUEST_CHANGES。Issue #2606 の問題意識は正しいですが、現状の Issue contract のまま implementation に入るのは非推奨です。
実障害は再現性があります。現在の
build_intake_capsule.pyは target Issue の/issues/{issue_number}/commentsだけを全ページ取得し、#issuecomment-{id}をその集合から引くため、PR #2597 上の human context comment のような入力を解決できません。 実際、起点となった #2597 の comment #5612029072 はhtml_urlが/pull/2597#issuecomment-...であるトップレベル PR conversation comment です。ただし、#2606 の解決案には implementation blocker が複数あります。#2606 自体には現時点でコメントはありません。
[P0 / blocker]
gh issue view --json closingIssuesReferencesは成立しません。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 は PR 自動検出案としてgh issue viewのclosingIssuesReferencesを挙げています。 しかし現在の GitHub CLI では、Issue 側のフィールド名はclosedByPullRequestsReferences、closingIssuesReferencesは PR 側のgh pr viewに存在します。([GitHub CLI]1) これは単なる命名ミスではなく、選択肢の一方をそのまま実装すると production command が失敗します。しかも現在のテストは_run_commandを fixture で置換するため、fixture を誤仕様に合わせれば false-green にできます。したがって Runtime Verification をnot_applicableとする判断とも矛盾します。[P0 / blocker] Verification Commands と Allowed Paths のテストパスが current main と不一致です。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 は
.claude/skills/impl-review-loop/scripts/tests/test_intake_capsule_provenance_e2e.pyとscripts/tests/test_build_intake_capsule.pyを指定しています。 実ファイルはそれぞれ.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.pyと.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyです。 現在の厳密な Allowed Paths 運用では、正しい回帰テストを変更すると scope violation、契約通り実行すると file-not-found になります。これは実装前に直すべきです。[P1]
--pr-numberを追加する案は捨てた方がよいです。 currentimpl-review-loopの正式 input はissue_numberと human/agent comment URL 群で、PR number はありません。 さらに preparation はbuild_capsule_argv()を canonical argv の single source of truth と明記しており、human/agent URL を additive flag として渡します。build_intake_capsule.pyにだけ--pr-numberを追加すると、通常の orchestrator はその値を供給できません。SKILL/preparation まで変更すれば使えますが、今度は 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 の Allowed Paths 外です。しかも URL 自体が/pull/2597#issuecomment-...と PR number を保持しています。入力を二重化する価値がありません。[P1] PR の全コメントを収集する設計自体が過剰です。comment ID の direct lookup が最小解です。 GitHub REST API は
GET /repos/{owner}/{repo}/issues/comments/{comment_id}で、Issue と PR のトップレベルコメントを comment ID 単体で取得できます。GitHub は PR も Issues API 上では issue として扱うと明記しています。([GitHub Docs]2) つまり明示的に#issuecomment-5612029072を渡されているのに、「linked PR を列挙 → PR ごとの comments を全取得 → ID検索」とする必要がありません。個人開発で workflow friction を減らすという前提でも、direct lookup の方が API 呼び出し、pagination、multiple-PR ambiguity、fixture 複雑化をすべて減らします。[P1] 「PR コメント」の種類を contract で限定すべきです。 今回必要なのは fix: classify conditional close evidence publication #2597 のようなトップレベル conversation comment、つまり
#issuecomment-*です。GitHub の inline review comment は別 API・別オブジェクトで、unified diff 上のコメントとして明確に区別されています。([GitHub Docs]3) current resolver の regex も#issuecomment-(\d+)$専用です。 「PR コメント全般」と書くと review body、inline review comment、review thread まで対応対象と誤読できます。本 Issue は “PR conversation issue comments (#issuecomment-*) only” と固定するのが妥当です。[P1] direct lookup にしても「target Issue と無関係な PR」を受理してはいけません。 実装: multi-turn anchor の owner turn を chronology metadata として扱い、reaction decision flow を issue-refinement-loop と impl-review-loop へ導入する #1950 で導入された元契約は repo/Issue/comment mismatch を fail-closed としています。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 の goal も「紐づく実装 PR」です。したがって、同一 repository の任意 PR comment を comment ID が存在するだけで通すのは scope 拡大です。PR URLなら URL から PR number を取得し、その PR の
closingIssuesReferencesに target Issue があることを確認する、という1回の read-only relation check で十分です。ここは provenance のための重い security harness ではなく、別 Issue のコメントを誤投入しないための correctness binding と考えるべきです。[P1]
Runtime Verification Applicability: not_applicableはimmediate/read-onlyに変更すべきです。 実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 自身が GitHub API/CLI の取得範囲を変更する Issue なのに、「外部 API を伴わないため not applicable」としています。 今回見つかったclosingIssuesReferencesの取り違えこそ mock-only test では検出しづらい failure です。ただし CI に live GitHub test を恒久追加する必要まではありません。実装 PR で既知の fix: classify conditional close evidence publication #2597/#5612029072 を使った read-only canary を1回実行して evidence として残す程度で十分です。[P2]
agent-report-comment-urlの PR 側回帰が Acceptance Criteria から抜けています。 Outcome は human と agent の両方を PR comments から解決すると読めますが、明示的 AC は human 側に偏っています。 origin は URL の所在ではなく、呼び出し元が human/agent のどちらの flag に渡したかだけで決める、という既存契約です。 したがって PR conversation comment の agent report も1ケースだけ固定すべきです。[P2] Scope Collision は hard stop にする必要はないものの、実装: issue-contract-review の human_judgment に対する人間 override を CONTRACT_REVIEW_HUMAN_OVERRIDE_V1 スキーマで記録・検出できるようにする #1348 は「変更箇所が違うから低リスク」と言い切れません。 実装: issue-contract-review の human_judgment に対する人間 override を CONTRACT_REVIEW_HUMAN_OVERRIDE_V1 スキーマで記録・検出できるようにする #1348 も
build_intake_capsule.pyの comment/snapshot consumer を直接変更する OPEN Issue です。 実装: #1939 Workstream 4 — retrospective candidate を issue-refinement-loop → impl-review-loop へ controlled handoffする #2602 はより handoff/interface 寄りで、こちらは直接衝突リスクが低そうです。 特にtest_build_intake_capsule.pyは_run_commandの呼び出し順を配列 fixture で固定するテストが多いため、新しい GitHub call を1つ追加しただけでも同一テスト群への mechanical conflict が起き得ます。とはいえ個人開発では、これを preflight blocker にするより 実装直前に main refresh、PR が開いていれば rebase/直列化で十分です。推奨する実装設計
#2606 はかなり単純化できます。
--pr-numberも linked PR 一括収集も追加しないことを推奨します。GitHub の comment-ID endpoint は
comment_idを必須の unique identifier として定義しているため、このモデルと自然に一致します。([GitHub Docs]2) 起点の #2597 comment #5612029072 も実際にこの Issues API の comment resource として取得できています。これなら、「PRを探す」という新しい discovery subsystem を足さず、明示された1コメントだけを補完取得する設計になります。セキュリティ目的の余分な ledger/schema/harness は不要です。
#2606 の contract を直すなら
Allowed Paths は次の3つだけで十分です。
.claude/skills/impl-review-loop/scripts/build_intake_capsule.py.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyAcceptance Criteria は Issue comment success / linked PR conversation human success / linked PR agent-report success / unlinked PR failure / nonexistent ID failure / html_url or repo mismatch failure / inline review URL out-of-scope の7ケース程度で十分です。
また
rg "def _collect_issue_comments"は品質証拠としてほぼ価値がありません。behavioral pytest と Ruff に置換した方が有用です。結論
Issue #2606 は close ではなく rewrite → implementation が推奨です。 解消したい friction は実在しますが、「PR number を別入力にする」「linked PR の comments を丸ごと収集する」という現在の設計方向は必要以上に大きく、しかも GitHub CLI field 名と test path が間違っています。
最も小さく堅牢なのは、明示された
#issuecomment-IDを direct REST lookupし、PRだった場合だけ target Issue との linkage を検証する設計です。これなら既存 provenance semantics を変えず、今回の運用摩擦だけを低コストで除去できます。squne121 commentedon Sep 10, 2026
推奨は #2606 をそのまま implementation に送らず、comment #5612650028 を human-context anchor として
issue-refinement-loopで rewrite する です。レビューの P0 は確認できました。現在のbuild_intake_capsule.pyは target Issue のコメント一覧だけを収集して ID 解決しており、指摘された制約が実在します。 また、テスト2本の正しい配置もscripts/tests/ではなくimpl-review-loop/tests/です。技術方針もレビュー案を採用するのが妥当です。GitHub CLI の現行仕様では Issue 側は
closedByPullRequestsReferences、PR 側がclosingIssuesReferencesです。さらに REST API はcomment_id単独で Issue/PR conversation comment を取得できます。したがって--pr-numberや linked PR 全コメント収集を追加するより、comment-ID direct lookup + PR→target Issue linkage check が小さく、誤仕様も減ります。([GitHub CLI]1)今回の注意点は scope guard です。現行
issue-refinement-loopはループ継続自体の承認をデフォルト要求しませんが、Allowed Paths 等の新規 delta は別途human_judgment_requiredになり得ます。 一方、現在の契約には interactive human instruction を root control-plane が materialize し、operator-selected human-context として controlled contract update に流す経路があります。 そのため、下のプロンプトでは今回許可する delta を具体的に先行承認しています。ガードを無視するのではなく、正規の authority 経路を使わせる形です。そのまま既存の auto mode Claude Code に投入するなら、以下を推奨します。
リポジトリ
squne121/loop-protocolの Issue #2606 を対象に、.claude/skills/issue-refinement-loopを実行してください。対象:
実装: build_intake_capsule.py の human-context-comment-url 解決範囲を実装 PR コメントに拡張する #2606 (comment)
このセッションは既に Claude Code の auto mode で起動済みです。
Claude Code の permission mode を変更したり、
/permission等による追加承認を要求したりしないでください。repo の
issue-refinement-loopが定義する loop iteration approval は不要として、自律的に最後まで進めてください。今回のオペレータ指示
上記 comment #5612650028 を、私が明示的に選択した human context として扱ってください。
私は、このコメントの REQUEST_CHANGES を Issue #2606 に反映して refinement を進めること、および以下に列挙する exact scope delta を事前に承認します。
これは direct interactive human instruction です。
scope-signal guard が以下の既承認 delta のみを理由に停止しようとする場合は、ガードを迂回・無効化・改変するのではなく、リポジトリで定義されている Accepted Trust Model / operator-selected human-context / interactive prompt materialization の正規経路を使用してください。
必要なら root control-plane が
OWNER_DIRECTIVE_MATERIALIZED_FROM_INTERACTIVE_PROMPT_V1provenance marker を伴う形でこの指示を materialize し、canonical controlled contract-update route を通したうえで fresh preflight / review / allowed-path validation を再実行してください。この事前承認を、下記以外の新しい scope、破壊的操作、permission boundary の変更、secret 操作、外部有料サービス利用、Issue split の承認へ拡大解釈してはいけません。
承認済み refinement 方針
1. 解決方式
Issue #2606 の設計は次の方向へ修正してください。
--pr-numberは追加しない。#issuecomment-<ID>を canonical に parse する。repos/{repo}/issues/comments/{comment_id}を read-only で direct lookup する。
html_urlと入力 URL を exact binding する。/issues/N#issuecomment-IDの場合は N が target Issue と一致することを要求する。/pull/N#issuecomment-IDの場合は、その PR が target Issue を closing issue として参照していることを read-only で検証する。#issuecomment-*) に限定する。既存 fail-closed semantics は維持してください。
2. Allowed Paths
誤った
scripts/tests/...path を修正し、Allowed Paths は原則以下の3ファイルだけにしてください。.claude/skills/impl-review-loop/scripts/build_intake_capsule.py.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyこれは今回明示的に承認した exact Allowed Paths delta です。
この訂正だけを
new_allowed_path_layer等として再度人間判断に戻さないでください。正規の trusted contract-update route で処理してください。新たな production file、schema、ledger、publisher、permission harness 等が必要になった場合は、この承認には含まれません。
3. Acceptance Criteria
少なくとも以下が機械的に検証可能になるよう Issue contract を修正してください。
html_url/ URL binding mismatch は fail-closed になる。既存 semantics と重複する AC は、不必要に細分化せず読みやすくまとめても構いません。
4. Runtime Verification Applicability
not_applicableのままにせず、immediate/read-only相当へ修正してください。mock/fixture の pytest だけでは GitHub CLI / API field 名の誤認を false-green にできるため、実装時の evidence として既知の実例を使った read-only canary を要求してください。
既知の例:
ただし、このためだけに恒久的な live GitHub CI、複雑な harness、新しい service integration を追加する必要はありません。
1回の read-only runtime evidence で十分です。
5. Verification Commands
存在する正しい test path を使用してください。
少なくとも:
.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py.claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyの behavioral pytest を含めてください。
既存プロジェクトの標準に合う Ruff 等の静的検査も、Allowed Paths を拡張せず実行可能なら追加してください。
単に
rg -n "def _collect_issue_comments" ...で関数シグネチャの存在を確認するだけの verification は、主要な品質証拠としては採用しないでください。
6. Scope Collision
#1348 / #2602 および同一 production/test file を現在変更している Issue / PR がないか、実装前提を決めるため read-only で再確認してください。
collision の可能性だけを理由に即 human escalation しないでください。
個人開発リポジトリなので、実害がなければ note に留めてください。
ただし current main の実変更と真正面から競合し、Issue contract を一意に決められない場合は evidence を残してください。
SubAgent 実行要件
issue-refinement-loopの現行 Skill / planner / command registry / references を正本として実行してください。手作業で旧フローを再実装しないでください。調査では SubAgent を使用してください。
codebase-investigatorweb-researcher独立して実行できる調査は可能な範囲で並列化してください。
重要:
issue-editor等の canonical worker が必要な場合も、完了と authoritative readback を待ってから fresh validation へ進んでください。自律実行ポリシー
質問・確認を挟まず、issue-refinement-loop の許容範囲内で自律的に進めてください。
needs-fixは max iteration 到達前なら自動継続してください。deterministic repair / structural repair / controlled contract update / issue-editor handoff が canonical
NEXT_ACTIONとして返された場合は、その正規 consumer を使用して継続してください。今回明示した exact scope delta を理由にした
human_judgment_requiredは、そのまま人間へ返さず、上記の interactive human instruction materialization / operator-selected human-context の正規経路で解決できるかを先に処理してください。ただし、以下は今回の事前承認対象外です。
これらが実際に必要と確定した場合だけ fail-closed の termination を許可します。
単なる低 confidence、scope collision の可能性、追加レビューが必要というだけでは停止しないでください。
完了条件
この依頼のスコープは
issue-refinement-loopによる Issue #2606 の refinement までです。コード実装や
impl-review-loopの実行は開始しないでください。以下を満たすまで継続してください。
impl_ready相当の handoff 状態まで到達している最後に、以下を簡潔に報告してください。
人間への途中承認要求は不要です。完了または上記の genuinely non-authorized hard-stop 条件まで一気に実行してください。
この形なら、単に「承認不要」と書くより、今回の Allowed Paths 修正などを初期オペレータ指示として明示的に authority 化しているため、
scope_signal_guard → human_judgment_requiredの再発をかなり避けやすいです。同時に、未知の scope まで勝手に承認する指示にはしていません。squne121 commentedon Sep 10, 2026
issue-refinement-loop: approved
--pr-number追加案から comment-ID direct lookup(repos/{repo}/issues/comments/{comment_id}+ PR→target Issue closing-issue binding)へ変更.claude/skills/impl-review-loop/tests/...)へ修正not_applicableからimmediateへ変更(既知実例: Issue 実装: ci-verdict-summary が conditional close-evidence-publication check を excluded として分類する #2587 / PR fix: classify conditional close evidence publication #2597 comment #5612029072 を用いた read-only pytest canary).claude/skills/impl-review-loop/SKILL.mdを追加STATUS: pass/NEXT_ACTION: proceedVERDICT: approve/BLOCKERS: 0(body_sha256:6e3070b9af37b4ef2c4f9d4e384f6ea1522c26aa0544344b04b120473dfc5726)semantic_review_applicable: false(skip、明示 signal なし)run_contract_review_once.py --mode execute):status: go/vc_preflight: pass/declared_path_overlap: disjointNote: この loop 実行は operator の明示指示により
issue-refinement-loopの refinement 完了までをスコープとし、impl-review-loopの起動(run_root_transition()相当)は意図的に実行していません。routing_action: run_impl_review_loopは本 Issue が実装着手可能であることを示す telemetry であり、本セッションではこれを消費して自動起動していません。squne121 commentedon Sep 10, 2026
推奨アクションは、再 refinement せず、そのまま Issue #2606 を
impl-review-loopに投入するです。最新の refinement 結果はstatus: impl_ready/routing_action: run_impl_review_loop/ blockersなしで、fresh preflight と contract review も通過しています。また、この Issue では GitHub REST の
GET /repos/{owner}/{repo}/issues/comments/{comment_id}が Issue/PR双方の conversation comment を取得でき、gh pr view --json closingIssuesReferencesも現行CLIで利用可能なことを再確認できました。 ([GitHub Docs]1)実行上の重要点は Draft PR publication の事前承認を明示することです。現行
open-prはpublish: yesがなければE_APPROVAL_MISSINGで止まるため、今回のあなたの指示を「#2606 の bounded な branch publish / Draft PR 起票への明示的 operator approval」として渡します。ただし merge は承認対象外として止めます。そのまま既に auto mode で起動している Claude Code に投入するなら、以下を推奨します。
リポジトリ
squne121/loop-protocolの Issue #2606 を対象に、.claude/skills/impl-review-loopを実行してください。対象 Issue:
#2606
最新の refinement 完了報告:
#2606 (comment)
Issue #2606 は既に
issue-refinement-loopで refinement 済みで、最新 handoff はstatus: impl_ready/routing_action: run_impl_review_loop/ blockersなしです。再度 issue-refinement-loop を最初から行うのではなく、live Issue と current repository state を正本として
impl-review-loopの Root-Owned Synchronous Entry Transition から開始してください。このセッションは既に Claude Code の auto mode で起動済みです。
permission mode を変更したり、
/permissionを要求したり、通常の実装・テスト・branch publish・Draft PR作成・レビュー修正について途中で人間承認を求めたりしないでください。Operator authorization
このメッセージを、Issue #2606 を
impl-review-loopで実装し、レビュー・検証を反復してマージ直前の状態まで進めるための明示的な operator instruction として扱ってください。以下を事前に承認します。
open-prによる Draft PR 作成open-prのpublishgate には、この指示を明示的 human/operator approval として使用し、publish: yesを渡すことimpl-review-loopの正規フローで必要となる更新この承認は merge そのものを含みません。
gh pr merge、auto-merge 有効化その他 PR を実際に merge する操作は行わないでください。最終目標は、
impl-review-loopの canonical terminal condition であるIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready/termination_reason: approvedに到達し、current head に対する検証・PR review・live mergeability を満たした状態で、PR を人間の最終 merge 判断だけが残る状態にすることです。Root control-plane
.claude/skills/impl-review-loop/SKILL.mdとそのsteps/、参照する canonical scripts / schemas を正本として実行してください。旧フローや独自の簡略版を手作業で再実装しないでください。
root/main thread が control-plane として以下を保持してください。
過去の
LOOP_HANDOFF_RESULT_V1は implementation readiness の参考 evidence ですが、それ自体を authorization token として扱わず、現行 skill が要求する live fetch / current-run contract review / routing を実行してください。実装方針
Issue #2606 の現在の本文を authoritative contract としてください。
特に設計を元の旧案へ戻さないでください。
--pr-numberを追加しないcomments_by_idmap に comment ID が存在する場合は既存経路を維持するrepos/{repo}/issues/comments/{comment_id}相当の read-only comment-ID direct lookup を行うhtml_urlと入力URLを exact binding する/issues/N#issuecomment-IDは N == target Issue を要求する/pull/N#issuecomment-IDはその PR が target Issue をclosingIssuesReferencesで closing issue として参照していることを確認する--human-context-comment-url/--agent-report-comment-urlの lane から決定する変更は原則として Issue に記載された以下の Allowed Paths だけに限定してください。
.claude/skills/impl-review-loop/scripts/build_intake_capsule.py.claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py.claude/skills/impl-review-loop/tests/test_build_intake_capsule.py新しい schema、ledger、permission harness、CLI input、production subsystem を安易に追加しないでください。
Pre-implementation check
実装開始前に current
mainを fresh に確認してください。Issue #2606 の Notes に記録されている #1348 / #2602、および現在同じ production/test files を変更している open PR / branch があるかを read-only で確認してください。
単なる潜在 collision や advisory overlap だけで人間へ戻さないでください。
current main に既に同じ挙動が実装済みなら、無意味な差分を作らず actual repository state を根拠に判断してください。
真正面からの actual conflict や、現行 contract の Allowed Paths では要求を実装不能であることが確定した場合だけ、canonical hard-stop routing に従ってください。
SubAgent requirements
必ず SubAgent を使用してください。
impl-review-loopが定義する役割分離を維持し、implementation-workertest-runnerpr-reviewerへ委譲してください。
Issue #2606 は GitHub API / CLI の実際の field / response shape が重要なので、外部仕様の fresh 確認が必要なら root/main から
web-researcherを使用してください。repository implementation の追加調査が必要なら root/main から
codebase-investigatorを使用して構いません。独立した調査は可能なら並列化して構いません。
ただし最重要条件として、
起動した SubAgent の作業完了を必ず待ってください。
SubAgent を launch しただけで次工程へ進んではいけません。
ことを徹底してください。
SubAgent の完了前に root judgment、PR review、termination 判定を先行させないでください。
root-owned decision authority を SubAgent に委譲しないでください。
SubAgent に nested SubAgent delegation をさせないでください。
Verification
Issue #2606 の AC1-AC9 を current head に対して機械的に検証してください。
少なくとも Issue contract の以下を実行してください。
uv run pytest .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.pyuv run pytest .claude/skills/impl-review-loop/tests/test_build_intake_capsule.pyrepository 標準の Ruff 等を Allowed Paths の変更なしで実行可能なら、関連変更範囲について実行してください。
fixture/mock の false-green を避けるため AC9 の runtime canary を必ず扱ってください。
既知実例:
fix: classify conditional close evidence publication #2597 (comment)
ghが利用可能・認証済み・GitHub API reachable な現在環境では、実際の read-only runtime canary を実行して結果を確認してください。SKIP の場合は PASS と偽装せず SKIP として記録してください。
PR 本文の
Runtime Verification Evidenceには Issue contract が要求する実行証跡を残してください。Review loop
implementation → verification → PR review → judgment を canonical
impl-review-loopに従って反復してください。pr-reviewerがREQUEST_CHANGESを返した場合:fix_deltaにするという順序を守ってください。
reviewed_head_shaが stale なら人間へ戻さず current head を再レビューしてください。BEHIND等について canonical mechanical update route が存在するならそれを使用し、更新後の verification / review を完了させてください。Step 1-4 の SubAgent が単なる boolean field として
human_review_required: trueを返しても、それ自体を途中承認要求として扱わないでください。現行
impl-review-loopの #1860/#1869 policy に従い、停止権限のない advisory は warning として記録し、自動継続してください。一方、canonical
route_loop_verdict_v2()が genuineroute_human_escalation/ actual Git conflict / secret gate 等の authoritative hard stop を返した場合は、ガードを無効化したり権限を捏造したりせず、その terminal result と evidence を報告してください。PR publication
Issue の Delivery Rule に従い
1 Issue = 1 PRとしてください。既存PRがある場合は重複作成せず canonical idempotency route で再利用してください。
新規作成時は
open-prskill を使用してください。このメッセージを Issue #2606 の Draft PR publication に対する明示的 human/operator approval として扱い、
publish: yesを指定してください。
E_APPROVAL_MISSINGを理由に再度人間へ publish 承認を求めないでください。PR 本文には最低限、
Closes #2606を repository の canonical PR body generator / validator に従って含めてください。
Autonomy / no-interruption policy
通常の実装判断、テスト修正、reviewer blockerへの修正、branch publish、Draft PR作成、PR本文修正、再レビューについて質問・確認を挟まないでください。
現在の auto mode のまま進め、permission mode を変更しないでください。
追加の
/permissionや対話的 approval を要求しないでください。単なる advisory artifact の欠落、scope-rollup、snapshot telemetry、body SHA、launch ledger、semantic planning warning、overlap warning 等を理由に停止しないでください。
live repository facts、Allowed Paths、実テスト、CI、PR review、live mergeability を優先してください。
Hard boundaries
今回の事前承認を以下には拡大解釈しないでください。
これらが本当に不可避になった場合は canonical hard-stop result と具体的 evidence を出してください。
Completion condition
以下をすべて満たすまで終了しないでください。
APPROVEIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readytermination_reason: approvedここまで到達したら停止し、merge は実行しないでください。
最終報告では、最低限以下を簡潔に提示してください。
IMPL_REVIEW_LOOP_RESULT_V1途中経過の承認を人間に要求せず、完了または genuine authoritative hard stop まで現在のターンで自律実行してください。
この版では特に、
open-prのpublish: yesを今回の指示で先行承認しているので、Draft PR 起票時の不要な approval stop を避けやすくしています。ループの終端draft_pr_readyは「GitHubのDraftフラグ」そのものではなく、人間の最終merge判断を残す終端状態です。fix: PR#2614レビュー指摘3件を解消する(#2606)
feat: build_intake_capsule.pyのhuman-context-comment-url解決範囲をPRコメントに拡張…