Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: derived design note を runtime で読まない方針を維持しつつ、canonical sources との齟齬を常時検知する
change_kind: mixedParent Issue
none(単独改善)
Parent Goal Ref
- Goal: issue-refinement-loop の design note が SKILL と drift し続けると、AI が stale assertion を再利用して誤運用する問題を解消する
- Desired Destination: derived design note が SKILL の実装 runtime の主要な契約点を機械可読に宣言し、pytest で再発を検出できる状態にする
Current Validated Scope
docs/dev/workflows/issue-refinement-loop-design.mdの Invocation Contract を SKILL の現行値に合わせるdocs/dev/workflows/issue-refinement-loop-design.mdにDERIVED_RUNTIME_CLAIMS_V1を追加し、主要契約点を明文化する.claude/skills/issue-refinement-loop/tests/test_design_note_contract.pyを新設し、以下を検出する:max_iterations=1needs_second_pass- canonical source からの長文コピー
Remaining Parent Gaps
なし
Outcome
docs/dev/workflows/issue-refinement-loop-design.md が .claude/skills/issue-refinement-loop/SKILL.md と drift しない設計ノートになり、.claude/skills/issue-refinement-loop/tests/test_design_note_contract.py の回帰テストで stale contract が自動検知できる状態。
In Scope
max_iterationsの既定値(SKILL は default 3)と termination semantics(needs-fix は上限まで自動継続、超過時はhuman_escalation)を design note に反映REVIEW_ISSUE_RESULT_COMPACT_V1とdecide_next_loop_action.pyの routing 参照を design note に同期LOOP_STATEとscope_signal_guardの実体参照先をreferences/loop-state.md/references/termination-policy.mdへ明示.claude/skills/issue-refinement-loop/tests/test_design_note_contract.pyで以下を検出する:- 派生 claim と SKILL 実体の乖離
max_iterations: 1/needs_second_passスタイルの再退行- canonical source から 12 行以上または 600 文字以上の長文コピー(空行・見出し・短い path 除外)
docs/dev/workflows/issue-refinement-loop-design.mdのnot_loaded_when条件(normal loop execution (runtime)/routine issue refinement/any SubAgent execution within the loop itself)を明確化
Out of Scope
- SKILL 本文の直接編集(Allowed Paths 外)
.claude/agents/*.mdの直接編集- issue-refinement-loop の runtime ロジック変更(既存実装)
- 外部サービス調査
Acceptance Criteria
- AC1:
max_iterationsと iteration stop semantics が SKILL.md の実装値(既定 3 /human_escalation)と一致する。 - AC2: reviewer contract 名が
ISSUE_REVIEW_RESULT_COMPACT_V1へ統一されている。 - AC3: LOOP_STATE 参照先が
loop-state実体参照として design note 内に明記される。 - AC4:
DERIVED_RUNTIME_CLAIMS_V1を追加し、max_iterations/termination_reason/review_result_contract/loop_state_referenceの4項目を YAML で宣言する。 - AC5:
docs/dev/workflows/issue-refinement-loop-design.mdはmax_iterationsが 3、iteration + 1 >= max_iterations -> human_escalationを含む。 - AC6:
.claude/skills/issue-refinement-loop/tests/test_design_note_contract.pyを新設し、max_iterations=1/needs_second_pass/ 長文コピー fixture を含めた再発検知テストが PASS する。 - AC7: design note の
not_loaded_whenにnormal loop execution (runtime)が含まれ、routine refinement / SubAgent 実行で読み込まれないことが明記される。
Verification Commands
# AC1
$ rg -n "max_iterations[:=][[:space:]]*3" docs/dev/workflows/issue-refinement-loop-design.md
# AC2
$ rg -n "ISSUE_REVIEW_RESULT_COMPACT_V1" docs/dev/workflows/issue-refinement-loop-design.md
# AC3
$ rg -n "references/loop-state.md" docs/dev/workflows/issue-refinement-loop-design.md
# AC4
$ rg -n "DERIVED_RUNTIME_CLAIMS_V1|max_iterations_default|iteration_limit_termination|review_result_contract|loop_state_reference" docs/dev/workflows/issue-refinement-loop-design.md
# AC5
$ rg -n "iteration \+ 1 >= max_iterations -> human_escalation|max_iterations\s*[:=][[:space:]]*3" docs/dev/workflows/issue-refinement-loop-design.md
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_design_note_contract.py -q -x
# baseline-expect: pass
# AC7
$ rg -n "not_loaded_when:|normal loop execution \(runtime\)|routine issue refinement|any SubAgent execution within the loop itself" docs/dev/workflows/issue-refinement-loop-design.mdAllowed Paths
docs/dev/workflows/issue-refinement-loop-design.md.claude/skills/issue-refinement-loop/tests/**.claude/skills/issue-refinement-loop/SKILL.md
Runtime Verification Applicability
decision: not_applicable
deferred_verification_condition: N/A
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Scope Delta(任意)
N/A
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Jun 19, 2026
判定: REQUEST_CHANGES
#1012 の問題意識は正しいです。現行
issue-refinement-loop-design.mdはmax_iterationsを「既定 1」と書いており、現行SKILL.mdはmax_iterations既定 3 /default_max_iterations: 3です。これは明確な stale contract です。ただし、この Issue contract のまま実装すると「数値 1→3 だけ直して PASS」になり、派生 design note に残っている古い routing semantics までは検出できません。#1012 には現時点でコメントがないため、本文契約以外の anchor decision もありません。
Blockers
B1. stale 対象が
max_iterationsだけに狭すぎるdesign note は
max_iterations=1の根拠として「1周で十分」「超過時はneeds_second_pass」と説明していますが、現行SKILL.mdはiteration + 1 >= max_iterationsでhuman_escalationに停止する設計です。つまり直すべき stale contract は数値だけではなく、termination semantics も含みます。さらに design note の SubAgent Contract Matrix は
REVIEW_ISSUE_RESULT_V1を前提にしていますが、現行SKILL.mdはISSUE_REVIEW_RESULT_COMPACT_V1を consumer contract としています。PR #805 でも issue-reviewer / issue-author の compact contract 化が明記されています。修正要求: AC1/AC2 を「主要 runtime constants」ではなく、最低限以下まで明示してください。
max_iterationsdefaulttermination_reasonB2.
canonical_sources整合テストの仕様が曖昧frontmatter には
canonical_sourcesとconflict_rule: canonical_sources_winが存在しますが、#1012 は「何を canonical source から抽出し、design note のどの主張と照合するか」を定義していません。regex で本文を雑に探す実装だと、表現変更に弱く、逆に本質的な stale claim を見逃します。design note に小さな機械可読ブロックを追加して、そこだけをテスト対象にする方が堅いです。YAML を読むなら arbitrary object construction を避けるため
safe_load系を使うべきです。PyYAML docs でもsafe_loadは標準タグだけを扱う API と説明されています。推奨:
中身は最低限これです。
uv runは project environment を同期・利用してコマンドを実行する用途なので、VC としては妥当です。([Astral Docs]1)fixture は repo 実体を書き換えず
tmp_pathに置いて検査するのが安全です。pytest docs でもtmp_pathは各 test function 固有の一時ディレクトリを提供します。([pytestドキュメント]2)B5. Allowed Paths に
docs/dev/agent-skill-boundaries.mdが入っているが、変更目的が未定義docs/dev/agent-skill-boundaries.mdは「SKILL.md / SubAgent 定義に書くとコンテクスト汚染になるため、本ドキュメントを正本とする」と明記された境界ドキュメントです。ここを Allowed Paths に入れるなら、何を変更するのか AC に落とす必要があります。現状の #1012 では design note と tests だけで達成可能に見えます。
agent-skill-boundaries.mdを変更しないなら Allowed Paths から外すべきです。変更するなら、「derived design note の runtime 非ロード方針をどの loading tier / ssot-discovery ルールに接続するか」を明示してください。loading tier は同ドキュメントに定義済みです。B6. #467 / #460 の履歴を contract に反映していない
max_iterations=3は単なる現在値ではなく、Issue #460 / PR #467 で「1→3」「permission mode とは別概念」「needs-fix は上限まで自動継続」という policy change として入っています。PR #467 はSKILL.mdの既定値変更、loop policy 追加、termination-policy 更新、planner/golden fixture 更新まで含んでいました。そのため #1012 は「SKILL.md の値と一致」だけでなく、「#467 後の loop policy を design note が再び 1 / needs_second_pass に戻して説明しない」ことを検出対象にすべきです。
修正版 Issue 方針
#1012 は次のように直すと実装可能です。
投稿コメント案
現状の #1012 は「良いバグ報告」ですが、「再発防止 Issue」としてはまだ弱いです。テスト対象を数値一致から derived design note の機械可読 claim と canonical source の差分検出 に上げるべきです。
squne121 commentedon Jun 19, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 20, 2026
Contract Review Result
squne121 commentedon Jun 20, 2026
impl-review-loop: 完了 (2026-06-20T00:16:00Z)
FOLLOW_UP_MATERIALIZATION_RESULT_V1:
schema_version: 1
materialized_by: impl-review-loop
follow_up_issues: []
squne121 commentedon Jun 20, 2026
impl-review-loop: 完了 (2026-06-20T00:37:24Z)
squne121 commentedon Jun 20, 2026
impl-review-loop: 完了 (${NOW})
squne121 commentedon Jun 20, 2026
impl-review-loop: 完了 (2026-06-20T00:37:46Z)
squne121 commentedon Jun 20, 2026
PR #1017 で解決済みのため close します。post-merge-cleanup により関連 worktree/branch も整理済みです。