Repository navigation
Closed
Labels
phase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "issue-refinement-loop の anchor scope reframe 判定を、payload 不在時に fail_closed で停止させず、既存の freeform lane を継続利用できる設計にする(ただし multi-turn integrity gate と証跡保持を壊さない安全な契約で)"
change_kind: workflowParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: なし(単独改善)
- Desired Destination:
_classify_anchor_scope_reframe()のno_anchor_scope_reframe_v1_payload診断ラベルが genuine absence のみを指すようになり、かつ_apply_multi_turn_candidate_route()/_project_scope_delta_decision_to_approval()の既存 safety invariant(multi-turn integrity gate、証跡保持)を壊さない状態にする。
Remaining Parent Gaps
なし(単独改善のため)。
Background(reframe 理由)
2026-08-14、issue-refinement-loop の human escalation 後、operator instruction に基づき canonical reproduction を実施した(詳細: reframe 前の Decision コメント、current main SHA 8bc7f8c46d03c586dc11e525c072b5ddc401f0bf の dedicated worktree で検証)。
判明した事実:
_classify_anchor_scope_reframe()がstatus: fail_closedを返しても、_structured_anchor_payload_present_but_invalid()(run_refinement_preflight.py)がno_anchor_scope_reframe_v1_payloadを明示的に除外しているため、genuine-absence の単純ケースでは_build_scope_delta_authority_evidence()(freeform lane、実装: fix(issue-refinement-loop): bind freeform OWNER scope authority end-to-end and expose routing telemetry #2053 AC2 由来)は現状でも問題なく継続する。またより上位のclassify_scope_delta_authority()経由で freeform directive がcontract_update_requiredに到達する経路も既存テスト(test_operator_selected_scope_reframe.py::test_freeform_workflow_wide_directive_routes_contract_update_without_anchor_payload、実装: issue-refinement-loop の approved 終了時に triage-required ラベル遷移を実行する #2084 comment #5249734344 の再現)で確認済みであり、これは既に機能している。- 一方、当初案(AC1:
statusのみをfail_closed→not_applicableに置換する最小差分)をそのまま実装すると、以下が壊れることをコードトレースで確認した:_apply_multi_turn_candidate_route()のoriginal_status == "fail_closed" and original_reason == "no_anchor_scope_reframe_v1_payload" and integrity_confirmed分岐が恒久的に到達不能になり、multi_turn_anchor_context_trusted_owner_advisoryへの昇格が機能しなくなる。- 同分岐の fallthrough により、integrity 未確認の multi-turn candidate が
fail_closed(blocking)からnot_applicable(non-blocking)へ意味的降格する。 plan_refinement_loop.py::_project_scope_delta_decision_to_approval()のdecision.get("status") == "not_applicable"早期 return が、trusted author の freeform コメントが実際に存在したケースの証跡(anchor_comment_url/anchor_comment_hash/anchor_author_association/required_rerun)を失う。_parse_anchor_scope_reframe_body()は genuine absence と malformed YAML / 誤ったschema_versionの fence を現状区別しておらず(両方ともNoneを返しno_anchor_scope_reframe_v1_payloadにバケットされる)、当初案の Out of Scope(「malformed/wrong-version は対象外」)は実装上保護されていなかった。
この reframe は、上記の実際に確認された defect のみを対象とし、既に機能している freeform 経路(#2053/#2086/classify_scope_delta_authority())には触れない。
Current Validated Scope
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py内、以下の関数のみを対象とする:_parse_anchor_scope_reframe_body()/ 新設する presence 判定ヘルパー(genuine absence と malformed/wrong-schema-version の tri-state 判定)_classify_anchor_scope_reframe()(genuine absence 分岐のみ。malformed/wrong-schema-version/wrong_repo/wrong_issue_number/stale の既存 fail-closed 挙動は変更しない)_apply_multi_turn_candidate_route()(advisory upgrade 条件と fallthrough の safety invariant 維持)
.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py内、_project_scope_delta_decision_to_approval()のみを対象とする(証跡保持の修正)。_build_scope_delta_authority_evidence()/classify_scope_delta_authority()/ 実装: fix(issue-refinement-loop): bind freeform OWNER scope authority end-to-end and expose routing telemetry #2053・実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086 の freeform authority transport 自体は対象外(既に正しく機能している)。
Outcome
以下がすべて満たされたコミットが作成される:
_classify_anchor_scope_reframe()は、trusted author かつ genuine absence(本文にANCHOR_SCOPE_REFRAME_V1fenced block 自体が存在しない)の場合のみstatus: not_applicable(reason: no_anchor_scope_reframe_v1_payloadは維持)を返す。- malformed YAML / 誤った
schema_versionの fenced block が存在する場合は genuine absence と区別され、status: fail_closedのまま維持される(新しい reason はschema_invalid:prefix など、既存の invalid-payload 分岐と一貫した形式にする)。 _apply_multi_turn_candidate_route()は、genuine-absence ケースの upstream status がfail_closed/not_applicableのどちらであっても、reason == "no_anchor_scope_reframe_v1_payload"を根拠に advisory upgrade 判定(integrity confirmed →warn/advisory、integrity unconfirmed → blocking 維持)を行う。_project_scope_delta_decision_to_approval()は、genuine-absence ケースでscope_delta_decision.statusがnot_applicableであっても、trusted author の anchor comment 証跡フィールド(comment_url/body_sha256/author_association/required_rerun)を失わない。.claude/skills/issue-refinement-loop/tests/配下の既存テスト(test_anchor_scope_reframe_preflight.py、test_anchor_context_multi_turn_supersession.py、test_operator_selected_scope_reframe.py、test_preflight_run_with_anchor.py、test_anchor_scope_reframe_downgrade_safety.pyを含む)と新規追加する producer→consumer 統合テストがpytestで green になる。
In Scope
_classify_anchor_scope_reframe()の genuine-absence 分岐をstatus: fail_closedからstatus: not_applicableに変更する(reason: no_anchor_scope_reframe_v1_payloadは維持)。_parse_anchor_scope_reframe_body()、またはその手前で呼ばれる新設ヘルパーが、genuine absence(fence 自体が存在しない)と present-but-invalid(malformed YAML / 誤った schema_version の fence が存在する)を区別できるようにする。present-but-invalid は genuine absence 側の分岐に混入させず、既存の invalid-payload 系 fail-closed 挙動(fail_closed、schema_invalid:系 reason)を維持する。_apply_multi_turn_candidate_route()の分岐条件を、upstreamstatusがfail_closedかnot_applicableかに関わらずreason == "no_anchor_scope_reframe_v1_payload"を正しく認識するように更新する。integrity confirmed → advisory upgrade(既存warn/multi_turn_anchor_context_trusted_owner_advisoryを維持)、integrity unconfirmed → blocking 状態を維持する(not_applicableへの意味的降格を防ぐ)。plan_refinement_loop.py::_project_scope_delta_decision_to_approval()を更新し、genuine-absence ケースでstatusがnot_applicableであっても、trusted author の anchor comment 証跡フィールドが_base_approval_result()の早期 return で失われないようにする。最終的なapproval["status"](missing_marker)と_decide_scope_signal_route()が返すルート(SCOPE_ROUTE_HUMAN_JUDGMENT_REQUIRED)自体は変更しない。_classify_anchor_scope_reframe()→_apply_multi_turn_candidate_route()→_project_scope_delta_decision_to_approval()の producer→consumer chain を実際に貫通する統合テストを追加する(既存test_anchor_context_multi_turn_supersession.pyのようにscope_delta_decisiondict を手書きで直接構築するのではなく、_classify_anchor_scope_reframe()の実際の戻り値を入力として使う)。最低限、以下をカバーする:- trusted OWNER、single-turn、genuine absence
- trusted OWNER、multi-turn、genuine absence、retrieval integrity confirmed(advisory upgrade が機能することを確認)
- trusted OWNER、multi-turn、genuine absence、retrieval integrity unconfirmed(blocking のまま維持されることを確認)
- trusted OWNER、present-but-wrong-schema-version の fenced block(
fail_closedのまま維持されnot_applicableにならないことを確認)
- 変更に伴い、
.claude/skills/issue-refinement-loop/references/anchor-comment-handling.mdおよび.claude/skills/issue-refinement-loop/references/scope-signal-guard.md内にno_anchor_scope_reframe_v1_payload → fail_closedという古い記述があれば、新しい tri-state 挙動に合わせて更新する。
Out of Scope
ANCHOR_SCOPE_REFRAME_V1の構造化 payload 自体の schema 変更(schemas/anchor_scope_reframe_v1.schema.json等)。- payload が valid に parse できた上で
wrong_repo/wrong_issue_number/staleに該当するケースの既存 fail-closed 挙動の変更(_structured_anchor_payload_present_but_invalid()の対象、変更しない)。 classify_scope_delta_authority()/_build_scope_delta_authority_evidence()/ 実装: fix(issue-refinement-loop): bind freeform OWNER scope authority end-to-end and expose routing telemetry #2053・実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086 の freeform authority transport 自体の変更(既に正しく機能していることを確認済み)。with_human_context/with_agent_reportlane 名のリネームや意味論の再定義。- reviewer transport(
reviewer_transport.py)の per-attempt deadline(90秒)と長時間 Verification Command の不整合修正(別 Issue で扱う。本 Issue の Allowed Paths には含めない)。 - destructive operation・permission boundary・external paid service・別 Issue への partition に関する既存の safety boundary の変更。
- 新しい public schema・永続 state store の追加。
Acceptance Criteria
- AC1:
run_refinement_preflight.pyに、fencedyamlblock の genuine absence(fence 自体が本文にない)と present-but-invalid(fence は存在するが YAML 構文エラー、またはschema_versionがANCHOR_SCOPE_REFRAME_V1と一致しない)を区別する判定ロジックが存在する。 - AC2:
_classify_anchor_scope_reframe()は、trusted author かつ genuine absence の場合、戻り値statusがnot_applicableになり、reasonはno_anchor_scope_reframe_v1_payloadのまま維持される。 - AC3:
_classify_anchor_scope_reframe()は、trusted author かつ present-but-invalid(malformed YAML または誤ったschema_versionの fence が存在する)の場合、戻り値statusはfail_closedのまま維持され、not_applicableにはならない。 - AC4: payload が valid に parse できた上で
wrong_repo/wrong_issue_number/staleに該当するケースのstatusは、引き続きfail_closedを返す(既存挙動を壊さない)。 - AC5:
_apply_multi_turn_candidate_route()は、genuine-absence かつ trusted owner かつ multi-turn candidate かつ retrieval integrity confirmed の場合、upstreamstatusがfail_closed/not_applicableのいずれであってもstatus: "warn"/reason: "multi_turn_anchor_context_trusted_owner_advisory"へ昇格する。 - AC6:
_apply_multi_turn_candidate_route()は、genuine-absence かつ trusted owner かつ multi-turn candidate かつ retrieval integrity unconfirmed の場合、blocking な状態(fail_closed相当、implementation_go: false)のまま維持され、not_applicable(non-blocking)に意味的降格しない。 - AC7:
plan_refinement_loop.py::_project_scope_delta_decision_to_approval()は、genuine-absence ケースでscope_delta_decision.statusがnot_applicableであっても、comment_url/body_sha256/author_association/required_rerunを_base_approval_result()の初期値のまま返さず、scope_delta_decisionの該当フィールドから正しく populate する。 - AC8:
_classify_anchor_scope_reframe()の実際の戻り値を_apply_multi_turn_candidate_route()と_project_scope_delta_decision_to_approval()に順に通す統合テストが追加され、AC5/AC6/AC7 の4シナリオ(single-turn absence / multi-turn absence+integrity confirmed / multi-turn absence+integrity unconfirmed / present-but-wrong-schema-version)をカバーする。 - AC9:
.claude/skills/issue-refinement-loop/tests/配下の pytest 全体が green で通過する(既存 regression の破壊がない)。
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_anchor_scope_reframe_preflight.py::test_genuine_absence_vs_present_invalid_tri_state -v# AC2
# baseline-expect: pass
$ rg -n "no_anchor_scope_reframe_v1_payload" .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_anchor_scope_reframe_preflight.py::test_present_invalid_wrong_schema_version_stays_fail_closed -v# AC4
# baseline-expect: pass
$ rg -n "wrong_repo" .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py# AC5
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py::test_genuine_absence_integrity_confirmed_advisory_upgrade_via_classifier -v# AC6
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py::test_genuine_absence_integrity_unconfirmed_stays_blocking_via_classifier -v# AC7
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py::test_not_applicable_genuine_absence_preserves_anchor_evidence -v# AC8
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py::test_producer_consumer_chain_classify_to_route_to_approval -v# AC9
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -qAllowed 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/tests/test_anchor_scope_reframe_preflight.py.claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py.claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py.claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py.claude/skills/issue-refinement-loop/tests/test_anchor_scope_reframe_downgrade_safety.py.claude/skills/issue-refinement-loop/references/anchor-comment-handling.md.claude/skills/issue-refinement-loop/references/scope-signal-guard.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
classify_scope_delta_authority()/_build_scope_delta_authority_evidence()自体の変更が必要と判明した場合(Out of Scope)- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Runtime Verification Applicability
- decision: immediate
- reason: 本 Issue は preflight routing(
_classify_anchor_scope_reframe()→_apply_multi_turn_candidate_route()→_project_scope_delta_decision_to_approval())という複数ファイルにまたがる subprocess/consumer chain の意味論を変更する。direct unit test(fixture 手書き)だけでは AC5-AC8 が要求する producer→consumer 結合を検証できないため、AC8 の統合テストに<!-- runtime-verification: true -->タグを付与し、実際の関数呼び出しチェーンを通した検証を必須とする。
applicable_acs: AC5, AC6, AC7, AC8
execution_environment:uv run --locked pytest(リポジトリ内 in-process 実行、外部プロセス起動・ネットワーク通信なし)
skip_conditions: なし(本 Issue の統合テストは repo 内 pytest のみで完結し、SKIP exit 77 相当の外部依存を持たない)
fallback_policy: 統合テストが失敗した場合は fallback FAIL とし、AC5/AC6/AC7 いずれかの safety invariant が壊れていることを示す。SKIP や silent pass への fallback は行わない。
artifact_requirements: PR にuv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -qの実行結果(pass 件数・fail 0 件)を証跡として添付する。
Required Design References
.claude/skills/issue-refinement-loop/references/anchor-comment-handling.md—_classify_anchor_scope_reframe()の fail-closed 分岐と freeform lane 移行に関する正本ドキュメント。.claude/skills/issue-refinement-loop/references/scope-signal-guard.md—_apply_multi_turn_candidate_route()の advisory upgrade / multi-turn integrity gate の設計文脈。- Issue 実装: fix(issue-refinement-loop): bind freeform OWNER scope authority end-to-end and expose routing telemetry #2053(実装: freeform authority producer/router/consumer transport、
_structured_anchor_payload_present_but_invalid()の downgrade-forbidden 除外ロジックの由来、CLOSED)。 - Issue 実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086(実装: operator-selected human context の scope reframe を自動継続、CLOSED/マージ済み PR 実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2096)— 本 Issue が前提とする freeform lane の実装元。ただし
_classify_anchor_scope_reframe()自体は 実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086 の変更対象に含まれていなかったことを確認済み。
Delivery Rule
1 Issue = 1 PR で完結させる。dedicated worktree で作業し、Draft PR をデフォルトとする。
Metadata
Metadata
Assignees
Labels
phase/implementationImplementation phase
Activity
squne121 commentedon Aug 14, 2026
判定
REQUEST_CHANGES — 現在の Issue 契約のままでは実装不可です。
レビュー基準は 2026年8月14日時点の
main、SHA8bc7f8c46d03c586dc11e525c072b5ddc401f0bfです。Issue #2156 は「構造化 payload 不在時のfail_closedをnot_applicableに変える」ことを主変更としていますが、提案された分岐変更は、既存の freeform compatibility contract を改善するより先に、malformed payload の authority downgrade 防止と multi-turn retrieval-integrity gate を破壊します。重大指摘
P0-1 — 「payload 不在」と「payload が存在するが不正」を現行 parser が区別できない
Issue は次の二つを別扱いすると規定しています。
not_applicablefail_closedしかし現行の
_parse_anchor_scope_reframe_body()は、少なくとも以下をすべてNoneとして返します。schema_versionが別値の YAML現行
_classify_anchor_scope_reframe()は、このpayload is None分岐全体をfail_closed / no_anchor_scope_reframe_v1_payloadにしているため、結果的に不正入力も閉じています。Issue の指定どおり、この一分岐をそのままnot_applicableにすると、malformed・wrong-version・quoted payload まで「payload 不在」と誤認されます。これは単なるテスト期待値の変更ではありません。現行 caller は「present-but-invalid の structured payload だけ freeform fallback を禁止する」という downgrade guard を持っています。ところが malformed payload が
not_applicable / no_anchor_scope_reframe_v1_payloadになれば、この guard は payload 不在と判断し、同じコメント本文を_build_scope_delta_authority_evidence()に再投入します。#2053 が明示的に禁止した、構造化検証に失敗した本文を freeform authority として再解釈する経路が復活します。必要な修正
内部 parser を最低でも次の三状態にしてください。
公開 status は以下に射影できます。
schema_versionmarker や canonical YAML fence が存在するが parse/schema validation に失敗した場合は、必ずpresent_invalidです。単純なif payload is Noneの status 置換では実装してはいけません。P0-2 — multi-turn anchor の retrieval-integrity gate が迂回される
現行
_apply_multi_turn_candidate_route()は、trusted OWNER の multi-turn anchor を advisorywarnに落とす条件を、次の完全一致に限定しています。取得完全性が一つでも確認できない場合は、元の
fail_closedを維持します。これは chronology metadata を信頼してよいかを決める安全境界です。#2156 の変更後は baseline decision が
not_applicableになるため、この分岐に入りません。「その他の status/reason」は変更せず返す実装なので、取得不完全な multi-turn anchor が non-blocking なnot_applicableのまま通ることになります。latest_owner_turnも生成されず、既存の integrity predicate は実質的に無効化されます。既存テストはfail_closed / no_anchor...を手で組み立てて関数へ渡すものが多く、production classifier との結合破壊を検出しない可能性があります。必要な修正
not_applicable導入時には、multi-turn route も同じ変更単位で再設計する必要があります。最低限、次の二ケースを production classifier から通した結合テストが必要です。→ advisory
warn、latest_owner_turnを保存→ 現行と同等の fail-closed。少なくとも non-blocking continuation にしない
この変更には
test_anchor_context_multi_turn_supersession.pyが必要ですが、同ファイルは #2156 の Allowed Paths に含まれていません。P1-1 — Issue が主張する機能上の欠陥は、current
mainですでに回避されているcurrent
mainの caller は、structured decision がno_anchor_scope_reframe_v1_payloadの場合、その decision 自体はfail_closedでも、present-but-invalid ではないと判定して_build_scope_delta_authority_evidence()を実行します。つまり、structured classifier の局所 status は、現在すでに freeform lane の停止条件ではありません。さらに #2086 の regression test は、operator-selected human-context の freeform directive が structured payload なしで
contract_update_requiredに到達し、human_judgment_required / no_anchor_scope_reframe_v1_payloadにならないことを明示的に検証しています。#2086 とその実装 PR #2096 は、次の境界まで実装済みです。
with_human_contextによる origin assertionstructured payload なしの semantic directive classification
investigation-derived exact path transport
controlled contract update
fresh gate 前の
implementation_allowed=falseprivileged executor からの実 subprocess 到達性
したがって #2156 には、まず以下の再現証跡が必要です。
その canonical invocation が現在すでに
contract_update_requiredまたはissue_editor_requiredに到達するなら、#2156 は機能修正ではなく内部 status の名称整理です。その場合、P0 の回帰リスクに見合う変更理由はありません。また #1327 は、
scope_signal_delta_inputが生成されず legacy fallback へ流れる問題を別設計課題として明示しています。実際の障害が legacy scope-signal fallback なら、scope_delta_decision.statusを変えるだけでは delta input は生成されず、根本原因を直しません。P1-2 — Allowed Paths と AC5 が両立しない
#2156 は全
issue-refinement-looptests の green を AC5 にしていますが、現在の Allowed Paths では達成できません。test_anchor_scope_reframe_downgrade_safety.pyは、payload がまったくないケースについて現行 classifier のfail_closedを直接 assert しています。このファイルを変更せず classifier をnot_applicableにすれば、少なくともこの regression は失敗します。ところが同ファイルは Allowed Paths 外です。さらに
no_anchor_scope_reframe_v1_payloadは、次の資産で参照されています。scope-signal-guard.mdanchor-comment-handling.mdplan_refinement_loop.pyrun_refinement_preflight.py特に
scope-signal-guard.mdは、scope_delta_decision.statusの enum と freeform trusted-directive compatibility を記述する規範文書ですが、現在の Allowed Paths に含まれていません。最低限追加すべき Allowed Paths
consumer inventory の結果、planner 側にも status-specific logic がある場合は
plan_refinement_loop.pyと対応テストも追加対象です。P1-3 — AC1 が
author_associationと authority lane を混同している#2156 AC1 は「trusted author かつ payload 不在」を条件にしています。しかし #2086 の accepted trust model では、freeform authority の根拠は次の組み合わせです。
author_association=OWNER|MEMBER|COLLABORATORだけでは human-context authority になりません。同じ URL をwith_agent_reportまたは unlabeled lane で渡した場合はgenerated_by_agentのままです。GitHub API は issue comment と pull-request review comment を別の resource として扱い、
author_associationを返しますが、これは repository との関係を表す metadata です。「その本文を物理的に人間が入力した」という provenance 証明ではありません。したがって、#2086 が採用した invocation-lane boundary を維持する必要があります。これは公式 API 仕様からの推論です。([GitHub Docs]1)追加すべき negative AC
with_agent_reportで渡した場合、freeform human authority に昇格しないP1-4 — Verification Commands が変更の意味論を検証していない
現行 VC の問題点は明確です。
rg -n "status.*not_applicable"対象分岐の挙動を証明しない
rg -n "no_anchor_scope_reframe_v1_payload"変更前から存在するため baseline-positive
rg -n "wrong_repo"変更前から存在するため baseline-positive
parser と classifier の直接テストのみ
canonical invocation の final route、exit code、multi-turn integrity の結合を保証しない
PR #2096 では一度「192 tests passed」と報告された後、production registry と異なる stub、手動注入された
investigation_derived_path_literals、real subprocess 未到達などの P0 false-green が発見されました。#2156 はまさに同じ routing 層を変更するため、直接関数 test だけでは不十分です。また Issue 本文には
Runtime Verification Applicabilityがありません。repository の標準運用では runtime verification 対象 Issue は policy に従うことになっており、本件は wrapper routing と exit semantics の変更なのでdecision: immediateが妥当です。外部仕様との照合
JSON Schema の
enumは値を固定集合に制限する仕組みです。current repository のrefinement_loop_plan_v1.jsonは、すでに次の三値を許可しています。したがって
not_applicable自体に public schema migration は不要です。問題は enum 追加ではなく、既存 consumer が status/reason の組をどのように解釈しているかです。 ([JSON Schema]2)推奨する Issue の再定義
最初に実装するべきものは status 変更ではなく、current-main canonical reproduction test です。
再現がすでに成功する場合
preflight.run.with_human_contextから freeform directive がcontract_update_requiredに到達するなら、#2156 は #2086 / PR #2096 により実質解決済みです。局所 diagnostic status の整形だけを目的とした変更は、今回確認された authority downgrade と integrity bypass のリスクを負う価値がありません。再現が失敗する場合
Issue の Outcome を次のように変更するのが妥当です。
修正版 Acceptance Criteria 案
Genuine absence
canonical structured marker/fence が存在しない trusted human-context comment は、structured decision が
not_applicable / no_anchor_scope_reframe_v1_payloadになる。Present-invalid preservation
malformed YAML、wrong schema version、quoted block、schema invalid、wrong repo、wrong issue、stale はすべて
fail_closedになり、同じ本文から freeform authority evidence を生成しない。Lane isolation
同じ comment URL を
with_agent_reportまたは unlabeled lane で渡しても human authority に昇格しない。Freeform positive route
with_human_contextの plain freeform scope directive はcontract_update_requiredまたはissue_editor_requiredに到達し、implementation_allowed=falseを維持する。Multi-turn integrity
integrity complete の場合だけ advisory route を許可し、integrity incomplete の場合は non-blocking continuation にしない。
Canonical wrapper evidence
fixture-backed CLI/subprocess invocation で final
STATUS、NEXT_ACTION、planner decision、wrapper exit codeを検証する。Regression
targeted suites と
issue-refinement-loop/tests/全体が green。修正版 Verification Commands 案
uv run --locked pytest \ .claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py \ -k "advisory or integrity" \ -quv run --locked pytest \ .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py \ -k "without_anchor_payload or agent_report_lane or unlabeled_lane" \ -q最終結論
#2156 の目的である「構造化 payload 不在だけを理由に freeform directive を停止しない」は正しい方向です。しかし、その機能要件は current
mainにすでに実装されており、Issue が指定する単純な status 変更は、次の既存契約を破壊します。したがって、現 Issue はそのまま implementation-ready ではありません。まず canonical route の再現を追加し、再現済みなら close、失敗するなら tri-state parse と downstream consumer integration を含む Issue に reframeするのが妥当です。
なお、今回のレビューでは repository の current-main source、tests、Issue/PR 履歴を精査しましたが、ローカル checkout 上で pytest や subprocess verification 自体は実行していません。
squne121 commentedon Aug 14, 2026
issue-refinement-loop: human_escalation
.claude/skills/issue-refinement-loop/tests/の pytest 全体実行だけで約111秒かかり、reviewer transport の per-attempt 内部タイムアウトを超過している可能性が高い。Issue 実装: issue-refinement-loop の anchor scope reframe payload 不在判定を fail_closed から freeform lane 継続へ変更する #2156 の本文内容とは無関係なインフラ/環境要因)これまでの進捗(参考情報)
## Runtime Verification Applicabilityセクション欠落## Required Design Referencesに実在 repo-relative パスがないbaseline-expect: pass注釈欠落)issue-editor経由で上記4件を修正する3箇所の diff を適用済み(stale hash guard 経由、idempotency 確認済み)。修正後の本文を直接読み直し、3箇所の変更が意図通り反映されていることを確認済み。reviewer_transport_environment_failureで終了し、修正後の最終 VERDICT を自動取得できなかった。独立調査で判明した追加の懸念(Step 1, review 対象外だが記録として残す)
codebase-investigatorの初回報告(status="none"/reason="no_payload")は実コードと不一致だったため、直接rg/ソース確認で否定済み。実装は現在status: "fail_closed",reason: "no_anchor_scope_reframe_v1_payload"を返しており、Issue 本文の現状記述と一致する。ただし、
run_refinement_preflight.py内_apply_multi_turn_candidate_route()(約3050-3070行目)に以下の分岐がある:Issue #2156 の AC1(
statusをfail_closed→not_applicableに変更、AC2 でreasonは維持)をそのまま実装すると、この分岐のoriginal_status == "fail_closed"条件が恒久的に成立しなくなり、multi_turn_anchor_context_trusted_owner_advisory(multi-turn owner advisory upgrade)経路が到達不能になる可能性がある。この regression risk は現在の Issue 本文の In Scope(「呼び出し元がこの status 値だけで停止判定をしていないかを確認」)ではカバーされているが、AC/VC には反映されていない。実装着手前に、この分岐も含めてstatus値の消費箇所を網羅的に確認するか、Scope に明記することを推奨する。squne121 commentedon Aug 14, 2026
推奨は、#2156 を現行本文のまま実装へ進めず、まず human escalation を「reframe する」という人間判断で解消することです。
GitHub 上の現行本文は依然として「payload 不在なら
fail_closed → not_applicable」を中心とする AC1–AC5 と、3ファイルだけの Allowed Paths のままです。 一方、先行 OWNER レビューの P0 は未反映です。実コードでも_parse_anchor_scope_reframe_body()は malformed YAML や期待 schema でない payload をNoneに畳み、_classify_anchor_scope_reframe()はそのNoneをfail_closed / no_anchor_scope_reframe_v1_payloadにしています。つまり単純な status 置換では genuine absence と present-invalid が区別できません。また、今回あなたが独立発見した multi-turn 問題も実コードで確認できます。
_apply_multi_turn_candidate_route()はoriginal_status == "fail_closed"とreason == "no_anchor_scope_reframe_v1_payload"、さらに retrieval integrity の完全性を同時に要求して advisory route に入っています。AC1だけ変えると、この既存安全経路が到達不能になります。さらに重要なのは、#2086 の目的自体が「
with_human_contextの freeform directive を structured payload 不在だけで止めない」であり、その実装 PR #2096 は既に merged です。 したがって最初に canonical reproduction を行い、既に機能上の目的を満たしているなら #2156 はnot_plannedで閉じるのが最小リスクです。失敗する場合だけ、tri-state parse、downgrade 防止、multi-turn integrity、lane isolation、wrapper E2E を含む Issue に拡張すべきです。#2053 も invalid/stale/wrong-target structured payload から freeform authority への downgrade を明示的に禁止しています。reviewer transport は別 Issue に分離するのが妥当です。current main の
PER_ATTEMPT_DEADLINE_SECONDSは 90秒です。 今回の実測約111秒の AC5 suite を checker attempt 内で走らせる限り、#2156 の意味論とは無関係に timeout します。#2156 で timeout を便乗修正せず、既存重複 Issue を検索したうえで別の infra defect として扱うのを推奨します。以下を Claude Code に渡すのが適切です。
Claude Code 作業プロンプト — Issue #2156 human escalation 解消
対象:
squne121/loop-protocol目的
Issue #2156 の
issue-refinement-loopが reviewer transport の environment failure によりhuman_escalationで終了した。このプロンプトを operator による human judgment として扱い、現行 Issue 本文を implementation-ready とみなして実装へ進むのではなく、まず unresolved semantic risk を解消して Issue を次のどちらかへ収束させること。
mainですでに目的が満たされていることを canonical reproduction で証明し、実装: issue-refinement-loop の anchor scope reframe payload 不在判定を fail_closed から freeform lane 継続へ変更する #2156 をコード変更なしで終了する。この作業では #2156 の実装 PR は作らない。
まず refinement / close decision を完了させる。
Operator decision
現行 #2156 の AC1 をそのまま実装してはならない。
特に以下を unresolved blocker として扱うこと。
_parse_anchor_scope_reframe_body()が genuine absence と malformed / wrong-version / non-canonical structured payload を十分に区別できているか。_apply_multi_turn_candidate_route()がstatus == "fail_closed"とreason == "no_anchor_scope_reframe_v1_payload"に依存しているため、AC1 の status 変更で multi-turn retrieval-integrity gate が到達不能にならないか。with_human_context/with_agent_report/ unlabeled lane の authority isolation が維持されるか。先行 OWNER review comment
5292483715と human escalation comment5292728083の双方を必須入力として扱うこと。作業開始
current
origin/mainを fetch し、現在の SHA を記録する。live GitHub から以下を再取得し、過去ログのコピーを authority にしないこと。
dedicated worktree を使用すること。既存の unrelated working tree を変更しない。
Subagent 調査
main Claude Code session から独立した read-only subagent を並列起動し、全 subagent の完了を待つこと。subagent 自身による nested delegation は不要。
最低限、次の役割を分離する。
codebase investigator:
_parse_anchor_scope_reframe_body→
_classify_anchor_scope_reframe→
_apply_multi_turn_candidate_route→
_structured_anchor_payload_present_but_invalid→
_build_scope_delta_authority_evidence→ planner / wrapper final route
の producer/consumer chain を current main から追跡する。
consumer/test investigator:
status/reason == no_anchor_scope_reframe_v1_payloadの全 consumer と関連 tests/docs を inventory し、status 変更で壊れる assertion、routing、safety invariant、Allowed Paths を列挙する。history/contract investigator:
実装: fix(issue-refinement-loop): bind freeform OWNER scope authority end-to-end and expose routing telemetry #2053、実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2086、PR 実装: operator-selected human context の scope reframe を自動継続し scope expansion stop を撤去する #2096、実装: review/refinementのreplay・envelope・custom publisherをbounded loopへ置換する #1873、implement: recover reviewer transport failures and cryptographically bind compact verdicts to artifacts #2054/PR 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する #2142 の accepted contract と 実装: issue-refinement-loop の anchor scope reframe payload 不在判定を fail_closed から freeform lane 継続へ変更する #2156 の現在契約を比較し、既存機能との重複・逆行を確認する。
adversarial reviewer:
「AC1 をそのまま実装した場合」を仮定して downgrade、integrity bypass、lane confusion、false-green、unreachable branch を敵対的に探索する。
初回報告を鵜呑みにせず、重要 claim は main thread が source/test を直接確認すること。
最重要: canonical reproduction
コード変更前の current main で、#2156 が主張する functional defect を再現する。
最低限、production と同じ routing chain に可能な限り近い形で次を確認する。
Positive case
same-target trusted OWNER comment を明示的に
preflight.run.with_human_contextlane として投入する。comment は:
ANCHOR_SCOPE_REFRAME_V1payload なしとする。
最終的に以下を記録すること。
scope_delta_decision.statusscope_delta_decision.reasonscope_delta_authorityの disposition / route actionSTATUSNEXT_ACTIONimplementation_allowed重要なのは局所的な
scope_delta_decision.statusではなく、canonical invocation 全体が freeform contract rewrite lane を継続できるかである。Negative / safety cases
少なくとも次も確認する。
with_agent_reportmalformed structured input が freeform authority に downgrade する false-green を許可しない。
Decision gate A — current main ですでに目的達成済み
positive canonical reproduction が既に:
contract_update_requiredissue_editor_requiredへ到達し、
human_judgment_required / no_anchor_scope_reframe_v1_payloadで停止しない場合、#2156 の functional goal は #2086 / PR #2096 により既に満たされていると判断する。
その場合:
_classify_anchor_scope_reframe()の局所 diagnostic status を綺麗にするだけの目的で risky な変更を行わない。not_plannedとして close する。Decision gate B — functional defect が実在する
canonical reproduction が本当に失敗する場合のみ #2156 を reframe する。
単純な
payload is None -> status: not_applicableへの置換を禁止する。
Issue Outcome / In Scope / AC / Verification Commands / Allowed Paths を、少なくとも次の契約を満たすよう更新すること。
absentpresent_validpresent_invalidを区別できる。
not_applicable / no_anchor_scope_reframe_v1_payloadにできる。with_human_contextだけが human-context freeform authority を得る。with_agent_report/ unlabeled は昇格しない。STATUS/NEXT_ACTION/ route / exit code を検証する。consumer inventory に基づき Allowed Paths を正確に拡張すること。先行 review が挙げた以下は最低限再評価する。
.claude/skills/issue-refinement-loop/references/scope-signal-guard.md.claude/skills/issue-refinement-loop/tests/test_anchor_scope_reframe_downgrade_safety.py.claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py.claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py.claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.pyplan_refinement_loop.py等に status-specific consumer が存在すれば、それも Issue contract に追加する。scope が routing / subprocess / final wrapper behavior に広がるため、reframe 後の
Runtime Verification Applicabilityは原則decision: immediateとし、direct unit test だけで PASS にしない。Issue body を controlled editor 経由で更新し、live readback と body SHA 再取得を行う。
reviewer transport environment failure の扱い
#2156 の意味論と reviewer transport timeout defect を混ぜないこと。
current reviewer transport の per-attempt deadline と、実際の deterministic verification duration を計測する。
今回報告済みの参考値:
PER_ATTEMPT_DEADLINE_SECONDS = 90.claude/skills/issue-refinement-loop/tests/full pytest ≈ 111 sec同じ mismatch が current main でも再現するなら、まず既存 Issue に重複がないか検索する。
重複がなければ、別 Issue として起票する。例:
fix(issue-refinement-loop): reviewer transport の固定90秒 deadline が長時間 Verification Command を environment_failure にするその Issue では単なる timeout 増加だけを前提にせず、
を調査対象にする。
この infra fix を #2156 の Allowed Paths に便乗させない。
Final review
reframe した場合、fresh live body を対象に independent adversarial review を行う。
既知の
root_review_pipelinetransport timeout が再発した場合、その timeout を semantic REQUEST_CHANGES と混同しない。一方で、timeout を理由に自動 APPROVE を捏造もしない。この operator instruction による human judgment は:
「現行 #2156 は implementation-ready ではない。まず canonical reproduction を行い、既に解消済みなら close、未解消なら安全契約へ reframe する」
である。
したがって、以前の human escalation を理由に同じ質問を operator へ戻さず、この decision tree を実行すること。
完了条件
最終結果は次のどちらかでなければならない。
A. no-code close
current main ですでに functional goal 達成済みであることを canonical evidence で示し、#2156 に説明コメントを投稿し、適切な state reason で close。
B. refinement complete
#2156 が tri-state / downgrade safety / lane isolation / multi-turn integrity / canonical wrapper verification を含む implementation-ready contract に更新され、fresh adversarial review で semantic blocker が残っていない。
どちらの場合も、reviewer transport timeout の重複調査結果を記録し、必要なら別 Issue を起票する。
Stop conditions
通常の read-only 調査、subagent 利用、fixture-backed verification、#2156 本文更新・コメント投稿、重複確認は途中承認を求めず進めてよい。
ただし以下では停止して明示報告すること。
最終報告には current main SHA、Issue body SHA、canonical reproduction result、decision A/B、変更した Issue state/body、別 infra Issue の有無を含めること。
このケースでは、「refinement の transport を直してから #2156 を再レビュー」より、「#2156 の実在 defect をまず再現する」方を先にするのが重要です。#2086/#2096 で既に functional route が成立しているなら、危険な内部 status の変更そのものを捨てられます。
squne121 commentedon Aug 14, 2026
Operator instruction 対応: canonical reproduction 完了・Decision Gate B(reframe)を選択
対象: OWNER review
#issuecomment-5292483715、human escalation#issuecomment-5292728083、および本 Issue に対する operator decision instruction。origin/mainSHA:8bc7f8c46d03c586dc11e525c072b5ddc401f0bf.claude/worktrees/issue-2156-reframe-decision(同 SHA、detached)Canonical reproduction 結果(サマリ)
_classify_anchor_scope_reframe()+_build_scope_delta_authority_evidence()を実コードから直接呼び出して以下を確認した(run_refinement_preflight.pyの実際の呼び出しシーケンスに従う):scope_delta_decision.status_build_scope_delta_authority_evidence)fail_closed/no_anchor_scope_reframe_v1_payloadpresent_but_invalid=Falseのため downgrade-forbidden gate を通過)fail_closed/no_anchor_scope_reframe_v1_payload(absent と同一ラベル)schema_versionの fence(構文的には valid)fail_closed/no_anchor_scope_reframe_v1_payload(absent と同一ラベル)fail_closed/no_anchor_scope_reframe_v1_payloadfail_closed/untrusted_author_association: 'NONE'さらに既存テスト
test_operator_selected_scope_reframe.py::test_freeform_workflow_wide_directive_routes_contract_update_without_anchor_payload(#2084 comment #5249734344 の実際の failure profile を再現)により、freeform かつ構造化 payload なしの trusted operator directive がcontract_update_requiredへ到達する経路は現行 main で既に機能していることを確認した(classify_scope_delta_authority()経由、_classify_anchor_scope_reframe()とは別の分類器)。Decision Gate A(no-code close)は不採用
理由:
_classify_anchor_scope_reframe()のstatusラベルは cosmetic ではなく、少なくとも1つの実consumerで行動に影響することをコードトレースで確認した。したがって「本 Issue の目的はすでに達成済みで、close するだけでよい」という結論は採用しない。Decision Gate B(reframe)を選択 — 確認済みの具体的リスク
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.pyと.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.pyの実コードを直接読み、AC1(statusのみfail_closed→not_applicableに変更する最小差分)を実装した場合に何が起きるかを確定的にトレースした。_apply_multi_turn_candidate_route()の advisory upgrade が恒久的に到達不能になる(run_refinement_preflight.py内、original_status == "fail_closed" and original_reason == "no_anchor_scope_reframe_v1_payload" and integrity_confirmedの分岐)。AC1 実装後この条件のoriginal_status == "fail_closed"が常に False になり、status: "warn"/reason: "multi_turn_anchor_context_trusted_owner_advisory"への昇格が dead code 化する。# Any other original status/reason ... is returned unchanged)により、AC1 実装後は integrity unconfirmed のケースもstatus: "not_applicable"のまま返る。従来はfail_closed(blocking)だった状態がnot_applicable(non-blocking)に意味的降格する。これは既存テストtest_anchor_context_multi_turn_supersession.py内の該当ケース(assert routed["reason"] == "multi_turn_anchor_context_trusted_owner_advisory"を含む fixture、"status": "fail_closed", "reason": "no_anchor_scope_reframe_v1_payload"を直接構築するテスト)が、実際の_classify_anchor_scope_reframe()を経由しない fixture ベースであるため、この regression を検出できないことも確認した(false-green risk)。plan_refinement_loop.py::_project_scope_delta_decision_to_approval()で証跡が失われる: 現行コードはdecision.get("status") == "not_applicable"を先頭でチェックし、真の場合_base_approval_result()を即座に return する(anchor_comment_url/anchor_comment_hash/anchor_author_association/required_rerunを一切埋めない)。この早期 return は元々「anchor reframe が全く試みられていない」ケース用に存在するが、AC1 実装後は「trusted author の freeform コメントは存在した」ケースまでこの早期 return に飲み込まれ、証跡フィールドが失われる。最終 route(SCOPE_ROUTE_HUMAN_JUDGMENT_REQUIRED)自体はmissing/missing_markerどちらでも同一のため機能的なブロッキングは発生しないが、artifact 上の証跡完全性が損なわれる。_parse_anchor_scope_reframe_body()は genuine absence と malformed/wrong-schema-version を区別していない(run_refinement_preflight.py:1330-1355)。fence を検出してもschema_versionがANCHOR_SCOPE_REFRAME_V1と一致しない限り、ループは次の fence を探しに行き、最終的にNoneを返す(対象外 fence は「存在しない」のと同じ扱い)。YAML 構文エラー時も同様に即None。したがって本 Issue の Out of Scope(「payload が存在するが malformed / wrong-version の場合の fail-closed は対象外」)は現行実装では実質的に保護されていない——これらのケースは現在もno_anchor_scope_reframe_v1_payloadという genuine-absence と同じ reason にバケットされているため、AC1 をそのまま実装すると、malformed/wrong-schema-version の fence もnot_applicableに巻き込まれる。以上より、本 Issue は「
statusの局所置換」ではなく、上記4点を含む安全な契約へ reframe した上で再実装する必要があると判断した。Issue 本文をこれから更新する。reviewer transport environment failure について
前回の human escalation で報告した
reviewer_transport_environment_failureは、本 Issue の内容とは無関係のインフラ問題であることを確認した。reviewer_transport.pyのPER_ATTEMPT_DEADLINE_SECONDS = 90に対し、.claude/skills/issue-refinement-loop/tests/の pytest full suite 実測は 111 秒(1316 tests,uv run --locked pytest ... -qで計測)であり、baseline_vc_preflight がこの VC を実行するだけで deadline を超過しうる。重複 Issue は見つからなかったため、別 Issue として起票する(本 Issue の Allowed Paths には含めない)。squne121 commentedon Aug 14, 2026
implement-issue: 実装完了 (2026-08-14T13:29:15Z)
.claude/worktrees/issue-2156-issue-refinement-loop-anchor-scope-refraworktree-issue-2156-issue-refinement-loop-anchor-scope-refra.claude/skills/issue-refinement-loop/tests/全体 1322 passed)fix: #2156 fix_delta で独立検証3件(Allowed Paths違反revert・E501・日本語見出し)を修正する
squne121 commentedon Aug 14, 2026
fix_delta 適用完了(PR #2171、head
b1fafb7a)独立検証で判明した3件を修正し、push・CI green を確認しました。
1. Allowed Paths 違反の revert
.claude/settings.jsonは Issue #2156 の Allowed Paths に含まれていなかったため、git checkout origin/main -- .claude/settings.jsonで origin/main の内容に完全に revert しました。2. Ruff E501 修正
run_refinement_preflight.py:1435のreason文字列(122文字)を implicit string concatenation で3行に分割し、120文字以内に収めました。文字列の実際の値・AC3 の挙動は変更していません(uv run --locked ruff check .claude/scripts scripts schemas .claude/skillsPASS)。3. 日本語比率不足の修正
anchor-comment-handling.mdの新規見出しをに変更し、
validate_japanese_content.py --threshold 0.1でfailed_blocks: 0/aggregate_ratio: 0.405を確認しました。全 AC 再検証結果(AC1-AC9、すべて PASS)
test_genuine_absence_vs_present_invalid_tri_statePASSEDrg -n "no_anchor_scope_reframe_v1_payload"マッチありtest_present_invalid_wrong_schema_version_stays_fail_closedPASSEDrg -n "wrong_repo"マッチありtest_genuine_absence_integrity_confirmed_advisory_upgrade_via_classifierPASSEDtest_genuine_absence_integrity_unconfirmed_stays_blocking_via_classifierPASSEDtest_not_applicable_genuine_absence_preserves_anchor_evidencePASSEDtest_producer_consumer_chain_classify_to_route_to_approvalPASSEDuv run --locked pytest .claude/skills/issue-refinement-loop/tests/ -q→ 1322 passed(regression なし、修正前と同数)CI 結果(PR #2171、
gh pr checks 2171)全20チェック green(Passed: 20 / Failed: 0)。
python-test-core(Ruff + pytest serial lane 含む)とPR Body Japanese Checkの両方が green になったことを確認済みです。変更ファイル(今回の fix_delta 分のみ)
.claude/settings.json(revert).claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py(E501修正のみ).claude/skills/issue-refinement-loop/references/anchor-comment-handling.md(見出し日本語化のみ)PR #2171 は引き続き human マージ待ちです。
fix: #2156 PR #2171 OWNER adversarial review 5件を修正する