Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "POST staging representation が final persisted-body authority に流入しないことを adversarial regression で固定し、POST/PATCH の comment-body transport を canonical JSON stdin に統一する"
change_kind: code
dedupe_key: "follow-up:squne121/loop-protocol:pr/2621:1"Parent Issue
なし(単独改善)
Parent Goal Ref
- Goal: Issue 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 が POST staging 側の digest を final persisted-body authority へ誤って流用できないことを、将来の実装に対しても regression で固定する。
- Desired Destination: 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 実装後も、final PATCH/readback の成功判定が direct GET の decoded Markdown body の UTF-8 SHA256 だけに bind され続けることを保証する。
Current Validated Scope
- current main はすでに
patch_comment()を canonical JSON UTF-8 →gh api --method PATCH --input -transport にしており、PATCH exit 0 の response representation を authority に使わず、直後の direct GET body でverify_controlled_publisher_comment_id_binding()による full binding を行っている(merged PR fix: reconcile untrusted PATCH comment responses #2621、.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.pyのpatch_comment())。 .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py::TestPatchCommentTransportAndReconciliationが、realpatch_comment()+ realverify_controlled_publisher_comment_id_binding()で PATCH endpoint/--silent/JSON body/単一 GET/invalid JSON・ID mismatch・body mismatch・GET body hash mismatch を既に検証済みである。- したがって「final PATCH/readback の body-hash authority を direct GET の decoded Markdown body の UTF-8 SHA256 に固定する」こと自体は、この Issue の新規実装対象ではなく 既に current main で満たされている baseline である。
- 一方
post_comment()は現在もtempfile.NamedTemporaryFile(mode="w", ..., encoding="utf-8")+gh api --field body=@<tempfile>を使っており、newlineを明示していないため text-mode I/O のデフォルト(newline=None、universal newlines 変換)を通る。-F/--field key=@fileはファイルを読んでその内容を field 値として構築する処理であり、--inputのように request body をそのまま渡す機構ではない(GitHub CLI 公式マニュアル: https://cli.github.com/manual/gh_api)。そのため temp-file の bytes は「GitHub に実際に送信された bytes」そのものではなく、body field を構築するための中間表現である。
Remaining Parent Gaps
- 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 本来の hash mismatch 診断および check-only の存在検出の実装は、この Issue が固定する staging/final authority 分離契約の確定後に 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 側で実施する。
- canonical parser、controlled executor、publisher trust policy、実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 receipt schema、permission/security harness、live GitHub canary の変更は別 Issue とする。
Outcome
- POST-staging representation(診断用の中間表現)と final PATCH/readback の persisted-body authority が、fixture 上で意図的に異なる digest を持つ deliberately-divergent regression によって、概念的にも実装的にも分離されている。
post_comment()がpatch_comment()と同じ canonical JSON UTF-8 →gh api --method POST --input -transport に統一され、tempfile.NamedTemporaryFile/--field body=@file/ 暗黙の OS newline 変換が削除されている。- 将来 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 が POST staging 側の digest を final authority として誤用しても、この regression が fail する状態になっている。
Runtime Verification Applicability
- decision: not_applicable
- reason: fake GitHub transport(stub subprocess)を用いる focused deterministic regression で staging/final authority boundary と POST transport 変更を検証でき、外部 runtime service は不要なため。
Background
merged PR #2621 により、patch_comment() は PATCH once → PATCH response representation を authority にしない → direct GET → full binding という契約に確定済みであり、.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py の TestPatchCommentTransportAndReconciliation が real transport + real verifier でこれを regression 済みである。
本 Issue は当初、この GET-authoritative invariant を test_contract_snapshot_author_binding.py に再度証明する形で起票されたが、operator (OWNER) によるレビュー(fact-check 済み、https://github.com/squne121/loop-protocol/issues/2627#issuecomment-5618785072)により、以下が判明した。
- AC1 は既存実装の重複証明に過ぎない: PATCH/readback の GET-authoritative invariant は
test_ensure_contract_snapshot.py::TestPatchCommentTransportAndReconciliationとして current main に既に存在する。同じ内容をtest_contract_snapshot_author_binding.pyに再度書くことは、実装 Issue としての baseline-failing delta が弱く、保守コストだけが増える。 - 「temp-file bytes = 実際に送信した bytes」という前提は不正確:
gh api -F/--field key=@fileはファイルを読み field 値を構築する処理であり、--inputの「事前構築済み request body をそのまま渡す」処理とは異なる(GitHub CLI 公式マニュアル: https://cli.github.com/manual/gh_api)。さらにNamedTemporaryFile(mode="w", encoding="utf-8")はnewline未指定のため、text I/O のデフォルト universal newlines 変換(Windows では CRLF 変換)を受ける(Python 公式ドキュメント: https://docs.python.org/3/library/tempfile.html)。したがって temp-file 内容は診断用の staging representation であり、final persisted-body authority の根拠にはならない。 - AC2(診断用途への限定)は現状のままでは証明できない: staging digest と final GET body digest が偶然一致する fixture だけでは、将来 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 が staging digest を final verifier へ誤って渡しても false-green になり得る。意図的に異なる digest を用いる deliberately-divergent regression が必要。
GitHub Issue Comments REST API の body field は raw Markdown 文字列として扱われ、GET はこれをそのまま返す(GitHub 公式ドキュメント: https://docs.github.com/en/rest/issues/comments)。このため「final authority = direct GET body の UTF-8 SHA256」という選択自体は正しく、変更しない。
- Deterministic fix: staging/final authority の混同を deliberately-divergent regression で防ぎ、POST transport を PATCH と同じ canonical JSON stdin へ統一してプラットフォーム依存の中間表現自体を削除する。再現可能で testable なため採用する。
- Workaround: POST 側の temp-file transport をそのまま残し、「diagnostics 限定」という運用注記だけを 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 に残す。プラットフォーム依存の newline 変換や概念混同のリスクを構造的に防げず、検証不能なため不採用とする。
Source
- source: post_merge_cleanup
- source_url: fix: reconcile untrusted PATCH comment responses #2621 (comment)
- note_id: 1
- dedupe_key:
follow-up:squne121/loop-protocol:pr/2621:1 - reframe_source_url: 実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 (comment)
In Scope
post_comment()をpatch_comment()と同じ canonical JSON UTF-8 →gh api --input -transport に統一し、tempfile.NamedTemporaryFile/--field body=@file/ 暗黙の OS newline 変換を削除する(返り値の型・HTTP status 分類・例外処理の既存契約は変更しない)。- POST-staging 用の digest 計算と、final PATCH/readback の persisted-body authority 用の digest 計算が、役割を示す別名(例:
staging_file_sha256とexpected_persisted_body_sha256相当の区別)でコード上明確に分離されていることを保証する。実装詳細の変数名そのものを本 Issue で過剰固定はしない。 - staging representation と final persisted body が意図的に異なる fixture を用いた deliberately-divergent regression を追加し、以下の両方向を検証する。
- staging digest が final persisted digest と異なっていても、final direct GET body が期待 body と一致すれば final binding は PASS する。
- staging digest が何らかの期待値と一致していても、final direct GET body が期待 final body と異なれば必ず FAIL する。
- 上記 regression の自然な配置先(
test_ensure_contract_snapshot.pyの既存TestPatchCommentTransportAndReconciliation相当の real-transport regression 群、または隣接する新規テストクラス)に追加する。
Out of Scope
- merged PR fix: reconcile untrusted PATCH comment responses #2621 の branch、commit、または内容の変更・再オープン・再実装。
- PATCH/readback の GET-authoritative invariant 自体の再実装・再証明(current main で既に実装・regression 済みのため)。
- Issue 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の body/comment の編集。
- canonical parser、controlled executor、publisher allowlist / trust policy、実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 receipt schema、permission/security harness、mandatory live GitHub canary の変更。
- 実装: stale base-bound contract snapshot をfresh materializationする #1655 の stale-base binding 問題そのものの解消(merge-order / current-main reconciliation の確認のみ行う)。
- POST staging-byte diagnostics という概念自体の削除、または 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の check-only existence-detection outcome の実装完了。
Acceptance Criteria
- AC1 (Deliberately-divergent regression): staging representation と final persisted body が意図的に異なる fixture を用いた focused regression が、(a) staging digest が final persisted digest と異なっていても final direct GET body が期待 body と一致すれば PASS すること、(b) staging digest が何らかの期待値と一致していても final direct GET body が期待 final body と異なれば必ず FAIL することの両方を検証する。
- AC2 (Role separation): POST-staging 用 digest と final persisted-body authority 用 digest が、コード上(変数名・引数名など)で役割の異なる別概念として区別されており、両者が同一の authority-like な名前を共有していないことを regression または静的確認で示す。
- AC3 (POST transport simplification):
post_comment()がpatch_comment()と同じ canonical JSON UTF-8 →gh api --method POST --input -transport に統一され、tempfile/--field body=@fileを使用しないことを focused regression で検証する。既存の POST 呼び出し元の返り値契約((html_url_or_None, post_status_code, http_status_or_None))が変わらないことも検証する。 - AC4 (Non-regression): merged PR fix: reconcile untrusted PATCH comment responses #2621 由来の
TestPatchCommentTransportAndReconciliation(test_ensure_contract_snapshot.py)を含む既存の PATCH/readback regression が引き続き PASS する。
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
# AC2
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
# AC3
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py -q
# AC4
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.py .claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py -qAllowed 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
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- final authority を direct GET 以外へ変更しなければ解決できない場合
- POST transport の統一により
post_comment()の呼び出し元契約(返り値の型・意味)を変更しなければ解決できない場合
Required Skills
- Python
- pytest
- JSON / YAML serialization
gh apiの-F/--fieldと--inputsemantics
Required Design References
.claude/skills/impl-review-loop/SKILL.md—ensure_contract_snapshot.pyの two-phase POST/PATCH ワークフローの正本- Issue 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 — POST staging-byte diagnostics と check-only detection の既存 implementation contract(本 Issue 完了後、current main に対して再 refinement が必要)
- Issue 実装: Contract Snapshot publish の transport round-trip と PATCH reconciliation を修正する #2619 — GET decoded Markdown body UTF-8 SHA256 を final authority とする finalized contract
- merged PR fix: reconcile untrusted PATCH comment responses #2621 —
patch_comment()の GET-authoritative full-binding 契約とTestPatchCommentTransportAndReconciliation - fix: reconcile untrusted PATCH comment responses #2621 (comment) — post-merge cleanup source
- 実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 (comment) — OWNER によるreframe指摘(本 Issue の reframe 根拠)
- https://cli.github.com/manual/gh_api —
gh apiの-F/--field key=@fileと--inputの semantics 差異 - https://docs.github.com/en/rest/issues/comments — GitHub Issue Comments REST API の
bodyfield semantics - https://docs.python.org/3/library/tempfile.html — Python text-mode temporary file の newline semantics
Scope Delta(任意)
- 変更内容: Allowed Paths に
.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.pyを追加する。 - 理由: investigation(codebase-investigator, read-only)により、PATCH/readback の real-transport regression(
TestPatchCommentTransportAndReconciliation)と既存の POST regression が既にtest_ensure_contract_snapshot.pyに配置されていることが確認された。deliberately-divergent regression と POST transport simplification regression の自然な配置先はこのファイルであり、test_contract_snapshot_author_binding.py(verify_controlled_publisher_comment_id_bindingのモック transport を使う高レベル binding-authority テスト層)に同内容を追加すると既存構造と乖離する。 - 根拠: operator-selected human-context anchor comment(https://github.com/squne121/loop-protocol/issues/2627#issuecomment-5618785072)の P2 指摘(POST transport simplification の推奨)を実装可能にするための投機的でない直接的な帰結であり、scope creep には該当しない。
Delivery Rule
1 Issue = 1 PR、専用 worktree、Draft PR を既定とする。- この Issue は 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の hard predecessor とし、この Issue の PR が merge されるまで 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 と同じ Allowed Paths を並行編集しない。
- 実装: stale base-bound contract snapshot をfresh materializationする #1655、実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490、および 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 と current main の差分競合を実装開始時に確認し、競合を解消するための scope 拡張は行わない。
- 本 Issue の POST transport simplification(AC3)が採用されるため、実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の temp-file readback SHA256 を前提とする AC(tempfile-specific な AC)は obsolete になり得る。実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 は final PATCH persisted-body authority を所有せず、hash mismatch diagnostics と check-only existence classification のみを責務とする。実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 は本 Issue の PR merge 後、current main に対して再 refinement が必要である。
Notes for Reviewer
Scope Collision (C1): related_issue=#2602, #1944, #1655, #1513, #1490, #1053, #966, #962, #961; overlapping_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。Edit intent is limited to the staging-diagnostic/final-authority boundary and POST transport simplification. This Issue is registered as a hard predecessor of #1513; #1655 and #1490 remain separate concerns and must be reconciled against current main before implementation. AC1 (旧: GET-authoritative invariant の再証明) は current main で既に満たされているため、実装対象から除外し、adversarial regression(新 AC1/AC2)と POST transport simplification(新 AC3)へ reframe した(reframe_in_place、根拠: https://github.com/squne121/loop-protocol/issues/2627#issuecomment-5618785072)。
Activity
squne121 commentedon Sep 10, 2026
結論
判定は
REQUEST_CHANGES — reframe_in_placeが適切です。#2627 の根本方針、つまり **「POST 時の staging 情報」と「最終的に GitHub に永続化された Markdown body の authority を分離する」**こと自体には賛成です。#1513 は temp-file 側を
expected_body_sha256の根拠にしようとしている一方、#2619 / merged PR #2621 は final PATCH 後の authority を direct GET で取得したbodyの UTF-8 SHA256 に確定させています。#2627 はこの衝突を認識して作られています。ただし、現状の #2627 のまま実装すると、ほぼ既存テストの重複だけで終わる可能性が高いです。さらに「POST staging-byte」という概念自体にも技術的な誤認が残っています。この2点は実装前に直した方がよいです。
敵対的レビュー
優先度 | Finding | 判定 -- | -- | -- P1 | AC1 の GET-authoritative invariant は current main ですでに実装・回帰済み | 要修正 P1 | 「temp-file bytes = 実際に送信した bytes」という #1513/#2627 のモデルが不正確 | 要修正 P1 | AC2 に staging hash と final hash が意図的に異なる negative fixture がない | 要修正 P2 | POST transport 自体を PATCH と同じ canonical JSON stdin に統一した方が単純 | 強く推奨 P2 | expected_body_sha256 という同一概念名が staging / persisted authority の混同を誘発する | 改善推奨 P3 | final PATCH 後の direct GET がやや重複している | 今回は拡張不要 — | parser / receipt / security harness / live GitHub canary を Out of Scope にしている | 妥当P1 — AC1 はすでに current main が満たしている
ここが最大の問題です。
merged PR #2621 は
patch_comment()を、PATCH once → PATCH response representation を authority にしない → direct GET → full bindingへ既に変更しています。PR自体も merged 済みです。
current
mainの実装でも、となっていて、
sha256_of()は文字列を UTF-8 encode して SHA256 を取っています。PATCH stdout は authority に使っていません。さらに
test_ensure_contract_snapshot.pyのTestPatchCommentTransportAndReconciliationは既に、PATCH endpoint、--silent、JSON body、1回の GET、invalid JSON / ID mismatch / body mismatch、GET body hash mismatchなどを realpatch_comment()+ real verifier で検査しています。つまり #2627 の
は、Issue作成時点ですでに実装されている contract です。GitHub API もデフォルトの
bodyを raw Markdown として返すため、この authority の選択そのものは正しいです。(GitHub Docs)したがって #2627 は「implementation Issue」としては baseline-failing delta が弱すぎます。単に同じ test を
test_contract_snapshot_author_binding.pyにもう一度書くだけなら、品質向上に対して保守コストが増えます。#2627 の本当の価値は AC1 を再証明することではなく、将来 #1513 を実装したときに AC1 を壊せない negative regression を作ることに置くべきです。
P1 —
POST staging-byte digestの意味がまだ間違っている現在の
post_comment()は temp file に本文を書き、を実行しています。
しかし GitHub CLI の実装を見ると、
-F body=@fileは ファイルを読み、その内容を Go のstringとして field parameter に入れる処理です。さらに
gh apiはその fields map をrequestBody = paramsとして HTTP request を構築します。一方、事前構築済み request body をそのまま渡す機構は別の--inputです。 GitHub CLI の公式マニュアルも@fileは field の「値を読む」機能、--inputは request body 自体を渡す機能、と明確に分けています。(GitHub CLI)したがって、
ではありません。
正確には、
です。
さらに現在の
NamedTemporaryFile(mode="w", encoding="utf-8")はnewlineを指定していません。NamedTemporaryFileのデフォルトはnewline=Noneであり、Python の text I/O は write 時に\nを OS の line separator へ変換します。Windows なら典型的には CRLF です。(Python Docs)これは #1513 の
という設計が、プラットフォーム依存の intermediate representation を authority-like な名前へ流し込むことを意味します。
#2627 はそれを「diagnostics に限定する」としていますが、単に用途を限定するだけでなく、概念名まで明確に分離した方がよいです。
例えば、
staging_file_sha256と
expected_persisted_body_sha256くらいには分けるべきです。
P1 — AC2 は「混同していないこと」を実際には証明できない
#2627 の AC2 は、
としています。
しかし現在の記述だと、staging body と final body がたまたま同じ SHA になる fixture でも PASS できます。それでは、将来 #1513 が staging digest を誤って final verifier に渡してもテストが false-green になり得ます。
ここは 意図的に異なる digest を作る regression が必要です。
例えば fixture 上で、
のように明確に異なる値を使い、staging digest が何であっても final PATCH 後は
だけで成功・失敗が決まることを検証します。
逆方向も必要です。つまり、
staging digest が期待値と一致していても、final GET body が違えば必ず fail。
この2方向を入れて初めて「diagnostic と authority が分離されている」という AC2 を証明できます。
P2 — temp file 自体を消す方が、かなり良い設計
このプロジェクトの前提なら、私はここまで踏み込む案を推します。
現在 PATCH は既に、
という deterministic な transport です。
POST も全く同じ方式に揃えるのが一番単純です。
そうすると、
になり、
という余分な中間層が消えます。
GitHub API が要求しているのは最終的には JSON の
body: stringだけです。(GitHub Docs)これは security hardening ではなく、コード削減・platform差削減・診断単純化です。今回の個人開発の優先順位にはかなり合っています。
この方式を採るなら、#1513 の「temp-file readback SHA」を実装する必要そのものが薄れます。#1513 は、
hash mismatch diagnostics + check-only existence classification
だけに再スコープできます。
P2 — #2627 を残すなら、こう直すのが良い
私なら #2627 の Goal を、
に変えます。
Acceptance Criteria も以下の4点に絞ります。
Final authority regression
final PATCH の成功条件は direct GET の raw Markdown
bodyを UTF-8 encode した SHA256 のみ。PATCH representation や POST staging digest は成功根拠にならない。Deliberately-divergent regression
staging digest と final persisted body digest を意図的に異ならせ、final GET が一致すれば PASS、final GET が不一致なら staging digest にかかわらず FAIL。
POST transport simplification(推奨)
post_comment()も PATCH と同じ canonical JSON +--input -にし、temp file /--field body=@fileを削除する。これを採るなら 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の tempfile-specific AC2/AC5 は obsolete とする。No scope creep
canonical parser、controlled executor、publisher allowlist、実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 receipt schema、permission/security harness、mandatory live GitHub canaryには触れない。
この4点なら、実装内容と Issue の存在理由が明確になります。
関連Issue/PRの扱い
#1513 は hash mismatch diagnostics / check-only existence detection を所有させればよく、final PATCH authority は所有させるべきではありません。現在の #1513 は temp-file hashを
expected_body_sha256にする記述が強すぎるので、#2627 を先行させるなら #1513 実装時にその意味を POST-stage 限定へ解釈する必要があります。#2619 / PR #2621 は既に completed として扱ってよく、再オープンや再実装は不要です。特に PR #2621 の cleanup review で指摘された docstring、
--silent、endpoint assertion は最終版に反映されています。PR #1548 は古い設計履歴として重要です。当時は Safety Claim に「PATCH exact payload / response / independent GET を照合」と明示されていましたが、これは #2621 で意図的に変更された契約です。元に戻す理由はありません。
#1490 の publish receipt は今回には不要です。既存 snapshot の長期再利用保証という別問題であり、ここへ混ぜると schema/storage/harness のコストだけが増えます。
#1655 も stale base binding の別問題です。同じファイルを触るので merge-order collision の確認だけで十分です。
最終判断
#2627 は close/duplicate にするほど無価値ではありませんが、現状のまま
impl-review-loopに渡すのは推奨しません。最大の改善は、「既存 GET-authority をもう一度テストするIssue」から、「#1513 が staging digest を final authority へ漏らすことを不可能にする adversarial regression Issue」へ変えることです。
さらに品質・有用性優先なら、私は POST の temp-file transport を廃止し、PATCH と同じ canonical JSON
--input -に統一する案を第一候補にします。これなら #1513 の原因領域自体が縮まり、追加の receipt、live canary、security harness は不要です。(GitHub CLI)現状の評価は P1 × 3、P2 × 2、P0なし。方向性は維持しつつ、Issue 本文を一度精緻化してから実装へ進めるのが適切です。
## 結論判定は
REQUEST_CHANGES — reframe_in_placeが適切です。#2627 の根本方針、つまり **「POST 時の staging 情報」と「最終的に GitHub に永続化された Markdown body の authority を分離する」**こと自体には賛成です。#1513 は temp-file 側を
expected_body_sha256の根拠にしようとしている一方、#2619 / merged PR #2621 は final PATCH 後の authority を direct GET で取得したbodyの UTF-8 SHA256 に確定させています。#2627 はこの衝突を認識して作られています。ただし、現状の #2627 のまま実装すると、ほぼ既存テストの重複だけで終わる可能性が高いです。さらに「POST staging-byte」という概念自体にも技術的な誤認が残っています。この2点は実装前に直した方がよいです。
敵対的レビュー
mainですでに実装・回帰済みexpected_body_sha256という同一概念名が staging / persisted authority の混同を誘発するP1 — AC1 はすでに current main が満たしている
ここが最大の問題です。
merged PR #2621 は
patch_comment()を、PATCH once → PATCH response representation を authority にしない → direct GET → full bindingへ既に変更しています。PR自体も merged 済みです。
current
mainの実装でも、となっていて、
sha256_of()は文字列を UTF-8 encode して SHA256 を取っています。PATCH stdout は authority に使っていません。さらに
test_ensure_contract_snapshot.pyのTestPatchCommentTransportAndReconciliationは既に、PATCH endpoint、--silent、JSON body、1回の GET、invalid JSON / ID mismatch / body mismatch、GET body hash mismatchなどを realpatch_comment()+ real verifier で検査しています。つまり #2627 の
は、Issue作成時点ですでに実装されている contract です。GitHub API もデフォルトの
bodyを raw Markdown として返すため、この authority の選択そのものは正しいです。([GitHub Docs]1)したがって #2627 は「implementation Issue」としては baseline-failing delta が弱すぎます。単に同じ test を
test_contract_snapshot_author_binding.pyにもう一度書くだけなら、品質向上に対して保守コストが増えます。#2627 の本当の価値は AC1 を再証明することではなく、将来 #1513 を実装したときに AC1 を壊せない negative regression を作ることに置くべきです。
P1 —
POST staging-byte digestの意味がまだ間違っている現在の
post_comment()は temp file に本文を書き、を実行しています。
しかし GitHub CLI の実装を見ると、
-F body=@fileは ファイルを読み、その内容を Go のstringとして field parameter に入れる処理です。さらに
gh apiはその fields map をrequestBody = paramsとして HTTP request を構築します。一方、事前構築済み request body をそのまま渡す機構は別の--inputです。 GitHub CLI の公式マニュアルも@fileは field の「値を読む」機能、--inputは request body 自体を渡す機能、と明確に分けています。(GitHub CLI)したがって、
ではありません。
正確には、
です。
さらに現在の
NamedTemporaryFile(mode="w", encoding="utf-8")はnewlineを指定していません。NamedTemporaryFileのデフォルトはnewline=Noneであり、Python の text I/O は write 時に\nを OS の line separator へ変換します。Windows なら典型的には CRLF です。([Python Docs]3)これは #1513 の
という設計が、プラットフォーム依存の intermediate representation を authority-like な名前へ流し込むことを意味します。
#2627 はそれを「diagnostics に限定する」としていますが、単に用途を限定するだけでなく、概念名まで明確に分離した方がよいです。
例えば、
staging_file_sha256と
expected_persisted_body_sha256くらいには分けるべきです。
P1 — AC2 は「混同していないこと」を実際には証明できない
#2627 の AC2 は、
としています。
しかし現在の記述だと、staging body と final body がたまたま同じ SHA になる fixture でも PASS できます。それでは、将来 #1513 が staging digest を誤って final verifier に渡してもテストが false-green になり得ます。
ここは 意図的に異なる digest を作る regression が必要です。
例えば fixture 上で、
のように明確に異なる値を使い、staging digest が何であっても final PATCH 後は
だけで成功・失敗が決まることを検証します。
逆方向も必要です。つまり、
staging digest が期待値と一致していても、final GET body が違えば必ず fail。
この2方向を入れて初めて「diagnostic と authority が分離されている」という AC2 を証明できます。
P2 — temp file 自体を消す方が、かなり良い設計
このプロジェクトの前提なら、私はここまで踏み込む案を推します。
現在 PATCH は既に、
という deterministic な transport です。
POST も全く同じ方式に揃えるのが一番単純です。
そうすると、
になり、
という余分な中間層が消えます。
GitHub API が要求しているのは最終的には JSON の
body: stringだけです。([GitHub Docs]1)これは security hardening ではなく、コード削減・platform差削減・診断単純化です。今回の個人開発の優先順位にはかなり合っています。
この方式を採るなら、#1513 の「temp-file readback SHA」を実装する必要そのものが薄れます。#1513 は、
hash mismatch diagnostics + check-only existence classification
だけに再スコープできます。
P2 — #2627 を残すなら、こう直すのが良い
私なら #2627 の Goal を、
に変えます。
Acceptance Criteria も以下の4点に絞ります。
Final authority regression
final PATCH の成功条件は direct GET の raw Markdown
bodyを UTF-8 encode した SHA256 のみ。PATCH representation や POST staging digest は成功根拠にならない。Deliberately-divergent regression
staging digest と final persisted body digest を意図的に異ならせ、final GET が一致すれば PASS、final GET が不一致なら staging digest にかかわらず FAIL。
POST transport simplification(推奨)
post_comment()も PATCH と同じ canonical JSON +--input -にし、temp file /--field body=@fileを削除する。これを採るなら 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の tempfile-specific AC2/AC5 は obsolete とする。No scope creep
canonical parser、controlled executor、publisher allowlist、実装: contract snapshot既存再利用パスにpublish receipt bindingを追加する #1490 receipt schema、permission/security harness、mandatory live GitHub canaryには触れない。
この4点なら、実装内容と Issue の存在理由が明確になります。
関連Issue/PRの扱い
#1513 は hash mismatch diagnostics / check-only existence detection を所有させればよく、final PATCH authority は所有させるべきではありません。現在の #1513 は temp-file hashを
expected_body_sha256にする記述が強すぎるので、#2627 を先行させるなら #1513 実装時にその意味を POST-stage 限定へ解釈する必要があります。#2619 / PR #2621 は既に completed として扱ってよく、再オープンや再実装は不要です。特に PR #2621 の cleanup review で指摘された docstring、
--silent、endpoint assertion は最終版に反映されています。PR #1548 は古い設計履歴として重要です。当時は Safety Claim に「PATCH exact payload / response / independent GET を照合」と明示されていましたが、これは #2621 で意図的に変更された契約です。元に戻す理由はありません。
#1490 の publish receipt は今回には不要です。既存 snapshot の長期再利用保証という別問題であり、ここへ混ぜると schema/storage/harness のコストだけが増えます。
#1655 も stale base binding の別問題です。同じファイルを触るので merge-order collision の確認だけで十分です。
最終判断
#2627 は close/duplicate にするほど無価値ではありませんが、現状のまま
impl-review-loopに渡すのは推奨しません。最大の改善は、「既存 GET-authority をもう一度テストするIssue」から、「#1513 が staging digest を final authority へ漏らすことを不可能にする adversarial regression Issue」へ変えることです。
さらに品質・有用性優先なら、私は POST の temp-file transport を廃止し、PATCH と同じ canonical JSON
--input -に統一する案を第一候補にします。これなら #1513 の原因領域自体が縮まり、追加の receipt、live canary、security harness は不要です。([GitHub CLI]2)現状の評価は P1 × 3、P2 × 2、P0なし。方向性は維持しつつ、Issue 本文を一度精緻化してから実装へ進めるのが適切です。
squne121 commentedon Sep 10, 2026
推奨は
reframe_in_placeを採用し、#2627 を閉じずに目的とACを組み替える です。currentmainでは PATCH はすでに canonical JSON--input -→ direct GET binding になっている一方、POST はまだNamedTemporaryFile+--field body=@fileです。したがって、既存 PATCH authority の再テストではなく「staging representation が final authority に流入しないこと」と「POST/PATCH transport の統一」に価値を寄せるのが妥当です。また #1513 は現在も temp-file readback SHA を
expected_body_sha256に使うことを AC2/AC5 として要求しており、今回の推奨設計と直接衝突します。ただし今回の refinement では #1513 自体を編集せず、#2627 側に「#2627 完了後に #1513 を再精緻化する必要がある」と明示するのがスコープ上きれいです。issue-refinement-loopは loop iteration の承認をデフォルト要求しません。また、今回のようにオペレーターが明示的に anchor comment を指定したケースはwith_human_contextlane を使用でき、調査で導出した exact path を scope reframe に利用する仕組みがあります。以下を、そのまま auto mode の Claude Code に渡す想定です。
Repository:
squne121/loop-protocolTarget Issue:
#2627
Human-context anchor comment:
#2627 (comment)
.claude/skills/issue-refinement-loopを使い、上記 anchor comment を起点として #2627 の refinement loop を完遂してください。このセッションは既に auto mode で起動済みです。通常の refinement、調査、Issue 本文更新、再レビューについて人間の逐次承認を求めないでください。合理的かつ deterministic に選択できる場合は推奨案を自律的に採用してください。Claude Code の permission mode や hook 設定を変更する必要はありません。
Anchor の扱い
このプロンプト自体が、上記 anchor comment を operator-selected human context として使用する明示指示です。
canonical main root / default branch から、skill が定義する
preflight.run.with_human_context相当の正規 lane を使用してください。author_associationだけから human origin を推定しない。REQUEST_CHANGES — reframe_in_placeは重要な human feedback として扱うが、技術的主張は current main と一次資料で fact-check してから採用する。サブエージェント
必ずサブエージェントを使用してください。
少なくとも read-only の
codebase-investigator相当を起動し、以下を currentmainで確認させてください。.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.py.claude/skills/impl-review-loop/tests/test_contract_snapshot_author_binding.py.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.pyanchor comment に含まれる外部技術主張が refinement decision に影響するため、skill の条件を満たす範囲で
web-researcher相当も利用し、可能な限り公式一次資料から以下を確認してください。gh api -F/--field body=@fileの意味gh api --input -の request-body semanticsbodyfieldサブエージェントは read-only とし、nested SubAgent delegation はさせないでください。
起動した全サブエージェントの完了を必ず待ってください。
途中結果だけを見て Issue rewrite や最終判定へ進んではいけません。
全 terminal result を root/main control-plane が回収・統合してから次へ進んでください。
推奨する reframe 方針
anchor comment の P1 指摘は原則採用してください。fact-check で反証されたものだけ、証拠付きで不採用にしてください。
#2627 は close / duplicate にせず、概ね次の目的へ
reframe_in_placeすることを第一候補とします。特に以下を反映してください。
既存 AC1 の重複を除去する
current main ですでに成立している
PATCH → direct GET → decoded Markdown body UTF-8 SHA256という invariant を、単に別テストファイルでもう一度再証明することを 実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 の主目的にしない。
実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 の価値は、将来 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 を実装した際に staging digest がこの final authority を上書き・迂回できないことを regression で保証する点に置く。
staging と persisted authority の概念を分離する
temp-file bytes = GitHub に実際に送信された bytesという表現は、fact-check 結果に従って正確な intermediate/staging representation の表現へ改める。
staging/provisional diagnostic と final persisted-body authority に同一の authority-like な名称を使わない。
必要なら例えば、
staging_file_sha256expected_persisted_body_sha256のように役割を明示する。ただし実装詳細を Issue 本文で過剰固定せず、最小限の contract とする。
deliberately-divergent regression を必須化する
staging/provisional digest と final GET body digest が意図的に異なる fixture を要求する。
少なくとも次の両方向を証明できる AC にする。
staging と final が偶然同じ digest になる fixture だけで AC を満たしたことにしない。
POST transport simplification を第一候補として採用する
codebase investigation と一次資料で問題がなければ、
post_comment()も PATCH と同様にPython str → canonical JSON UTF-8 → gh api --input -へ統一し、
--field body=@fileを削除する方針を 実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 の In Scope / AC に含める。
これは security hardening としてではなく、コード量削減、platform variance 削減、transport semantics 単純化として扱う。
テスト配置を current main に合わせる
PATCH/readback contract がすでに
.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.pyに十分存在するなら、同じ内容をtest_contract_snapshot_author_binding.pyへ重複追加しない。POST transport regression や cross-boundary regression の自然な配置先を investigation で決定する。
その結果
.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.pyの編集が必要なら、今回の operator-selected human-context anchor と investigation-derived exact path に基づき、skill の scope-delta authority の正規経路で 実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 の Allowed Paths へ追加してください。単に現在の Allowed Paths に無いという理由だけで人間へ戻さないでください。実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 との責務境界を明示する
実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 から 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 本文・コメントを直接編集しない。
POST transport を canonical JSON stdin に統一する場合、実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の tempfile-specific AC2/AC5 は obsolete になり得ることを 実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 の Remaining Gaps / dependency note 等に明記する。
実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 が今後所有すべき中心責務は、
とし、final PATCH persisted-body authority は 実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 の責務へ戻さない。
実装: Reconcile contract snapshot PATCH/readback invariants with Issue #1513 #2627 完了後、実装: ensure_contract_snapshot.py の go コメント binding 検証が実際に投稿済みの go コメントを恒久的に検出できないバグを修正する #1513 は実装前に current main に対して再 refinement が必要であることを明示する。
Scope creep を避ける
今回は以下へ拡張しない。
同一ファイル競合については merge-order / current-main reconciliation の確認だけ行う。
Issue rewrite
調査と fact-check 後、
issue-refinement-loopの canonical planner/reviewer routing に従い #2627 本文を更新してください。目標は少なくとも以下が明確な Issue にすることです。
本文を書き換えたら必ず再レビューしてください。
needs-fixなら、skill が許す bounded loop の範囲で自動修正 → 再レビューを続けてください。各 iteration の通常継続で人間承認を要求しないでください。承認不要ポリシー
以下について私への確認を挟まないでください。
「案A/Bどちらにしますか」のような選択を人間へ戻さず、品質・有用性・単純性を優先して最善案を選択してください。
ただし skill の canonical hard stop 自体は捏造して回避しないでください。
human_judgment_required、max-iteration exhaustion、破壊的/非冪等な外部操作、permission boundary変更、秘密情報要求、対象 Issue の context-binding 不一致など、本当に skill が停止を要求する場合だけ停止し、blocker と再開条件を具体的に報告してください。完了条件
以下をすべて満たした時点で終了してください。
reframe_in_placeで必要十分な implementation Issue に更新済みこのタスクでは実装コード変更、PR作成、#1513 の編集までは開始しないでください。
#2627 の refinement 完了地点で止め、最後に次だけ簡潔に報告してください。
なお、Claude Code セッションが現在 別の ACTIVE Task に binding されている場合は、このプロンプトを送る前に
/taskで #2627 へ明示的に切り替える方が安全です。squne121 commentedon Sep 10, 2026
issue-refinement-loop: 完了 (2026-09-10T13:02Z)
Reframe 概要
operator-selected human-context anchor comment(OWNER, https://github.com/squne121/loop-protocol/issues/2627#issuecomment-5618785072、`REQUEST_CHANGES — reframe_in_place`)を受け、以下を fact-check 済みで反映した。
TestPatchCommentTransportAndReconciliation)で既に実装・回帰済みであることを確認し、再証明を主目的から外した。post_comment()をpatch_comment()と同じ canonical JSON UTF-8 →gh api --input -へ統一)を新 AC3 として採用。test_ensure_contract_snapshot.pyを Scope Delta 経由で追加(investigation により real-transport regression の自然な配置先と確認)。実行した調査・レビュー
ensure_contract_snapshot.py/ 両テストファイル / PR fix: reconcile untrusted PATCH comment responses #2621 を実地確認。AC1 既実装・POST が temp-file 経由・deliberately-divergent fixture 不在、を確認。gh api -F/--field、--input、GitHub Issue Comments API body field、Python tempfile newline semantics)を公式一次資料で fact-check、すべて CONFIRMED。run_root_review_pipeline.py produce):canonical_step2_route: step_2_5(VERDICT: approve)。non-blocking improvement 1件(Current Validated Scope と In Scope の token jaccard 乖離、severity: warning)。issue-design-reviewer):assessment: findings、low severity 1件(AC3後の POST-staging digest の意味の明示不足、requires_owner_choice: false)。join_review_results.pyによりeffective_verdict: approve。次アクション
本セッションでは、operator instruction により実装コード変更・PR作成・#1513 の編集は開始しない。#2627 は
refinement完了状態で終了する。実装は別途明示的なimpl-review-loop起動を待つ。Downstream: #1513
本 Issue の PR merge 後、#1513 は current main に対して再 refinement が必要(tempfile-specific AC がこの Issue の POST transport simplification により obsolete になり得るため)。
squne121 commentedon Sep 10, 2026
推奨は、#2627 を再 refinement せず、そのまま
impl-review-loopに投入することです。最新の refinement はstatus: approved、deterministic checker / semantic design review とも APPROVE、blocker なしまで到達しています。実装の主眼もかなり明確です。現在の
PATCH経路はすでに canonical JSON stdin + direct GET authority に寄せられている一方、post_comment()側には tempfile +--field body=@fileが残っています。#2627 はそこを統一しつつ、POST staging digest と final persisted-body authority を意図的に異ならせる negative regression を固定するのが中心です。 GitHub CLI 自体も--input -による stdin body を正式にサポートしているため、この簡素化は自然です。([GitHub CLI]1)-review-loop` 自体が、Main Thread を control plane に限定し、implementation-worker → test-runner → pr-reviewer の SubAgent チェーンで「実装→検証→レビュー」を回す設計です。したがって、各 SubAgent の完了を必ず待ち、REQUEST_CHANGES は承認を挟まず修正ループへ戻す指示を明示するのが適切です。以下を、そのまま既に auto mode で起動している Claude Code に送るのを推奨します。
対象リポジトリは
squne121/loop-protocol、対象は GitHub Issue #2627 です。このターンから、人間の逐次承認を求めずに
.claude/skills/impl-review-loopを正規のオーケストレーターとして使用し、Issue #2627 の実装・検証・PRレビュー修正ループを、マージ直前の merge-ready 状態まで自律的に進めてください。まず live の Issue #2627 本文・全コメント・関連 Issue / PR と current
main、.claude/skills/impl-review-loop/SKILL.mdおよび同 skill が参照する step/reference を読み直してください。過去の reframe 前の契約ではなく、現在の Issue 本文と最新の approved refinement result を authority としてください。issue_number=2627としてimpl-review-loopを開始してください。iteration budget を明示指定できる場合はmax_iterations=5としてください。実行モデル
Main Thread は control plane / orchestration / state management のみに徹してください。Main Thread 自身が implementation-worker、test-runner、pr-reviewer の役割を代替してコード編集・検証・レビューを済ませないでください。
実装フェーズでは
implementation-workerSubAgent を使用し、SubAgent が完全に終了して結果を返すまで必ず待ってください。検証フェーズでは
test-runnerSubAgent を使用し、すべての要求された検証が完了して結果を返すまで必ず待ってください。PR review フェーズでは
pr-reviewerSubAgent を使用し、current PR head に対する独立レビューが完全に終了して verdict を返すまで必ず待ってください。SubAgent 実行中に次のフェーズへ進まないでください。SubAgent の完了を推測せず、明示的な completed/result を確認してください。
各 child SubAgent はさらに SubAgent を spawn する nested delegation を行わないでください。SubAgent orchestration は Main Thread が所有してください。
通常操作の承認不要
通常の調査、worktree/branch 作成、Issue contract 内のコード編集、テスト追加・修正、format/lint、commit、push、Draft PR 作成・更新、PR body 更新、CI確認、レビュー要求、レビュー指摘への修正、再テスト、再push、再レビューは、人間へ確認せず自動で継続してください。
REQUEST_CHANGESが返った場合は、内容を current-head evidence と照合したうえで、そのまま implementation-worker → test-runner → pr-reviewer の次 iteration に進めてください。各 iteration の途中で「修正してよいですか」「pushしてよいですか」「レビューを続けますか」等の承認を求めないでください。Issue #2627 固有の実装方針
current Issue contract を忠実に実装してください。
第一候補は
.claude/skills/impl-review-loop/scripts/ensure_contract_snapshot.pyのpost_comment()を、現在の tempfile +--field body=@filetransport から、既存patch_comment()と同系統のPython str -> canonical JSON UTF-8 bytes -> gh api --input -へ単純化することです。
POST request の JSON body は
bodystring を保持し、Unicode、改行、backslash 等について Python の入力文字列から GitHub API に渡す JSON semantics が一意になるようにしてください。不要になった tempfile lifecycle とbody=@filetransport は削除してください。ただし、今回の核心は transport の変更だけではありません。
POST 時点の staging representation / staging digest と、final PATCH 後に GitHub に永続化された Markdown body の authority を明確に分離してください。
final persisted-body の成功判定 authority は、既存契約どおり independent direct GET で取得した raw Markdown
bodyの UTF-8 SHA256 としてください。PATCH response representation、POST response representation、POST staging representation、POST staging digest のいずれも final persisted-body の成功根拠へ昇格させないでください。regression test には、staging と final が偶然同じ値になる happy-path だけでなく、意図的に異なる digest を使う adversarial fixture を必ず含めてください。
具体的には、staging digest と final expected/persisted digest が異なっていても、final direct GET body が期待 final body と一致すれば final binding が PASS することを証明してください。
逆に、staging representation/digest が期待値と一致していても、final direct GET body が期待 final body と異なれば必ず FAIL することを証明してください。
既に PR #2621/current main で証明済みの PATCH GET-authority invariant を大量に重複テストしないでください。既存テストを再利用し、#2627 で必要な POST transport と staging/final boundary の差分だけを追加してください。
テスト配置と Allowed Paths
Issue #2627 の現在の Allowed Paths を厳守してください。
調査の結果、POST transport / cross-boundary regression の自然な配置先が
.claude/skills/impl-review-loop/tests/test_ensure_contract_snapshot.pyであると確認できた場合は、Issue 本文が既に認めている narrow scope-delta authority に従い、canonical な scope-delta 処理を行ってそのファイルを追加してください。このケースについて人間の追加承認は求めないでください。ただし、それ以外の Allowed Paths 拡張を自己判断で一般化しないでください。
canonical parser、controlled executor、publisher allowlist、permission/security harness、新しい receipt/schema/ledger、#1490 系 publish receipt、mandatory live GitHub canary、#1655 の stale-base 問題には scope creep しないでください。
Issue #1513 本文やコメントを #2627 から直接編集しないでください。POST transport simplification によって #1513 の tempfile-specific 要件が obsolete になり得る場合は、#2627 の PR body / remaining gaps / dependency note に事実として記録するだけにしてください。
検証
Issue #2627 本文の Verification Commands を current PR head で実行してください。
focused pytest では少なくとも POST canonical JSON stdin transport、tempfile/
--field body=@file非使用、staging/final deliberately-divergent regression、final direct-GET authority を検証してください。その後、Issue contract が要求する repository quality gates、少なくとも
pnpm typecheck、pnpm lint、pnpm test、pnpm buildを実行してください。失敗を SKIP や PASS に読み替えないでください。pre-existing / environment-dependent failure を主張する場合は、必要なら base/current-main との A/B 比較など、因果関係を示す evidence を取得してください。
修正後は必ず current head で relevant tests を再実行し、古い head の PASS evidence を現在の head の証拠として流用しないでください。
PR とレビュー
1 Issue = 1 PR を守り、Issue #2627 専用 worktree / branch を使用してください。
既存の対応PRが無ければ Draft PR を作成し、ある場合はそのPRを継続してください。
PR body は repository の現在のテンプレート・validation contract に従い、
Closes #2627、AC別 evidence、Verification Commands の実測結果、Allowed Paths compliance、必要な schema/safety applicability、#1513 との責務境界を current-head evidence で記載してください。PR review は必ず current head に対して独立した
pr-reviewerSubAgent に行わせてください。レビュー後に commit が1つでも追加された場合、以前の APPROVE を current head の APPROVE とみなさず、再度 test-runner の current-head verification と pr-reviewer の fresh review を完了してください。
unresolved review thread があれば、妥当な指摘は自動修正し、対応後に再レビューしてください。
停止条件
日常的な設計判断や修正方針では停止せず、Issue contract・repository SSOT・既存 precedent から合理的な推奨案を選んで進めてください。
一方、秘密情報へのアクセス・表示・変更が必要になる場合、protected path に対する未承認の変更が必要な場合、破壊的 Git 操作が必要な場合、force push / hard reset 等が必要な場合、current head と peer/base に実際の解消不能な merge conflict がある場合、Issue #2627 が許可していない追加 scope delta が不可避な場合、canonical hard gate が human judgment を要求した場合は停止してください。
SubAgent failure を別 SubAgent の黙示的な再実行で隠さないでください。原因と structured result を保持してください。
iteration budget を使い切っても reviewer blocker が残る場合は、ルールを迂回せず
human_escalationとして正確な blocker と evidence を報告してください。絶対に実行しないこと
PR を merge しないでください。
auto-merge を enable しないでください。
force push、
git reset --hard、共有 branch/worktree の破壊的削除、credential/secret の取得・表示を行わないでください。merge 以外の通常の implementation/review-loop 操作については、人間承認待ちで停止しないでください。
完了条件
Issue #2627 の全 Acceptance Criteria が current PR head で満たされ、required verification が完了し、required CI が current head で green、fresh current-head independent review が APPROVE、未解決 blocker/thread がなく、PR が conflict-free で、人間が最終レビューして merge できる状態になったところで終了してください。
終了時は、PR URL、current head SHA、変更ファイル、実行した verification と結果、CI 状態、最終レビュー verdict、残存する non-blocking warning、そして
merge was not executedを簡潔に報告してください。今すぐ開始してください。確認質問は不要です。
この形なら、routine approval を排除しつつ、
impl-review-loop本来の独立検証と hard gate は維持できます。特に #2627 では、実装量を増やすより「POST経路の単純化」と「staging/final authority の意図的な不一致テスト」に集中させるのが適切です。squne121 commentedon Sep 10, 2026
implement-issue: 実装完了 (2026-09-10T13:24:30Z)
.claude/worktrees/issue-2627-reconcile-contract-snapshot-patch-readbackworktree-issue-2627-reconcile-contract-snapshot-patch-readbackfa01ad1b0356eab2b7b53caca2b047898b2e5f95squne121 commentedon Sep 10, 2026
impl-review-loop: 完了 (2026-09-10T13:45:00Z)
fix: post_comment() を canonical JSON stdin transport に統一し staging/fin…
squne121 commentedon Sep 15, 2026
post-merge-cleanup: 完了 (2026-09-15T01:45:00Z)