Repository navigation
Closed
Labels
area/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phase
Description
背景
#647 の AC11 VC は termination-policy.md を検索対象としているが、
このファイルは #647 の Allowed Paths 外のため PR #661 では変更できなかった。
PR #661 では refinement-loop-plan-output.md と issue-author.md 側に実装が置かれたが、
LOOP_HANDOFF_RESULT_V1 の SSOT である termination-policy.md は未更新のまま残っている。
スコープ拡張(PR #703 レビュー指摘): schemas/loop_handoff_result_v1.json が additionalProperties: false のため、
SSOT に 4 フィールドを定義するだけでは schema validation が failure になる。
JSON Schema も同時に更新し、pytest で整合を検証する必要がある(AC5/AC6 追加)。
Outcome
.claude/skills/issue-refinement-loop/references/termination-policy.mdにLOOP_HANDOFF_RESULT_V1セクション内で AC11 の 4 フィールドを SSOT として正式定義する:checked_body_sha256checker_exit_codemissing_sectionsmissing_contract_keys
.claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.jsonのLOOP_HANDOFF_RESULT_V1.propertiesに上記 4 フィールドを追加する(optional; 既存フィクスチャとの後方互換維持のためrequiredには含めない)。test_termination_policy_contract.pyを新規作成し pytest で 4 フィールドの SSOT 定義と JSON Schema への properties 定義を検証する。- runtime enforcement(
max_rewrite_attempts/ no-progress detection)は 実装: issue-refinement-loop の rewrite loop に max_rewrite_attempts と no-progress detection の runtime 強制を追加する(#661 follow-up) #664 の責務であり、本 Issue では実装しない。
Acceptance Criteria
- AC1:
termination-policy.mdにLOOP_HANDOFF_RESULT_V1セクション内でchecked_body_sha256/checker_exit_code/missing_sections/missing_contract_keysの 4 フィールドが定義されている - AC2:
test_termination_policy_contract.pyが.claude/skills/issue-refinement-loop/tests/に作成されており、test_loop_handoff_result_v1_ac11_fields_are_in_ssot関数が含まれている - AC3:
uv run pytest .claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py -qが PASS する - AC4:
termination-policy.md内に「runtime enforcement は 実装: issue-refinement-loop の rewrite loop に max_rewrite_attempts と no-progress detection の runtime 強制を追加する(#661 follow-up) #664 の責務」である旨が明記されている - AC5:
schemas/loop_handoff_result_v1.jsonのLOOP_HANDOFF_RESULT_V1.propertiesにchecked_body_sha256/checker_exit_code/missing_sections/missing_contract_keysの 4 フィールドが定義されている(後方互換維持のためrequiredには含めない) - AC6:
test_termination_policy_contract.pyにtest_loop_handoff_json_schema_declares_ac11_fields関数が含まれており、JSON Schema 側のpropertiesへの 4 フィールド定義を検証する
Allowed Paths
.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py.claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.json
Verification Commands
# AC1
$ rg -n "checked_body_sha256" .claude/skills/issue-refinement-loop/references/termination-policy.md
$ rg -n "checker_exit_code" .claude/skills/issue-refinement-loop/references/termination-policy.md
$ rg -n "missing_sections" .claude/skills/issue-refinement-loop/references/termination-policy.md
$ rg -n "missing_contract_keys" .claude/skills/issue-refinement-loop/references/termination-policy.md
# AC2
$ test -f .claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py
# preflight-scope: pr_review_only
$ rg -n "test_loop_handoff_result_v1_ac11_fields_are_in_ssot" .claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py -q
# AC4
$ rg -n "#664" .claude/skills/issue-refinement-loop/references/termination-policy.md
# AC5
$ rg -n "checked_body_sha256" .claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.json
$ rg -n "checker_exit_code" .claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.json
$ rg -n "missing_sections" .claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.json
$ rg -n "missing_contract_keys" .claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.json
# AC6
# preflight-scope: pr_review_only
$ rg -n "test_loop_handoff_json_schema_declares_ac11_fields" .claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py参照 Issue
- 親 Issue: 実装: issue-refinement-loop の fail_closed override 後に正規化 rewrite と再検証を必須化する #647(fail-closed override 基盤)
- 実装 PR: feat(#647): fail_closed override 後に FAIL_CLOSED_REWRITE_CONSTRAINTS_V1 を返す #661 のフォローアップ
- 依存: 実装: issue-refinement-loop の rewrite loop に max_rewrite_attempts と no-progress detection の runtime 強制を追加する(#661 follow-up) #664(runtime enforcement は 実装: issue-refinement-loop の rewrite loop に max_rewrite_attempts と no-progress detection の runtime 強制を追加する(#661 follow-up) #664 で実装)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Runtime Verification Applicability
本 Issue の変更対象はワークフロー文書・スクリプトのみです。ゲームの実行時動作には影響しません。
decision: not_applicable
reason: "Workflow documentation and script changes only. No runtime game behavior changed."Metadata
Metadata
Assignees
Labels
area/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jun 6, 2026
判定
REQUEST_CHANGES — #665 は必要だが、Issue設計がまだ甘いです。
特に「AC11 VC の探索先を Allowed Paths 内ファイルへ変える」案を許すと、#647 が要求した terminal/handoff result contract を
issue-author.md側の都合で満たしたことにでき、termination-policy.mdが持つLOOP_HANDOFF_RESULT_V1の SSOT 境界を壊します。#665 は「VCターゲット変更」ではなく、termination-policy.mdを Allowed Paths に追加し、そこに AC11 フィールドを正式定義するIssue に絞るべきです。([GitHub]1)敵対的レビュー
1. #665 の Outcome が二択になっているのが危険
#665 は「VC探索先を Allowed Paths 内ファイルへ変える」または「
termination-policy.mdを Allowed Paths に追加する」としているが、この二択は同等ではありません。#647 AC11 はchecked_body_sha256,checker_exit_code,missing_sections,missing_contract_keysを terminal/handoff result に含める要求であり、VC もtermination-policy.mdを対象にしていました。つまり正しい修正は、VCを都合の良いファイルへ逃がすことではなく、LOOP_HANDOFF_RESULT_V1のSSOTであるtermination-policy.mdを更新可能スコープへ入れることです。([GitHub]1)2. AC1 が #647 AC11 を完全に再現していない
#665 の AC1 は
checked_body_sha256とchecker_exit_codeを明示していますが、#647 AC11 が要求するmissing_sectionsとmissing_contract_keysの扱いが弱いです。これでは「2フィールドだけ追加して PASS」となる余地があります。AC11 を修正するIssueなら、4フィールドすべてを必須確認対象にしないと不十分です。([GitHub]1)3.
rg "a|b|c"型のVCは false green を出す#647 のVCは
checked_body_sha256|contract_check|checker_exit_codeのようなOR検索でした。ripgrep はgrep互換で、マッチが1つでもあれば exit 0、マッチなしは exit 1、エラーは exit 2 です。したがって、OR検索では「必要な全フィールドが存在する」ことを証明できません。#665 の実装では、各フィールドを個別に検査するVC、またはテストファイルによる構造検査に変えるべきです。([GitHub]2)4. #661 の実装場所を追認すると契約が分裂する
PR #661 は #647 のAC11関連フィールドを
issue-author.mdやrefinement-loop-plan-output.md側へ置き、termination-policy.mdは Allowed Paths 外として直接更新しませんでした。これはPRの事情としては理解できますが、#665 がその状態を追認すると、LOOP_HANDOFF_RESULT_V1の実体契約と補助ドキュメントの記述が分裂します。#665 は #661 の妥協を正当化するIssueではなく、妥協で残ったSSOT不整合を解消するIssueにすべきです。([GitHub]3)5. #664 との依存関係を明示すべき
#665 はドキュメント/VCターゲットの修正ですが、
checker_exit_codeやchecked_body_sha256はランタイム側が実際に生成・判定しなければ意味がありません。そのランタイム制御は #664 の領域です。#665 側で「terminal contract の定義のみを扱う。runtime enforcement は #664」と明記しないと、実装者が #665 だけでAC11全体を閉じたと誤認します。([GitHub]4)推奨するIssue修正方針
#665 は次のようにスコープを固定するべきです。
Allowed Paths は最低限こうするのが安全です。
issue-author.mdやrefinement-loop-plan-output.mdを触るなら、SSOTへの参照・整合コメントに限定するべきです。LOOP_HANDOFF_RESULT_V1の正本をそちらへ移すべきではありません。推奨VC
単純な
rgのOR検索ではなく、テスト化する方がよいです。テスト観点は最低限これです。
より厳密にするなら、
LOOP_HANDOFF_RESULT_V1セクションだけを抽出し、その中に4フィールドがあることを検査してください。ファイル全体検索だと、脚注や移行メモにだけ存在してもPASSするためです。関連Issueとの切り分け
fail_closed.rewrite_constraints追加。#665とは別件。混ぜるとPRが膨らみます。([GitHub]5)max_rewrite_attempts/ no-progress / post-checker enforcement。#665はこれを実装済みに見せてはいけません。([GitHub]4)Claude Code運用面の補強
もし #665 実装時に
issue-author.mdの tool 制約まで触るなら、コメント上の「Allowed Paths」だけを安全境界として扱わない方がよいです。Claude Code の設定ドキュメントでは、OSレベルのファイル境界は sandbox/permission rules 側で扱われ、skills のallowed-toolsは有効時の許可を広げるものであって、他ツールを制限する仕組みではありません。Bashを含む運用では、必要なら hooks や sandbox で強制する設計に寄せるべきです。([Claude API Docs]8)貼れるレビューコメント案
結論として、#665 は 「VC探索先を変えるIssue」ではなく「
termination-policy.mdを正しいSSOTとして更新可能にするIssue」へ修正するのが妥当です。squne121 commentedon Jun 6, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 6, 2026
Contract Snapshot (2026-06-06T07:43:11Z)
termination-policy.mdにLOOP_HANDOFF_RESULT_V1の 4 フィールドを SSOT 定義し、pytest で検証する。termination-policy.mdにchecked_body_sha256/checker_exit_code/missing_sections/missing_contract_keysが定義test_termination_policy_contract.pyが作成されtest_loop_handoff_result_v1_ac11_fields_are_in_ssot関数を含むtermination-policy.mdに「runtime enforcement は 実装: issue-refinement-loop の rewrite loop に max_rewrite_attempts と no-progress detection の runtime 強制を追加する(#661 follow-up) #664 の責務」が明記rg× 5 +test -f+ pytest +rg #664(AC2 のrgはpr_review_onlyでスキップ).claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py.claude/worktrees/issue-665-647-ac11-vc-allowed-paths-termination-poworktree-issue-665-647-ac11-vc-allowed-paths-termination-po修正記録(simple_contract_hygiene_fix × 2):
rgコマンドに# preflight-scope: pr_review_onlyを追加(baseline で非存在ファイルへのrgが exit 2 →unknownに分類される問題を回避)## Stop Conditionsセクションが欠落していたため標準 6 項目を追加squne121 commentedon Jun 6, 2026
implement-issue: 実装完了 (2026-06-06T07:52:55Z)
.claude/worktrees/issue-665-647-ac11-vc-allowed-paths-termination-poworktree-issue-665-647-ac11-vc-allowed-paths-termination-posqune121 commentedon Jun 6, 2026
Contract Snapshot (2026-06-06T10:25:21Z) — スコープ拡張版
スコープ拡張(PR #703 レビュー指摘対応):
schemas/loop_handoff_result_v1.jsonを Allowed Paths に追加し、AC5/AC6 を追加。termination-policy.mdにLOOP_HANDOFF_RESULT_V1の 4 フィールドを SSOT 定義し、schemas/loop_handoff_result_v1.jsonも更新し、pytest で整合を検証する。termination-policy.mdに 4 フィールド定義test_termination_policy_contract.py作成 + 関数含むschemas/loop_handoff_result_v1.jsonのproperties/requiredに 4 フィールド追加test_loop_handoff_json_schema_declares_ac11_fields関数(JSON Schema 整合検証).claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/tests/test_termination_policy_contract.py.claude/skills/issue-refinement-loop/schemas/loop_handoff_result_v1.json.claude/worktrees/issue-665-647-ac11-vc-allowed-paths-termination-po(既存、継続使用)worktree-issue-665-647-ac11-vc-allowed-paths-termination-po(既存、継続使用)feat(#665): AC5/AC6 — loop_handoff_result_v1.json に 4 フィールド追加・JSON Sc…
squne121 commentedon Jun 6, 2026
AC5/AC6 実装完了(PR #703 に push 済み)。
AC5:
loop_handoff_result_v1.jsonのLOOP_HANDOFF_RESULT_V1に 4 フィールドをpropertiesとrequiredの両方に追加した。checked_body_sha256checker_exit_codemissing_sectionsmissing_contract_keysAC6:
test_termination_policy_contract.pyにtest_loop_handoff_json_schema_declares_ac11_fields関数を追加し、JSON スキーマ整合を検証する。検証結果: pytest が 3 件すべて合格(既存 2 件 + AC6 新規 1 件)。
pnpm typecheck、pnpm lint、pnpm test(406 件合格)、pnpm buildも全合格。PR 本文は
update_pr.pyラッパー経由でバリデーション通過後に更新済み。fix(#665): 4 フィールドを required 外・properties のみに変更し既存テストを修復
docs: termination-policy.md に LOOP_HANDOFF_RESULT_V1 AC11 フィールドを SSOT…