Repository navigation
Description
Source
follow-up:squne121/loop-protocol:issue/2416:upstream-25816-stale-comment
Parent Issue
なし(単独改善)
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "scripts/agent-ops/verify_pr_reviewer_permission_boundary.py の stale なコメントを正確な状態に更新する"
change_kind: docsParent Goal Ref
- Goal: なし(単独改善)
- Desired Destination: N/A(parent なし)
Current Validated Scope
scripts/agent-ops/verify_pr_reviewer_permission_boundary.py内に、upstreamanthropics/claude-code#25816が現在も OPEN、または worktree 上の project-agent discovery が現在も confirmed broken であるかのように読める current-state claim が複数箇所残っている(2026-09-03 issue-refinement-loop の codebase-investigator 調査で確認済み、いずれも同一ファイル内):- module docstring 内("Agent discovery route" セクション):
confirmed OPEN upstream Claude Code bug when cwd is a git worktree linked via a .git file pointing at commondir UPSTREAM_WORKTREE_AGENT_DISCOVERY_BUG_REF定数付近のコメント:confirmed OPEN upstream Claude Code bug -- custom agents under .claude/agents/ are not discovered when cwd is a git worktreebuild_agents_json_passthrough_argv呼び出し箇所のインラインコメント:which is confirmed broken from a git-worktree cwd upstream
- module docstring 内("Agent discovery route" セクション):
- 2026-09-03 issue-refinement-loop の web-researcher による fact-check(一次資料: GitHub Issue ページおよび公式 release notes)で、upstream
anthropics/claude-code#25816("Custom agents in.claude/agents/not discovered when running from git worktree")は CLOSED であり、Claude Code v2.1.47(2026-02-18 リリース)の release notes に "Fixed custom agents and skills not being discovered when running from a git worktree ... (#25816)" として修正が明記されていることを確認した。
Remaining Parent Gaps
なし
Outcome
scripts/agent-ops/verify_pr_reviewer_permission_boundary.py 内の、upstream anthropics/claude-code#25816 および worktree project-agent discovery に関する current-state claim(Current Validated Scope に列挙した箇所すべて)が、upstream #25816 が CLOSED / Claude Code v2.1.47 で修正済みであることを正確に反映した内容に更新され、コミットされている。あわせて、--agents JSON passthrough を現在も使用している理由が、historical introduction 理由(upstream bug の workaround として導入された経緯)と現在の retention 理由(candidate-head の agent definition を session-local に fresh binding し、effective definition の曖昧性を避けるという現行の目的)を区別して記述された状態になっている。
Runtime Verification Applicability
decision: immediate
reason: 対象 Allowed Path scripts/agent-ops/verify_pr_reviewer_permission_boundary.py は docs/dev/extension-surface-runtime-policy.yaml の rule subagent-lifecycle-start-stop-delegation-fallback(selector path_globs に scripts/agent-ops/** を含み、issue_time_enforcement 未宣言のため既定で hard、default_decision: immediate)に一致するため、Issue 時点で decision: not_applicable を宣言することはできない(scripts/agent-guards/extension_surface_policy_matcher.py::evaluate_issue_risk_trigger は decision 値のみを rank 比較する mechanical gate であり、Issue 本文中の自由記述による exception 宣言を解釈しない)。AC1-AC3 の VC 自体は対象ファイルに対する静的テキスト照合(rg)であり、単体では not_applicable 相当(プロセス起動・通信・I/O 不要)に見える。しかし AC1-AC3 が確認する内容(upstream anthropics/claude-code#25816 が CLOSED であり Claude Code v2.1.47 で修正済みであるという外部事実の反映)は、記述内容自体が現実の状態と一致している必要がある技術文書であり、この一致は本 Issue のリファインメント作業中に issue-refinement-loop の web-researcher(一次資料: GitHub Issue ページ、公式 release notes)による fact-check で既に検証済みである(Current Validated Scope 参照)。したがって AC1-AC3 の VC はこの検証済み事実が本文に正確に反映されていることを確認する役割を持ち(#2416 の Runtime Verification Applicability と同型の位置づけ)、PR 時点で改めてプロセスを起動する新規 runtime smoke は不要と判断し、decision: immediate を維持しつつ SKIP/fallback 機構は本 Issue の性質上不要とする。AC4(py_compile)は既存の静的構文検証であり runtime-verification タグを付与しない。
applicable_acs: AC1, AC2, AC3
execution_environment: AC1-AC3 の VC は rg によるテキスト存在確認(Allowed Paths が対象ファイル単独であり、新規実行可能スクリプトを追加しないため)。AC1-AC3 が反映する外部事実(upstream #25816 の状態、Claude Code v2.1.47 の release notes 記載)自体の確認は、本 Issue のリファインメント時に web-researcher により実施済みであり、再確認が必要な場合は anthropics/claude-code#25816 および https://github.com/anthropics/claude-code/releases/tag/v2.1.47 を参照する(新規 harness/script 追加は行わない)。
skip_conditions: AC1-AC4 の VC はローカル環境で常に実行可能な静的テキスト照合/構文チェックであり、プロセス起動やネットワーク通信を伴わないため SKIP 対象なし。
fallback_policy: フォールバック経路は用意しない。静的テキスト照合である AC1-AC4 の VC に、動作検証固有の SKIP/fallback 機構を追加で持ち込まない。
artifact_requirements: AC1-AC4 の VC 実行結果(exit code)を実装 PR の証跡として残す。新規 artifact ディレクトリ・schema は追加しない。
In Scope
scripts/agent-ops/verify_pr_reviewer_permission_boundary.py内で、upstreamanthropics/claude-code#25816が現在も OPEN、または worktree 上の project-agent discovery が現在も confirmed broken であるかのように読める current-state claim を、Current Validated Scope に列挙した箇所すべて(1箇所に限定しない)を対象に書き換える- 「confirmed OPEN upstream Claude Code bug」「confirmed broken from a git-worktree cwd upstream」という表現、および同義の stale wording を削除し、upstream
anthropics/claude-code#25816が CLOSED であり Claude Codev2.1.47で修正済みであることを反映する内容に置き換える --agentsJSON passthrough を現在も使い続けている理由を、「#25816 が今も壊れているための workaround」という表現ではなく、candidate-head の.claude/agents/pr-reviewer.mdagent definition を毎回 fresh に session-local binding し、実行される effective agent definition の曖昧性を避けるという現行の目的として説明し直す。upstream bug が workaround 導入の historical context であったことと、現在の retention 理由は明確に区別して記述する- project
.claude/agents/discovery(file-based,--agent <name>)と--agentssession-local JSON binding は、現状どおり明確に区別された別経路として記述し続ける(両者を同値な経路であるかのように新たに書き換えない)
Out of Scope
run_worktree_agent_runtime_smoke.pyや本スクリプトの実行ロジック・agent discovery route の変更(Issue 実装: minimal harness の permission/runtime safety boundary を復旧する #1881 Stop Conditions により禁止)- v2.1.47 修正を踏まえてエージェント discovery route 自体を workaround から標準経路へ戻す設計変更(別 Issue で検討する)
- 他のコメントブロック(Workspace-trust prerequisite セクション等)の内容変更
Acceptance Criteria
- AC1:
scripts/agent-ops/verify_pr_reviewer_permission_boundary.py内に "confirmed OPEN upstream Claude Code bug" という文言が存在しない - AC2: 同ファイル内に "confirmed broken from a git-worktree cwd upstream" という文言が存在しない
- AC3: 同ファイル内に、upstream
anthropics/claude-code#25816が CLOSED であり Claude Codev2.1.47で修正済みであることを示す記述が存在する - AC4: 既存の Python 構文が壊れていない(コメント修正のみでロジック変更がない)
Verification Commands
- AC1:
confirmed OPEN upstream Claude Code bugという文言が存在しないことを確認する(rg -q(quiet mode)を否定形!で使うことで no-match(AC 達成)時に exit 0 となる static assertion。件数取得ではなく存在確認のためrg -cは使わない) - AC2:
confirmed broken from a git-worktree cwd upstreamという文言が存在しないことを確認する(AC1 と同じ理由で! rg -q形式を用いる) - AC3:
v2.1.47を含む記述が存在することを確認(出力が 1 件以上であること) - AC4: Python 構文エラーがないことを確認(VC preflight allowlist の
python3 -m py_compile特例に合わせuv run接頭辞なしで実行する)
# AC1
$ ! rg -q "confirmed OPEN upstream Claude Code bug" scripts/agent-ops/verify_pr_reviewer_permission_boundary.py
# AC2
$ ! rg -q "confirmed broken from a git-worktree cwd upstream" scripts/agent-ops/verify_pr_reviewer_permission_boundary.py
# AC3
$ rg -c "v2.1.47" scripts/agent-ops/verify_pr_reviewer_permission_boundary.py
# AC4
# baseline-expect: pass
$ python3 -m py_compile scripts/agent-ops/verify_pr_reviewer_permission_boundary.pyAllowed Paths
- scripts/agent-ops/verify_pr_reviewer_permission_boundary.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 実装が文言変更に留まらず
delegation_trigger_condition/fallback_path_logic/start_stop_signal_handlingのいずれかの実行可能セマンティクスを変更する必要があると判明した場合
Required Skills
なし
Required Design References
- docs/dev/extension-surface-runtime-policy.yaml
- docs/dev/runtime-verification-policy.md
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PRを原則とする- Draft PR を既定とする
- worktree での作業を推奨する
Background / Notes for Reviewer
本 Issue は Issue #2416「実装: SubAgent 定義変更時の candidate-head bootstrap review を worktree-agent-runtime-smoke で自動回復する」の Notes for Reviewer セクションで明示的に non-blocking follow-up として記録されていたものであり、当時は #2416 の Out of Scope として意図的に修正しなかった。
その後、PR #2429(#2416 の実装 PR)の post-merge-cleanup で改めて this follow-up が浮上した。#2416 のリファインメント中に gemini-cli-headless-delegation の web-researcher による fact-check を通じて、scripts/agent-ops/verify_pr_reviewer_permission_boundary.py(module docstring 付近)のコメントが参照する upstream anthropics/claude-code#25816 は、コメント中の記述("confirmed OPEN upstream Claude Code bug")とは異なり、実際には既に CLOSED であり Claude Code v2.1.47 で修正済みであることが独立に確認された。
2026-09-03 OWNER anchor comment(issuecomment-5517674717)による refinement: OWNER から、上記の修正を「特定の一文だけを消す」契約に限定せず、同一ファイル内に残る同義の stale wording 全体(module docstring・定数コメント・インラインコメントの計3箇所)を対象にすること、--agents JSON passthrough の retention 理由を historical introduction 理由(#25816 workaround)と current retention 理由(session-local fresh binding による曖昧性回避)とを区別して記述すること、rg -c ベースの Verification Command が no-match(AC 達成)時に non-zero exit を返し得る false-failure を除去すること、という指摘を受けた。本 refinement で以下を実施した:
- issue-refinement-loop の
codebase-investigator(local-asset advisory route)により、対象ファイル全体を調査し、stale current-state claim が3箇所(module docstring、UPSTREAM_WORKTREE_AGENT_DISCOVERY_BUG_REF定数コメント、build_agents_json_passthrough_argv呼び出し箇所のインラインコメント)に存在することを確認した(Current Validated Scope に反映)。同調査で、--agentsretention 理由の historical/current 混同、および.claude/agents/discovery と--agentssession-local binding の同値視は、現状の記述には見当たらないことも確認した(In Scope の該当項目は「現状の区別を維持する」という non-regression 要件として記述)。 - issue-refinement-loop の
web-researcherにより、upstreamanthropics/claude-code#25816が CLOSED であり、Claude Code v2.1.47 のリリースノートに修正が明記されていることを一次資料(GitHub Issue ページ、公式リリースノート)で fact-check した(Current Validated Scope に反映)。 - Verification Commands の AC1 を、
rg -cの count-mode false-failure(no-match 時 exit 1 が「検証失敗」と誤解釈されるリスク)を避けるため、! rg -q "..."という本リポジトリの既存 convention(baseline_vc_preflight.pyの_is_negated_search_command()が静的にexpected_fail/baseline_fail_expected/goに分類する否定形コマンド)に置き換えた。新規 harness・新規 checker は追加していない。 - pre-edit static readiness check(
contract_readiness_check.py --mode preflight-static)により、本 refinement 対象の指摘とは独立に、既存本文が RDR001(Required Design References 未記載)と EXTSURF001(Allowed Paths がdocs/dev/extension-surface-runtime-policy.yamlの rulesubagent-lifecycle-start-stop-delegation-fallbackに一致するが decision: not_applicable のままだった)の2件の readiness エラーを抱えていたことを検出した。前者は Required Design References に本ポリシー2文書を追加して解消した。後者は、当該 deterministic gate(scripts/agent-guards/extension_surface_policy_matcher.py::evaluate_issue_risk_trigger)が decision 値のみを機械的に rank 比較し、Issue 本文の自由記述による exception 宣言を一切解釈しないことを確認したうえで、decision をimmediateへ変更した。あわせて Issue 実装: SubAgent 定義変更時の candidate-head bootstrap review を worktree-agent-runtime-smoke で自動回復する #2416 の Runtime Verification Applicability(同種のscripts/agent-ops/**配下ドキュメント修正で確立済みの precedent)に倣い、AC1-AC3(stale wording 削除・v2.1.47 記述追加の rg 静的照合)を<!-- runtime-verification: true -->タグ付き AC とし、その正当性を「本 refinement 中にweb-researcherが既に実施した外部事実の fact-check 結果が本文に正確に反映されていることを確認する」という位置づけで Runtime Verification Applicability の各フィールドに明記した。これにより C11(decision/タグ整合)も解消しつつ、PR 時点で新たな live runtime smoke・security gate・schema・checker・persistent artifact は一切追加していない。
Scope Overlap Note(起票時 preflight)
check_issue_overlap.py の preflight(policy_class C1, decision overlap_requires_comment)で、Allowed Paths に scripts 配下を広く含む既存 OPEN Issue(#420, #205)との文字列レベルの overlap が検出された。
- non_conflict_reason: 実装: playtest-log の JSON Schema / validator の追加 #420 と 実装: .claude/skills 配下スクリプトの executable bit を監査し CI guard を追加する #205 はいずれも
scriptsディレクトリ全体を Allowed Paths に含む別目的の Issue(実装: playtest-log の JSON Schema / validator の追加 #420: playtest-log JSON Schema/validator 追加、実装: .claude/skills 配下スクリプトの executable bit を監査し CI guard を追加する #205: executable bit 監査 CI guard 追加)であり、本 Issue の対象ファイルscripts/agent-ops/verify_pr_reviewer_permission_boundary.pyを具体的に扱っているわけではない。実際のファイルレベルでの変更衝突は想定されない。 - edit_intent: 本 Issue はコメント文言のみを 1 コミットで修正する小規模改善であり、実装: playtest-log の JSON Schema / validator の追加 #420 / 実装: .claude/skills 配下スクリプトの executable bit を監査し CI guard を追加する #205 の実装方針とは独立している。
- dependency ordering: なし(依存関係なし。並行に進めて問題ない)。
Activity
squne121 commentedon Sep 2, 2026
判定
REQUEST_CHANGES です。方向性は正しいですが、現状の Issue #2430 は「stale comment を直したことにできる」一方で、同じファイルに残る別の stale な current-state claim を取り逃がせる契約になっています。さらに AC1 の Verification Command は、正しい状態になると
rgが exit 1 を返すため、自動ループを無駄に止める可能性があります。Issue #2430 自体には現時点でコメントはありません。 一方、由来である Issue #2416 と PR #2429 のレビューでは、#25816 の記述が stale であることは既に non-blocking follow-up として整理されています。
したがって 「別の大きな設計問題を発見した」というより、follow-up Issue の切り出し方が少し甘いという評価です。
敵対的レビュー
P1 — AC が stale surface 全体を捕捉していません。
Issue は主に「11〜38行目付近」の
"confirmed OPEN upstream Claude Code bug"を対象にしています。しかし current main の同じファイルには、それ以外にも現在形の記述が残っています。
confirmed upstream bug workaround/hits a confirmed OPEN upstream Claude Code bugconfirmed OPEN upstream Claude Code bugIssue #25816 workaroundIssue #25816 workaroundwhich is confirmed broken from a git-worktree cwd upstreamが残っています。最後の文言は、現在の AC1
"confirmed OPEN upstream Claude Code bug"検索では捕まりません。つまり AC1〜AC3 を全部 PASS させながら、現在も upstream が broken だと断言するコメントを残せます。upstream #25816 は実際に Closed です。([GitHub]1) また upstream issue のコメントにも v2.1.47 の修正として worktree 内の project-level agents/skills discovery 修正が記録されています。
修正案: Allowed Path は増やさず、同じ Python ファイル内の #25816 を current failure として扱うコメントすべてを In Scope にしてください。
P1 — AC1 の Verification Command が自動ループと相性最悪です。
現状:
rg -c "confirmed OPEN upstream Claude Code bug" scripts/agent-ops/verify_pr_reviewer_permission_boundary.pyAC1 は「0件なら成功」ですが、ripgrep は no match のとき exit 1、match ありで 0、検索エラーで 2 を返します。これは ripgrep 側の意図された仕様です。([GitHub]2)
したがって、
impl-review-loopや一般的な command runner が non-zero を FAIL と解釈すれば、ACを満たした瞬間に Verification Command が失敗します。 今回のような trivial docs fix で harness に止められる典型パターンです。ここは新しい checker を作らず、Python の単純 assert にするのがよいです。
これなら「0件」を特殊扱いするためだけの harness は不要です。
P1 —
--agentsを残す理由が自由記述すぎます。Issue は「historical context・後方互換・再発防止等、実際の判断根拠」としています。
ここは実装者に考えさせる必要がありません。current repository には既にもっと強い具体的理由があります。
PR docs: step-4-pr-review に discovery-failure recovery routing を追記 #2429 後の canonical
impl-review-loopは Tier 2 を、と定義しています。
Claude Code の現行公式仕様でも
--agentsは session scope・priority 2、project.claude/agents/は priority 3、user は 4、plugin は 5 です。project agent discovery 自体は cwd から repository root まで行われ、worktree を含む現在の通常経路が前提になっています。([Claude]3)したがってコメントは、
ではなく、
とするのが最も正確です。
「後方互換だから」「再発防止だから」のような未検証理由を invent する必要はありません。
P2 — project discovery と
--agentsを完全に同等とは書かない方がよいです。現行 Claude Code では
.claude/agents/は live watch され、編集は数秒以内に次の delegation へ反映されます。([Claude]3)一方、project-level agent の frontmatter hooks は workspace trust が必要ですが、
--agentsで渡した definition の hooks はその trust step なしで動作します。([Claude]3)つまりこの probe は ordinary project discovery の完全な同値試験ではなく、明示的に candidate definition を bind した permission-boundary probe です。
Issue 実装: verify_pr_reviewer_permission_boundary.py の stale な upstream #25816 コメントを修正する #2430 でロジックを変える必要はありません。ただしコメントで「通常 discovery と同じものを単に別経路で実行している」とまで一般化しない方が正確です。
P2 — Runtime Verification
not_applicableはそのままでよいです。ここはむしろ Issue の良い点です。コメント訂正のために Claude Code を live 起動したり、新規 runtime smoke、security test、schema、guard を足す価値はありません。
static assertion + py_compileだけで十分です。個人開発で実用性優先なら、この Issue を理由に #25816 の再現試験や discovery-route 移行まで始めない方がよいです。通常の project discovery へ戻すべきかは、必要性が実際に生じてから別スコープで判断すれば足ります。推奨する Issue #2430 の着地
Issue を捨てる必要はありません。スコープを広げるのではなく、同一 Allowed Path 内の stale comment surface を正確に閉じるだけで十分です。
契約の核心を次のように直すことを推奨します。
Acceptance Criteria も、特定の一文を消す AC から 誤った意味が残っていない AC に変えるべきです。
優先順位
(1)
confirmed brokenを含む同ファイル内の全 stale claim を対象化 → (2)rg -cの false-failure を除去 → (3)--agents維持理由を candidate-definition binding に固定、の3点で十分です。これ以上の runtime harness、security gate、新規テストファイルは #2430 では不要です。修正後なら、非常に小さい docs-only PR としてそのまま
impl-review-loopに流せる品質になります。squne121 commentedon Sep 3, 2026
推奨アクションは Issue #2430 を指定コメントを OWNER anchor /
operator_asserted_human_contextとしてissue-refinement-loopに再投入し、Issue 本文を in-place で refinement することです。Issue の目的・Allowed Path・docs-only 性質は維持できるため、別 Issue 化や実装開始は不要です。指定コメントが指摘する 3 点――同一ファイル内の stale current-state claim の取りこぼし、rg -cの false-failure、--agents維持理由の曖昧さ――を契約へ取り込むのが最短です。現行
issue-refinement-loopは iteration ごとの承認を既定で要求せず、direct human context にはpreflight.run.with_human_contextとcontract_update.run.with_human_contextという canonical lane があります。したがって「各 iteration でユーザーに確認する」は不要です。human_judgment_required、max iteration 到達、environment failure など canonical hard stop のときだけ停止させるのが整合的です。サブエージェントについては、独立調査を dispatch した後に 完了 join barrier を置き、結果が揃う前に Issue mutation / review へ進ませない指示を入れるのがよいです。リポジトリ側にも「Agent tool が返って実出力を保持するまで completion と扱わない」という契約があります。 現行 Claude Code も background subagent の結果は completion notification 後に届き、その完了を待って結果を報告する仕様です。([Claude]1)
そのまま新規 Claude Code セッションへ渡すなら、以下を推奨します。
#2430 (comment)
上記コメントを Issue #2430 に対する trusted human context / OWNER anchor として扱い、
issue-refinement-loopを実行してください。目的は実装開始ではありません。
Issue #2430 の契約を指定レビューコメントに整合させ、canonical final gate を通して
implementation_readyにすることです。基本方針
最初に current default branch の以下を読み、repository authority を正本としてください。
.claude/skills/issue-refinement-loop/SKILL.mdreferences/.claude/skills/issue-refinement-loop/scripts/command_registry.py独自の refinement 手順や判定ロジックを再実装せず、
REFINEMENT_LOOP_PLAN_V1、command registry、canonical routing の結果に従ってください。issue_numberは2430。anchor_comment_urlは以下です。https://github.com/squne121/loop-protocol/issues/2430#issuecomment-5517674717この URL は operator-selected human-context lane として扱ってください。
unlabeled
with_anchorやwith_agent_reportへ落とさず、canonical なpreflight.run.with_human_context/ trusted contract-update lane を使用してください。人間承認について
この refinement loop の各 iteration について、私への承認確認は不要です。
loop_iteration_approval_gate.default_required: falseに従い、を canonical workflow が許す範囲で自動継続してください。
「次へ進めてよいですか」「Issue 本文を書き換えますか」「もう一度レビューしますか」等の conversational confirmation は求めないでください。
ただし repository authority が明示的に要求する genuine hard stop は迂回しないでください。特に
human_judgment_required、canonical max-iteration termination、解決不能な environment failure、destructive/non-idempotent boundary、permission/external-service boundary の変更、issue split が本当に必要になった場合は fail-closed で停止し、正確な blocker を報告してください。単なる
state/needs-human等の presentation label や、既知の deterministic repair を理由に人間確認へエスカレーションしないでください。指定コメントから解消すべきレビュー事項
指定コメントは raw instruction として直接 Issue body へコピーせず、canonical anchor handling / fact-check / normalization を通してください。
その上で、少なくとも以下の意味論が Issue #2430 の refined contract に反映される状態を目指してください。
scripts/agent-ops/verify_pr_reviewer_permission_boundary.py内で、anthropics/claude-code#25816が現在も OPEN、または worktree project-agent discovery が現在も confirmed broken であるかのように読む current-state claim 全体を対象にする。特定の一文
confirmed OPEN upstream Claude Code bugだけを消す契約に限定しないこと。
同一 Allowed Path 内に残る、同じ意味の stale wording も調査して contract に反映してください。
upstream
anthropics/claude-code#25816が CLOSED であり、Claude Codev2.1.47の修正に含まれた、という外部事実を fresh に fact-check すること。--agentsJSON passthrough を現在も使う理由を、「#25816 が今も壊れているための workaround」
としないこと。
current repository authority と current Claude Code semantics を確認した上で、candidate-head の agent definition を fresh に session-local binding して effective definition の曖昧性を避ける、という現行 probe の実際の目的に沿って契約化してください。
historical introduction reason と current retention reason を混同しないでください。
project
.claude/agents/discovery と--agentssession-local binding を完全に同値な経路とは表現しないこと。Verification Commands の
rg -c "confirmed OPEN upstream Claude Code bug" ...は no-match 時の exit status により AC を満たした状態で command runner を FAIL させ得るため、その false-failure を除去してください。
新規 harness を増やすのではなく、既存 repository convention と review anchor を踏まえた単純で deterministic な static assertion を優先してください。
Runtime Verification Applicability は原則
not_applicableのままとしてください。この docs/comment-only refinement のために Claude Code live runtime smoke、新しい security gate、新しい schema、新しい checker、新しい persistent artifact を追加する方向へ膨らませないでください。
Allowed Pathsは可能な限り現状のscripts/agent-ops/verify_pr_reviewer_permission_boundary.pyだけを維持してください。
この refinement の目的は scope expansion ではなく、同じ Allowed Path 内の stale comment surface を正確に閉じることです。
サブエージェントの使用
planner / canonical procedure が許可・要求する read-only SubAgent を実際に使用してください。
特に anchor comment は repository facts、PR history、upstream external facts を含むため、canonical investigation/fact-check が required なら
codebase-investigatorを省略しないでください。web research policy が required なら canonical
web-researcherを使用してください。semantic design review trigger が発火する場合は、その canonical reviewer SubAgent / transport を使用してください。
独立な read-only 調査は canonical policy の範囲で並列 dispatch して構いません。
重要: dispatch した SubAgent の作業完了を必ず待ってください。
background execution になった場合も、部分出力や「起動済み」を完了扱いしないでください。
completion notification / Agent result が実際に返り、必要な全 SubAgent の最終結果が揃うまで join してください。
SubAgent がまだ running の状態で、
へ進まないでください。
各 SubAgent の結果を受け取ってから main control-plane が canonical producer / planner に従って最終判断してください。
nested delegation は repository policy が禁止する場合は行わないでください。
また canonical Step 2 が root-owned review pipeline であり
issue-reviewerSubAgent を使用しない現行設計なら、古い手順を復活させないでください。refinement loop
指定 anchor を snapshot 固定して所属 Issue を検証し、canonical preflight を実行してください。
trusted human-context contract patch が生成された場合は、canonical main root / default branch から正規の contract-update phase を使用してください。
Issue body を更新したら fresh な状態から review を再実行してください。
needs-fixの場合は max iterations 内で自動的に次の rewrite/review iteration へ進んでください。人間承認は挟まないでください。deterministic safe repair が提示された場合は canonical disposition に従って適用してください。
review が approve になってもそこで終了せず、fresh な final contract review / readiness gate を実行し、
CONTRACT_REVIEW_RESULT_V1.status == "go"と freshness が成立するところまで進めてください。最終成功条件は単なる「Issue 本文を書き換えた」ではなく、
HANDOFF_STATE = implementation_ready相当の canonical state が確認されることです。
スコープ制約
このセッションでは Issue #2430 の refinement のみ行ってください。
verify_pr_reviewer_permission_boundary.pyの実装変更、commit、implementation PR 作成、impl-review-loopの開始は行わないでください。refinement 完了後に implementation が可能になっても、その事実と推奨 next action を報告するところまでとしてください。
指定レビューを理由に不要な follow-up Issue を作成しないでください。
同一 Outcome / Allowed Path 内で in-place に解消できる限り #2430 を更新してください。
終了時の報告
最後に簡潔に以下を報告してください。
impl-review-loopへ渡せること途中経過の承認要求はせず、canonical hard stop が発生しない限り refinement 完了まで自律的に進めてください。
一点だけ、このプロンプトで無効化できるのは workflow 上の「確認してから次 iteration」だけです。Claude Code 自体の Bash/Edit/GitHub 等の permission prompt はモデルへの指示では変更できません。Anthropic 公式も、permission は Claude Code 側で enforcement され、prompt では変更できないと明記しています。(Claude)
端末上の承認ダイアログまでゼロにしたい場合は、既存の allow rules /
auto、または隔離環境ならbypassPermissionsをセッション側で設定する必要があります。bypassPermissionsは保護パスへの write を含め大半の prompt を飛ばすため、公式には container/VM 等の隔離環境向けとされています。([Claude]2)squne121 commentedon Sep 3, 2026
issue-refinement-loop 終了報告
termination_reason: approved
anchor: issuecomment-5517674717(OWNER, trusted human context,
preflight.run.with_human_contextlane)anchor classification:
feedback_update_requiredとして snapshot 固定し、canonical anchor handling を通して契約へ反映(raw snapshot はそのまま body へコピーせず正規化済み)実施内容
codebase-investigator(local-asset advisory route)でscripts/agent-ops/verify_pr_reviewer_permission_boundary.pyを調査し、stale current-state claim が3箇所(module docstring・UPSTREAM_WORKTREE_AGENT_DISCOVERY_BUG_REF定数コメント・build_agents_json_passthrough_argv呼び出し箇所のインラインコメント)に存在することを確認web-researcherで upstreamanthropics/claude-code#25816が CLOSED、Claude Code v2.1.47(2026-02-18)の release notes に修正が明記されていることを一次資料で fact-check(SUPPORTED)Exploreagent で VC の negative-assertion 規約(! rg -q "..."が静的にexpected_fail/goに分類される)を確認し、rg -cの no-match false-failure を解消docs/dev/extension-surface-runtime-policy.yamlのsubagent-lifecycle-start-stop-delegation-fallbackrule に一致するがdecision: not_applicableのままだった)を抱えていたことを検出し、Required Design References の追加、および Issue 実装: SubAgent 定義変更時の candidate-head bootstrap review を worktree-agent-runtime-smoke で自動回復する #2416 の precedent に倣ったdecision: immediate+ AC1-AC3 への<!-- runtime-verification: true -->タグ付与(根拠: 本 refinement 中に実施済みのweb-researcherfact-check)で解消issue-editorによる本文更新を3回実施(初回 + fix_delta 2周)。各回ともcontract_readiness_check.py --mode preflight-staticとcheck_issue_contract.py --mode checkをローカルで事前検証してから publishrun_root_review_pipeline.py produce):canonical_step2_route: step_2_5、VERDICT: approvesemantic_review_applicable: false(checker_gap_count=0/heuristic_concern_count=0/ anchor comment に severity-tagged heading なし / owner_decision_conflict なし / cross_contract_change なし)→ semantic design review レーンはスキップevaluate_termination_dependency_gate):decision: proceed(no_hard_dependencies_confirmed_this_cycle)run_contract_review_once.py --mode static):status: go、readiness_status: go、vc_preflight_status: pass(AC1-AC3:expected_baseline_fail/AC4:baseline_expect_pass、いずれもdecision: go)、declared_path_overlap.disjoint: true反映した contract delta(Issue #2430)
--agentsretention 理由の historical/current 区別、discovery route の非同値性維持を明記not_applicable→immediate(scripts/agent-ops/**が hard rule に一致するため deterministic gate 上必須)。AC1-AC3 にruntime-verification: trueを付与し、SKIP/fallback は「静的テキスト照合のため不要」と明記rg -cの false-failure を! rg -qの negated 静的アサーションへ置換、AC ごとに# AC<N>marker を付与、AC4 は VC preflight allowlist に合わせuv run接頭辞なしのpython3 -m py_compile+# baseline-expect: passdocs/dev/extension-surface-runtime-policy.yaml/docs/dev/runtime-verification-policy.mdを追加scripts/agent-ops/verify_pr_reviewer_permission_boundary.py単独を維持)unresolved blocker
なし。non-blocking advisory が1件(
scope_cvs_in_scope_mismatch、severity: warning、Current Validated Scope と In Scope のトークン重複が閾値未満)残るが、review-issueの deterministic verdict には影響しない non-blocking improvement。次のアクション
CONTRACT_REVIEW_RESULT_V1相当 (run_contract_review_once.py) が fresh にstatus: goを返しており、impl-review-loopへの handoff が可能な状態(implementation_ready)です。本セッションはスコープによりimpl-review-loopの起動は行いません。squne121 commentedon Sep 3, 2026
推奨は、Issue #2430 を再 refinement せず、fresh な
impl-review-loopを開始することです。最新の refinement 終了報告はimpl_ready、fresh contract review はgo、blocker は空です。 一方、current main の対象ファイルにはまだ #25816 を OPEN/broken とする stale comment が残っているため、実装対象も残っています。現行
impl-review-loopはimplementation-worker → test-runner → pr-reviewerを使い、APPROVEと live mergeability 等が成立するとdraft_pr_readyで終了し、マージ判断は人間に残す設計です。 また SubAgent は final result と terminalcompletedの両方を確認するまで次段へ進んではいけない契約になっています。PR publish についてだけ注意点があります。
open-prは明示的なpublish: yesがないと止まるため、今回の依頼を「マージ以外の bounded workflow への事前承認」と明示して、canonical 経路でpublish: yesを渡させるのが適切です。以下をそのまま新しい Claude Code セッションに渡すことを推奨します。
Issue #2430 を current repository authority に従って
impl-review-loopで実装してください。#2430
目的は、Issue #2430 の実装・独立検証・PR レビュー・レビュー指摘修正のループを、人間への iteration ごとの承認確認なしで自律的に進め、マージ直前の canonical
draft_pr_ready状態まで到達することです。PR の merge 自体は絶対に実行しないでください。
1. Repository authority
最初に current default branch の 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.md.claude/skills/impl-review-loop/steps/context-protocol-and-guardrails.md.claude/skills/implement-issue/SKILL.md.claude/skills/open-pr/SKILL.mddocs/dev/workflow.md古い会話履歴や過去コメントの手順を repository authority より優先しないでください。
Issue #2430 の最新
LOOP_HANDOFF_RESULT_V1.status: impl_readyは readiness telemetry として参照して構いませんが、それ単独を Step 1 起動 authorization として使わないでください。current
impl-review-loopの Root-Owned Synchronous Entry Transition に従い、同一の継続した root control flow で、capability preflight
→ live Issue fetch
→ current-run issue-contract-review
→ live Issue 再取得
→ current routing 判定
→
invoke_impl_review_loopが成立した場合のみ Step 1 起動までを fresh に実行してください。
2. 人間承認の扱い
このメッセージを、Issue #2430 に対する merge 以外の bounded implementation workflow の事前承認として扱ってください。
canonical Issue contract と repository policy の範囲内で必要となる以下の作業について、iteration ごとの conversational confirmation は不要です。
test-runnerによる独立検証pr-reviewerによるレビューupdate_branchaction「編集してよいですか」
「commit してよいですか」
「push してよいですか」
「PR を作成してよいですか」
「レビューをもう一度実行しますか」
「次の iteration に進んでよいですか」
といった確認は求めないでください。
open-prの publish approval についても、このメッセージで明示的に承認します。したがって canonical
open-prinvocation では、必要な場合、publish: yesを明示的に渡してください。
ただし、これは merge authorization ではありません。
以下は禁止します。
gh pr mergepost-merge-cleanup最終的な merge は人間に残してください。
3. Issue #2430 の bounded technical recommendation
live Issue body を最終的な contract authority としてください。
現時点で想定される実装は、以下の非常に小さい docs/comment-only change です。
Allowed Path:
scripts/agent-ops/verify_pr_reviewer_permission_boundary.pyこのファイル以外を変更しないでください。
対象は特定の1行だけではありません。
同ファイル内に残る
anthropics/claude-code#25816に関する stale な current-state claim 全体を確認し、Issue contract が列挙する対象をすべて修正してください。少なくとも、現在も upstream が OPEN / broken であるかのように読める以下の意味を残さないこと。
confirmed OPEN upstream Claude Code bugconfirmed broken from a git-worktree cwd upstream新しい記述では以下を正確に区別してください。
anthropics/claude-code#25816は historical context 上、この--agentspassthrough 導入の契機となった upstream bug だった。しかし #25816 は CLOSED であり、Claude Code v2.1.47 で修正済みである。
現在も
--agentsJSON passthrough を維持する理由は、「upstream がまだ broken だから」ではない。現在の目的は、candidate-head の
.claude/agents/pr-reviewer.mddefinition を fresh に読み、session-local--agents <json>として明示的に bind することで、実際に使用される effective agent definition の曖昧性を避けること。project
.claude/agents/discovery と session-local--agentsbinding は別の経路であり、完全に同等であるかのようには記述しないこと。この Issue では 実行ロジックを変更しないでください。
以下へスコープを広げないでください。
run_worktree_agent_runtime_smoke.pyの変更implement-issueの一般的な TDD guidance が、この docs/comment-only Issue の Allowed Paths を越える変更を要求するように見える場合は、live Issue contract / Allowed Paths / explicit Out of Scope を優先してください。4. Verification
Issue #2430 の live body から Acceptance Criteria と Verification Commands を fresh に取得し、そこに書かれた literal commands を正本として実行してください。
現行 contract と一致している場合、想定される Verification Commands は以下です。
ただしコピーした上記ではなく、実行時の live Issue body が異なる場合は live contract を使用してください。
新しい runtime smoke を発明しないでください。
Issue の Runtime Verification Applicability が
decision: immediateであっても、この Issue で定義済みの static VC と既存 fact-check の contract に従い、不要な harness を追加しないでください。5. SubAgent の実使用
impl-review-loopが定める SubAgent を実際に使用してください。少なくとも canonical workflow に従って、
Step 1:
implementation-workerStep 2:
test-runnerStep 4:
pr-reviewerを使用してください。
root/main thread がこれらの役割を代替して、実装・独立検証・レビューを一人で済ませないでください。
各 dispatch では repository authority に従い、actual Issue number、PR number、head SHA、Allowed Paths、literal Verification Commands、fix_delta 等を materialize し、placeholder のまま child へ渡さないでください。
6. SubAgent completion join barrier
dispatch した SubAgent の作業完了を必ず待ってください。
これは必須です。
各 canonical SubAgent task について、以下の両方が成立するまで、その phase を完了扱いにしないでください。
list_agents等の現行 canonical lifecycle observation で terminalcompletedを確認していること片方だけでは completion と判定しないでください。
wait_agentの timeout、mailbox activity、途中経過、partial output、steer response、起動成功だけを completion と扱わないでください。task が background で走る場合も同様です。
completion notification と final result が返るまで待ってください。
必要な SubAgent がまだ
runningの間に、draft_pr_ready判定へ進まないでください。
erroredinterruptedshutdownnot_foundを
completedとみなさないでください。recoverable discovery failure なら current
step-4-pr-review.md等に定義された canonical bounded recovery を使ってください。genuinely unrecoverable な場合のみ hard-stop としてください。
nested SubAgent delegation が Issue / repository policy で禁止されている場合は行わず、root-owned orchestration の範囲で必要な direct SubAgent を使用してください。
7. implementation-review loop
canonical routing をそのまま実行してください。
基本的には、
Implementation
→ independent Verification
→ current-head VC gate
→ PR Review
→ Step 5 routing
を繰り返してください。
REQUEST_CHANGESの場合、人間へ確認せず、blockers を canonicalfix_deltaとして次のimplementation-workeriteration に渡してください。修正後は current head に対して必要な Verification と PR Review を再実行してください。
BEHINDの場合は canonical control-plane が生成するupdate_branchaction を canonical worker に委譲し、その後 Verification と PR Review を再実行してください。reviewed head が stale なら、人間確認ではなく current head で rereview してください。
UNKNOWN/BLOCKED/UNSTABLE/DRAFT等について current repository authority が bounded retry / CI evaluator / mechanical action を規定している場合は、その route に従ってください。単なる SubAgent の
human_review_required: trueという boolean 自己申告だけを理由に即停止せず、current
impl-review-loopの Step 5 routing authority に従ってください。Reviewer の
APPROVEだけで完了扱いにしないでください。current repository authority が要求する、
を満たし、canonical
route: approvedへ到達するところまで進めてください。8. 本当に停止すべき条件
通常の iteration では人間確認を求めません。
ただし current repository authority が定義する genuine hard stop を無効化しないでください。
たとえば、
HUMAN_REVIEW_REQUIREDverdictDIRTYが成立した場合は停止してください。
その場合も「どうしますか?」だけで終わらず、
を報告してください。
9. マージ直前の終了条件
目標は current
impl-review-loopが定義するIMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_readyまたは current repository authority 上それに対応する canonical pre-merge terminal state です。
そこまで到達したら停止してください。
merge はしないでください。
終了時には簡潔に以下を報告してください。
pr-reviewerverdictIMPL_REVIEW_LOOP_RESULT_V1statuscompleted確認済みか必要な SubAgent が1つでも running の状態では最終報告を出さないでください。
canonical hard stop が発生しない限り、途中で人間承認を挟まず 実装 → 検証 → レビュー → 修正 → 再検証 → 再レビュー → pre-merge terminal state まで自律的に進めてください。
このプロンプトで無くせるのは主にワークフロー上の再確認です。Claude Code 自体の Bash/Edit/GitHub 等の permission はモデルのプロンプトでは変更できず、Claude Code 側で enforcement されます。現在の公式仕様では
autoは依頼との整合性を安全チェックしながら tool call を自動承認し、bypassPermissionsは大半の prompt を飛ばしますが、後者は隔離された container/VM 向けとされています。([Claude]1)また現行 Claude Code は background SubAgent が既定になり得て、結果は後続の completion notification で返るため、上の final result + terminal
completedの join barrier は特に重要です。(Claude)squne121 commentedon Sep 3, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Sep 3, 2026
implement-issue: 実装完了 (2026-09-03T12:45:50Z)
.claude/worktrees/issue-2430-upstream-25816-stale-commentworktree-issue-2430-upstream-25816-stale-comment! rg -qx2,rg -c v2.1.47= 3,py_compileexit 0)。加えてpnpm typecheck/lint/test/build(1874 tests passed)とtest_model_routing.py(24 passed)も全て PASS。squne121 commentedon Sep 3, 2026
impl-review-loop: 完了 (2026-09-03T22:05:00Z)
fix: remove residual "Issue #25816 workaround" wording and narrow ove…
docs: verify_pr_reviewer_permission_boundary.py の stale な #25816 コメント…