Repository navigation
Description
Parent Issue
なし(単独改善)
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "termination report が canonical actual materialization result を lossless に受け取り、検証済みの FOLLOW_UP_MATERIALIZATION_RESULT_V1 を全 termination reason で出力すること"
change_kind: codeParent Goal Ref
- Goal: なし(単独改善のため親 Issue 不在)
- Desired Destination: N/A
Current Validated Scope
render_termination_report.pyの termination report 入力契約を、canonical actual materialization result(created / reused / skipped / no-op を含む)を受け取れる形にする- materialization result の schema / validator を追加または既存入力境界へ接続し、lossless payload と必須入力欠落を決定論的に検証する
publish_termination_report.pyおよび materializer / publisher caller が検証済み actual result を renderer に渡すことを確認・必要なら調整する- created / reused / skipped / no-op 等の非空結果と空結果を actual 性付きで検証する pytest を追加する
- canonical input (
TERMINATION_REPORT_INPUT_V1) と publisher caller の実例・SSOT 定義をreferences/termination-policy.md/issue-refinement-loop/SKILL.mdと同期する
Remaining Parent Gaps
なし
Outcome
termination report の FOLLOW_UP_MATERIALIZATION_RESULT_V1 が、caller から渡された canonical actual materialization result をそのまま lossless に反映し、created / reused / skipped / no-op 等の非空結果および空結果を区別して終了コメントへ出力できる状態。schema / validator は必須 input 欠落を fail-closed とし、renderer が常に空配列を生成するだけの PR #1832(head 31ac20913386ef2b0a91057fbf1de491a9286af2)の snapshot / head は stale として扱い、新 contract で再実装・再レビューされる。
Background
.claude/skills/issue-refinement-loop/references/termination-policy.md は全 termination reason の終了コメントに FOLLOW_UP_MATERIALIZATION_RESULT_V1 を要求する。Spark fact check では PR #1832 が renderer 内で常に空配列を生成し、actual result の入力・validation・caller 配線を持たないこと、および現行 Allowed Paths に input schema / caller がないことが確認された。
In Scope
render_termination_report.pyが termination report の canonical input から actual materialization result を受け取り、schema_version/materialized_by/follow_up_issues/note_only_observationsと各 reason/status payload を lossless に出力する- materialization result の input schema / validator を必要最小限の Allowed Paths に追加し、必須 input 欠落・型不整合・actual 性の欠落を fail-closed にする
publish_termination_report.pyと materializer / publisher caller の配線を更新し、検証済み actual result を renderer に渡す。publish は renderer の結果を改変しないcreated/reused/skipped/no-op等の非空結果、空結果、および全 termination reason を actual 性付きで検証する pytest- PR fix(refinement): 全終端理由で follow-up materialization 結果を出力 (#1321) #1832 の snapshot / head が stale になったことを Issue / PR 検証証跡で明示し、新 contract で再実装・再レビューを要求する
Out of Scope
- follow-up 候補の実際の抽出・作成・再利用判定ロジック(既存 materializer の actual result を受け渡す境界を除く)
issue-author/create-issue経由の follow-up 作成フロー自体の変更FOLLOW_UP_MATERIALIZATION_RESULT_V1の schema major version 変更、既存 consumer の一斉 migration、または互換性を超える API 再設計LOOP_HANDOFF_RESULT_V1marker のロジック変更
Acceptance Criteria
- AC1: renderer の canonical input が actual materialization result を受け取り、非空 payload(created / reused / skipped_* の少なくとも各 1 件)を
FOLLOW_UP_MATERIALIZATION_RESULT_V1に lossless 出力し、no-op は status を新設せず canonical empty result(follow_up_issues: []/note_only_observations: [])として出力する - AC2: materialization result schema / validator が必須 input 欠落・型不整合・actual 性欠落を fail-closed とし、無入力時に空配列を勝手に生成して PASS しない
- AC3:
references/termination-policy.mdとissue-refinement-loop/SKILL.mdに定義された publisher caller 例が検証済み actual result を renderer に渡し、publish 側が当該ブロックを改変せず転送する - AC4:
approved/human_escalation/superseded_by_decisionの全 termination reason で、caller が明示した canonical actual result(非空または canonical empty)を同じ意味論で出力し、reason に応じて空配列を推測・置換しない - AC5: 既存 render / publish テストと追加された actual-result 契約テストが全件 PASSし、
TERMINATION_REPORT_INPUT_V1/ publisher caller の SSOT と Issue contract の同期、および PR fix(refinement): 全終端理由で follow-up materialization 結果を出力 (#1321) #1832 の旧 snapshot / head に束縛された証跡を再利用しないことを検証する
Verification Commands
# baseline-expect: fail
# AC1
# SSOT: TERMINATION_REPORT_INPUT_V1 と canonical actual input(no-op は canonical empty、status新設なし)
# preflight-scope: runtime_only
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_follow_up_materialization_actual_contract.py
# baseline-expect: fail
# AC2
# preflight-scope: runtime_only
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_follow_up_materialization_actual_contract.py
# baseline-expect: fail
# AC3
# SSOT: publisher caller example and lossless forwarding
# preflight-scope: runtime_only
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_follow_up_materialization_actual_contract.py
# baseline-expect: fail
# AC4
# SSOT: all termination reasons preserve explicit actual / canonical empty semantics(no-op含む)
# preflight-scope: runtime_only
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_follow_up_materialization_actual_contract.py
# baseline-expect: fail
# AC5
# SSOT sync: termination-policy.md and issue-refinement-loop/SKILL.md
# preflight-scope: runtime_only
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_render_termination_report.py .claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py .claude/skills/issue-refinement-loop/tests/test_follow_up_materialization_actual_contract.pyAllowed Paths
.claude/skills/issue-refinement-loop/scripts/render_termination_report.py.claude/skills/issue-refinement-loop/scripts/publish_termination_report.py.claude/skills/issue-refinement-loop/scripts/follow_up_materialization_result_schema.py.claude/skills/issue-refinement-loop/scripts/publish_termination_report.py(materializer / publisher caller boundary).claude/skills/issue-refinement-loop/tests/test_follow_up_materialization_actual_contract.py.claude/skills/issue-refinement-loop/tests/test_render_termination_report.py.claude/skills/issue-refinement-loop/tests/test_publish_termination_report.py.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/SKILL.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- In Scope の固定契約(schema major、既存 consumer migration、follow-up 作成ロジック)の変更が必要になった場合
- 必須 input の canonical source または caller が特定できず、actual 性を決定論的に証明できない場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/SKILL.md
Scope Delta(任意)
- 追加: canonical actual materialization result の input schema / validator、materializer / publisher caller の最小配線、actual payload 契約テスト
- 変更: 全 reason の空配列出力要求を、actual result の非空 / 空を lossless に保持する要求へ具体化
- 追加: PR fix(refinement): 全終端理由で follow-up materialization 結果を出力 (#1321) #1832 head
31ac20913386ef2b0a91057fbf1de491a9286af2の snapshot stale と再実装・再レビュー要求 - 削除: なし
Runtime Verification Applicability
本 Issue は termination report のワークフロー出力と schema / caller 配線を対象とし、ゲーム実行時動作には影響しません。
decision: not_applicable
reason: "Workflow report rendering, validation, caller wiring, and deterministic tests only."Delivery Rule
1 Issue = 1 PR。worktree で作業し、Draft PR を既定とする。
Source(自動起票 Issue 必須セクション)
- origin_skill: pr-review-judge
- source_url: feat: issue-refinement-loop termination report に LOOP_HANDOFF_RESULT_V1 marker生成を実装する #1317 (comment)
- source_note_id: follow_up_materialization_v1_all_termination_reasons_actual_input_contract
- dedupe_key: follow-up:squne121/loop-protocol:1321:actual-materialization-input-contract
Activity
squne121 commentedon Jul 18, 2026
判定
REQUEST_CHANGES — 現状の契約では実装着手不可です。
#1321 が埋めようとしている欠落自体は実在します。termination policy は
approved/human_escalation/superseded_by_decisionのすべてでFOLLOW_UP_MATERIALIZATION_RESULT_V1を出力し、2つの配列を空でも省略しないことを要求しています。ただし #1321 は、「正しい materialization 結果を出力する」契約ではなく、「それらしいブロックを必ず置く」契約になっています。ACを満たす最小実装は、全 termination reason で常に次を出力するだけです。
これは、実際には Issue が作成・再利用・スキップされていても空配列を出せるため、監査記録として不正確です。#1321 は実体化処理を Out of Scope とし、入力契約や producer wiring を定義せず、ACも文字列の存在確認に留めています。
関連Issue・PRから見た位置づけ
#186 / PR #449 は、
follow_up_issue_requestsが起票前候補、follow_up_issuesが起票後の結果であり、judge・materializer・reporter の責務を分離するためのdocs-only変更でした。特に、起票しない component が materialized result を埋めてはならないという設計です。#1311 / PR #1317 の
LOOP_HANDOFF_RESULT_V1実装は、これに対してかなり堅牢です。完全な入力オブジェクトを caller から受け取り、wrapper/inner を正規化し、JSON Schemaとpolicy validatorで検証し、yaml.safe_dumpと動的フェンスで出力しています。renderer自身は値を推測・合成しません。#1321 はこの実装パターンを表面的な「marker追加」だけコピーし、最重要部分である producer → input → validator → renderer の経路を欠落させています。
Blocker 1 — 実結果をrendererへ運ぶ入力契約がない
現行
TERMINATION_REPORT_INPUT_V1の正式記述には、termination reason、cause、Issue番号、iteration、blockersしかありません。実装側でも、
normalize_input()が明示的に扱う構造化結果はloop_handoffだけです。rendererはloop_handoffを検証し、approvedの場合だけ出力しますが、follow-up materialization result を受け取るフィールドも、検証するコードも、出力するコードもありません。一方、現在の loop state が保持するのは
candidates、つまりdedupe_key・summary・source evidence を持つ起票前候補です。作成済みIssue番号、再利用、closed duplicate、skip reason といった結果ではありません。破綻例
termination_reason: approvedしか渡らない。follow_up_issues: []を出す。canonical schema は
created/reused_open/ 各種skipped_*、Issue番号・URL、reason、note-only observationを明示的に区別しています。必須修正
TERMINATION_REPORT_INPUT_V1に、完全な結果を受け取るフィールドを追加すべきです。loop_handoffと同様に wrapper / inner object の両方を受け付けても構いませんが、正規化条件を明文化し、曖昧な形はfail-closedにする必要があります。また、入力フィールド省略を空結果へ変換してはいけません。follow-upが存在しない場合も、callerがcanonical empty resultを明示的に渡すべきです。これにより「実際に空」と「配線漏れ」を区別できます。
Blocker 2 — 非承認終了時の候補を既存schemaで表現できない
現行フローでは、
last_verdict == approveの場合だけ Step 4.5 に進みます。follow-up候補も「承認後にStep 4.5でmaterialize」と定義されています。一方、#1321 は
human_escalationとsuperseded_by_decisionにも同じ結果ブロックを要求します。ここで未解決なのは、非承認終了時に候補が存在した場合の意味論です。現行statusには次しかありません。
not_attempted、aborted_by_termination、pending_human_reviewに相当する状態はありません。整合的な選択肢は次のいずれかです。
#1321 は実体化処理をOut of Scopeとし、固定schema変更が必要なら停止すると定めているため、どの選択肢も現在の契約内では実装できません。これはIssue自身のStop Conditionを既に満たしている状態です。
Blocker 3 — Allowed Pathsがend-to-end実装を禁止している
現在のAllowed Pathsは次の3ファイルだけです。
しかし、正しく実装するには少なくとも以下が必要です。
特に
SKILL.mdまたは実際のcallsiteを変更しなければ、Step 4.5の結果をtermination inputへ渡せません。現在の公開されているpublish例も、termination_reasonとissue_numberしか渡していません。#1317後にも
loop_handoffの入力形状が正式なTERMINATION_REPORT_INPUT_V1に記載されなかったため、別Issue #1322としてドキュメント負債が残っています。#1321で同じ分断を繰り返すべきではありません。Allowed Pathsを拡張するか、schema/renderer実装とorchestrator wiringを別Issueへ明示的に分割する必要があります。
High — ACとVerificationが文字列存在確認に偏りすぎている
現在のACは、各reasonで本文に名前が含まれることと、空配列キーが存在することしか検証しません。
この条件では、次の欠陥がすべてPASSします。
schema_version: 999materialized_by: post-merge-cleanupstatus: createdなのにissue: nullreasonとstatusの矛盾LOOP_HANDOFF_RESULT_V1とフェンスが衝突必要なテストは、少なくとも次です。
created、reused_open、各種skipped_*、note-onlyの非空ケースをround-tripする。invalid_inputとしてrejectする。<!--、-->、複数行、Unicodeを含むsummaryを壊さず出力する。LOOP_HANDOFF_RESULT_V1、follow-up block、CONTROLLED_EXEC_MARKERが共存する統合ケースを検証する。--input-filepathの双方で入力オブジェクトをdeep equalityでrendererへ渡す。High — machine-readableなwire formatを固定すべき
現行policyはYAMLの形を示していますが、follow-up blockの開始境界をHTML markerで示すか、fenced YAMLをどのように探索するかが固定されていません。
推奨形式は、
LOOP_HANDOFF_RESULT_V1と同じ次の形です。最低限、以下を固定すべきです。
LOOP_HANDOFF_RESULT_V1との順序CONTROLLED_EXEC_MARKERとの順序GFMでは、closing fenceはopeningと同じ文字種かつ同じ長さ以上でなければなりません。したがって、固定の3バッククォートではなく、現行rendererの動的フェンス関数を再利用するのが妥当です。([GitHub Pages]1)
PyYAMLの
safe_dumpは標準YAMLタグだけを生成するため、現在のLOOP_HANDOFF_RESULT_V1と同様に、sort_keys=False、allow_unicode=Trueで直列化する方針が適切です。 ([PyYAML]2)High — machine-readable JSON Schemaを追加すべき
Markdown上のschemaだけでは、statusとIssueオブジェクトの相関をruntimeで強制できません。
schemas/follow_up_materialization_result_v1.jsonを追加し、既存のloop_handoff_result_v1.jsonと同じDraft 7で次を強制すべきです。materialized_byについて、共通schemaでは複数skillを許容しても、issue-refinement-loop rendererのpolicy validatorではissue-refinement-loopを要求するのが安全です。なお、
jsonschemaのformatはデフォルトでは検証されず、URIやdate-timeなど一部形式は追加dependencyがなければ検証が成功扱いになります。現在のプロジェクトdependencyは基本のpyyamlと[jsonschema](https://python-jsonschema.readthedocs.io/en/stable/validate/)のみなので、URLを厳格に検証するなら手動policy validatorを使うか、format extrasを明示的に導入する必要があります。 (jsonschema)Medium — publisher本体の変更は原則不要
現行publisherは、rendererの
bodyをそのままgh issue comment --body-file -のstdinへ渡しています。CONTROLLED_EXEC_MARKERを末尾へ追加する以外、個々のresult blockを解釈していません。GitHub CLIの公式仕様でも、
--body-file -は標準入力からコメント本文を読み取ります。(GitHub CLI)したがって #1321 のpublisher作業は、まず転送統合テストのみにすべきです。テストが失敗した場合だけpublisher本体を変更する方が、変更面積と回帰リスクを抑えられます。
推奨する修正版契約
入力
runtime規則
invalid_input。rendererが空結果を推測しない。loop_handoffと同じ厳密なunwrap条件にする。publishable=falseとし、publisherはGitHubへ投稿しない。approvedでLOOP_HANDOFF_RESULT_V1も存在する場合の順序を固定する。修正版ACの中心
最終結論
#1321 は、出力フォーマットの不足を正しく認識しているものの、materialization結果のデータフローと非承認終了時の意味論を欠いたままです。現状のACでは「全ケースで空配列を出すだけ」の実装が合格し、canonical contractが求める実結果の報告を満たしません。
実装前に少なくとも次の3点をIssue本文へ反映すべきです。
follow_up_materialization_resultの明示的な入力契約。この修正なしにmarker存在だけでmergeすると、終了コメントが形式的には完全でも、実態と異なる監査情報を恒常的に生成する可能性があります。
squne121 commentedon Jul 28, 2026
Contract Review Result
squne121 commentedon Jul 28, 2026
implement-issue: 実装完了
/home/squne/projects/LOOP_PROTOCOL/.claude/worktrees/issue-1321-follow-up-materialization-all-reasonsworktree-issue-1321-follow-up-materialization-all-reasons1929ed1cc640117f39f0d0e67468275c5a6dd6f1test(refinement): satisfy Ruff import order (#1321)
squne121 commentedon Jul 28, 2026
Contract Review Result
squne121 commentedon Jul 31, 2026
#1860 Owner Decision(2026-07-30)に基づき、PR #1875(Issue #1873実装)が本Issueとsupersede関係にある旨を記録する。
PR #1875は本Issueの拡張対象であった
render_termination_report.py(TERMINATION_REPORT_INPUT_V1検証renderer)とpublish_termination_report.pyのtermination publisher部分を撤去し、専用termination publisher経路そのものを廃止した。最終summary投稿は通常のgh issue comment --body-fileへ移行しており、FOLLOW_UP_MATERIALIZATION_RESULT_V1schemaを全termination reasonで出力するという本Issueの目標は、対象コンポーネントの廃止により成立しない。紐づくPR #1832もこの理由でcloseした(mergeせず)。独立残存scopeが見つからなかったため、本Issueを
not plannedとしてclose する。follow-up materialization挙動自体(人間可読なblockers/warnings summaryへの反映)は #1873/PR #1875のbounded loop設計に吸収されている。