Skip to content

実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ #3004

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "contract snapshot の正常な POST/PATCH 後に Issue.updatedAt の読取り時差が生じても、検証済みの自分の投稿を false-stale とせず、後続の trusted blocked を含む真正な競合だけを fail-closed にする"
change_kind: workflow
dedupe_key: "impl-review-loop:ensure-snapshot:own-publish-updated-at-race-false-stale"

Parent Issue

none(単独の再発防止)

Parent Goal Ref

Current Validated Scope

2026-10-10 の main 2258cccf17ed631441ea8573efcca178f9ce4af9 で .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py と既存テストを確認した。

Remaining Parent Gaps

なし。#2982 と #2993 の実装コード・CI は変更しない。

Outcome

ensure_contract_snapshot.py --mode auto --post で実際に作成した trusted snapshot が、同一 Issue body・同一 comment ID/body・同一 fingerprint・同一 base に束縛され、最終 readback の全コメント集合に対する canonical parser の結果でも当該 go が authoritative であるとき、自己投稿に由来する updatedAt の時刻差だけで stale_or_conflicting_snapshot を返さない。後続の trusted blocked、外部の Issue 本文変更、base drift、fingerprint 不整合、不完全 readback は従来どおり失効させる。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: fake GitHub remote state machine による deterministic pytest で、POST/PATCH/readback の呼出順序と race を再現できる。実 GitHub に Issue を作成する live test は通常 VC に含めない。

In Scope

  • .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py の verify_snapshot_authority_postcondition() と materialized_go 経路を最小修正する。
    • 最終 readback で取得したコメント集合全体に、既存 canonical parser の trusted filtering と authoritative result priority を適用する。
    • 自己 POST/PATCH 完了後の materialized_go 経路に限り、updatedAt の時刻差のみの場合に bounded read-only reconciliation を許可する。
  • .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py に、real ensure_contract_snapshot() / real verify_snapshot_authority_postcondition() / real canonical parser を通す regression を追加する。外部 I/O と remote state だけを fake にする。
  • 既存 test_contract_snapshot_author_binding.py を回帰確認し、trusted publisher / digest / fingerprint binding が退行しないことを確認する。

Out of Scope

Acceptance Criteria

  • AC1: fake remote で POST/PATCH が成功し、時刻が U0 → U1 → U1 と推移して Issue body・comment ID/body・fingerprint・base が不変なら、real ensure_contract_snapshot() が元の snapshot URL を付けて status: ok / source: materialized_go を返す。POST は 1 回、PATCH は 1 回、対象 comment ID は投稿した 1 件のみで、重複コメントを発生させず、reconciliation のために POST/PATCH を繰り返さない。
  • AC2: final readback で取得したコメント集合全体に対して、既存 canonical parser の trusted filtering と authoritative result priority を適用する。自己投稿した go より後に authoritative な trusted blocked が現れた場合は、updatedAt が両取得で一致していても失敗する(時刻一致を理由に検査を省略しない)。untrusted blocked と通常コメントは authoritative 扱いせず、独自のコメント増加ルールで無条件に拒否もしない。
  • AC3: 時刻差の reconciliation は自己 POST/PATCH 完了後の materialized_go 経路だけに限定する。Issue body SHA、comment ID と最終 comment body SHA、fingerprint、base ref/SHA を固定し、authoritative result priority を維持する。時刻差のみの場合に限り bounded read-only 再 readback を許可する。途中で実際に観測した不一致は後続の一致で帳消しにしない。上限到達と不完全 readback は成功扱いしない。単純な expected_updated_at の更新、固定期待時刻による無限 retry、共有 verifier の時刻比較の削除は行わない。check-only / existing_go の既存の時刻ドリフト拒否は緩和しない。
  • AC4: post-publication 時点で Issue body 変更、comment ID/body/fingerprint の不整合、base ref/SHA 変更、不完全 readback、reconciliation 上限到達のいずれかを注入すると、real ensure_contract_snapshot() は従来どおり fail-closed となる。
  • AC5: 新規 regression は real ensure_contract_snapshot()、real verify_snapshot_authority_postcondition()、real canonical parser を実行する。POST/PATCH/readback の wiring を扱うケースでは必要な real publisher / binding helper も実行する。fake にしてよいのは外部 I/O と remote state だけで、検証対象の production 判定関数を success-only stub に置き換えない。既存テストの _real_* 参照と fake remote を優先して再利用する。
  • AC6: 新規テストを旧 production implementation と組み合わせると実 assertion が失敗し、修正後の implementation では同じテストが成功する。exit 5 / import error / skip / xfail は再現成功として扱わない。主要変異(reconciliation 削除、trusted priority 検証削除、check-only への例外拡大)が、それぞれ別の新規テスト失敗になる。pr_review_only は事前検証の扱いであり、最終 AC 達成や executed PASS を意味しない。
  • AC7: 既存 test_ensure_contract_snapshot.py 全体と test_contract_snapshot_author_binding.py が PASS し、check-only の existing_go 判定と時刻差拒否、producer binding、POST/PATCH round-trip の回帰が維持される。
  • AC8: 新 schema / gate / ledger / lock service / approval layer は増えず、変更は Allowed Paths 内に限定され、実 GitHub に Issue を作成する live test を通常 VC に追加しない。

Verification Commands

# AC1
# AC2
# AC3
# AC4
# AC5
# AC6
# preflight-scope: pr_review_only
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race

# AC7
# baseline-expect: pass
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q

# AC7
# baseline-expect: pass
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py -q

# AC8
# preflight-scope: pr_review_only
$ git diff --name-only origin/main...HEAD

Allowed Paths

  • .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py
  • .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py
  • .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py(回帰 fixture 変更が必要な場合のみ)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • 権威ある readback を省略するか、実際の外部競合を成功扱いしないと修正できない場合

Required Skills

なし

Required Design References

  • docs/dev/workflow.md
  • .claude/skills/impl-review-loop/steps/preparation.md
  • .claude/skills/impl-review-loop/steps/step-4-pr-review.md

Delivery Rule

1 Issue = 1 PR。#2916 / PR #2982 に変更を混ぜない。現行 workflow と既存テストのみを使い最小修正する。

Activity

  1. squne121 commented on Oct 10, 2026

    @squne121
    OwnerAuthor

    判定:REQUEST_CHANGES

    方向性は妥当ですが、現状の Issue 契約のままでは「false-stale を直したつもりで競合を見逃す実装」と「実装前の VC で停止する状態」の両方が起こり得ます。 特に重要なのは、最終検証が他の trusted コメントを見ていない点と、未実装テストを -k で指定する VC です。

    レビュー基準は、取得時点の main 81b2c54fcee20dcf25f04ca0da57bed077568916 です。以下は Issue 契約と現行コードに対するレビューであり、未作成の修正 PR に対する判定ではありません。

    1. P1:AC2 が「維持する」としている trusted block の検出は、現行の最終検証で成立していない

    問題

    Issue #3004 の AC2 は、投稿後に別の trusted block が現れた場合も、従来どおり fail-closed を維持することを要求しています。しかし、現行 verify_snapshot_authority_postcondition() はコメント一覧を取得した後、自分が投稿した ID のコメントだけを取り出し、その一件だけを parser に渡しています。後から追加された別の trusted blocked は最終判定の入力に入りません。

    現行処理の要点は次のとおりです。

    コメント一覧を取得
      → expected_comment_id のコメント C を抽出
      → parse_contract_review_results([C], ...)
      → C が authoritative go かを検査

    コード上の反例

    投稿前の競合検査:問題なし
    自分の go コメント C を投稿・確定
    別の trusted blocked コメント D が追加される
    投稿後の Issue.updatedAt 読取り:U1
    最終検証の Issue.updatedAt 読取り:U1
    最終コメント一覧:[C, D]
    最終 parser 入力:[C] のみ
    → D を無視して成功し得る

    これは updatedAt の伝播遅延を仮定しなくても成立します。両方の時刻読取りが既に D の追加を反映していれば、時刻比較は一致するからです。投稿前には全体の競合を検査していても、投稿後のこの窓は埋まりません。

    影響

    時刻比較を緩和するだけでは、この既存欠陥が残ります。また、negative fixture が「trusted block を追加すると同時に updatedAt も不一致にする」構成だと、時刻差だけで失敗してしまい、trusted block を実際には読んでいないテストが PASS します。

    最小修正

    AC2 を「既存挙動の維持」だけでなく、次の具体的な要件にしてください。

    最終 readback で取得したコメント集合に対し、既存 parser の trusted filtering と結果優先順位を適用し、自己投稿した go が後続の authoritative result によって失効していないことを確認する。updatedAt が一致する場合も、この検査を省略しない。

    既存 parser には authoritative filtering と latest-result 判定があります。新しい parser や「コメントが増えたら停止する」独自規則は不要です。特に、untrusted blocked や通常の会話コメントまで停止理由にしないことが重要です。


    2. P1:新規 -k selector の VC は、現行 workflow では期待失敗ではなく設計不備として停止する

    問題

    AC1・AC2 の VC は次の形です。

    # baseline-expect: fail
    $ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race

    この selector に対応するテストは、今回の Issue で追加する前提です。ところが repository の current authoring rule は、既存ファイルに未実装テスト名を -k で指定する形を明示的に禁止しています。テスト未収集は vc_no_tests_collected として扱われ、baseline-expect: fail を付けても通常の defect reproduction にはなりません。

    これは pytest 自体も区別している事象です。テストが実行されて失敗した場合は exit 1、テストが収集されなかった場合は exit 5 です。現行 preflight と adjudicator も exit 5 を特別扱いしています。pytest ドキュメント

    影響

    修正コードに到達する前に contract refinement が必要になり、今回解消したい「正常な作業を harness が止める」問題を、Issue 自身が再発させます。

    最小修正

    今回の Allowed Paths と既存の #2635 の前例に合わせるなら、focused test を pr_review_only にするのが扱いやすいです。#2635 も、実 orchestration に追加する新規 focused test をこの方式で扱っています。

    # AC1
    # AC2
    # preflight-scope: pr_review_only
    $ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race

    ただし、事前審査での未実行と、修正後の検証成功は分ける必要があります。受け入れ条件には次を加えるべきです。

    新規テストを旧 production implementation に適用すると、対象の assertion が失敗する。修正後の実装では同じテストが成功する。未収集・import error・skip を defect reproduction として扱わない。

    既存のファイル全体・author-binding suite の regression VC は維持できます。新しい VC checker や wrapper を作る必要はありません。


    3. P2:updatedAt を再確認する条件が曖昧で、単純 retry では直らず、単純な比較削除では広く緩みすぎる

    問題

    現行コードは、すでに POST/PATCH 後に Issue を再取得し、その updated_at_post を最終検証の期待値に渡しています。したがって、「投稿前ではなく投稿後の時刻を使う」だけの修正は、現状との差分になりません。

    現在の失敗クラスは、例えば次の遷移です。

    POST/PATCH 後の取得:body=B、updatedAt=U0
    最終検証での取得:  body=B、updatedAt=U1
    → U0 != U1 で失敗

    ここで expected_updated_at=U0 のまま最終検証を繰り返しても、以後の読取りが U1 に収束した場合は永遠に一致しません。一方、共有 verifier から時刻比較を削除すると、existing_go・check-only など自己投稿直後ではない経路の意味まで変わります。既存テストは、それらの経路での時刻ドリフト拒否を固定しています。

    もう一つの曖昧さは、「自己投稿による時刻更新」の判別です。

    repository の Issue 取得は gh issue view --json body,updatedAt、コメント操作は REST API です。確認した upstream の gh issue view 実装も、指定フィールドを GraphQL の FindIssueOrPR() で取得する構成です。別リソース・別読取り経路の観測値を、自己更新の因果証明と同一視することはできません。GitHub

    同じ body・comment・fingerprint・base が観測され、時刻だけが変わったという情報からは、その更新が自己投稿由来か、契約に無関係な別更新由来かまでは判別できません。これは fixture に「自己更新」とラベルを付けても解決しない、観測入力の問題です。

    最小修正

    Issue には、原因推定ではなく実装が判定できる条件を記載してください。

    今回の自己 POST/PATCH 完了後の materialized_go 経路に限り、固定した Issue body SHA、comment ID、最終 comment body SHA、fingerprint、base ref/SHA、および canonical な trusted-result 優先順位を再確認する。時刻差だけの場合は、上限付きの read-only reconciliation を許可する。

    そのうえで、次の境界を固定するのが適切です。

    境界 | 要求する挙動 -- | -- 再確認の対象 | 時刻だけでなく、成功の根拠となる一式を再取得・検査する 固定する期待値 | body SHA、comment ID/body SHA、fingerprint、base を観測値へ追従させない 再試行対象 | 今回許容する時刻差に限定する 実際の不一致を観測した場合 | 後続読取りで元に戻っても、その不一致を「自己投稿の副作用」として消さない 書込み | reconciliation のために POST/PATCH を繰り返さない 終了 | 試行回数・総時間に上限を持ち、未確定を成功扱いしない 他の呼出し経路 | check-only・既存 go 再利用の時刻ドリフト契約は変更しない

    このうち「通常コメント/untrusted block は余計に止めない」は、新しい仕様を発明する趣旨ではなく、既存 parser の authoritative filtering をそのまま使用する要求です。

    関連 Issue・PR との切り分け

    PR #2993 と #2982 は、今回の修正待ちに戻す対象ではありません。 #2993 は protected-script 検査の false-fail 修正で、2026年10月9日に merge 済みです。#2982 は実行済み pr_review_only non-pass を reviewer に委譲する変更で、2026年10月10日に merge 済みです。今回の取得時 main は後者の merge commit でした。発見経路と修正対象を混ぜない整理が必要です。

    #2996 は別の consumer 接続問題です。 ensure の出力 envelope を Step 4 へ渡す際の正規化を所有しています。#3004 で出力 schema や adjudicator を変更する必要はなく、現在の scope 分離は維持してよいです。

    #2627/#2635 の成果は再利用すべきです。 POST/PATCH の transport と、staging body・最終永続化 body の digest 区別は既に扱われています。今回、その機構を作り直す理由はありません。コメント本文の検証も、GitHub が返す raw Markdown の body と既存 binding を使い続けるのが適切です。GitHub Docs

    #1655 との関係は、限定例外として明示するのがよいです。 同 Issue は body・updatedAt・trusted comment・base の途中ドリフト拒否を要求しています。#3004 が変更するのは「今回の自己投稿完了後の時刻差の扱い」であり、base-bound snapshot 再利用全体を緩める変更ではない、と記載すべきです。ただし、それを理由に新しい承認待ちや別 Issue の merge 待ちを作る必要はありません。

    原因の確度と、増やさないほうがよい仕組み

    Issue #3004 には、投稿時の最終検証が authority_issue_updated_at_mismatch で失敗し、その後の check-only では同じ snapshot を再利用できた、という記録があります。参照された #2989 の snapshot コメント自体も確認できました。ただし、この二つだけで、当初の失敗が GitHub の伝播遅延による false-negative だったと因果確定はできません。 当該実行時の全読取り値と競合状態が必要です。fake remote は想定 failure class の再現には使えますが、過去の実行原因の証明にはなりません。

    したがって、本文は「伝播遅延が疑われる観測」と「今回固定する deterministic な挙動」を分けるべきです。原因確定のためだけに live GitHub 再現を恒久 gate にする必要はありません。なお、関連する test_ensure_contract_snapshot_fingerprint_patch.py は実 GitHub に使い捨て Issue を作成・close する live test を含むため、名前だけを見て今回の通常 VC へ一括追加するのも避けるべきです。

    current impl-review-loop は contract snapshot を advisory artifact と位置付けています。helper が不確かな snapshot を成功として返さないことと、開発 workflow 全体を新しい gate で停止させることは別です。 この修正は、既存 verifier・parser・局所 fixture の改善に留めるのが、個人趣味開発という前提にも合っています。

    推奨は、上記4点を #3004 の本文へ反映したうえで、既存の POST/PATCH と author binding を維持し、materialized_go 専用の限定 reconciliation を実装することです。 新 schema、ledger、lock service、approval layer は不要です。

    このレビューでは GitHub 上の変更・コメント投稿は行っていません。また、repository の pytest と live GitHub への書込み再現は実行していません。競合コメントの見落としは現行コードから導いた反例、伝播遅延は未確定の原因仮説として区別しています。

    ## 判定:REQUEST_CHANGES

    方向性は妥当ですが、現状の Issue 契約のままでは「false-stale を直したつもりで競合を見逃す実装」と「実装前の VC で停止する状態」の両方が起こり得ます。 特に重要なのは、最終検証が他の trusted コメントを見ていない点と、未実装テストを -k で指定する VC です。

    レビュー基準は、取得時点の main 81b2c54fcee20dcf25f04ca0da57bed077568916 です。以下は Issue 契約と現行コードに対するレビューであり、未作成の修正 PR に対する判定ではありません。

    1. P1:AC2 が「維持する」としている trusted block の検出は、現行の最終検証で成立していない

    問題

    Issue #3004 の AC2 は、投稿後に別の trusted block が現れた場合も、従来どおり fail-closed を維持することを要求しています。しかし、現行 verify_snapshot_authority_postcondition() はコメント一覧を取得した後、自分が投稿した ID のコメントだけを取り出し、その一件だけを parser に渡しています。後から追加された別の trusted blocked は最終判定の入力に入りません。

    現行処理の要点は次のとおりです。

    コメント一覧を取得
      → expected_comment_id のコメント C を抽出
      → parse_contract_review_results([C], ...)
      → C が authoritative go かを検査
    

    コード上の反例

    投稿前の競合検査:問題なし
    自分の go コメント C を投稿・確定
    別の trusted blocked コメント D が追加される
    投稿後の Issue.updatedAt 読取り:U1
    最終検証の Issue.updatedAt 読取り:U1
    最終コメント一覧:[C, D]
    最終 parser 入力:[C] のみ
    → D を無視して成功し得る
    

    これは updatedAt の伝播遅延を仮定しなくても成立します。両方の時刻読取りが既に D の追加を反映していれば、時刻比較は一致するからです。投稿前には全体の競合を検査していても、投稿後のこの窓は埋まりません。

    影響

    時刻比較を緩和するだけでは、この既存欠陥が残ります。また、negative fixture が「trusted block を追加すると同時に updatedAt も不一致にする」構成だと、時刻差だけで失敗してしまい、trusted block を実際には読んでいないテストが PASS します。

    最小修正

    AC2 を「既存挙動の維持」だけでなく、次の具体的な要件にしてください。

    最終 readback で取得したコメント集合に対し、既存 parser の trusted filtering と結果優先順位を適用し、自己投稿した go が後続の authoritative result によって失効していないことを確認する。updatedAt が一致する場合も、この検査を省略しない。

    既存 parser には authoritative filtering と latest-result 判定があります。新しい parser や「コメントが増えたら停止する」独自規則は不要です。特に、untrusted blocked や通常の会話コメントまで停止理由にしないことが重要です。


    2. P1:新規 -k selector の VC は、現行 workflow では期待失敗ではなく設計不備として停止する

    問題

    AC1・AC2 の VC は次の形です。

    # baseline-expect: fail
    $ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race

    この selector に対応するテストは、今回の Issue で追加する前提です。ところが repository の current authoring rule は、既存ファイルに未実装テスト名を -k で指定する形を明示的に禁止しています。テスト未収集は vc_no_tests_collected として扱われ、baseline-expect: fail を付けても通常の defect reproduction にはなりません。

    これは pytest 自体も区別している事象です。テストが実行されて失敗した場合は exit 1、テストが収集されなかった場合は exit 5 です。現行 preflight と adjudicator も exit 5 を特別扱いしています。[pytest ドキュメント](https://docs.pytest.org/en/stable/reference/exit-codes.html)

    影響

    修正コードに到達する前に contract refinement が必要になり、今回解消したい「正常な作業を harness が止める」問題を、Issue 自身が再発させます。

    最小修正

    今回の Allowed Paths と既存の #2635 の前例に合わせるなら、focused test を pr_review_only にするのが扱いやすいです。#2635 も、実 orchestration に追加する新規 focused test をこの方式で扱っています。

    # AC1
    # AC2
    # preflight-scope: pr_review_only
    $ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race

    ただし、事前審査での未実行と、修正後の検証成功は分ける必要があります。受け入れ条件には次を加えるべきです。

    新規テストを旧 production implementation に適用すると、対象の assertion が失敗する。修正後の実装では同じテストが成功する。未収集・import error・skip を defect reproduction として扱わない。

    既存のファイル全体・author-binding suite の regression VC は維持できます。新しい VC checker や wrapper を作る必要はありません。


    3. P2:updatedAt を再確認する条件が曖昧で、単純 retry では直らず、単純な比較削除では広く緩みすぎる

    問題

    現行コードは、すでに POST/PATCH 後に Issue を再取得し、その updated_at_post を最終検証の期待値に渡しています。したがって、「投稿前ではなく投稿後の時刻を使う」だけの修正は、現状との差分になりません。

    現在の失敗クラスは、例えば次の遷移です。

    POST/PATCH 後の取得:body=B、updatedAt=U0
    最終検証での取得:  body=B、updatedAt=U1
    → U0 != U1 で失敗
    

    ここで expected_updated_at=U0 のまま最終検証を繰り返しても、以後の読取りが U1 に収束した場合は永遠に一致しません。一方、共有 verifier から時刻比較を削除すると、existing_go・check-only など自己投稿直後ではない経路の意味まで変わります。既存テストは、それらの経路での時刻ドリフト拒否を固定しています。

    もう一つの曖昧さは、「自己投稿による時刻更新」の判別です。

    repository の Issue 取得は gh issue view --json body,updatedAt、コメント操作は REST API です。確認した upstream の gh issue view 実装も、指定フィールドを GraphQL の FindIssueOrPR() で取得する構成です。別リソース・別読取り経路の観測値を、自己更新の因果証明と同一視することはできません。[GitHub](https://raw.githubusercontent.com/cli/cli/trunk/pkg/cmd/issue/view/view.go)

    同じ body・comment・fingerprint・base が観測され、時刻だけが変わったという情報からは、その更新が自己投稿由来か、契約に無関係な別更新由来かまでは判別できません。これは fixture に「自己更新」とラベルを付けても解決しない、観測入力の問題です。

    最小修正

    Issue には、原因推定ではなく実装が判定できる条件を記載してください。

    今回の自己 POST/PATCH 完了後の materialized_go 経路に限り、固定した Issue body SHA、comment ID、最終 comment body SHA、fingerprint、base ref/SHA、および canonical な trusted-result 優先順位を再確認する。時刻差だけの場合は、上限付きの read-only reconciliation を許可する。

    そのうえで、次の境界を固定するのが適切です。

    境界 要求する挙動
    再確認の対象 時刻だけでなく、成功の根拠となる一式を再取得・検査する
    固定する期待値 body SHA、comment ID/body SHA、fingerprint、base を観測値へ追従させない
    再試行対象 今回許容する時刻差に限定する
    実際の不一致を観測した場合 後続読取りで元に戻っても、その不一致を「自己投稿の副作用」として消さない
    書込み reconciliation のために POST/PATCH を繰り返さない
    終了 試行回数・総時間に上限を持ち、未確定を成功扱いしない
    他の呼出し経路 check-only・既存 go 再利用の時刻ドリフト契約は変更しない

    GitHub 公式の「大量の mutative request の間を空ける」という推奨は、secondary rate limit 対策です。一定時間 sleep すれば Issue とコメントの観測が整合する、という保証として使ってはいけません。 また、unsafe method の conditional request は原則非対応なので、ここに安易な If-Match/CAS 設計を足す方向も勧めません。[GitHub Docs](https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api)


    4. P2:「実 ensure_contract_snapshot() を通す」だけでは、今回の検証経路をテストしたことにならない

    問題

    test_ensure_contract_snapshot.py の autouse fixture は、少なくとも次を成功固定の stub に置き換えています。

    verify_controlled_publisher_comment_id_binding
    patch_comment
    verify_snapshot_authority_postcondition
    

    さらに base ref/SHA の取得も固定します。したがって、新しいテストが実 ensure_contract_snapshot() を呼んでいても、今回修正すべき final verifier を実行せずに成功する構成を容易に作れます。

    これは一般的な mock 批判ではありません。同じファイルには、実 production chain を検証するために autouse の置換を明示的に戻す既存テストがあります。#2635 も、実 orchestration と staging/final digest の配線不備を固定するための Issue でした。

    影響

    positive test が修正前から通る、negative test が別の stub によって失敗する、といった false-green が起こります。AC1 の「実関数を通す」という表現だけでは、それを排除できません。

    最小修正

    テスト要件に、実行する production boundary を明記してください。

    新規 focused test は、実 ensure_contract_snapshot()、実 final-authority verifier、実 canonical parser を通す。POST/PATCH/readback の配線を検証するケースでは、実 publisher/binding helper も使う。fake は外部 I/O と遠隔状態に置き、判定関数そのものを成功固定にしない。

    既存の _real_* 参照と fake remote の構造を利用すれば足ります。新しい汎用 test harness は不要です。

    特に、次の変異に対してテストが落ちることを確認すると、今回の failure class を固定できます。

    • reconciliation を削除すると、時刻差だけの正常系が失敗する。
    • 他の trusted result の検査を削除すると、後続 blocked のケースが失敗する。
    • check-only にも時刻差許容を広げると、既存再利用の回帰が失敗する。

    これは恒久的な mutation-test 基盤の追加ではなく、#2635 と同様の限定的な検証で十分です。

    受け入れテストに追加したいケース

    AC の大幅増加より、既存 AC1〜AC3 に次の組合せを明記することを勧めます。

    ケース 期待結果
    自己 POST/PATCH 後、時刻だけ U0 → U1 → U1、他の根拠は一致 同じ URL で ok / materialized_go。追加投稿なし
    後続 trusted blocked があるが、二回の時刻取得は両方 U1 成功しない。時刻差に依存せず検出
    通常コメント/untrusted blocked だけが追加される 独自の「コメント増加 gate」で停止させない
    body、最終 comment body、fingerprint、base のいずれかが不一致 時刻差として救済しない
    readback が不足・失敗、または上限内に確定しない 成功を返さない。理由を保持する
    check-only/既存 go 再利用で時刻ドリフト 今回の自己投稿救済を適用しない
    上記すべての reconciliation POST/PATCH 回数と対象 ID を検査し、再投稿で解決していないことを確認

    このうち「通常コメント/untrusted block は余計に止めない」は、新しい仕様を発明する趣旨ではなく、既存 parser の authoritative filtering をそのまま使用する要求です。

    関連 Issue・PR との切り分け

    PR #2993 と #2982 は、今回の修正待ちに戻す対象ではありません。 #2993 は protected-script 検査の false-fail 修正で、2026年10月9日に merge 済みです。#2982 は実行済み pr_review_only non-pass を reviewer に委譲する変更で、2026年10月10日に merge 済みです。今回の取得時 main は後者の merge commit でした。発見経路と修正対象を混ぜない整理が必要です。

    #2996 は別の consumer 接続問題です。 ensure の出力 envelope を Step 4 へ渡す際の正規化を所有しています。#3004 で出力 schema や adjudicator を変更する必要はなく、現在の scope 分離は維持してよいです。

    #2627/#2635 の成果は再利用すべきです。 POST/PATCH の transport と、staging body・最終永続化 body の digest 区別は既に扱われています。今回、その機構を作り直す理由はありません。コメント本文の検証も、GitHub が返す raw Markdown の body と既存 binding を使い続けるのが適切です。[GitHub Docs](https://docs.github.com/en/rest/issues/comments)

    #1655 との関係は、限定例外として明示するのがよいです。 同 Issue は body・updatedAt・trusted comment・base の途中ドリフト拒否を要求しています。#3004 が変更するのは「今回の自己投稿完了後の時刻差の扱い」であり、base-bound snapshot 再利用全体を緩める変更ではない、と記載すべきです。ただし、それを理由に新しい承認待ちや別 Issue の merge 待ちを作る必要はありません。

    原因の確度と、増やさないほうがよい仕組み

    Issue #3004 には、投稿時の最終検証が authority_issue_updated_at_mismatch で失敗し、その後の check-only では同じ snapshot を再利用できた、という記録があります。参照された #2989 の snapshot コメント自体も確認できました。ただし、この二つだけで、当初の失敗が GitHub の伝播遅延による false-negative だったと因果確定はできません。 当該実行時の全読取り値と競合状態が必要です。fake remote は想定 failure class の再現には使えますが、過去の実行原因の証明にはなりません。

    したがって、本文は「伝播遅延が疑われる観測」と「今回固定する deterministic な挙動」を分けるべきです。原因確定のためだけに live GitHub 再現を恒久 gate にする必要はありません。なお、関連する test_ensure_contract_snapshot_fingerprint_patch.py は実 GitHub に使い捨て Issue を作成・close する live test を含むため、名前だけを見て今回の通常 VC へ一括追加するのも避けるべきです。

    current impl-review-loop は contract snapshot を advisory artifact と位置付けています。helper が不確かな snapshot を成功として返さないことと、開発 workflow 全体を新しい gate で停止させることは別です。 この修正は、既存 verifier・parser・局所 fixture の改善に留めるのが、個人趣味開発という前提にも合っています。

    推奨は、上記4点を #3004 の本文へ反映したうえで、既存の POST/PATCH と author binding を維持し、materialized_go 専用の限定 reconciliation を実装することです。 新 schema、ledger、lock service、approval layer は不要です。

    このレビューでは GitHub 上の変更・コメント投稿は行っていません。また、repository の pytest と live GitHub への書込み再現は実行していません。競合コメントの見落としは現行コードから導いた反例、伝播遅延は未確定の原因仮説として区別しています。

  2. squne121 commented on Oct 10, 2026

    @squne121
    OwnerAuthor

    推奨アクション

    Issue #3004 は、指定された REQUEST_CHANGES コメントの4項目を Issue 契約へ反映し、issue-refinement-loop を自律実行する方針を推奨します。

    GitHub で確認した現在の Issue は Open で、指摘された修正はまだ本文に反映されていません。

    特に重要なのは次の4点です。

    1. P1 — trusted result の見落とし防止:最終 readback でコメント集合全体を既存 parser に渡し、後続の authoritative blocked を確実に検出する。
    2. P1 — VC の修正:未実装テストを指定する -k の baseline-expect: fail を、正規の pr_review_only に変更する。
    3. P2 — updatedAt の限定的な救済:自己投稿直後の materialized_go に限り、固定した identity と binding を再検証する bounded read-only reconciliation を要求する。
    4. P2 — false-green の防止:実 orchestration だけでなく、実 final verifier・canonical parser・必要な publisher/binding helper を通る regression test を契約に明記する。

    この段階では実装コードの変更を開始せず、Issue 本文の Acceptance Criteria、Verification Commands、スコープ境界を完成させるのが適切です。

    追加確認

    2026年10月10日の取得時点で、main は 2258cccf17ed... まで進んでいました。現行コードでも、指摘された最終検証の単一コメント parsing と updatedAt 即時不一致判定を確認しています。

    また、pytest はテスト失敗を exit 1、未収集を exit 5 と区別しています。今回の VC 修正には実質的な意味があります。

    image

    pytest documentation

    再発防止 Issue は新規起票していません。 確認した4項目は #3004 の既存スコープに収まり、VC 未収集や実 orchestration の回帰対策には #1434、#2515、#2635 などの既存 Issue もあります。独立した未登録の再発原因は現時点で確認できませんでした。

    Claude Code 貼り付け用プロンプト

    以下は、現在の対話的 Claude Code の auto mode セッションにそのまま投入する指示です。

    Issue #3004 — issue-refinement-loop 自律実行指示

    対象

    この依頼は、上記 OWNER review comment を人間から明示的に選択した refinement 指示である。canonical origin lane では operator_asserted_human_context を使用する。ただし GitHub 投稿者情報だけから人間による執筆を証明したと扱わず、repository の trust / binding validation を維持する。

    途中の通常作業・修正反復・GitHub Issue 更新について、人間への逐次確認は不要。

    今回の目標は Issue refinement の完了であり、production implementation の開始ではない。

    1. Fresh state と canonical authority

    最初に以下を実施する。

    1. git status、現在の checkout、canonical main root、branch、HEAD を確認する。
    2. GitHub から Issue 実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ #3004 の最新本文・全コメントと指定 anchor comment を取得する。
    3. anchor comment の issue 所属、comment ID、投稿者、本文、更新状態を検証し、snapshot を固定する。
    4. 関連 Issue / PR を fresh に確認する。
    5. current main から以下を読む。
      • AGENTS.md、CLAUDE.md、関連 .claude/rules/**
      • .claude/skills/issue-refinement-loop/SKILL.md
      • references/anchor-comment-handling.md
      • references/ac-vc-reflection.md
      • references/termination-policy.md
      • references/follow-up-materialization.md
      • scripts/command_registry.py
      • .claude/agents/issue-editor.md
      • .claude/agents/codebase-investigator.md
      • docs/dev/dor.md
      • .claude/skills/create-issue/references/body-authoring.md

    必要な追加 reference は Skill の MUST_READ と canonical plan に従って読む。

    過去の main SHA、過去の review verdict、過去の contract snapshot を current authority として再利用しない。

    他の Issue / branch / worktree の dirty work は保護する。

    2. issue-refinement-loop を正式実行

    issue-refinement-loop Skill を明示的に使用し、Issue #3004、指定 anchor URL、現行ループ既定上限 max_iterations=3 を入力として実行する。

    canonical main root を親 control-plane とする。

    • Step 0 / Step 0f は repository-owned planner と command registry を使用する。
    • human-context anchor は preflight.run.with_human_context の正規 profile を使用する。
    • preflight.run.with_anchor から human authority を推測しない。
    • trusted contract patch plan が成立した場合、親 main thread が contract_update.run.with_human_context を使用する。
    • NEXT_ACTION: issue_editor_required の場合、指定 anchor URL を reviewer_feedback_url に使って正規 issue-editor route へ進む。
    • deterministic repair が指定された場合は、対応する canonical consumer を使用する。
    • run_refinement_preflight.py の直接実行、raw gh issue edit、手組み planner result、手製 approval override は使わない。

    コマンド引数・追加必須 field・execution class は current command_registry.py を正本とする。

    3. REQUEST_CHANGES の反映

    既存の Issue #3004 を in-place で修正する。目的と Allowed Paths を維持し、以下を AC / VC / Outcome に反映する。

    P1: 後続 trusted result の検出

    AC2 は「既存の fail-closed を維持」という抽象表現で済ませない。

    最終 readback で取得したコメント集合全体に対して、既存 canonical parser の trusted filtering と authoritative result priority を適用することを要求する。

    自己投稿した go が後続の authoritative blocked に失効していないことを必ず確認する。

    updatedAt が一致する場合でも検査を省略しない。

    通常コメント、untrusted blocked は独自のコメント増加ルールによって無条件に拒否しない。

    P1: VC の preflight 停止を解消

    既存の -k post_publish_updated_at_race VC は、新規テスト実装前に exit 5 となる。baseline-expect: fail を defect reproduction として流用しない。

    focused VC は原則として次の形に修正する。

    # AC1
    # AC2
    # preflight-scope: pr_review_only
    $ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race
    

    既存ファイル全体と author-binding suite の regression VC は維持する。

    さらに AC に以下を明記する。

    • 新規テストを旧 production implementation と組み合わせると実 assertion が失敗する。
    • 修正後の implementation では同じテストが成功する。
    • exit 5 / import error / skip / xfail を再現成功として扱わない。
    • pr_review_only は事前検証の扱いであり、最終 AC 達成や executed PASS を意味しない。

    P2: 時刻差の限定 reconciliation

    単純な expected_updated_at 更新、固定期待時刻による無限 retry、共有 verifier の時刻比較削除は禁止する。

    今回の自己 POST/PATCH 完了後の materialized_go 経路に限定し、以下を契約化する。

    • Issue body SHA を固定する。
    • comment ID と最終 comment body SHA を固定する。
    • fingerprint と base ref/SHA を固定する。
    • authoritative result priority を維持する。
    • 時刻差のみの場合、bounded read-only reconciliation を許可する。
    • 途中で実際に観測した不一致は後続の一致で帳消しにしない。
    • reconciliation のために POST/PATCH を繰り返さない。
    • 上限到達・不完全 readback は成功扱いしない。
    • check-only / existing_go の既存時刻ドリフト契約は緩和しない。

    「GitHub 伝播遅延が歴史的失敗の唯一原因だった」とは断定しない。観測可能な条件と、原因についての未確定仮説を区別する。

    P2: 実 production boundary の検証

    新規 regression は少なくとも以下を実行することを AC に明記する。

    • real ensure_contract_snapshot()
    • real verify_snapshot_authority_postcondition()
    • real canonical parser
    • POST/PATCH/readback の wiring を扱うケースで必要な real publisher / binding helper

    fake にしてよいのは外部 I/O と remote state。検証対象の production 判定関数自体を success-only stub に置き換えない。

    既存テストの _real_* 参照や fake remote を優先利用し、新規汎用 harness を追加しない。

    期待する主要ケース:

    1. U0 → U1 → U1 で他の authority が一致し、元の URL に ok / materialized_go を返す。
    2. 後続 trusted blocked があり、時刻は両取得で U1 のままでも失敗する。
    3. untrusted blocked / 通常コメントは誤って authoritative 扱いしない。
    4. body / comment / fingerprint / base drift は失敗する。
    5. 不完全 readback、上限到達は失敗する。
    6. check-only / existing_go の時刻差拒否は保持する。
    7. POST/PATCH 回数と対象 comment ID を確認し、重複投稿していない。

    主要変異として reconciliation 削除、trusted priority 検証削除、check-only への例外拡大が、それぞれ適切なテスト失敗になることを要求する。

    これらは後続実装の Acceptance Criteria であり、この refinement invocation 中に production code を変更しない。

    4. スコープ維持

    #3004 の責務は materialized-go post-publication readback とその回帰テストに限定する。

    スコープを曖昧に拡大しない。新たな architecture layer や別機能領域が必要になった場合は、canonical scope routing に従う。

    Issue 本文にある実装フェーズ向け Stop Conditions を、refinement Skill 自身の正規 SubAgent 委譲の禁止と混同しない。

    5. SubAgent の利用と完了待ち

    SubAgent は current agent 定義と planner decision に従って起動する。

    • codebase-investigator: planner が調査 required と判定した場合に、対象コード、既存テスト、parser、VC authoring の実態を read-only で検証する。
    • web-researcher: planner が外部検証 required と判定した場合に、pytest / GitHub CLI / GitHub API 仕様を公式資料優先で検証する。
    • issue-editor: controlled contract update が full rewrite を要求する場合や、Step 4 が rewrite を要求する場合に起動する。

    独立した調査のみ並列実行してよい。依存する更新・検証は順序を守る。

    各 SubAgent には以下を明示する。

    • task と対象 Issue / anchor URL
    • fresh base commit
    • authority / canonical SSOT
    • read-only または mutation ownership
    • 必須 evidence と expected result
    • 守るべき scope / Allowed Paths

    SubAgent dispatch だけで完了と判定してはならない。

    すべての必要な SubAgent の terminal completion を待ち、実 result・artifact・evidence を取得・検証してから次ステップへ進む。

    in-progress、background 起動済み、result 未取得を成功扱いしない。

    SubAgent の権限外操作を親の暗黙承認で代行させない。必要な root-owned mutation は main thread が正規 route で担当する。

    6. 自動レビュー・修正反復

    current Skill の canonical Step 2 を使用する。

    run_root_review_pipeline.py produce は main thread から規定の background execution で実行し、task completion notification と最終 JSON result を join する。

    routing は producer が返す canonical_step2_route を唯一の authority とする。

    • step_4 → issue-editor rewrite → controlled readback → fresh review
    • step_2_5 → semantic design applicability → 正規の後続処理
    • deterministic repair 指示 → 対応 canonical consumer
    • fixable needs-fix → 承認を挟まず自動修復・再検証

    既定の3 iteration の範囲で続行する。iteration ごとの人間承認確認は不要。

    ただし上限、genuine human_judgment_required、integrity failure 等の canonical stopping boundary を捏造して解除しない。

    Issue body mutation 後は必ず fresh body SHA、readback、readiness、final review を取得する。古い go 判定を使い回さない。

    実際の canonical failure を natural-language 推測で PASS に置き換えない。

    7. 再発防止 Issue の扱い

    調査・review・rewrite で、#3004 の既存 AC や別の既存 Issue では所有されない独立した再発原因が確定した場合は、既存 create-issue workflow / issue-creator を用いて再発防止 Issue を起票する。

    起票前に open / closed Issue を検索し、dedupe_key と scope overlap を確認する。

    特に #3004、#2996、#2635、#1434、#2515 との重複を避ける。

    新規 Issue には具体的な failure scenario、root cause、最小の修正範囲、AC、実際に failure class を固定する VC を記載する。

    独立した新規原因が無い場合は新規 Issue を作らず、既存 Issue へ反映または関連付ける。

    起票・再利用・スキップの結果を最終報告する。

    8. 明示的な作業承認と境界

    今回、以下の通常作業を一括承認する。

    これらを逐次的な人間承認待ちの理由にしない。

    Claude Code の現在の auto mode を維持し、permission mode の変更、bypassPermissions、--dangerously-skip-permissions、hooks / policy の迂回は要求しない。

    Destructive operation、credential / secret 操作、履歴破壊、authority 外変更、真に解消不能な scope conflict、canonical human judgment、evidence integrity 喪失、loop 上限到達は停止境界として尊重する。

    9. 完了条件

    以下を満たすまで、調査・提案だけで終了しない。

    1. OWNER review の4 finding がすべて disposition 済み。
    2. Issue 実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ #3004 の本文更新と independent readback が確認済み。
    3. AC / VC / Allowed Paths の整合性が検証済み。
    4. canonical final review と readiness の結果を取得済み。
    5. approved に到達した場合は、正規 termination report と必要な handoff marker が投稿済み。
    6. 必要な SubAgent の全結果を回収済み。
    7. 再発防止 follow-up の起票・再利用・不要判定が完了済み。

    この invocation では impl-review-loop を自動起動せず、実装用 worktree、production code、PR は変更・作成しない。

    最後に日本語で次を報告する。

    • Issue URL と最終 body SHA-256
    • 採用した各 finding と具体的な変更
    • 実行した SubAgent と terminal completion
    • preflight / review / readiness の結果
    • 反復回数と終了理由
    • 新規または再利用した再発防止 Issue
    • 未解決 blocker
    • implementation-ready か、追加の人間判断が必要か

    最終目標は Issue #3004 の canonical refinement 完了。通常の途中判断では停止せず、repository が定義する実際の終了条件まで進めること。

    このプロンプトは、承認待ちの削減と canonical gate の維持を両立させています。特に issue-refinement-loop が承認終了後に実装を自動開始しないという現行契約を守り、次段階の実装は別 invocation に分離しています。

  3. squne121 commented on Oct 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-10-10T00:45:17Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/3004
      body_sha256: "sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a","source_provenance":{"source_type":"body_file","body_file":"/tmp/contract_review_once_body_dfzq8642.md"}}
        vc_preflight:
          decision: pass
          classifications: '[{"ac":"AC1,AC2,AC3,AC4,AC5,AC6","line":8,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race","command_hash":"sha256:01a41f6e776d3b38b0c9abb529914adede1ef9cb5c983c5492178213aa069f32","execution_key_hash":null,"runner":"skipped","exit_code":null,"classification":"skipped","category":"preflight_scope_pr_review_only","decision":"go","scope_class":"pr_review_only","confidence":"low","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":0,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"verification_owner":"pr-review-judge","deferred_reason":"VC marked pr_review_only; verification deferred to PR review","runtime_verification_required":false,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:f49a04e98d2332a855709ba76ef3616c447babbd9e5d99c682276ef666947cc1"}},{"ac":"AC7","line":12,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q","command_hash":"sha256:847601667a9d9a65148d3296f1d44295772727dbfbbd802fb60565d6c87116fd","execution_key_hash":"sha256:7bca4bbc117d88b7bf8db1d512dacfd082b35a38684ca75490c2e78d38e9a4cc","runner":"exec","exit_code":0,"classification":"expected_pass","category":"baseline_expect_pass","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["........................................................................ [ 50%]","......................................................................   [100%]","142 passed in 0.33s"],"stdout_truncated":false,"stdout_original_line_count":4,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":536,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"pass","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":11,"raw":"# baseline-expect: pass"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:a8267734fadfa848bf0665715353d953f126dd038182e80bf25e0b2e904c8957"}},{"ac":"AC7","line":16,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py -q","command_hash":"sha256:ff8b8d6e54e012ff83a734057255b9489085b2a1e2b8027cf8139cacf693a471","execution_key_hash":"sha256:dda5a778001fe55a37c97c444946c0c1254cae399acd272cf7058e4648e03d5a","runner":"exec","exit_code":0,"classification":"expected_pass","category":"baseline_expect_pass","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":[".......................................                                  [100%]","39 passed in 0.14s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":345,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"pass","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":15,"raw":"# baseline-expect: pass"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:539668ae6b05eb6824f75bf4c92821ede0c30ff3c581fd5c52625cf72a66e650"}},{"ac":"AC8","line":20,"raw_command":"git diff --name-only origin/main...HEAD","command_hash":"sha256:be1f50637e3de31fde596ef434633a945474a3b9ee1b9961d2044b35c91f8f02","execution_key_hash":null,"runner":"skipped","exit_code":null,"classification":"skipped","category":"preflight_scope_pr_review_only","decision":"go","scope_class":"pr_review_only","confidence":"low","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":0,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"verification_owner":"pr-review-judge","deferred_reason":"VC marked pr_review_only; verification deferred to PR review","runtime_verification_required":false,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:3734276cc47a6c8f57030bc74c1612a10047f8ef927cb7f985a96050966e20b1"}}]'
          classifications_transport: {"schema":"vc_preflight_classifications_transport/v1","classification_count":4,"original_payload_sha256":"sha256:2af16a835d4062e57c64aa3cd344655acd8379a6dd94604b22c7db934601dfdd","compact":false,"truncated":false}
        declared_path_overlap: '{"schema":"declared_path_overlap/v1","advisory":true,"blocking":false,"decision":"advisory_only","disjoint":true,"overlapping_prs":[],"inventory":{"schema":"OPEN_PR_INVENTORY_V1","repo":"squne121/loop-protocol","state":"open","base_ref":"main","base_sha":"2258cccf17ed631441ea8573efcca178f9ce4af9","draft_policy":"include_drafts","prs":[{"number":2831,"title":"実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する","base_ref_name":"main","head_ref_name":"worktree-issue-2810-runtime-migration-classifier","head_ref_oid":"7c06e272c14b2d38e8f01899abdf85f3d0d5c9ec","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2831","changed_files_count_graphql":20},{"number":2914,"title":"fix: test-runner が mergeStateStatus=BLOCKED/UNSTABLE だけで TEST_VERDICT を FAIL にしないようにする","base_ref_name":"main","head_ref_name":"worktree-issue-2908-test-runner-blocked-not-fail","head_ref_oid":"2f44329742e2117b1bbbb34452417362558175aa","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2914","changed_files_count_graphql":1},{"number":2931,"title":"fix: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped workspace で解消する","base_ref_name":"main","head_ref_name":"worktree-issue-2860-run-scoped-scratch","head_ref_oid":"344f5da35326e04dacd13aa57dd962674888f336","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2931","changed_files_count_graphql":6},{"number":2940,"title":"feat: runner evidence に main-session init の permission_mode_observed を出力する","base_ref_name":"main","head_ref_name":"worktree-issue-2935-main-session-permission-mode","head_ref_oid":"37eb1ae20b98cc72fed816a7c88aca0d9b623a39","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2940","changed_files_count_graphql":3},{"number":2946,"title":"fix: runtime smoke fixture の child 起動先を general-purpose に是正し 2.1.289 で hook_id_correlated を成立させる (#2941)","base_ref_name":"main","head_ref_name":"worktree-issue-2941-claude-2-1-289-causal-evidence","head_ref_oid":"0fbc32e03e377b36d5800c940ab8311479c8cf46","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2946","changed_files_count_graphql":1},{"number":2974,"title":"fix: component-vrt-report の negative-control artifact を run_attempt 単位名に束縛する (#2969)","base_ref_name":"main","head_ref_name":"worktree-issue-2969-vrt-negctl-attempt-artifact","head_ref_oid":"2ab61441acc3f5062fa83fd147f570958f2dea3e","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2974","changed_files_count_graphql":2},{"number":3001,"title":"fix: repo-local 証跡を外部 claim の Web gate から分離する","base_ref_name":"main","head_ref_name":"worktree-issue-2857-repo-local-claims","head_ref_oid":"a31ac63634e67c1b8ccf1aeed8ef8f141b0f86bd","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/3001","changed_files_count_graphql":3},{"number":3003,"title":"fix: legacy termination dry-run でコメントと signal を抑止する (#2988)","base_ref_name":"main","head_ref_name":"worktree-issue-2988-termination-dry-run","head_ref_oid":"8f3e530b2f07c89a1e1260d578c523de5eae61d5","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/3003","changed_files_count_graphql":2}],"fetched_count":8,"totalCount":8,"has_next_page":false,"complete":true,"saturated":false,"limit":200,"page_count":1,"inventory_digest":"sha256:cd872e8d93c794bf494b8f83abd4e01060dfe1610b71ab88e2a7df4382a72445","errors":[]},"inventory_digest_extended":"sha256:746772a2a1695cdc54dea01d449e6b8932cb94029acffb61ad18d89b4ce4432e","errors":[],"note":"changed-file 名の単純な重なりのみを証明する advisory check。3-way merge・hunk 競合・rename/delete 競合は評価しない(実 Git merge 競合の判定は Issue #1792 の PAIRWISE_MERGE_OBSERVATION_V1 producer の責務)。単独では blocking にしない。disjoint は tri-state(true/false/null)— 観測が不完全な場合は null。"}'
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: '{"issue_number":3004,"contract_source_kind":"issue_comment","contract_source_id":"6091776325","contract_body_sha256":"sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a","allowed_paths_normalized_sha256":"35c6f3963f528591c0bfa99a8b565947486a4dc1b07cc770cbf935e3213056cb","base_ref":"main","base_sha_at_snapshot":"2258cccf17ed631441ea8573efcca178f9ce4af9"}'
  4. squne121 commented on Oct 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-10-10T00:46:14Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/3004
      body_sha256: "sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a","source_provenance":{"source_type":"body_file","body_file":"/tmp/contract_review_once_body_ginvp8cl.md"}}
        vc_preflight:
          decision: pass
          classifications: '[{"ac":"AC1,AC2,AC3,AC4,AC5,AC6","line":8,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race","command_hash":"sha256:01a41f6e776d3b38b0c9abb529914adede1ef9cb5c983c5492178213aa069f32","execution_key_hash":null,"runner":"skipped","exit_code":null,"classification":"skipped","category":"preflight_scope_pr_review_only","decision":"go","scope_class":"pr_review_only","confidence":"low","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":0,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"verification_owner":"pr-review-judge","deferred_reason":"VC marked pr_review_only; verification deferred to PR review","runtime_verification_required":false,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:f49a04e98d2332a855709ba76ef3616c447babbd9e5d99c682276ef666947cc1"}},{"ac":"AC7","line":12,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q","command_hash":"sha256:847601667a9d9a65148d3296f1d44295772727dbfbbd802fb60565d6c87116fd","execution_key_hash":"sha256:7bca4bbc117d88b7bf8db1d512dacfd082b35a38684ca75490c2e78d38e9a4cc","runner":"exec","exit_code":0,"classification":"expected_pass","category":"baseline_expect_pass","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":["........................................................................ [ 50%]","......................................................................   [100%]","142 passed in 0.36s"],"stdout_truncated":false,"stdout_original_line_count":4,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":590,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"pass","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":11,"raw":"# baseline-expect: pass"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:a8267734fadfa848bf0665715353d953f126dd038182e80bf25e0b2e904c8957"}},{"ac":"AC7","line":16,"raw_command":"uv run --locked pytest .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py -q","command_hash":"sha256:ff8b8d6e54e012ff83a734057255b9489085b2a1e2b8027cf8139cacf693a471","execution_key_hash":"sha256:dda5a778001fe55a37c97c444946c0c1254cae399acd272cf7058e4648e03d5a","runner":"exec","exit_code":0,"classification":"expected_pass","category":"baseline_expect_pass","decision":"go","scope_class":"regression_gate","confidence":"low","stdout_head":[".......................................                                  [100%]","39 passed in 0.16s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":451,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":"pass","vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":15,"raw":"# baseline-expect: pass"},"strict":null,"repair":null,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:539668ae6b05eb6824f75bf4c92821ede0c30ff3c581fd5c52625cf72a66e650"}},{"ac":"AC8","line":20,"raw_command":"git diff --name-only origin/main...HEAD","command_hash":"sha256:be1f50637e3de31fde596ef434633a945474a3b9ee1b9961d2044b35c91f8f02","execution_key_hash":null,"runner":"skipped","exit_code":null,"classification":"skipped","category":"preflight_scope_pr_review_only","decision":"go","scope_class":"pr_review_only","confidence":"low","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":0,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null,"verification_owner":"pr-review-judge","deferred_reason":"VC marked pr_review_only; verification deferred to PR review","runtime_verification_required":false,"timeout_provenance":{"timeout_seconds":150,"cleanup_tail_seconds":15,"source":"static_fallback","estimator_version":"v2","estimator_input_digest":"sha256:3734276cc47a6c8f57030bc74c1612a10047f8ef927cb7f985a96050966e20b1"}}]'
          classifications_transport: {"schema":"vc_preflight_classifications_transport/v1","classification_count":4,"original_payload_sha256":"sha256:523076b6c94ff831ee163b0efd02a286c0ee3124b954b18c32441294039b1d91","compact":false,"truncated":false}
        declared_path_overlap: '{"schema":"declared_path_overlap/v1","advisory":true,"blocking":false,"decision":"advisory_only","disjoint":true,"overlapping_prs":[],"inventory":{"schema":"OPEN_PR_INVENTORY_V1","repo":"squne121/loop-protocol","state":"open","base_ref":"main","base_sha":"dde7773a2e0a5f3ec140bd414817f48c2964c5da","draft_policy":"include_drafts","prs":[{"number":2831,"title":"実装: Claude-GPT model/proxy runtime migration の3分類ルーティングを追加する","base_ref_name":"main","head_ref_name":"worktree-issue-2810-runtime-migration-classifier","head_ref_oid":"7c06e272c14b2d38e8f01899abdf85f3d0d5c9ec","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2831","changed_files_count_graphql":20},{"number":2914,"title":"fix: test-runner が mergeStateStatus=BLOCKED/UNSTABLE だけで TEST_VERDICT を FAIL にしないようにする","base_ref_name":"main","head_ref_name":"worktree-issue-2908-test-runner-blocked-not-fail","head_ref_oid":"2f44329742e2117b1bbbb34452417362558175aa","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2914","changed_files_count_graphql":1},{"number":2931,"title":"fix: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped workspace で解消する","base_ref_name":"main","head_ref_name":"worktree-issue-2860-run-scoped-scratch","head_ref_oid":"344f5da35326e04dacd13aa57dd962674888f336","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2931","changed_files_count_graphql":6},{"number":2940,"title":"feat: runner evidence に main-session init の permission_mode_observed を出力する","base_ref_name":"main","head_ref_name":"worktree-issue-2935-main-session-permission-mode","head_ref_oid":"37eb1ae20b98cc72fed816a7c88aca0d9b623a39","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2940","changed_files_count_graphql":3},{"number":2946,"title":"fix: runtime smoke fixture の child 起動先を general-purpose に是正し 2.1.289 で hook_id_correlated を成立させる (#2941)","base_ref_name":"main","head_ref_name":"worktree-issue-2941-claude-2-1-289-causal-evidence","head_ref_oid":"0fbc32e03e377b36d5800c940ab8311479c8cf46","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2946","changed_files_count_graphql":1},{"number":2974,"title":"fix: component-vrt-report の negative-control artifact を run_attempt 単位名に束縛する (#2969)","base_ref_name":"main","head_ref_name":"worktree-issue-2969-vrt-negctl-attempt-artifact","head_ref_oid":"2ab61441acc3f5062fa83fd147f570958f2dea3e","is_draft":false,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/2974","changed_files_count_graphql":2},{"number":3001,"title":"fix: repo-local 証跡を外部 claim の Web gate から分離する","base_ref_name":"main","head_ref_name":"worktree-issue-2857-repo-local-claims","head_ref_oid":"94d9b4fb1d8efd4e404d7769bc51721f9a2661b6","is_draft":true,"is_cross_repository":false,"head_repository_owner":"squne121","head_repository_name":"loop-protocol","url":"https://github.com/squne121/loop-protocol/pull/3001","changed_files_count_graphql":3}],"fetched_count":7,"totalCount":7,"has_next_page":false,"complete":true,"saturated":false,"limit":200,"page_count":1,"inventory_digest":"sha256:956a10cea157712a979d0a70efdcbbe24ed63cc881aad71a8d5842cb4013f825","errors":[]},"inventory_digest_extended":"sha256:c50814ce9e7c768836585d26d3fa422df5894cdc40083b5ea1d397677f97bd9d","errors":[],"note":"changed-file 名の単純な重なりのみを証明する advisory check。3-way merge・hunk 競合・rename/delete 競合は評価しない(実 Git merge 競合の判定は Issue #1792 の PAIRWISE_MERGE_OBSERVATION_V1 producer の責務)。単独では blocking にしない。disjoint は tri-state(true/false/null)— 観測が不完全な場合は null。"}'
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: '{"issue_number":3004,"contract_source_kind":"issue_comment","contract_source_id":"6091785140","contract_body_sha256":"sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a","allowed_paths_normalized_sha256":"35c6f3963f528591c0bfa99a8b565947486a4dc1b07cc770cbf935e3213056cb","base_ref":"main","base_sha_at_snapshot":"dde7773a2e0a5f3ec140bd414817f48c2964c5da"}'
  5. squne121 commented on Oct 10, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    OWNER REQUEST_CHANGES 4 件の反映

    • P1 後続 trusted result の検出 → AC2: final readback のコメント集合全体に既存 canonical parser の trusted filtering と authoritative result priority を適用。updatedAt 一致時も省略せず、untrusted blocked / 通常コメントは独自のコメント増加ルールで拒否しない。
    • P1 VC の preflight 停止 → VC を # preflight-scope: pr_review_only へ変更(現行 main で -k post_publish_updated_at_race は exit 5 を実測)。AC6 に「旧 implementation で実 assertion が失敗し、修正後に成功する。exit 5 / import error / skip / xfail は再現成功にしない。pr_review_only は executed PASS ではない」を明記。
    • P2 時刻差の限定 reconciliation → AC3: 自己 POST/PATCH 後の materialized_go に限定し、body SHA / comment ID と最終 comment body SHA / fingerprint / base を固定した bounded read-only 再 readback のみ許可。観測済みの不一致は帳消しにせず、上限到達・不完全 readback は失敗、POST/PATCH は繰り返さない、check-only / existing_go は緩和しない。原因は未確定仮説として扱い、遅延が唯一の原因とは断定しない。
    • P2 実 production boundary → AC5: real ensure_contract_snapshot() / verify_snapshot_authority_postcondition() / canonical parser(必要なら publisher / binding helper)を通し、fake は外部 I/O と remote state のみ。AC1〜AC4 に主要 7 ケース、AC6 に主要変異 3 種の失敗を契約化。

    検証

    LOOP_HANDOFF_RESULT_V1:
      status: refinement_approved
      routing_action: none
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: https://github.com/squne121/loop-protocol/issues/3004#issuecomment-6091785140
        generated_at: "2026-10-10T00:46:14Z"
        body_sha256: sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: presentation-only metadata, not used for authority
      auto_fixes:
        result: auto_fixed
        required:
          - kind: contract_snapshot_materialization
            executor: implementation-worker
            result: applied
            evidence:
              before: stale snapshot https://github.com/squne121/loop-protocol/issues/3004#issuecomment-6091776325
              after: fresh go snapshot at main dde7773a
              comment_url: https://github.com/squne121/loop-protocol/issues/3004#issuecomment-6091785140
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-10-10T00:47:00Z"
      checked_body_sha256: sha256:b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  6. squne121 commented on Oct 10, 2026

    @squne121
    OwnerAuthor

    推奨アクション

    Issue #3004 は実装に進めてよい状態です。 impl-review-loop を正式に起動し、実装・検証・レビュー・修正反復を人間の逐次承認なしで進め、PR のマージ直前で停止させる方針を推奨します。

    GitHub の現行状態を確認しました。

    項目 | 確認結果 -- | -- 対象 | Issue #3004 Issue 状態 | Open Refinement | approved Contract review | go 最新の有効な snapshot | 6091785140 Refinement 終了報告 | 6091792220 承認済み本文 SHA-256 | b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a 確認時の main HEAD | dde7773

    今回の実装で特に重要なのは、以下の4点です。

    1. 後続 trusted result の見落とし防止:最終 readback の全コメント集合を既存 parser で評価し、後続の authoritative blocked を検出する。

    2. updatedAt の限定的 reconciliation:自己 POST/PATCH 後の materialized_go に限り、固定した identity・fingerprint・base の整合性を再確認する。

    3. false-green test の防止:実 ensure_contract_snapshot()・最終 verifier・canonical parser を実行する。判定関数を success-only stub に置き換えない。

    4. 実行前と実装後の VC を区別:pr_review_only は実装前の未実行を許容するだけで、最終的なテスト成功を意味しない。

    重要な境界として、承認済み refinement marker は単独では Step 1 の実装許可になりません。 現行 impl-review-loop の root-owned synchronous entry と live contract review を実行してから実装へ進む必要があります。

    実行前に解消すべき阻害要因

    現行 Skill から、もう1点確認できました。

    Issue #3004 のタイトルは 再発防止: で始まっていますが、impl-review-loop の intake は 実装: または implement: を要求します。 このままでは metadata_not_ready で停止する可能性が高いため、実装開始前に正規の metadata hygiene 手順でタイトルを修正し、GitHub readback を確認する指示を含めます。

    推奨タイトルは次のとおりです。

    実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ

    なお、この cross-loop false-ready の再発防止は、既存の Issue #2776 が所有しており、現在も Open です。新しい重複 Issue を作る対象ではありません。

    Claude Code 貼り付け用プロンプト

    以下を、現在 auto mode で起動している対話的 Claude Code にそのまま投入してください。

    Issue #3004 — impl-review-loop 自律実装・検証・PRレビュー

    目的と対象

    これは調査依頼でも実装計画の提案依頼でもない。実装を開始し、test・review・fix・re-test・PR 更新まで実行する指示である。

    現在の auto mode セッションを継続する。新しい Claude Code セッションの起動、permission mode 変更、Claude-GPT への切替は不要。

    本依頼により、以下の通常作業を一括して人間が承認する。

    • repository / GitHub / 必要な upstream の調査

    • canonical metadata hygiene

    • 対象 Issue の実装開始に必要な非意味的 metadata 更新

    • canonical root-owned entry と各 checker の実行

    • 必要な SubAgent の起動・結果回収・再起動

    • worktree 作成または既存 worktree の再利用

    • Allowed Paths 内のコード・テスト実装

    • テスト実行、修復、commit、push

    • 既存 PR の更新または新規 Draft PR の作成

    • CI の確認、失敗原因調査、通常の修復

    • review / fix iteration と fresh HEAD での再レビュー

    • 正規 GitHub コメント投稿

    • 独立した再発防止原因の dedupe 調査と必要時の Issue 起票

    • terminal verification と最終報告

    これらを iteration ごとの人間承認待ちの理由にしない。

    ただし、実 merge / auto-merge、force push、履歴破壊、secret 操作、foreign worktree の変更、permission bypass は承認しない。genuine な canonical stopping boundary は維持する。

    1. Fresh authority の取得

    最初に current repository を確認し、次の authority を取得する。

    1. AGENTS.md、CLAUDE.md、関連 .claude/rules/**

    2. .claude/skills/impl-review-loop/SKILL.md

    3. steps/preparation.md

    4. steps/step-1-implementation.md

    5. steps/step-2-verification.md

    6. steps/step-4-pr-review.md

    7. steps/step-5-feedback-and-termination.md

    8. steps/step-5-mergeability-handling.md

    9. .claude/skills/implement-issue/SKILL.md

    10. .claude/agents/implementation-worker.md

    11. .claude/agents/test-runner.md

    12. .claude/agents/pr-reviewer.md

    13. docs/dev/workflow.md

    14. .claude/skills/issue-refinement-loop/references/termination-policy.md

    必要な追加 reference は Skill の現行 procedure に従って読む。

    以下の live state も取得する。

    初期取得の順序・回数は canonical intake capsule-first policy に従う。独自の重複 fetch や ad-hoc authority 判定を追加しない。

    前回の確認値は参考情報に限る。

    これらを current-run の authorization として再利用しない。

    2. 既知の metadata_not_ready を先に解消する

    Issue #3004 の現在確認されているタイトルは次のとおり。

    再発防止: contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ

    しかし現行 impl-review-loop preparation は implementation Issue に 実装: または implement: prefix を要求する。

    さらに前回の refinement termination marker は title_prefix_ready: true と報告している。この表示を live title の代わりに信用してはならない。

    実装開始前の metadata hygiene を今回明示的に承認する。

    現在も prefix が不足していれば、repository の既存 canonical metadata hygiene / controlled mutation route で次のタイトルへ変更する。

    実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ

    処理条件:

    • タイトルが既に正常なら変更しない

    • Issue body、AC、VC、Allowed Paths をこのために書き換えない

    • 変更後の GitHub live title readback で prefix を確認する

    • metadata change により freshness が変わったら正規ルートで再取得する

    • title_prefix_ready: true を手製 artifact で偽装しない

    この cross-loop defect は既存 Issue #2776 が所有する。

    https://github.com/squne121/loop-protocol/issues/2776

    重複 Issue は起票しない。#3004 の実装を #2776 の merge 待ちにはしない。

    Task Context に旧タスクの identity が残っている場合も、current repository の通常の target rebind 手順を利用する。Task claim や workflow signal を捏造しない。

    3. Root-Owned Synchronous Entry

    metadata を正常化したら、impl-review-loop Skill を明示的に使用して Issue #3004 を実行する。

    /impl-review-loop 3004

    上記は repository-owned Skill invocation を意図する。単なる文字列実行で済ませず、現行 Skill procedure に従って実処理を開始する。

    Step 1 dispatch に先立ち、root/main thread が current canonical run_root_transition() 経路を実行する。

    • capability preflight

    • live Issue fetch

    • current-run contract review

    • 直後の live re-fetch

    • canonical route decision

    • invoke_impl_review_loop の場合のみ同期した Step 1 起動

    過去の LOOP_HANDOFF_RESULT_V1 は telemetry であり、implementation dispatch authorization ではない。

    独自の invocation token、手組み route packet、approval override は生成しない。

    Landing disposition

    既存の build_intake_capsule.py と implementation-landed evidence の canonical decision を使用する。

    • start_data_plane: true なら許可された実装へ進む

    • resume_existing_pr なら既存 PR / branch / worktree を再利用する

    • already_satisfied なら既存の terminal recommendation を生成する

    • reconciliation_required なら原因を調査し、canonical に許される範囲で修復する

    • duplicate worker / worktree / PR の作成は禁止

    実装が必要なら、対象 Issue 専用 worktree で作業し、root/main checkout と無関係な dirty work を変更しない。

    Snapshot の取り扱い

    ensure_contract_snapshot.py の結果は、現行 Skill に定義された advisory artifact policy に従う。

    stale_or_conflicting_snapshot、human_judgment 等が生じても、それだけで workflow 全体を停止させたり、成功へ書き換えたりしない。

    ただし trusted な後続 blocked / request_changes は canonical human veto として維持する。

    4. Issue #3004 の実装要件

    live Issue の AC1〜AC8 を正本とする。次の条件は最低限満たすこと。

    A. 後続 trusted result の検証

    .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py

    verify_snapshot_authority_postcondition() で、投稿した自分のコメント一件だけを parser に渡す既存経路を修正する。

    • 最終 readback で取得したコメント集合全体を canonical parser に渡す

    • trusted filtering と authoritative result priority を維持する

    • 後続 trusted blocked が authoritative なら、自己投稿した go を成功扱いしない

    • Issue updatedAt が一致していても検査する

    • 通常コメントや untrusted blocked を独自の comment-count gate で拒否しない

    新規 parser・ledger・gate は作らない。

    B. materialized_go 専用 reconciliation

    自己 POST/PATCH が完了した materialized_go 経路だけに、bounded read-only reconciliation を追加する。

    固定すべき authority:

    • Issue body SHA

    • comment ID

    • 最終 comment body SHA

    • fingerprint

    • base ref / SHA

    • authoritative trusted-result priority

    時刻だけが U0 → U1 → U1 と変化し、他の authority がすべて整合するケースでは、元の snapshot URL に対して status: ok / source: materialized_go を返せるようにする。

    一方、次は禁止する。

    • 固定期待値を観測された値へ追従させて成功させる

    • 共有 verifier から updatedAt 比較を広く削除する

    • check-only / existing_go の既存 stale 拒否を緩和する

    • POST/PATCH を reconciliation のために繰り返す

    • body / trusted result / fingerprint / base の不一致を後続の一致で帳消しにする

    • 上限到達・不完全 readback・未検証状態を成功扱いする

    GitHub の反映遅延が過去の失敗原因だったと因果確定したことにはしない。実際に観測・検証できる invariant を基準にする。

    C. False-green を防止する regression

    次の production boundary を実際に通す。

    • real ensure_contract_snapshot()

    • real verify_snapshot_authority_postcondition()

    • real canonical parser

    • 必要な real publisher / binding helper

    mock / fake の対象は外部 I/O と remote state を原則とする。

    既存テストの _real_* 参照と fake remote を優先して再利用し、新しい汎用テスト harness を追加しない。

    重要ケース:

    1. U0 → U1 → U1 と authority 不変で materialized_go 成功

    2. 後続 trusted blocked、時刻一致でも失敗

    3. 通常コメント・untrusted blocked による false reject を防止

    4. body / comment / fingerprint / base drift は失敗

    5. 不完全 readback・reconciliation 上限到達は失敗

    6. check-only / existing_go は既存の stale 拒否を保持

    7. POST/PATCH の回数および対象 comment ID が不変

    新規テストは、旧 production 実装では実 assertion が失敗する RED evidence を取り、修正後の実装で GREEN になることを確認する。

    pytest exit 5、import error、skip、xfail を RED evidence として扱わない。

    主要変異である reconciliation 削除、trusted priority 検査削除、check-only への例外拡大を、それぞれ既存の対象 regression が検知できることを限定的に確認する。

    恒久的な mutation-test framework は追加しない。

    D. 既存 regression

    少なくとも次を実行する。

    uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race
    

    uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q

    uv run --locked pytest .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py -q

    このほか canonical workflow が要求する lint / typecheck / test / build / CI を実行する。

    pr_review_only は baseline preflight での skip 認可にすぎない。current-head の実行事実と terminal AC 達成は区別する。

    テスト失敗は通常の修復対象である。直せる範囲で修復して再実行する。

    5. SubAgent 利用と完了待ち

    SubAgent は current .claude/agents/*.md と Skill procedure に従う。

    必須の担当:

    • implementation-worker — Step 1 implementation、worktree、commit / PR

    • test-runner — Step 2 independent read-only verification

    • pr-reviewer — Step 4 fresh PR review

    必要なら codebase-investigator 等の read-only 調査 SubAgent を追加してよい。

    各 SubAgent へ次を実値で渡す。

    親スレッドにしか存在しない暗黙の context へ依存させない。

    Completion protocol

    次の手順を全 canonical dispatch で守る。

    1. spawn_agent の戻り値から canonical task_name を保存する。

    2. background task の場合、wait_agent 等で完了を待つ。

    3. final result と artifact を実際に取得し検証する。

    4. list_agents で対象 task が terminal completed であることを確認する。

    5. result と terminal completion の両方が確認できた後にだけ downstream step へ進む。

    SubAgent の dispatch、background 実行開始、mailbox notification、部分出力だけで完了扱いしない。

    errored、interrupted、shutdown、not_found は成功扱いせず、現行の bounded recovery procedure に従う。

    独立した read-only 調査は並列化してよい。Implementation → Verification → Review → Judgment の依存順序は崩さない。

    SubAgent の完了を待っている間に「作業を開始したので終了」と報告してはならない。

    6. Verification → Review → Fix Loop

    Step 1 完了後、現行 impl-review-loop の Step 2 / Step 4 / Step 5 を正式実行する。

    • test-runner の final report を取得する

    • current PR HEAD と Issue body SHA に binding する

    • literal VC と command hash を保持する

    • step4-adjudicate の canonical 経路を通す

    • 必要なら pr_review_only non-pass の事実を失わず reviewer に委譲する

    • current-head gate を検証する

    • pr-reviewer を実行して final result を回収する

    • required CI を exact HEAD に対して確認する

    • Step 5 は step5-terminal-gate の route に従う

    step4-adjudicate の reviewer dispatch 許可と terminal approval を同一視しない。

    PR HEAD が変更された場合は、stale な test / CI / reviewer evidence を使わず、fresh HEAD で必要な再検証を行う。

    通常の自動修復

    次の状態では、原則として人間へ確認を求めず作業を続ける。

    • test / lint / build failure

    • CI failure

    • reviewer の REQUEST_CHANGES

    • 修正可能な deterministic blocker

    • head drift / main drift

    • 修復可能な branch behind

    • 既存 PR の通常更新

    • scope 内の false-green regression

    REQUEST_CHANGES では finding ごとに root cause と最小 fix_delta を確定し、implementation-worker に修正を委譲する。

    修正後は再度 test-runner → fresh PR review → Step 5 を行う。

    正規 max_iterations=3 の範囲で完遂を目指す。body-only lane 等の canonical 例外がある場合は、その規定どおり扱う。

    iteration counter の reset や gate bypass によって上限を回避しない。

    関連 Issue との scope 境界

    関連 Issue との重複や実際の競合がある場合、canonical scope routing で処理する。別 Issue の未完了を理由とする機械的な merge 待ちを勝手に増やさない。

    7. 再発防止 Issue

    実装・テスト・レビューで、#3004 と既存 Issue のいずれにも所有されていない独立した recurring failure class を確認した場合は、新規 GitHub Issue を起票する。

    起票前に open / closed Issue と PR を検索し、重複を避ける。

    必要時は current create-issue Skill / issue-creator の正規 procedure を使用する。

    Issue に必ず含める。

    • source / reproducer

    • root cause

    • 具体的 failure scenario

    • 最小修正範囲

    • AC

    • 実 failure class を固定する VC

    • 発見元 PR / Issue

    既存 Issue がある場合は新規作成せず、必要な evidence を既存 Issue に追加する。

    独立した問題が無ければ起票しない。

    8. 停止境界

    本依頼は通常の実装・修復・PR 更新を包括承認するものである。

    以下は自動承認に含めない。

    • merge / auto-merge

    • force push 等の履歴破壊

    • foreign branch / worktree の無断変更・削除

    • credential / secret の取得・変更・公開

    • permission bypass

    • 実際に解消不能な authority / scope conflict

    • genuine human_judgment_required

    • evidence integrity の喪失

    • canonical loop 上限超過

    Issue の Stop Conditions は、実装 worker の変更境界と root orchestrator の通常 SubAgent 委譲を区別して適用する。

    SubAgent の通常 dispatch や GitHub の通常 PR 操作を、無条件に「nested delegation」「外部サービス利用」として停止させない。一方で、本当に authority 外の変更が必要ならその事実を保持して停止する。

    9. 完了条件

    次をすべて確認するまで、調査や計画だけで終了しない。

    1. canonical metadata / root entry の処理完了

    2. Issue 実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ #3004 の実装と AC1〜AC8 の検証

    3. 必要な SubAgent の final result・terminal completion 確認

    4. 対象 branch / PR の作成または既存 PR の更新

    5. current HEAD での必要な test / CI

    6. fresh PR review の finding disposition

    7. canonical Step 5 terminal gate の結果

    8. 再発防止 follow-up の起票・再利用・不要判定

    目標 terminal state は 人間の merge 判断待ち である。

    PR は repository の canonical workflow に従って Draft のままでよい。実 merge と auto-merge は実行しない。

    最終的に日本語で次を報告する。

    • Issue URL / current body SHA

    • metadata title 修正の有無

    • 作業 branch / worktree

    • PR URL / Draft 状態 / latest HEAD

    • 実装した変更と AC 対応

    • Verification Commands / regression の実行結果

    • CI の exact HEAD と結果

    • reviewer verdict / reviewed HEAD / 残 finding

    • 各 SubAgent の task name、final result、terminal state

    • review / fix iteration 回数

    • 新規または再利用した再発防止 Issue

    • canonical termination route

    • 残 blocker

    • merge 判断可能か

    指示の到達点は、Issue #3004 を実装し、必要な自動修復と fresh review を終え、PR を人間が merge 判断できる状態にすることである。通常の途中判断では停止せず、current repository の正規 workflow を最後まで実行せよ。

    再発防止 Issue の処理結果

    Issue #2776 に #3004 の再現証拠を追加しました。

    title_prefix_ready: true の誤報告と実際の title prefix 欠落は、既存 Issue #2776 が対象とする failure class と一致します。GitHub コメントの追加が完了したことを確認済みです。

    その他の関連責務についても、#2996、#3005、#2635 などの既存 Issue を確認しました。現時点で独立した未登録の再発原因は確定していないため、重複する新規 Issue は作成していません。

    実装自体はまだ開始していません。 上記プロンプトは既存の auto mode Claude Code に渡して実行するためのものです。

    ## 推奨アクション

    Issue #3004 は実装に進めてよい状態です。 impl-review-loop を正式に起動し、実装・検証・レビュー・修正反復を人間の逐次承認なしで進め、PR のマージ直前で停止させる方針を推奨します。

    GitHub の現行状態を確認しました。

    項目 確認結果
    対象 [Issue #3004](#3004)
    Issue 状態 Open
    Refinement approved
    Contract review go
    最新の有効な snapshot [6091785140](#3004 (comment))
    Refinement 終了報告 [6091792220](#3004 (comment))
    承認済み本文 SHA-256 b391af15dddefeae93f77bf9015b4b7d8426e4190a460f89ae67df18447d836a
    確認時の main HEAD dde7773a2e0a5f3ec140bd414817f48c2964c5da

    今回の実装で特に重要なのは、以下の4点です。

    1. 後続 trusted result の見落とし防止:最終 readback の全コメント集合を既存 parser で評価し、後続の authoritative blocked を検出する。
    2. updatedAt の限定的 reconciliation:自己 POST/PATCH 後の materialized_go に限り、固定した identity・fingerprint・base の整合性を再確認する。
    3. false-green test の防止:実 ensure_contract_snapshot()・最終 verifier・canonical parser を実行する。判定関数を success-only stub に置き換えない。
    4. 実行前と実装後の VC を区別:pr_review_only は実装前の未実行を許容するだけで、最終的なテスト成功を意味しない。

    重要な境界として、承認済み refinement marker は単独では Step 1 の実装許可になりません。 現行 impl-review-loop の root-owned synchronous entry と live contract review を実行してから実装へ進む必要があります。

    実行前に解消すべき阻害要因

    現行 Skill から、もう1点確認できました。

    Issue #3004 のタイトルは 再発防止: で始まっていますが、impl-review-loop の intake は 実装: または implement: を要求します。 このままでは metadata_not_ready で停止する可能性が高いため、実装開始前に正規の metadata hygiene 手順でタイトルを修正し、GitHub readback を確認する指示を含めます。

    推奨タイトルは次のとおりです。

    実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ

    なお、この cross-loop false-ready の再発防止は、既存の [Issue #2776](#2776) が所有しており、現在も Open です。新しい重複 Issue を作る対象ではありません。

    Claude Code 貼り付け用プロンプト

    以下を、現在 auto mode で起動している対話的 Claude Code にそのまま投入してください。

    Issue #3004 — impl-review-loop 自律実装・検証・PRレビュー

    目的と対象

    これは調査依頼でも実装計画の提案依頼でもない。実装を開始し、test・review・fix・re-test・PR 更新まで実行する指示である。

    現在の auto mode セッションを継続する。新しい Claude Code セッションの起動、permission mode 変更、Claude-GPT への切替は不要。

    本依頼により、以下の通常作業を一括して人間が承認する。

    • repository / GitHub / 必要な upstream の調査
    • canonical metadata hygiene
    • 対象 Issue の実装開始に必要な非意味的 metadata 更新
    • canonical root-owned entry と各 checker の実行
    • 必要な SubAgent の起動・結果回収・再起動
    • worktree 作成または既存 worktree の再利用
    • Allowed Paths 内のコード・テスト実装
    • テスト実行、修復、commit、push
    • 既存 PR の更新または新規 Draft PR の作成
    • CI の確認、失敗原因調査、通常の修復
    • review / fix iteration と fresh HEAD での再レビュー
    • 正規 GitHub コメント投稿
    • 独立した再発防止原因の dedupe 調査と必要時の Issue 起票
    • terminal verification と最終報告

    これらを iteration ごとの人間承認待ちの理由にしない。

    ただし、実 merge / auto-merge、force push、履歴破壊、secret 操作、foreign worktree の変更、permission bypass は承認しない。genuine な canonical stopping boundary は維持する。

    1. Fresh authority の取得

    最初に current repository を確認し、次の authority を取得する。

    1. AGENTS.md、CLAUDE.md、関連 .claude/rules/**
    2. .claude/skills/impl-review-loop/SKILL.md
    3. steps/preparation.md
    4. steps/step-1-implementation.md
    5. steps/step-2-verification.md
    6. steps/step-4-pr-review.md
    7. steps/step-5-feedback-and-termination.md
    8. steps/step-5-mergeability-handling.md
    9. .claude/skills/implement-issue/SKILL.md
    10. .claude/agents/implementation-worker.md
    11. .claude/agents/test-runner.md
    12. .claude/agents/pr-reviewer.md
    13. docs/dev/workflow.md
    14. .claude/skills/issue-refinement-loop/references/termination-policy.md

    必要な追加 reference は Skill の現行 procedure に従って読む。

    以下の live state も取得する。

    初期取得の順序・回数は canonical intake capsule-first policy に従う。独自の重複 fetch や ad-hoc authority 判定を追加しない。

    前回の確認値は参考情報に限る。

    これらを current-run の authorization として再利用しない。

    2. 既知の metadata_not_ready を先に解消する

    Issue #3004 の現在確認されているタイトルは次のとおり。

    再発防止: contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ

    しかし現行 impl-review-loop preparation は implementation Issue に 実装: または implement: prefix を要求する。

    さらに前回の refinement termination marker は title_prefix_ready: true と報告している。この表示を live title の代わりに信用してはならない。

    実装開始前の metadata hygiene を今回明示的に承認する。

    現在も prefix が不足していれば、repository の既存 canonical metadata hygiene / controlled mutation route で次のタイトルへ変更する。

    実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ

    処理条件:

    • タイトルが既に正常なら変更しない
    • Issue body、AC、VC、Allowed Paths をこのために書き換えない
    • 変更後の GitHub live title readback で prefix を確認する
    • metadata change により freshness が変わったら正規ルートで再取得する
    • title_prefix_ready: true を手製 artifact で偽装しない

    この cross-loop defect は既存 Issue #2776 が所有する。

    #2776

    重複 Issue は起票しない。#3004 の実装を #2776 の merge 待ちにはしない。

    Task Context に旧タスクの identity が残っている場合も、current repository の通常の target rebind 手順を利用する。Task claim や workflow signal を捏造しない。

    3. Root-Owned Synchronous Entry

    metadata を正常化したら、impl-review-loop Skill を明示的に使用して Issue #3004 を実行する。

    /impl-review-loop 3004

    上記は repository-owned Skill invocation を意図する。単なる文字列実行で済ませず、現行 Skill procedure に従って実処理を開始する。

    Step 1 dispatch に先立ち、root/main thread が current canonical run_root_transition() 経路を実行する。

    • capability preflight
    • live Issue fetch
    • current-run contract review
    • 直後の live re-fetch
    • canonical route decision
    • invoke_impl_review_loop の場合のみ同期した Step 1 起動

    過去の LOOP_HANDOFF_RESULT_V1 は telemetry であり、implementation dispatch authorization ではない。

    独自の invocation token、手組み route packet、approval override は生成しない。

    Landing disposition

    既存の build_intake_capsule.py と implementation-landed evidence の canonical decision を使用する。

    • start_data_plane: true なら許可された実装へ進む
    • resume_existing_pr なら既存 PR / branch / worktree を再利用する
    • already_satisfied なら既存の terminal recommendation を生成する
    • reconciliation_required なら原因を調査し、canonical に許される範囲で修復する
    • duplicate worker / worktree / PR の作成は禁止

    実装が必要なら、対象 Issue 専用 worktree で作業し、root/main checkout と無関係な dirty work を変更しない。

    Snapshot の取り扱い

    ensure_contract_snapshot.py の結果は、現行 Skill に定義された advisory artifact policy に従う。

    stale_or_conflicting_snapshot、human_judgment 等が生じても、それだけで workflow 全体を停止させたり、成功へ書き換えたりしない。

    ただし trusted な後続 blocked / request_changes は canonical human veto として維持する。

    4. Issue #3004 の実装要件

    live Issue の AC1〜AC8 を正本とする。次の条件は最低限満たすこと。

    A. 後続 trusted result の検証

    .claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py

    verify_snapshot_authority_postcondition() で、投稿した自分のコメント一件だけを parser に渡す既存経路を修正する。

    • 最終 readback で取得したコメント集合全体を canonical parser に渡す
    • trusted filtering と authoritative result priority を維持する
    • 後続 trusted blocked が authoritative なら、自己投稿した go を成功扱いしない
    • Issue updatedAt が一致していても検査する
    • 通常コメントや untrusted blocked を独自の comment-count gate で拒否しない

    新規 parser・ledger・gate は作らない。

    B. materialized_go 専用 reconciliation

    自己 POST/PATCH が完了した materialized_go 経路だけに、bounded read-only reconciliation を追加する。

    固定すべき authority:

    • Issue body SHA
    • comment ID
    • 最終 comment body SHA
    • fingerprint
    • base ref / SHA
    • authoritative trusted-result priority

    時刻だけが U0 → U1 → U1 と変化し、他の authority がすべて整合するケースでは、元の snapshot URL に対して status: ok / source: materialized_go を返せるようにする。

    一方、次は禁止する。

    • 固定期待値を観測された値へ追従させて成功させる
    • 共有 verifier から updatedAt 比較を広く削除する
    • check-only / existing_go の既存 stale 拒否を緩和する
    • POST/PATCH を reconciliation のために繰り返す
    • body / trusted result / fingerprint / base の不一致を後続の一致で帳消しにする
    • 上限到達・不完全 readback・未検証状態を成功扱いする

    GitHub の反映遅延が過去の失敗原因だったと因果確定したことにはしない。実際に観測・検証できる invariant を基準にする。

    C. False-green を防止する regression

    次の production boundary を実際に通す。

    • real ensure_contract_snapshot()
    • real verify_snapshot_authority_postcondition()
    • real canonical parser
    • 必要な real publisher / binding helper

    mock / fake の対象は外部 I/O と remote state を原則とする。

    既存テストの _real_* 参照と fake remote を優先して再利用し、新しい汎用テスト harness を追加しない。

    重要ケース:

    1. U0 → U1 → U1 と authority 不変で materialized_go 成功
    2. 後続 trusted blocked、時刻一致でも失敗
    3. 通常コメント・untrusted blocked による false reject を防止
    4. body / comment / fingerprint / base drift は失敗
    5. 不完全 readback・reconciliation 上限到達は失敗
    6. check-only / existing_go は既存の stale 拒否を保持
    7. POST/PATCH の回数および対象 comment ID が不変

    新規テストは、旧 production 実装では実 assertion が失敗する RED evidence を取り、修正後の実装で GREEN になることを確認する。

    pytest exit 5、import error、skip、xfail を RED evidence として扱わない。

    主要変異である reconciliation 削除、trusted priority 検査削除、check-only への例外拡大を、それぞれ既存の対象 regression が検知できることを限定的に確認する。

    恒久的な mutation-test framework は追加しない。

    D. 既存 regression

    少なくとも次を実行する。

    uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q -k post_publish_updated_at_race
    
    uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
    
    uv run --locked pytest .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py -q
    

    このほか canonical workflow が要求する lint / typecheck / test / build / CI を実行する。

    pr_review_only は baseline preflight での skip 認可にすぎない。current-head の実行事実と terminal AC 達成は区別する。

    テスト失敗は通常の修復対象である。直せる範囲で修復して再実行する。

    5. SubAgent 利用と完了待ち

    SubAgent は current .claude/agents/*.md と Skill procedure に従う。

    必須の担当:

    • implementation-worker — Step 1 implementation、worktree、commit / PR
    • test-runner — Step 2 independent read-only verification
    • pr-reviewer — Step 4 fresh PR review

    必要なら codebase-investigator 等の read-only 調査 SubAgent を追加してよい。

    各 SubAgent へ次を実値で渡す。

    親スレッドにしか存在しない暗黙の context へ依存させない。

    Completion protocol

    次の手順を全 canonical dispatch で守る。

    1. spawn_agent の戻り値から canonical task_name を保存する。
    2. background task の場合、wait_agent 等で完了を待つ。
    3. final result と artifact を実際に取得し検証する。
    4. list_agents で対象 task が terminal completed であることを確認する。
    5. result と terminal completion の両方が確認できた後にだけ downstream step へ進む。

    SubAgent の dispatch、background 実行開始、mailbox notification、部分出力だけで完了扱いしない。

    errored、interrupted、shutdown、not_found は成功扱いせず、現行の bounded recovery procedure に従う。

    独立した read-only 調査は並列化してよい。Implementation → Verification → Review → Judgment の依存順序は崩さない。

    SubAgent の完了を待っている間に「作業を開始したので終了」と報告してはならない。

    6. Verification → Review → Fix Loop

    Step 1 完了後、現行 impl-review-loop の Step 2 / Step 4 / Step 5 を正式実行する。

    • test-runner の final report を取得する
    • current PR HEAD と Issue body SHA に binding する
    • literal VC と command hash を保持する
    • step4-adjudicate の canonical 経路を通す
    • 必要なら pr_review_only non-pass の事実を失わず reviewer に委譲する
    • current-head gate を検証する
    • pr-reviewer を実行して final result を回収する
    • required CI を exact HEAD に対して確認する
    • Step 5 は step5-terminal-gate の route に従う

    step4-adjudicate の reviewer dispatch 許可と terminal approval を同一視しない。

    PR HEAD が変更された場合は、stale な test / CI / reviewer evidence を使わず、fresh HEAD で必要な再検証を行う。

    通常の自動修復

    次の状態では、原則として人間へ確認を求めず作業を続ける。

    • test / lint / build failure
    • CI failure
    • reviewer の REQUEST_CHANGES
    • 修正可能な deterministic blocker
    • head drift / main drift
    • 修復可能な branch behind
    • 既存 PR の通常更新
    • scope 内の false-green regression

    REQUEST_CHANGES では finding ごとに root cause と最小 fix_delta を確定し、implementation-worker に修正を委譲する。

    修正後は再度 test-runner → fresh PR review → Step 5 を行う。

    正規 max_iterations=3 の範囲で完遂を目指す。body-only lane 等の canonical 例外がある場合は、その規定どおり扱う。

    iteration counter の reset や gate bypass によって上限を回避しない。

    関連 Issue との scope 境界

    関連 Issue との重複や実際の競合がある場合、canonical scope routing で処理する。別 Issue の未完了を理由とする機械的な merge 待ちを勝手に増やさない。

    7. 再発防止 Issue

    実装・テスト・レビューで、#3004 と既存 Issue のいずれにも所有されていない独立した recurring failure class を確認した場合は、新規 GitHub Issue を起票する。

    起票前に open / closed Issue と PR を検索し、重複を避ける。

    必要時は current create-issue Skill / issue-creator の正規 procedure を使用する。

    Issue に必ず含める。

    • source / reproducer
    • root cause
    • 具体的 failure scenario
    • 最小修正範囲
    • AC
    • 実 failure class を固定する VC
    • 発見元 PR / Issue

    既存 Issue がある場合は新規作成せず、必要な evidence を既存 Issue に追加する。

    独立した問題が無ければ起票しない。

    8. 停止境界

    本依頼は通常の実装・修復・PR 更新を包括承認するものである。

    以下は自動承認に含めない。

    • merge / auto-merge
    • force push 等の履歴破壊
    • foreign branch / worktree の無断変更・削除
    • credential / secret の取得・変更・公開
    • permission bypass
    • 実際に解消不能な authority / scope conflict
    • genuine human_judgment_required
    • evidence integrity の喪失
    • canonical loop 上限超過

    Issue の Stop Conditions は、実装 worker の変更境界と root orchestrator の通常 SubAgent 委譲を区別して適用する。

    SubAgent の通常 dispatch や GitHub の通常 PR 操作を、無条件に「nested delegation」「外部サービス利用」として停止させない。一方で、本当に authority 外の変更が必要ならその事実を保持して停止する。

    9. 完了条件

    次をすべて確認するまで、調査や計画だけで終了しない。

    1. canonical metadata / root entry の処理完了
    2. Issue 実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ #3004 の実装と AC1〜AC8 の検証
    3. 必要な SubAgent の final result・terminal completion 確認
    4. 対象 branch / PR の作成または既存 PR の更新
    5. current HEAD での必要な test / CI
    6. fresh PR review の finding disposition
    7. canonical Step 5 terminal gate の結果
    8. 再発防止 follow-up の起票・再利用・不要判定

    目標 terminal state は 人間の merge 判断待ち である。

    PR は repository の canonical workflow に従って Draft のままでよい。実 merge と auto-merge は実行しない。

    最終的に日本語で次を報告する。

    • Issue URL / current body SHA
    • metadata title 修正の有無
    • 作業 branch / worktree
    • PR URL / Draft 状態 / latest HEAD
    • 実装した変更と AC 対応
    • Verification Commands / regression の実行結果
    • CI の exact HEAD と結果
    • reviewer verdict / reviewed HEAD / 残 finding
    • 各 SubAgent の task name、final result、terminal state
    • review / fix iteration 回数
    • 新規または再利用した再発防止 Issue
    • canonical termination route
    • 残 blocker
    • merge 判断可能か

    指示の到達点は、Issue #3004 を実装し、必要な自動修復と fresh review を終え、PR を人間が merge 判断できる状態にすることである。通常の途中判断では停止せず、current repository の正規 workflow を最後まで実行せよ。

    再発防止 Issue の処理結果

    [Issue #2776 に #3004 の再現証拠を追加しました。](#2776 (comment))

    title_prefix_ready: true の誤報告と実際の title prefix 欠落は、既存 Issue #2776 が対象とする failure class と一致します。GitHub コメントの追加が完了したことを確認済みです。

    その他の関連責務についても、#2996、#3005、#2635 などの既存 Issue を確認しました。現時点で独立した未登録の再発原因は確定していないため、重複する新規 Issue は作成していません。

    実装自体はまだ開始していません。 上記プロンプトは既存の auto mode Claude Code に渡して実行するためのものです。

  7. changed the title [-]再発防止: contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ[/-] [+]実装: 再発防止 — contract snapshot 自己投稿直後の updatedAt 時差による false-stale を防ぐ[/+] on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions