Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2271"
goal_ref: "Issue契約修復後、current live bodyに対するfresh reviewがgoの場合だけimpl-review-loopへ進み、stale/missing artifactの扱いを一意にする"
change_kind: workflow
runtime_verification_applicability: immediateParent Issue
Parent Goal Ref
Goal: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる。
Desired Destination: issue-refinement-loop と impl-review-loop 間の fresh implementation entry contract を単一の normative policy へ統一する(本 parent scope のみを示す)。
Decisions Fixed
- 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860/PR 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1875/PR docs: workflow SSOT・Skill entrypointをPR #1875マージ後の状態へ整合 (#1876) #1880 の advisory・live-state 方針を維持する(選択肢B、OWNER REQUEST_CHANGES に基づき確定)。導入: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる #2271/実装: issue-refinement-loop から impl-review-loop への fresh implementation entry contract を統一する #2272 はこれらを supersede しない。
ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1は authorization packet ではなく、root/main thread が current invocation の control flow 内でのみ生成・消費する process-local route result である。保存・再ロード用の API を持たない。- GitHub comment、artifact、digest、invocation ID のいずれも単独では
impl-review-loopの Step 1 起動を authorize しない。process をまたいだ再開では常に live Issue を再取得し fresh review からやり直す。 - 旧
implementation_entry_decision(binding/review/routing/invocation を持つ authorization packet 型)は本 Issue の設計から撤回し、下記ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1に置き換える。
Current Validated Scope
- issue-refinement-loopは
LOOP_HANDOFF_RESULT_V1.status: impl_readyにfreshstatus: goを要求する - impl-review-loopのadvisory artifact policyはmissing/stale snapshotで停止しない
- impl-review-loop preparationは同一ファイル内でstale reviewをwarningにもhard stopにもしている
LOOP_HANDOFF_RESULT_V1の実在consumerがimpl-review-loop側に存在しない- live Issue/PRをauthorityとする導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 minimal-harness方針は維持する
- anchor review(導入: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる #2271 (comment) P1-3, P1-4)が、direct handoff transport の型・寿命・受け渡し方法が未定義であること、および process-level integration test が不足していることを指摘した
- OWNER REQUEST_CHANGES(https://github.com/squne121/loop-protocol/issues/2272#issuecomment-5369439173)が、旧
implementation_entry_decisionが digest-bound authorization を実質的に復活させ 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 と矛盾すること、fingerprint再利用主張が既存parser契約と非互換であること、root_invocation_idがself-attestedでreplay防止にならないことを指摘した
Remaining Parent Gaps
本 Issue 完了後も、impl-review-loop 本体の loop semantics 再設計や merge 自動化は parent #2271 の別 child として残る。
Root-Owned Synchronous Entry Transition(2026-08-21, OWNER REQUEST_CHANGES 反映・選択肢B確定)
root/main thread が同一 control flow 内で以下を同期的に実行する。durable authorization packet は導入しない。
root/main thread
|
|-- capability preflight
|-- live Issue fetch
|-- current-run issue contract review(issue-contract-review 経由)
|-- live Issue + base readback
|
|-- body/Allowed Paths drift --> rerun_contract_review(bounded retry付き)
|-- base SHA のみ drift ------> rerun_base_preflight(bounded retry付き)
|-- verdict が blocked/request_changes --> stop
|-- current-run go かつ live equality 成立 --> impl-review-loop を直接起動
|
`-- audit comment publish(best effort、route決定後、routingに影響しない)
process-local な戻り値として ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1 を定義する。root が current-run result を受け取った同じ control flow でのみ生成・消費し、GitHub comment・artifact・環境変数・一時ファイルへ保存しない。
ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1:
route: invoke_impl_review_loop | rerun_contract_review | rerun_base_preflight | stop
reason:
issue_number:
reviewed_body_sha256:
observed_live_body_sha256:
reviewed_base_sha:
observed_base_sha:
resume_from:
retry_count:Routing 優先順位
| 優先度 | 条件 | route |
|---|---|---|
| 1 | capability/live fetch/identity が検証不能 | stop |
| 2 | Issue body または Allowed Paths drift | rerun_contract_review |
| 3 | base SHA のみ drift | rerun_base_preflight |
| 4 | verdict が blocked / request_changes | stop |
| 5 | current-run go かつ live equality 成立 | invoke_impl_review_loop |
数値が小さい優先度を優先する。複数条件が同時成立する場合は最小番号の route を採用する。
body drift と base drift の区別・bounded retry
- body/Allowed Paths drift(review subject 自体の変更): 常に full
issue-contract-reviewを再実行する(rerun_contract_review)。 - base SHA drift のみ(unrelated commit による default branch tip 更新):
rerun_base_preflightroute で exact base SHA を pin し、その SHA から worktree を作成する。 rerun_base_preflightの再試行上限は 3 回とする。上限到達後も drift が解消しない場合はroute: stop/reason: base_preflight_retry_exhaustedを terminal result として返す(無制限の自動再試行はしない)。- reviewed base と実際の worktree base が不一致のまま implementation を開始しない。
production carrier(producer / consumer / call site の固定)
carrier:
producer: root-owned entry router(issue-refinement-loop 側の新規 routing module)
consumer: impl-review-loop preparation entry router(steps/preparation.md 側の新規 entry function)
encoding: strict JSON
delivery: 同一プロセス内の直接関数呼出し(プロセス境界を越える場合は明示的な subprocess stdin JSON)
forbidden:
- GitHub comment discovery
- ambient environment lookup
- stale artifact lookup
- transcript scraping同一 root invocation(root/main thread が Issue review 開始から impl-review-loop 起動判断までを単一の連続した control flow として実行する場合)の中でのみ ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1 を生成・消費する。プロセス境界を越える delivery が必要な場合は subprocess.run(input=..., capture_output=True) で strict JSON を stdin へ渡し、stdout を machine-readable result、stderr を diagnostics に分離する。
root invocation の識別(自己申告 root_invocation_id を廃止し process-local nonce へ置換)
- payload 内に自己申告の
root_invocation_idを含めない(自己申告 ID は replay 防止にならない)。 - ホストから
prompt_id(現在処理中の user prompt を識別する UUID)が取得可能な場合は correlation に利用する。 prompt_idが取得不能な場合、root が process-local nonce を生成し、root 側メモリにのみ保持する。nonce を payload や audit comment から再取得しない。session_idは audit correlation のみに使用し、entry authority の根拠にしない。- process restart(新しいプロセスの起動)後は nonce を復元せず、常に fresh review(capability preflight → live fetch → current-run review)からやり直す。
fingerprint の再利用範囲(AC13 の明確化・撤回)
既存 issue-contract-review の comment-based fingerprint validator(contract_source_kind == issue_comment を要求し、実 comment ID・trusted author provenance を検証する既存 parser)は、comment を経由しない同一 invocation 内の direct result にはそのまま適用できない。本 Issue では既存 comment fingerprint validator を「再利用する」とは主張せず、root control flow が以下を直接比較する live equality check として実装する:
reviewed_body_sha256(current-run review 時点の body SHA) とobserved_live_body_sha256(route 決定直前に再取得した live body SHA)reviewed_base_shaとobserved_base_sha
SHA256 算出・正規化方式は既存 issue-contract-review の contract_body_sha256 / allowed_paths_normalized_sha256 / base_ref / base_sha_at_snapshot と同一の canonicalization ロジックを流用してよいが、comment provenance 検証(comment ID・trusted author)は要求しない。既存 comment-based fingerprint parser 本体の外部契約・フィールド名・Allowed Paths は変更しない(.claude/skills/issue-contract-review/** は本 Issue の編集対象に含めない)。
audit comment の位置付け(非 authoritative の確定)
impl-review-loop起動判断(routeの決定)は GitHub audit comment の publish 成否を条件にしない。- audit comment publish は route 決定後の best-effort 処理とし、失敗時は warning として記録するのみで route を変更しない。
- audit comment 投稿失敗を implementation entry failure に昇格しない。
- restart 時は audit comment を authority として扱わず、常に fresh review からやり直す。
- ambiguous な POST 結果(応答 lost 等)は live comments を再取得して audit の重複投稿だけを reconcile し、route 判断には使わない。
Process-Level Test Requirements(P1-5 反映、AC8/AC17/AC18 で検証)
- producer/root entry router と consumer/impl-review-loop preparation entry router を別 subprocess として起動する process-level test を最低 1 本含む。
- strict JSON を stdin/stdout で受け渡す。
- fake GitHub transport は production と同一 interface へ依存注入する(monkeypatch による内部関数の直接差し替えのみに依存しない)。
- 各 test は pytest
tmp_pathの独立 repo/state を使用する。 impl-review-loopStep 1 の invocation を検出する spy を設置する。- negative case(fresh review が go でない、または live equality 不成立)では spy の invocation count が 0 であることを検証する(AC17)。
- fresh go かつ live equality 成立の positive case のみ invocation count が 1 であることを検証する。
- process kill 後は新しい process/新しい root nonce で再開し、旧 nonce の payload は re-authorize しないことを検証する。
- 過去の
LOOP_HANDOFF_RESULT_V1comment のみが存在し、current-run direct result がない comment-only replay を implementation entry として拒否することを検証する(AC18)。
Outcome
.claude/skills/issue-refinement-loop/references/termination-policy.md と .claude/skills/impl-review-loop/SKILL.md / steps/preparation.md が単一の fresh implementation entry contract(Normative Entry Policy、Root-Owned Synchronous Entry Transition)に統一され、ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1(process-local, 非永続, 非 authorization packet)を direct handoff の唯一の型として明示した上で、cross-skill contract regression tests(同一 invocation 内での実 consume を検証する process-level integration test、Process-Level Test Requirements を満たすものを含む)が追加された PR がマージされている状態。
Runtime Verification Applicability
runtime_verification_applicability:
decision: immediate
reason: "workflow routing policy の変更であり、fake GitHub transport を用いた process-level integration test を含めて pytest で即時検証可能なため"
applicable_acs: [AC1, AC2, AC3, AC4, AC5, AC6, AC7, AC8, AC9, AC10, AC11, AC12, AC13, AC14, AC15, AC16, AC17, AC18]
execution_environment: "fake GitHub transport(live GitHub API 非使用)で pytest を実行できる標準開発環境"
skip_conditions: "uv または pytest が利用不可の場合"
fallback_policy: "fallback は許容しない。全 AC は fake transport による決定論的 pytest 実行で PASS/FAIL を返す。"
artifact_requirements: "各 AC の pytest 実行ログ(PASS/FAIL 件数・failure trace)を PR コメントへ記録する。"In Scope
LOOP_HANDOFF_RESULT_V1のsingle parser/validator- impl-review-loop側consumerの実装(preparation entry router)
- issue-refinement-loop termination policyとの整合
- impl-review-loop advisory artifact policyの用語分離
- preparation.md内の相反規則の除去
- current-run fresh reviewのentry gate化
- body/base drift時のroute分離(rerun_contract_review / rerun_base_preflight)とbounded retry
- root-owned phase runbookとmutation readback規則
ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1(process-local, 非永続)の型定義と producer/consumer 実装- process-local nonce による root invocation 識別(root_invocation_id の自己申告を置換)
- 同一 invocation 内での direct handoff の実 consume を検証する process-level integration test(fake GitHub transport 使用、別 subprocess 起動、tmp_path 独立 state)
- cross-skill contract regression tests
- audit comment publish failure が routing に影響しないことの実装・検証
Out of Scope
- 新規の永続packet/ledger
- GitHub labelをreadiness authorityにすること
- stale snapshotをauthorizationへ昇格すること
- SubAgent自己申告だけでimplementation entryを決めること
- impl-review-loopの実装・検証・PR review本体の再設計
- merge自動化
.claude/skills/issue-contract-review/**の comment-based fingerprint validator本体の変更- 新規 enforcing hook の追加
Acceptance Criteria
- AC1: missing prior reviewは実装開始ではなくfresh reviewへrouteされる
- AC2: stale prior reviewはterminal stopではなくfresh reviewへrouteされる
- AC3: fresh reviewが
goかつlive equalityが成立する場合だけimpl-review-loop起動へ進む - AC4: fresh reviewが
blockedまたはrequest_changesの場合はroute: stopで停止する - AC5: review後のIssue body/Allowed Paths変更(body drift)を検出し
rerun_contract_reviewへrouteする - AC6: review後のbase SHA drift のみを検出し
rerun_base_preflightへrouteし、bounded retry(上限3回)到達後はroute: stopとする - AC7: GitHubコメント上の過去
impl_ready単独では実装開始しない - AC8: root-owned entry routerが生成した
ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1を、同一invocation内でimpl-review-loop preparation entry routerが実consumeする(直接関数呼出しまたは明示的subprocess stdin JSON経由) - AC9:
SKILL.mdとsteps/preparation.mdに相反するrouting規則が残らない - AC10: mutation partial failure後、live readbackから安全な
resume_fromを返す - AC11: capability preflight blocked時はIssue mutation前に停止する
- AC12: 新しいdurable authority、packet ledger、digest-bound control-planeを追加しない(
ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1は保存・再ロードAPIを持たないことを実装・テストで示す) - AC13: direct resultのlive equality確認は既存
issue-contract-reviewのcomment-based fingerprint validator(comment ID・trusted author provenance検証)を再利用せず、body_sha256/base_shaの直接比較として実装される - AC14: プロセスをまたいだ再開時、
ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1やnonceを直接authorizeに使わずlive Issueからfresh reviewへ戻る - AC15:
prompt_idが取得不能な場合にrootが生成するprocess-local nonceが、process restart後に復元されず新しいnonceへ置き換わる - AC16: audit comment publish failureがroute決定に影響せず、current-run goかつlive equality成立の場合は
impl-review-loop起動を継続する - AC17: negative case(fresh reviewがgoでない、またはlive equality不成立)でimpl-review-loop Step1のinvocation countが0であることをspyで検証する
- AC18: 過去の
LOOP_HANDOFF_RESULT_V1commentのみが存在しcurrent-run direct resultがないcomment-only replayをimplementation entryとして拒否する
Verification Commands
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac1_missing_prior_review_routes_to_fresh_review # AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac2_stale_prior_review_routes_to_fresh_review # AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac3_fresh_review_go_and_live_equality_invokes_step1 # AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac4_fresh_review_blocked_stops # AC4
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac5_body_drift_routes_to_rerun_contract_review # AC5
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac6_base_drift_routes_to_rerun_base_preflight_bounded_retry # AC6
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_replayed_envelope_same_live_state_after_process_restart_is_rejected # AC7
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_consumer_rejects_non_exact_route_schema # AC8
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_preparation_entry_policy.py -v -k test_ac9_no_conflicting_routing_rules # AC9
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac10_partial_failure_returns_resume_from # AC10
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac11_capability_preflight_blocked_stops_before_mutation # AC11
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac12_no_new_durable_authority_added # AC12
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac13_live_equality_does_not_reuse_comment_fingerprint_validator # AC13
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_replayed_envelope_same_live_state_after_process_restart_is_rejected # AC14
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac15_process_local_nonce_not_restored_after_restart # AC15
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac16_audit_publish_failure_does_not_change_route # AC16
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_ac11_capability_preflight_blocked_stops_before_mutation # AC17
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_loop_handoff_contract.py -v -k test_expected_token_must_not_be_derived_from_envelope # AC18Allowed Paths
.claude/skills/issue-refinement-loop/SKILL.md
.claude/skills/issue-refinement-loop/references/termination-policy.md
.claude/skills/issue-refinement-loop/scripts/
.claude/skills/issue-refinement-loop/tests/
.claude/skills/impl-review-loop/SKILL.md
.claude/skills/impl-review-loop/steps/preparation.md
.claude/skills/impl-review-loop/scripts/
.claude/skills/impl-review-loop/tests/
docs/dev/workflow.md
docs/dev/agent-skill-boundaries.md
docs/dev/workflows/impl-review-loop-design.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 新しい永続authorization packetが必要と判断された場合
- live Issue/PR以外をsemantic authorityにする必要が生じた場合
- label、snapshot digest、SubAgent自己申告をentry authorityにする必要が生じた場合
- impl-review-loop本体のloop semantics変更へscopeが拡大する場合
- 既存
issue-contract-reviewのcomment-based fingerprint validator本体の変更が必要と判明した場合
Required Skills
- Python(subprocess による strict JSON stdin/stdout 契約の実装)
- pytest(fake GitHub transport への dependency injection、
tmp_pathによる独立 repo/state 分離) - Claude Code SubAgent transport 契約(root/main thread と
impl-review-loop間の同一 invocation 内 direct call、または明示的な subprocess boundary)
Required Design References
- docs/dev/workflow.md
- docs/dev/agent-skill-boundaries.md
- docs/dev/workflows/impl-review-loop-design.md
Scope Delta(任意)
N/A
Notes for Reviewer
- Handoff Rule(GitHubコメント再取得handoffはaudit telemetryとして扱い、単独では実装をauthorizeしない)と Root-Owned Phase Runbook(各phaseのidempotent skip、resume_from)は本 Issue の normative 仕様として実装対象に含む。
- Related: Parent 導入: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる #2271、Source analysis: 実装: visual-impact-policy-trusted の decision/evidence artifact に run_attempt identity を結合する #2230 (comment)
- Anchor review(親): 導入: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる #2271 (comment) (P1-3, P1-4)
- Anchor review(本Issue、選択肢B確定の根拠): 実装: issue-refinement-loop から impl-review-loop への fresh implementation entry contract を統一する #2272 (comment)
Scope Collision Note
Scope Collision (C1) preflight 検出: .claude/skills/impl-review-loop/SKILL.md / .claude/skills/impl-review-loop/steps/preparation.md / .claude/skills/issue-refinement-loop/references/termination-policy.md を Allowed Paths に含む OPEN Issue が複数存在する(#2141, #2051, #2041, #1944, #1909, #1908, #1601, #1322, #1117, #1007, #966, #961, #944, #266, #259, #153, #88, #56, #51)。
non_conflict_reason: これらは fresh implementation entry contract の統一という単一 Outcome とは異なる関心事(context budget、phase status publisher、YAML キー正規化、preflight preparation の個別機能追加等)を扱っており、本 Issue は routing 契約の統一のみを対象とする。実装順序で衝突が生じる場合は PR 作成時に rebase で解消する。
Activity
squne121 commentedon Aug 21, 2026
判定
REQUEST_CHANGES。
Issue #2272 は、現行
impl-review-loopの intake 規則が自己矛盾していること、過去のLOOP_HANDOFF_RESULT_V1コメントを authorization にしてはならないこと、プロセス再開時は live Issue から再判定すべきことを正しく捉えています。親レビューの P1-3/P1-4 もかなり反映されています。ただし、現在の本文は以下の三点で実装開始可能な契約になっていません。
導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 系 Owner Decision を維持すると書きながら、digest-bound authorization を復活させている
implementation_entry_decisionの型はあるが、実際の transport と trusted caller identity がない「既存 fingerprint validator を再利用する」という AC13 が、既存 parser のフィールド・provenance・Allowed Paths と両立しない
P0-1 — fresh review gate が #1860/PR #1875/PR #1880 を暗黙に supersede している
#2272 は次を要求しています。
implementation_entry_decision.binding.*の body・Allowed Paths・base SHA が一致することfresh
goの場合だけ Step 1 へ進むことbody drift で handoff を無効化すること
base SHA drift で再レビューまたは再 preflight へ戻すこと
この decision を
impl-review-loopが直接 consume することこれは lifetime が ephemeral であっても、digest の一致によって実装開始を許可・禁止する authorization mechanism です。
persistence: ephemeralと書くだけでは、authority semantics は変わりません。一方、親 #2271 は「新しい digest-bound authorization を追加しない」と明記しています。また #1860 と PR #1875 は、parent binding digest、review envelope、永続 state、専用 reason-code/state-machine に意味判断を固定する設計を撤去しました。PR #1880 では、Issue 本文の一文字変更だけで prior review を無効化し handoff を禁止する規則も、#1860 の advisory/live-state 方針と矛盾するとして後退させています。
したがって、次のどちらかを明示的に選ぶ必要があります。
選択肢A — fresh entry hard gate を正式に復活させる
次を Owner Decision として明記します。
導入: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる #2271/実装: issue-refinement-loop から impl-review-loop への fresh implementation entry contract を統一する #2272 は、導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860・PR 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1875・PR docs: workflow SSOT・Skill entrypointをPR #1875マージ後の状態へ整合 (#1876) #1880 を issue-refinement → implementation entry の境界に限り supersede する
digest は durable artifact authority にはしないが、同一 root invocation 内の entry capability として使用する
親 導入: Claude-GPT → issue-refinement-loop → impl-review-loop の実行契約を end-to-end で整合させる #2271 の AC9 と
Decisions Fixedを同時に修正するdocs/dev/workflow.mdとagent-skill-boundaries.mdに限定例外を記録する選択肢B — #1860 を維持する
こちらを推奨します。
implementation_entry_decisionを authorization packet にしないroot/main thread が fresh review を同期実行し、直後に live Issue を再取得して
impl-review-loopを直接起動するstructured result は観測値・関数戻り値に限定する
GitHub comment、artifact、digest、invocation ID のいずれも単独では Step 1 を authorize しない
再開時は構造体を replay せず、live fetch からやり直す
現状は A と B を同時に採用しており、authority chain が一意ではありません。
P0-2 — 「既存 fingerprint fields の再利用」が実際の parser 契約と一致しない
既存
issue-contract-reviewparser の fingerprint は、概ね次の七フィールドです。さらに、既存 parser は以下を要求します。
contract_source_kind == issue_commentcontract_source_idは実際の GitHub comment IDbody SHA は
sha256:<64hex>Allowed Paths SHA は既定の形式
base は
base_sha_at_snapshottrusted author と実 comment provenance を検証する
producer 側も comment POST 後に実 comment ID を取得し、PATCH/readback して fingerprint を確定する二段階処理です。
一方、#2272 の新 schema は次のように変えています。
具体的な不一致は次です。
base_sha_at_snapshotがbase_shaに変更されているcontract_source_kind/contract_source_idが fingerprint から分離されているsource は direct Agent result を想定する一方、既存 parser は
issue_comment固定repositoryは新規フィールドaudit comment の投稿に失敗した場合、既存 parser が要求する実 comment ID を作れない
.claude/skills/issue-contract-review/**は Allowed Paths に含まれていないしたがって、現スコープでは以下を同時に満たせません。
AC8: comment を使わない direct handoff の実 consume
AC13: 既存 fingerprint validator をそのまま再利用
AC12: 新しい独立 freshness tuple/parser を作らない
必須修正
fingerprint を次の二層へ分離してください。
その上で、以下のどちらかを選びます。
canonicalization/hash 検証だけを既存 parser から pure module として抽出し、comment provenance 検証と分離する
direct result では既存 comment fingerprint を「再利用する」と主張せず、body/base の live equality を root control flow 内で直接確認する
前者なら、最低でも次を Allowed Paths に加える必要があります。
P0-3 —
root_invocation_idは self-attested であり、current invocation を証明しない現在の schema は payload 内に次を置くだけです。
しかし、以下が定義されていません。
誰が
root_invocation_idを生成するかconsumer が比較する trusted expected value をどこから得るか
Agent result に含まれる ID と root 側 ID をどう別経路で束縛するか
restart、resume、fork、並行 terminal をどう識別するか
production carrier が Skill 引数、stdout、stdin、temp file、環境変数のどれか
payload が自分で申告した ID と、その payload から読み出した ID を比較しても replay 防止にはなりません。
Claude Code の
session_idは current invocation の代用品になりません。session は終了後も保存され、--resume <session-id>で別プロセスから再開できます。同じ session を複数 terminal から再開した場合、メッセージが同一 transcript に混在し得ます。(Claude)Claude Code の hook input には、session より細かい単位として次が存在します。
prompt_id: 現在処理中の user prompt を識別する UUIDagent_id: SubAgent instance の識別子last_assistant_message: SubAgent の最終応答SubAgent は親 session 内で実行され、結果を main conversation に返します。(Claude)
ただし、親 #2271 は新しい enforcing hook の追加を禁止しています。従って推奨は次です。
prompt_idが既存 host から既に取得可能なら correlation に利用する取得不能なら root が process-local nonce を生成する
expected nonce は root 側メモリに保持し、payload や audit comment から再取得しない
session_idは audit correlation のみに使用するrestart 後は nonce を復元せず、fresh review へ戻る
既存
reviewer_transport.pyはすでに root-generated invocation ID、attempt ID、session resume identity、artifact binding を持っています。しかし、その永続 artifact は「同じproduce呼出しで生成・検証する限定例外」であり、他 skill の authorization に利用しないことが明記されています。ここから implementation entry authority へ拡張するなら、やはり明示的な Owner Decision が必要です。P1-1 — transport の production call site がない
現行
impl-review-loopの Inputs は次が中心です。issue_numberoptional
contract_snapshot_urlmax_iterationshuman/agent comment URL
implementation_entry_decision、root_invocation_id、direct review result の入力は存在しません。#2272 は
impl-review-loopの文書と scripts を編集対象に含めていますが、次を定めていません。root が decision をどの API で渡すか
consumer script の CLI
JSON の stdin/stdout 契約
Skill 本文がどの script を invocation するか
Claude-GPT launcher/host のどこが production caller になるか
「process-level integration test」があっても、production call site がなければ、テスト専用コード同士をつないで AC8 を満たせます。
必須の carrier 定義
少なくとも次を固定してください。
プロセス境界を置くなら、Python の
subprocess.run(input=..., capture_output=True)により JSON を stdin へ渡し、stdout を machine-readable result、stderr を diagnostics に分離できます。(Python documentation)Claude-GPT host/launcher を変更する必要があるなら、実際の production caller path を Allowed Paths に追加してください。追加しない場合は、「既存のどの root-owned call site が carrier を提供するか」をファイル・関数単位で固定する必要があります。
P1-2 — routing state machine の型と優先順位が未定義
以下のフィールドは名前だけで、closed contract がありません。
review.source_kindreview.source_idreview.verdictrouting.reason_coderouting.resume_frominvocation.produced_by_phaserepository の canonical format
SHA の prefix、桁数、大文字小文字
base_refの canonicalizationまた、複数条件が同時に発生した場合の優先順位もありません。
例:
review は
goだが body drift と base drift が同時発生audit mutation は成功したが readback が失敗
request_changesの後に process interruptionstale direct object と fresh
blockedcomment が共存capability preflight blocked と prior
goが共存推奨する優先順位は次です。
closed schema を採用するなら、
required、enum、additionalProperties: falseを使い、未知フィールドや未知 route を fail-closed にすべきです。JSON Schema は追加プロパティを既定で許可するため、閉じた transport を意図する場合は明示的な禁止が必要です。(JSON Schema)ただし、これは #1860 が避けた closed enum/state-machine の再導入でもあります。したがって schema を大きくするより、root entry router の三値程度の process-local 戻り値へ縮小する方が整合します。
P1-3 — base SHA drift と body drift を同一 freshness として扱うと livelock する
Issue body/Allowed Paths の変更と、default branch tip の更新は性質が異なります。
body/Allowed Paths drift: review subject 自体が変更されたため full review が必要
base SHA drift: unrelated commit でも発生し得るため、常に full review を要求すると busy repository で再試行が収束しない
worktree 作成後の base drift: baseline CI/merge-base の再確認は必要だが、Issue contract の意味が必ず変わるわけではない
既存 fingerprint producer は default base ref とその時点の SHA を取得して
base_sha_at_snapshotとして保存します。必要な規則は次です。
再試行回数と、上限到達時の terminal result も定義してください。上限なしの自動再レビューは、親が要求する deterministic terminal result と両立しません。
P1-4 — mutation partial failure と audit comment の位置付けが未確定
#2272 は次を同時に要求しています。
GitHub comment は audit telemetry であり authority ではない
mutation partial failure 後に deterministic
resume_fromを返すcapability preflight blocked 時は mutation 前に停止する
しかし、audit comment 投稿に失敗した場合に implementation entry を続けるかが定義されていません。
ここは明確に選ぶ必要があります。
audit が完全に非 authoritative の場合
comment publish failure は warning
current-run direct review が valid なら route を変更しない
restart 時は comment を authority にせず fresh review
ambiguous POST 結果は live comments を取得して audit の重複だけを reconcile
audit readback failureを implementation entry failureに昇格しない
audit 記録が必須の場合
publish/readback failure で implementation を止める
この時点で audit comment は実質的な entry authority になる
導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860/親 AC9 に対する Owner Decision が必要
現状はどちらとも読めます。
追加すべき fault cases は最低限次です。
mutation 成功、応答 lost、readback で一件一致
mutation 成功、readback failure
mutation 成功、readback 後に process kill
mutation結果不明、同一 marker が複数件
audit publish failure、direct result は fresh
gorestart 後、audit comment だけ存在
stale direct object と fresh live body
P1-5 — 現在の Verification Commands は「実 transport」を検証すると保証しない
各 AC に pytest 名が付いている点は改善ですが、テスト名だけでは以下の偽陽性が可能です。
producer と consumer を同一 Python process で直接関数呼出しする
monkeypatch で production carrier を迂回する
impl-review-loopの Step 1 が本当に起動されたか観測しないprocess restart を object 再生成で模擬する
fake GitHub transport が production interface と異なる
comment-only replay 時にも内部 side effect が発生する
process-level test には次を明記してください。
prior payload replayは拒否pytest の
tmp_pathは test function ごとに一意の temporary directory を提供します。monkeypatch は global state や network call の置換には使えますが、process boundary 自体の代替にはなりません。(pytest 文書)Child D #2278 の live E2E は必要ですが、#2272 の不十分な process test の代替にはなりません。#2278 は A/B/C merge 後に実行され、そこで発見した defect は follow-up Issue へ分離する契約だからです。すなわち、#2272 の transport defect を merge 前に防ぐ責務は依然として #2272 にあります。
推奨する再設計
最も #1860 と整合するのは、authorization packet を廃止し、root-owned synchronous transition にする設計です。
この設計では次が不要になります。
implementation_entry_decisionauthorization packetroot_invocation_idの永続化comment fingerprint と direct result fingerprint の統合
impl-review-loop による過去 artifact 探索
restart-safe authorization token
process-local の戻り値だけを残すなら、次程度で十分です。
重要なのは、この構造体に
authority: current_root_invocation_onlyと自己申告させることではありません。root が current-run result を受け取った同じ control flow 上でのみ利用し、保存・再ロードする API 自体を持たせないことです。Issue #2272 に必要な最小修正
Decisions Fixedに、導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 を維持するのか限定 supersede するのかを追加するimplementation_entry_decisionを authorization packet から process-local route result へ変更するAC13 の「既存 fingerprint fields を再利用」を削除または pure fingerprint module 抽出へ変更する
body drift と base drift の route を分離し、bounded retry を定義する
audit comment publish failure が routing を変更するか明記する
production carrier、producer、consumer、call site をファイル・関数単位で固定する
transport 実装を変更するなら、root/launcher または
issue-contract-reviewの実対象を Allowed Paths に追加するprocess restart、nonce mismatch、comment-only replay、ambiguous mutation を AC に追加する
negative test で Step 1 side effect がゼロであることを必須化する
Required Skills: なしを、少なくとも Python/pytest/Claude Code SubAgent transport 契約へ更新するこの修正なしでは、実装者は「既存 parser を再利用する」「direct object を使う」「comment は authority にしない」「digest-bound control-plane を作らない」という相互に両立しない四条件から、実装時に独自の authority model を選ばざるを得ません。現状の #2272 は問題診断としては妥当ですが、implementation contract としては未確定です。
## 判定REQUEST_CHANGES。
Issue #2272 は、現行
impl-review-loopの intake 規則が自己矛盾していること、過去のLOOP_HANDOFF_RESULT_V1コメントを authorization にしてはならないこと、プロセス再開時は live Issue から再判定すべきことを正しく捉えています。親レビューの P1-3/P1-4 もかなり反映されています。ただし、現在の本文は以下の三点で実装開始可能な契約になっていません。
implementation_entry_decisionの型はあるが、実際の transport と trusted caller identity がないP0-1 — fresh review gate が #1860/PR #1875/PR #1880 を暗黙に supersede している
#2272 は次を要求しています。
implementation_entry_decision.binding.*の body・Allowed Paths・base SHA が一致することgoの場合だけ Step 1 へ進むことimpl-review-loopが直接 consume することこれは lifetime が ephemeral であっても、digest の一致によって実装開始を許可・禁止する authorization mechanism です。
persistence: ephemeralと書くだけでは、authority semantics は変わりません。一方、親 #2271 は「新しい digest-bound authorization を追加しない」と明記しています。また #1860 と PR #1875 は、parent binding digest、review envelope、永続 state、専用 reason-code/state-machine に意味判断を固定する設計を撤去しました。PR #1880 では、Issue 本文の一文字変更だけで prior review を無効化し handoff を禁止する規則も、#1860 の advisory/live-state 方針と矛盾するとして後退させています。
したがって、次のどちらかを明示的に選ぶ必要があります。
選択肢A — fresh entry hard gate を正式に復活させる
次を Owner Decision として明記します。
Decisions Fixedを同時に修正するdocs/dev/workflow.mdとagent-skill-boundaries.mdに限定例外を記録する選択肢B — #1860 を維持する
こちらを推奨します。
implementation_entry_decisionを authorization packet にしないimpl-review-loopを直接起動する現状は A と B を同時に採用しており、authority chain が一意ではありません。
P0-2 — 「既存 fingerprint fields の再利用」が実際の parser 契約と一致しない
既存
issue-contract-reviewparser の fingerprint は、概ね次の七フィールドです。さらに、既存 parser は以下を要求します。
contract_source_kind == issue_commentcontract_source_idは実際の GitHub comment IDsha256:<64hex>base_sha_at_snapshotproducer 側も comment POST 後に実 comment ID を取得し、PATCH/readback して fingerprint を確定する二段階処理です。
一方、#2272 の新 schema は次のように変えています。
具体的な不一致は次です。
base_sha_at_snapshotがbase_shaに変更されているcontract_source_kind/contract_source_idが fingerprint から分離されているissue_comment固定repositoryは新規フィールド.claude/skills/issue-contract-review/**は Allowed Paths に含まれていないしたがって、現スコープでは以下を同時に満たせません。
必須修正
fingerprint を次の二層へ分離してください。
その上で、以下のどちらかを選びます。
前者なら、最低でも次を Allowed Paths に加える必要があります。
P0-3 —
root_invocation_idは self-attested であり、current invocation を証明しない現在の schema は payload 内に次を置くだけです。
しかし、以下が定義されていません。
root_invocation_idを生成するかpayload が自分で申告した ID と、その payload から読み出した ID を比較しても replay 防止にはなりません。
Claude Code の
session_idは current invocation の代用品になりません。session は終了後も保存され、--resume <session-id>で別プロセスから再開できます。同じ session を複数 terminal から再開した場合、メッセージが同一 transcript に混在し得ます。(Claude)Claude Code の hook input には、session より細かい単位として次が存在します。
prompt_id: 現在処理中の user prompt を識別する UUIDagent_id: SubAgent instance の識別子last_assistant_message: SubAgent の最終応答SubAgent は親 session 内で実行され、結果を main conversation に返します。([Claude]2)
ただし、親 #2271 は新しい enforcing hook の追加を禁止しています。従って推奨は次です。
prompt_idが既存 host から既に取得可能なら correlation に利用するsession_idは audit correlation のみに使用する既存
reviewer_transport.pyはすでに root-generated invocation ID、attempt ID、session resume identity、artifact binding を持っています。しかし、その永続 artifact は「同じproduce呼出しで生成・検証する限定例外」であり、他 skill の authorization に利用しないことが明記されています。ここから implementation entry authority へ拡張するなら、やはり明示的な Owner Decision が必要です。P1-1 — transport の production call site がない
現行
impl-review-loopの Inputs は次が中心です。issue_numbercontract_snapshot_urlmax_iterationsimplementation_entry_decision、root_invocation_id、direct review result の入力は存在しません。#2272 は
impl-review-loopの文書と scripts を編集対象に含めていますが、次を定めていません。「process-level integration test」があっても、production call site がなければ、テスト専用コード同士をつないで AC8 を満たせます。
必須の carrier 定義
少なくとも次を固定してください。
プロセス境界を置くなら、Python の
subprocess.run(input=..., capture_output=True)により JSON を stdin へ渡し、stdout を machine-readable result、stderr を diagnostics に分離できます。([Python documentation]3)Claude-GPT host/launcher を変更する必要があるなら、実際の production caller path を Allowed Paths に追加してください。追加しない場合は、「既存のどの root-owned call site が carrier を提供するか」をファイル・関数単位で固定する必要があります。
P1-2 — routing state machine の型と優先順位が未定義
以下のフィールドは名前だけで、closed contract がありません。
review.source_kindreview.source_idreview.verdictrouting.reason_coderouting.resume_frominvocation.produced_by_phasebase_refの canonicalizationまた、複数条件が同時に発生した場合の優先順位もありません。
例:
goだが body drift と base drift が同時発生request_changesの後に process interruptionblockedcomment が共存goが共存推奨する優先順位は次です。
stoprerun_contract_reviewrerun_base_sensitive_preflightblocked/request_changesstopgoかつ live equality 成立invoke_impl_review_loopclosed schema を採用するなら、
required、enum、additionalProperties: falseを使い、未知フィールドや未知 route を fail-closed にすべきです。JSON Schema は追加プロパティを既定で許可するため、閉じた transport を意図する場合は明示的な禁止が必要です。(JSON Schema)ただし、これは #1860 が避けた closed enum/state-machine の再導入でもあります。したがって schema を大きくするより、root entry router の三値程度の process-local 戻り値へ縮小する方が整合します。
P1-3 — base SHA drift と body drift を同一 freshness として扱うと livelock する
Issue body/Allowed Paths の変更と、default branch tip の更新は性質が異なります。
既存 fingerprint producer は default base ref とその時点の SHA を取得して
base_sha_at_snapshotとして保存します。必要な規則は次です。
再試行回数と、上限到達時の terminal result も定義してください。上限なしの自動再レビューは、親が要求する deterministic terminal result と両立しません。
P1-4 — mutation partial failure と audit comment の位置付けが未確定
#2272 は次を同時に要求しています。
resume_fromを返すしかし、audit comment 投稿に失敗した場合に implementation entry を続けるかが定義されていません。
ここは明確に選ぶ必要があります。
audit が完全に非 authoritative の場合
audit 記録が必須の場合
現状はどちらとも読めます。
追加すべき fault cases は最低限次です。
goP1-5 — 現在の Verification Commands は「実 transport」を検証すると保証しない
各 AC に pytest 名が付いている点は改善ですが、テスト名だけでは以下の偽陽性が可能です。
impl-review-loopの Step 1 が本当に起動されたか観測しないprocess-level test には次を明記してください。
pytest の
tmp_pathは test function ごとに一意の temporary directory を提供します。monkeypatch は global state や network call の置換には使えますが、process boundary 自体の代替にはなりません。([pytest 文書]5)Child D #2278 の live E2E は必要ですが、#2272 の不十分な process test の代替にはなりません。#2278 は A/B/C merge 後に実行され、そこで発見した defect は follow-up Issue へ分離する契約だからです。すなわち、#2272 の transport defect を merge 前に防ぐ責務は依然として #2272 にあります。
推奨する再設計
最も #1860 と整合するのは、authorization packet を廃止し、root-owned synchronous transition にする設計です。
この設計では次が不要になります。
implementation_entry_decisionauthorization packetroot_invocation_idの永続化process-local の戻り値だけを残すなら、次程度で十分です。
重要なのは、この構造体に
authority: current_root_invocation_onlyと自己申告させることではありません。root が current-run result を受け取った同じ control flow 上でのみ利用し、保存・再ロードする API 自体を持たせないことです。Issue #2272 に必要な最小修正
Decisions Fixedに、導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 を維持するのか限定 supersede するのかを追加するimplementation_entry_decisionを authorization packet から process-local route result へ変更するissue-contract-reviewの実対象を Allowed Paths に追加するRequired Skills: なしを、少なくとも Python/pytest/Claude Code SubAgent transport 契約へ更新するこの修正なしでは、実装者は「既存 parser を再利用する」「direct object を使う」「comment は authority にしない」「digest-bound control-plane を作らない」という相互に両立しない四条件から、実装時に独自の authority model を選ばざるを得ません。現状の #2272 は問題診断としては妥当ですが、implementation contract としては未確定です。
squne121 commentedon Aug 21, 2026
issue-refinement-loop 終了報告
OWNER REQUEST_CHANGES(https://github.com/squne121/loop-protocol/issues/2272#issuecomment-5369439173)を反映した rewrite を実行し、fresh review が
approve/status: goとなったためapprovedで終了する。主な変更点(Step 4 rewrite):
Decisions Fixedを新設し、選択肢B(導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860/PR 実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1875/PR docs: workflow SSOT・Skill entrypointをPR #1875マージ後の状態へ整合 (#1876) #1880 の advisory・live-state 方針を維持し、supersede しない)を明示。implementation_entry_decision(authorization packet 型)を撤回し、ROOT_IMPLEMENTATION_ENTRY_ROUTE_V1(process-local・非永続・保存/再ロードAPIなしの route result)へ置換。Root-Owned Synchronous Entry Transitionを新設し、root/main thread が同一 control flow 内で capability preflight → live fetch → current-run review → live readback → route 決定まで同期実行する設計を明記。rerun_contract_review/rerun_base_preflight、base preflight は bounded retry 上限3回)を追加。root_invocation_idを廃止し、prompt_idまたは root 生成の process-local nonce(restart 後は復元しない)へ置換。issue-contract-reviewの comment-based fingerprint validator(comment ID・trusted author provenance 検証)を再利用すると主張せず、body_sha256/base_shaの直接比較(live equality check)として実装する方針に変更。.claude/skills/issue-contract-review/**は編集対象・Allowed Paths から除外(Allowed Paths は変更なし)。Required Skillsを「なし」から Python/pytest/Claude Code SubAgent transport 契約へ更新。検証結果:
contract_readiness_check.py --mode preflight-staticでstatus: go。run_root_review_pipeline.py produce):VERDICT: approve、BLOCKERS: 0、deterministic checks(C1-C13)全 pass。run_root_review_pipeline.py gate-final-review:final_review_allowed: true。squne121 commentedon Aug 21, 2026
implement-issue: 実装完了 (2026-08-21T12:48:53Z)
.claude/worktrees/issue-2272-issue-refinement-loop-impl-review-loop-fworktree-issue-2272-issue-refinement-loop-impl-review-loop-ffix: F401 unused pytest import を2ファイルから除去する (#2272)
fix: preparation.md の AC2 順序回帰と Japanese Check を修正する (#2272)
fix: termination-policy.md の Root-Owned Synchronous Entry Transition …
fix: PR #2282 の OWNER REQUEST_CHANGES を受け root-direct 方式へ再設計する (#2272)
fix: root-direct re-audit で確認された P0/P1 defect を解消する (#2272)
実装: issue-refinement-loop から impl-review-loop への fresh implementation…
squne121 commentedon Aug 22, 2026
post-merge-cleanup: 完了 (2026-08-22T02:33:14Z)
cleanup 実施内容
worktree-issue-2272-issue-refinement-loop-impl-review-loop-f.claude/worktrees/issue-2272-issue-refinement-loop-impl-review-loop-f