Skip to content

実装: issue-refinement-loop から impl-review-loop への fresh implementation entry contract を統一する #2272

Closed

Description

@squne121

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: immediate

Parent Issue

#2271

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

Current Validated Scope

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_preflight route で 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-loop Step 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_V1 comment のみが存在し、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_V1 commentのみが存在し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  # AC18

Allowed 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

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

  1. added
    enhancement
    phase/implementation
    agent/implementer
    on Aug 21, 2026
  2. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。

    Issue #2272 は、現行 impl-review-loop の intake 規則が自己矛盾していること、過去の LOOP_HANDOFF_RESULT_V1 コメントを authorization にしてはならないこと、プロセス再開時は live Issue から再判定すべきことを正しく捉えています。親レビューの P1-3/P1-4 もかなり反映されています。

    ただし、現在の本文は以下の三点で実装開始可能な契約になっていません。

    1. 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 系 Owner Decision を維持すると書きながら、digest-bound authorization を復活させている

    2. implementation_entry_decision の型はあるが、実際の transport と trusted caller identity がない

    3. 「既存 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 として明記します。

    選択肢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-review parser の fingerprint は、概ね次の七フィールドです。

    issue_number:
    contract_source_kind:
    contract_source_id:
    contract_body_sha256:
    allowed_paths_normalized_sha256:
    base_ref:
    base_sha_at_snapshot:

    さらに、既存 parser は以下を要求します。

    • contract_source_kind == issue_comment

    • contract_source_id は実際の GitHub comment ID

    • body SHA は sha256:<64hex>

    • Allowed Paths SHA は既定の形式

    • base は base_sha_at_snapshot

    • trusted author と実 comment provenance を検証する

    producer 側も comment POST 後に実 comment ID を取得し、PATCH/readback して fingerprint を確定する二段階処理です。

    一方、#2272 の新 schema は次のように変えています。

    binding:
      repository:
      issue_number:
      contract_body_sha256:
      allowed_paths_normalized_sha256:
      base_ref:
      base_sha:
    

    review:
    source_kind:
    source_id:

    具体的な不一致は次です。

    • 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 を次の二層へ分離してください。

    review_subject:
    repository:
    issue_number:
    contract_body_sha256:
    allowed_paths_normalized_sha256:
    base_ref:
    base_sha_at_snapshot:

    review_provenance:
    kind: direct_agent_result | issue_comment
    source_id:

    その上で、以下のどちらかを選びます。

    • canonicalization/hash 検証だけを既存 parser から pure module として抽出し、comment provenance 検証と分離する

    • direct result では既存 comment fingerprint を「再利用する」と主張せず、body/base の live equality を root control flow 内で直接確認する

    前者なら、最低でも次を Allowed Paths に加える必要があります。

    .claude/skills/issue-contract-review/scripts/contract_review_result_parser.py
    .claude/skills/issue-contract-review/tests/

    P0-3 — root_invocation_id は self-attested であり、current invocation を証明しない

    現在の schema は payload 内に次を置くだけです。

    invocation:
    root_invocation_id:
    produced_by_phase:

    しかし、以下が定義されていません。

    • 誰が 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 を識別する UUID

    • agent_id: SubAgent instance の識別子

    • last_assistant_message: SubAgent の最終応答

    SubAgent は親 session 内で実行され、結果を main conversation に返します。(Claude)

    ただし、親 #2271 は新しい enforcing hook の追加を禁止しています。従って推奨は次です。

    1. prompt_id が既存 host から既に取得可能なら correlation に利用する

    2. 取得不能なら root が process-local nonce を生成する

    3. expected nonce は root 側メモリに保持し、payload や audit comment から再取得しない

    4. session_id は audit correlation のみに使用する

    5. 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_number

    • optional contract_snapshot_url

    • max_iterations

    • human/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 定義

    少なくとも次を固定してください。

    carrier:
    producer: root-owned entry router
    source: verified current-run review result
    encoding: strict JSON
    delivery: explicit stdin or explicit function argument
    forbidden:
    - GitHub comment discovery
    - ambient environment lookup
    - stale artifact lookup
    - transcript scraping
    consumer: impl-review-loop preparation entry router

    プロセス境界を置くなら、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_kind

    • review.source_id

    • review.verdict

    • routing.reason_code

    • routing.resume_from

    • invocation.produced_by_phase

    • repository の canonical format

    • SHA の prefix、桁数、大文字小文字

    • base_ref の canonicalization

    また、複数条件が同時に発生した場合の優先順位もありません。

    例:

    • review は go だが body drift と base drift が同時発生

    • audit mutation は成功したが readback が失敗

    • request_changes の後に process interruption

    • stale direct object と fresh blocked comment が共存

    • capability preflight blocked と prior go が共存

    推奨する優先順位は次です。

    優先度 条件 route
    1 capability/live fetch/identity が検証不能 stop
    2 Issue body または Allowed Paths drift rerun_contract_review
    3 base SHA のみ drift rerun_base_sensitive_preflight
    4 verdict が blocked / request_changes stop
    5 current-run go かつ live equality 成立 invoke_impl_review_loop

    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 として保存します。

    必要な規則は次です。

    body / Allowed Paths drift
      -> full issue-contract-review
    

    base tip drift only
    -> base-sensitive preflight
    -> exact base SHA を pin
    -> worktree をその SHA から作成
    -> bounded retry

    reviewed base と実 worktree base が不一致
    -> implementation は開始しない

    再試行回数と、上限到達時の 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 記録が必須の場合

    現状はどちらとも読めます。

    追加すべき fault cases は最低限次です。

    • mutation 成功、応答 lost、readback で一件一致

    • mutation 成功、readback failure

    • mutation 成功、readback 後に process kill

    • mutation結果不明、同一 marker が複数件

    • audit publish failure、direct result は fresh go

    • restart 後、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 には次を明記してください。

    - producer/router と consumer を別 subprocess として起動

    • strict JSON を stdin/stdout で受け渡す
    • fake GitHub transport は production と同一 interface へ依存注入
    • 各 test は pytest tmp_path の独立 repo/state を使用
    • Step 1 invocation spy を設置
    • negative case では invocation count == 0
    • fresh go caseのみ invocation count == 1
    • process kill後は新しい process/新しい root nonce で再開
    • 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 にする設計です。

    root/main thread
    |
    |-- capability preflight
    |-- live Issue fetch
    |-- current-run issue contract review
    |-- live Issue + base readback
    |
    |-- body/Allowed Paths drift --> rerun review
    |-- base drift only ----------> rerun base preflight
    |-- blocked/request_changes --> typed stop
    |-- fresh go -----------------> direct impl-review-loop invocation
    |
    `-- audit comment publish(best effort、route決定後)

    この設計では次が不要になります。

    • implementation_entry_decision authorization packet

    • root_invocation_id の永続化

    • comment fingerprint と direct result fingerprint の統合

    • impl-review-loop による過去 artifact 探索

    • restart-safe authorization token

    process-local の戻り値だけを残すなら、次程度で十分です。

    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:

    重要なのは、この構造体に authority: current_root_invocation_only と自己申告させることではありません。root が current-run result を受け取った同じ control flow 上でのみ利用し、保存・再ロードする API 自体を持たせないことです。


    Issue #2272 に必要な最小修正

    1. Decisions Fixed に、導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 を維持するのか限定 supersede するのかを追加する

    2. implementation_entry_decision を authorization packet から process-local route result へ変更する

    3. AC13 の「既存 fingerprint fields を再利用」を削除または pure fingerprint module 抽出へ変更する

    4. body drift と base drift の route を分離し、bounded retry を定義する

    5. audit comment publish failure が routing を変更するか明記する

    6. production carrier、producer、consumer、call site をファイル・関数単位で固定する

    7. transport 実装を変更するなら、root/launcher または issue-contract-review の実対象を Allowed Paths に追加する

    8. process restart、nonce mismatch、comment-only replay、ambiguous mutation を AC に追加する

    9. negative test で Step 1 side effect がゼロであることを必須化する

    10. 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 もかなり反映されています。

    ただし、現在の本文は以下の三点で実装開始可能な契約になっていません。

    1. 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 系 Owner Decision を維持すると書きながら、digest-bound authorization を復活させている
    2. implementation_entry_decision の型はあるが、実際の transport と trusted caller identity がない
    3. 「既存 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 として明記します。

    選択肢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-review parser の fingerprint は、概ね次の七フィールドです。

    issue_number:
    contract_source_kind:
    contract_source_id:
    contract_body_sha256:
    allowed_paths_normalized_sha256:
    base_ref:
    base_sha_at_snapshot:

    さらに、既存 parser は以下を要求します。

    • contract_source_kind == issue_comment
    • contract_source_id は実際の GitHub comment ID
    • body SHA は sha256:<64hex>
    • Allowed Paths SHA は既定の形式
    • base は base_sha_at_snapshot
    • trusted author と実 comment provenance を検証する

    producer 側も comment POST 後に実 comment ID を取得し、PATCH/readback して fingerprint を確定する二段階処理です。

    一方、#2272 の新 schema は次のように変えています。

    binding:
      repository:
      issue_number:
      contract_body_sha256:
      allowed_paths_normalized_sha256:
      base_ref:
      base_sha:
    
    review:
      source_kind:
      source_id:

    具体的な不一致は次です。

    • 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 を次の二層へ分離してください。

    review_subject:
      repository:
      issue_number:
      contract_body_sha256:
      allowed_paths_normalized_sha256:
      base_ref:
      base_sha_at_snapshot:
    
    review_provenance:
      kind: direct_agent_result | issue_comment
      source_id:

    その上で、以下のどちらかを選びます。

    • canonicalization/hash 検証だけを既存 parser から pure module として抽出し、comment provenance 検証と分離する
    • direct result では既存 comment fingerprint を「再利用する」と主張せず、body/base の live equality を root control flow 内で直接確認する

    前者なら、最低でも次を Allowed Paths に加える必要があります。

    .claude/skills/issue-contract-review/scripts/contract_review_result_parser.py
    .claude/skills/issue-contract-review/tests/
    

    P0-3 — root_invocation_id は self-attested であり、current invocation を証明しない

    現在の schema は payload 内に次を置くだけです。

    invocation:
      root_invocation_id:
      produced_by_phase:

    しかし、以下が定義されていません。

    • 誰が 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 を識別する UUID
    • agent_id: SubAgent instance の識別子
    • last_assistant_message: SubAgent の最終応答

    SubAgent は親 session 内で実行され、結果を main conversation に返します。([Claude]2)

    ただし、親 #2271 は新しい enforcing hook の追加を禁止しています。従って推奨は次です。

    1. prompt_id が既存 host から既に取得可能なら correlation に利用する
    2. 取得不能なら root が process-local nonce を生成する
    3. expected nonce は root 側メモリに保持し、payload や audit comment から再取得しない
    4. session_id は audit correlation のみに使用する
    5. 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_number
    • optional contract_snapshot_url
    • max_iterations
    • human/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 定義

    少なくとも次を固定してください。

    carrier:
      producer: root-owned entry router
      source: verified current-run review result
      encoding: strict JSON
      delivery: explicit stdin or explicit function argument
      forbidden:
        - GitHub comment discovery
        - ambient environment lookup
        - stale artifact lookup
        - transcript scraping
      consumer: impl-review-loop preparation entry router

    プロセス境界を置くなら、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_kind
    • review.source_id
    • review.verdict
    • routing.reason_code
    • routing.resume_from
    • invocation.produced_by_phase
    • repository の canonical format
    • SHA の prefix、桁数、大文字小文字
    • base_ref の canonicalization

    また、複数条件が同時に発生した場合の優先順位もありません。

    例:

    • review は go だが body drift と base drift が同時発生
    • audit mutation は成功したが readback が失敗
    • request_changes の後に process interruption
    • stale direct object と fresh blocked comment が共存
    • capability preflight blocked と prior go が共存

    推奨する優先順位は次です。

    優先度 条件 route
    1 capability/live fetch/identity が検証不能 stop
    2 Issue body または Allowed Paths drift rerun_contract_review
    3 base SHA のみ drift rerun_base_sensitive_preflight
    4 verdict が blocked / request_changes stop
    5 current-run go かつ live equality 成立 invoke_impl_review_loop

    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 として保存します。

    必要な規則は次です。

    body / Allowed Paths drift
      -> full issue-contract-review
    
    base tip drift only
      -> base-sensitive preflight
      -> exact base SHA を pin
      -> worktree をその SHA から作成
      -> bounded retry
    
    reviewed base と実 worktree base が不一致
      -> implementation は開始しない
    

    再試行回数と、上限到達時の 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 記録が必須の場合

    現状はどちらとも読めます。

    追加すべき fault cases は最低限次です。

    • mutation 成功、応答 lost、readback で一件一致
    • mutation 成功、readback failure
    • mutation 成功、readback 後に process kill
    • mutation結果不明、同一 marker が複数件
    • audit publish failure、direct result は fresh go
    • restart 後、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 には次を明記してください。

    - producer/router と consumer を別 subprocess として起動
    - strict JSON を stdin/stdout で受け渡す
    - fake GitHub transport は production と同一 interface へ依存注入
    - 各 test は pytest tmp_path の独立 repo/state を使用
    - Step 1 invocation spy を設置
    - negative case では invocation count == 0
    - fresh go caseのみ invocation count == 1
    - process kill後は新しい process/新しい root nonce で再開
    - prior payload replayは拒否
    

    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 にする設計です。

    root/main thread
      |
      |-- capability preflight
      |-- live Issue fetch
      |-- current-run issue contract review
      |-- live Issue + base readback
      |
      |-- body/Allowed Paths drift --> rerun review
      |-- base drift only ----------> rerun base preflight
      |-- blocked/request_changes --> typed stop
      |-- fresh go -----------------> direct impl-review-loop invocation
      |
      `-- audit comment publish(best effort、route決定後)
    

    この設計では次が不要になります。

    • implementation_entry_decision authorization packet
    • root_invocation_id の永続化
    • comment fingerprint と direct result fingerprint の統合
    • impl-review-loop による過去 artifact 探索
    • restart-safe authorization token

    process-local の戻り値だけを残すなら、次程度で十分です。

    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:

    重要なのは、この構造体に authority: current_root_invocation_only と自己申告させることではありません。root が current-run result を受け取った同じ control flow 上でのみ利用し、保存・再ロードする API 自体を持たせないことです。


    Issue #2272 に必要な最小修正

    1. Decisions Fixed に、導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 を維持するのか限定 supersede するのかを追加する
    2. implementation_entry_decision を authorization packet から process-local route result へ変更する
    3. AC13 の「既存 fingerprint fields を再利用」を削除または pure fingerprint module 抽出へ変更する
    4. body drift と base drift の route を分離し、bounded retry を定義する
    5. audit comment publish failure が routing を変更するか明記する
    6. production carrier、producer、consumer、call site をファイル・関数単位で固定する
    7. transport 実装を変更するなら、root/launcher または issue-contract-review の実対象を Allowed Paths に追加する
    8. process restart、nonce mismatch、comment-only replay、ambiguous mutation を AC に追加する
    9. negative test で Step 1 side effect がゼロであることを必須化する
    10. Required Skills: なし を、少なくとも Python/pytest/Claude Code SubAgent transport 契約へ更新する

    この修正なしでは、実装者は「既存 parser を再利用する」「direct object を使う」「comment は authority にしない」「digest-bound control-plane を作らない」という相互に両立しない四条件から、実装時に独自の authority model を選ばざるを得ません。現状の #2272 は問題診断としては妥当ですが、implementation contract としては未確定です。

  3. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    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 決定まで同期実行する設計を明記。
    • routing 優先順位表(5段階)、body drift と base drift の route 分離(rerun_contract_review / rerun_base_preflight、base preflight は bounded retry 上限3回)を追加。
    • production carrier(producer/consumer/delivery/forbidden)をファイル・関数単位で固定。
    • 自己申告 root_invocation_id を廃止し、prompt_id または root 生成の process-local nonce(restart 後は復元しない)へ置換。
    • AC13 を撤回・明確化: 既存 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 は変更なし)。
    • audit comment publish failure を non-authoritative の best-effort として明記(route 決定に影響しない)。
    • Process-Level Test Requirements(別 subprocess・fake transport 依存注入・tmp_path 分離・invocation spy・negative case invocation count 0・process kill 後の新 nonce・comment-only replay 拒否)を明記。
    • AC を14件から18件へ拡張(AC15: nonce非復元、AC16: audit publish failureがrouteに非影響、AC17: negative case invocation count 0、AC18: comment-only replay拒否)。VC もAC単位で更新。
    • Required Skills を「なし」から Python/pytest/Claude Code SubAgent transport 契約へ更新。

    検証結果:

    • pre-edit / post-edit ともに contract_readiness_check.py --mode preflight-static で status: go。
    • rewrite 後の fresh review(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。
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: "https://github.com/squne121/loop-protocol/issues/2272#issuecomment-5369439173"
        generated_at: "2026-08-21T11:55:58Z"
        body_sha256: "sha256:b083a01ff50e6524ed0ea54fc890de76015ca6e2ed8fabfb586dca185bc03550"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "本ループでは label 変更を行っていない"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-21T11:58:03Z"
      checked_body_sha256: "sha256:b083a01ff50e6524ed0ea54fc890de76015ca6e2ed8fabfb586dca185bc03550"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
  4. self-assigned this
    on Aug 21, 2026
  5. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-21T12:48:53Z)

  6. squne121 commented on Aug 22, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-08-22T02:33:14Z)

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues:
        - request_dedupe_key: "follow-up:squne121/loop-protocol:issue:2278"
          status: reused_open
          issue:
            number: 2278
            url: "https://github.com/squne121/loop-protocol/issues/2278"
          reason: "dedupe_key文字列検索ではヒットしなかったが、提案タイトルが既存Issue #2278(open)のタイトルと完全一致するため、新規起票せず既存Issueを再利用と判定した。"
    
      note_only_observations: []

    cleanup 実施内容

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent/implementerenhancementphase/implementation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions