Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "trusted human anchor comment が明示した scope amendment を AI scope creep と分離し、additional human escalation なしで refinement loop の入力要求として扱えるようにする"
change_kind: codeParent Issue
none(単独改善)
Parent Goal Ref
- Goal: issue-refinement-loop が trusted human anchor comment による scope 拡張要求を「人間依頼由来の作業要件」として処理し、AI が自発的に発見した scope 拡張とは異なる routing をする
- Desired Destination:
run_refinement_preflight.pyが anchor comment の provenance を判定し、ANCHOR_SCOPE_AMENDMENT_V1を planner のknown_contextに渡す
Current Validated Scope
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.pyに anchor comment の author metadata 取得・provenance 判定・ANCHOR_SCOPE_AMENDMENT_V1生成を追加する.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.pyがknown_context.classification: feedback_update_requiredまたはanchor_reframe: trueを受け取れるように拡張する.claude/skills/issue-refinement-loop/schemas/にANCHOR_SCOPE_AMENDMENT_V1スキーマを追加する.claude/skills/issue-refinement-loop/references/anchor-comment-handling.mdとscope-signal-guard.mdを更新する.claude/skills/issue-refinement-loop/tests/に AC 対応 pytest fixture を追加する
Remaining Parent Gaps
CONTEXT_PROVENANCE_V1スキーマ全体の導入(human-requested / agent-inferred / repo-evidence の provenance 分離)— 別 Issue 化予定autonomy_modeをLOOP_STATE_V1に追加し「人間承認不要」の意図を loop state routing に反映する — 別 Issue 化予定decide_next_loop_action.pyの CLI/schema 迷走防止 wrapper — 別 Issue 化予定
Background
#993 の作業では、anchor comment が REQUEST_CHANGES として AC / Allowed Paths / fixture 追加を具体的に指示していたにもかかわらず、loop は new_allowed_path_layer を「人間承認が必要な scope 拡張」として扱い停止した。
現行の anchor-comment-handling.md は anchor comment の分類・fact-check・正規化済み feedback の利用を要求しているが、live preflight(run_refinement_preflight.py)はその分類結果を planner の known_context に渡せていない。具体的には、anchor comment の author_association / scope_impact の判定が実装されておらず、known_context.classification: feedback_update_required も anchor_reframe: true も planner input に含まれていない。
その結果、decide_next_loop_action.py は scope_signal_guard.triggered == true かつ excluded_by_anchor_reframe == false という状態を見て常に human_escalation を返し、人間が GitHub comment で明示した scope 拡張要求を AI が自発的に広げた scope creep と区別できない。
関連 Issue: #920(anchor reframe comment schema の追加 — scope-signal-guard.md とテストを先行実装中)
Depends on #920
Outcome
run_refinement_preflight.py が trusted anchor comment(author_association: OWNER | MEMBER | COLLABORATOR の REQUEST_CHANGES 相当)を検出した場合に ANCHOR_SCOPE_AMENDMENT_V1 を生成し、planner input の known_context に anchor_reframe: true として渡すコードが追加された状態で、pytest fixture(#993 相当)が初回 Y なしで scope_signal_guard.excluded_by_anchor_reframe: true になることが検証されている。
In Scope
run_refinement_preflight.pyで anchor comment 本文・author metadata を取得し、ANCHOR_SCOPE_AMENDMENT_V1を生成する- trusted author 判定は
OWNER | MEMBER | COLLABORATORを基準にする REQUEST_CHANGES/Allowed Paths/Acceptance Criteria/Verification Commandsなどの明示的な契約修正指示をscope_impact: amendとして分類するknown_context.classification: feedback_update_requiredまたはanchor_reframe: trueを planner input に渡す- untrusted author / ambiguous comment は fail-closed で human escalation する
ANCHOR_SCOPE_AMENDMENT_V1スキーマファイルを追加する- AC 対応 pytest fixture を追加する(
#993相当の anchor comment でexcluded_by_anchor_reframe: trueになることを回帰検証)
Out of Scope
agent_inferredの scope 追加を自動承認する機能(従来どおり human_escalation)CONTEXT_PROVENANCE_V1全体の導入(別 Issue)autonomy_modeの導入(別 Issue)decide_next_loop_action.pyの wrapper 追加(別 Issue)issue-authorへの raw anchor snapshot 渡し禁止以外の Step 4 変更
Acceptance Criteria
- AC1: trusted anchor comment が
REQUEST_CHANGESとして AC / Allowed Paths / VC の追加を明示している fixture では、planner output がscope_signal_guard.excluded_by_anchor_reframe: trueになる - AC2: 同じ Allowed Paths 拡張でも、anchor comment 由来ではなく AI が自発的に作った変更では
scope_signal_guard.triggered: trueのまま human escalation する - AC3: untrusted author または ambiguous comment の場合は fail-closed で human escalation する
- AC4:
issue-authorへ raw anchor snapshot を直接渡さず、正規化済みanchor_comment_feedbackのみを渡す - AC5:
#993の anchor comment 相当 fixture を追加し、初回Yなしで loop が Step 1/2 に進めることを regression test 化する
Verification Commands
# AC1
uv run pytest .claude/skills/issue-refinement-loop/tests -q -x -k "trusted_anchor"# AC2
uv run pytest .claude/skills/issue-refinement-loop/tests -q -x -k "agent_inferred_scope"# AC3
uv run pytest .claude/skills/issue-refinement-loop/tests -q -x -k "untrusted_author or ambiguous_comment"# AC4
uv run pytest .claude/skills/issue-refinement-loop/tests -q -x -k "anchor_comment_feedback"# AC5
uv run pytest .claude/skills/issue-refinement-loop/tests -q -x -k "anchor_scope_amendment"Allowed Paths
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py.claude/skills/issue-refinement-loop/schemas/**.claude/skills/issue-refinement-loop/references/anchor-comment-handling.md.claude/skills/issue-refinement-loop/references/scope-signal-guard.md.claude/skills/issue-refinement-loop/tests/**docs/dev/workflows/issue-refinement-loop-design.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python / pytest
- GitHub REST API(author_association / comment metadata 取得)
- JSON Schema(ANCHOR_SCOPE_AMENDMENT_V1 設計)
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR- worktree で実装する
- Draft PR として作成し、AC 全件 VC 通過後に Ready for Review にする
- Depends on feat: issue-refinement-loop に anchor scope reframe comment schema を追加する #920 merge(scope-signal-guard.md の anchor reframe schema が先行して確立されている必要あり)
Activity
squne121 commentedon Jul 4, 2026
Closed as superseded by #1323。#1323 の本文改訂(OWNER 判断 2026-07-04, #1323 (comment) への回答)により、本 Issue が目的とした trusted anchor scope amendment の判定・provenance 分離は #1323 の scope_delta_authority / scope_delta_authority_evidence_v1 に統合された。
feat: Refinement Loop の scope guard を人間レビュー由来の契約更新として自動反映できるようにする (#1323