Skip to content

実装: run_refinement_preflight が trusted anchor scope amendment を planner known_context に渡せるようにする #1008

Closed

Description

@squne121

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: code

Parent 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

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jun 19, 2026
  2. squne121 commented on Jul 4, 2026

    @squne121
    OwnerAuthor

    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 に統合された。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions