Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
change_kind: code
stage: 1
blocked_by: [920, 1027]
dedupe_key: "ops-improvement:loop-protocol:scope-signal-guard-lane-split:2026-06"Parent Issue
なし(standalone issue)
Background
#985 では EnemySpawnSystem.ts が Allowed Paths 外であることが new_allowed_path_layer として検出された。#1060 でも deterministic check は APPROVE だが、新規 skill directory に対する scope_signal_guard が human judgment を要求した。
現在の挙動では、危険な runtime scope expansion と docs/skill/policy 追加のような管理対象 scope expansion が同じ human escalation に寄りやすい。anchor comment による reframe / Scope Delta Approval があれば proceed できるよう、契約と checker lane を明確化する必要がある。
本 Issue は #920(anchor reframe schema)および #1027(scope_signal_delta 差分ベース判定)の実装完了を前提とする(blocked_by: [920, 1027])。
Parent Goal Ref
- Goal:
scope_signal_guardがnew_runtime_path_layer,new_skill_or_docs_layer,new_hook_or_agent_layer,missing_scope_delta_approvalを分けて出力し、人間判断が必要なケースと proceed_with_notes 可能なケースを区別する - Desired Destination: 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985 / 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 の scope_signal_guard 誤停止が regression fixture として再現可能で、anchor comment reframe がある場合は proceed_with_notes が返される状態
- 注意:
proceed_with_notesは「このまま実装してよい」ではない。issue-contract-review での current-bodystatus: goを再取得する必要がある。anchor approval があっても contract-review rerun は必須であり、proceed_with_notes は「anchor approval を確認した上で contract-review を再実行してよい」の意味に留まる。
Current Validated Scope
.claude/skills/issue-refinement-loop/references/scope-signal-guard.md: reason_code を runtime / docs / skill / hook / agent / test に分類する定義追加.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py: anchor comment Scope Delta Approval 検出ロジック(ANCHOR_SCOPE_REFRAME/Scope Delta Approval/Allowed Paths Expansion Rationaleの検出を含む).claude/skills/issue-refinement-loop/scripts/build_loop_state.py: scope_signal_guard lane フィールド追加.claude/skills/issue-refinement-loop/fixtures/golden/: 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985 / 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 regression fixturedocs/dev/workflows/issue-refinement-loop-design.md: lane 定義更新- 注意:
build_refinement_phase_state.pyは 実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 が同ファイルを対象とするリスクがあるため、本 Issue の Current Validated Scope から除外する。実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 との sequence-after 関係を参照。
Remaining Parent Gaps
なし(このIssue単独で完結)
Outcome
scope_signal_guard が new_runtime_path_layer, new_skill_or_docs_layer, new_hook_or_agent_layer, missing_scope_delta_approval を分けて出力し、人間判断が必要なケースと proceed_with_notes 可能なケースを区別する。
proceed_with_notes は contract-review の rerun required を示すステータスであり、実装 go ではない。anchor approval があっても、issue-contract-review の current-body status: go を別途取得しなければ実装フェーズに進んではならない。
SCOPE_SIGNAL_GUARD_DECISION_V2 schema により、raw_signal / scope_context / scope_delta_approval / route の各フィールドを artifact に保存し、decision traceability を確保する。
In Scope
- scope_signal_guard reason_code の細分化(
scope_context.path_layer/domain_flags/conflict_type/routeの4フィールド) - anchor comment Scope Delta Approval 検出(
ANCHOR_SCOPE_REFRAME/Scope Delta Approval/Allowed Paths Expansion Rationaleの alias として対応) - proceed_with_notes / human_judgment_required の分岐
- 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985 / 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 regression fixture(実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 との分離を保証)
SCOPE_SIGNAL_GUARD_DECISION_V2artifact スキーマ(comment id / body hash / author / created_at / issue_url を含む)author_association検証(OWNER / MEMBER / COLLABORATOR のみ valid)- security-sensitive path に対する fail-closed gate(設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558 との整合)
Out of Scope
- compact_review_result / reviewer_claim_replay の変更(別 Issue の責務)
- guard/hook の変更(別 Issue の責務)
- AC/VC の deterministic checker 変更
build_refinement_phase_state.pyの変更(実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 との衝突回避のため除外)- security gate 本体の実装(設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558 の責務)
docs/dev/workflows/issue-refinement-loop-design.mdの更新(scope_signal_guard の top-level prefix 制約回避のため別 follow-up Issue で実施)
Acceptance Criteria
- AC1:
new_allowed_path_layerをscope_context.path_layerとして runtime / docs / skill / hook / agent / test_fixture / unknown に分類する(SCOPE_SIGNAL_GUARD_DECISION_V2の path_layer フィールドに出力) - AC2: anchor comment に
ANCHOR_SCOPE_REFRAME/Scope Delta Approval/Allowed Paths Expansion Rationaleがあり、target issue 一致 + author_association が OWNER/MEMBER/COLLABORATOR の場合は proceed_with_notes を返す。proceed_with_notes は contract-review rerun required であり実装 go ではない。 - AC3: reframe なしの runtime path expansion は human_judgment_required
- AC4: docs-only skill追加は deterministic approval 条件を満たせば human escalation しない
- AC5: 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985
EnemySpawnSystem.tscase と 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060ci-test-performance skillcase の fixture が追加される(実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 との分離を保証し、非重複 assertion で構成する) - AC6: termination report は
scope_signal_guard_reason_codeだけでなく、missing approval field と suggested contract patch を出す - AC7: 既存の fail-closed safety は維持される(security-sensitive path を持つ場合の fail-closed を含む)
- AC8: Scope Delta Approval は対象 Issue の comment URL のみ有効。別 Issue / PR / 外部 URL は
invalid_scope_delta_approvalとして fail-closed - AC9:
author_associationが OWNER / MEMBER / COLLABORATOR のいずれでもない場合、approval は invalid として fail-closed - AC10:
SCOPE_SIGNAL_GUARD_DECISION_V2artifact に raw_signal / scope_context / scope_delta_approval / route を保存する(comment id / body hash / author / created_at / issue_url を含む) - AC11: 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985 fixture: runtime path expansion + approval missing → human_judgment_required、approval present でも contract-review rerun required(proceed_with_notes)
- AC12: 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 fixture: docs/skill layer + deterministic approval + no security flag → proceed_with_notes
- AC13: security-sensitive path/term がある場合、Scope Delta Approval があっても
security_risk_gate_requiredとして fail-closed(設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558 との整合)
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- 既存 scope_signal_guard の fail-closed 方針を崩す変更が必要になった場合
- 実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 との fixture/state builder 衝突が解消できない場合は 実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086 完了後に sequence する
- feat: issue-refinement-loop に anchor scope reframe comment schema を追加する #920 の anchor reframe schema との互換性確保が不可能と判明した場合(新 marker が既存
excluded_by_anchor_reframeを破壊する場合) - 実装: agent-ops: scope_signal_guard を差分ベース診断にして In Scope 語彙追加停止ループを防ぐ #1027 の scope_signal_delta 実装が本 Issue の AC に必須となり Allowed Paths/Scope 拡大が避けられない場合
SCOPE_SIGNAL_GUARD_DECISION_V2schema が 実装: scope collision 判定を構造化コンテキストで汎用化し、単語一致による誤エスカレーションを抑止する #550/PR feat(#550): generalize scope collision detection with scope_context #554 のscope_context設計と非互換と判明した場合- security-sensitive path の fail-closed 判定で 設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558 の責務との境界が曖昧になり、security gate 実装(Allowed Paths 外)が必要と判明した場合
Required Skills
- Python
- issue-refinement-loop architecture
- scope_signal_guard semantics
Verification Commands
# AC1
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC2
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC4
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC5
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC7
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
# AC8
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC9
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC10
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC11
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC12
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -q
# AC13
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -qAllowed Paths
.claude/skills/issue-refinement-loop/references/scope-signal-guard.md.claude/skills/issue-refinement-loop/references/loop-state.md.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py.claude/skills/issue-refinement-loop/scripts/build_loop_state.py.claude/skills/issue-refinement-loop/fixtures/
Runtime Verification Applicability
- decision: deferred
- reason: 実装後の pytest で AC1-AC13 を検証
- deferred_verification_condition: pytest が 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985 / 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060 regression fixture を含む全 AC で PASS すること
- deferred_destination: impl-review-loop / issue-contract-review での go 判定後
Related Issues
- 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985: 本改善のトリガー(scope_signal_guard が anchor reframe を無視して human_escalation)
- 実装: CI test lane policy docs と ci-test-performance skill を追加する #1060: ci-test-performance skill での同様の過剰停止
- 実装: scope collision 判定を構造化コンテキストで汎用化し、単語一致による誤エスカレーションを抑止する #550 / 設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558: scope_signal_guard 汎用化の先行作業(scope rollup は security gate でない、security gate は 設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558 の責務)
- feat: issue-refinement-loop に anchor scope reframe comment schema を追加する #920: anchor reframe schema との互換性(blocked_by)
- 実装: agent-ops: scope_signal_guard を差分ベース診断にして In Scope 語彙追加停止ループを防ぐ #1027: scope_signal_delta 差分ベース判定(blocked_by)
- 実装: review checker compact artifact の blocking semantics を修正し C4 VC failure を human escalation に誤分類しない #1086: build_refinement_phase_state.py / 実装: existing enemy_chaser を new taxonomy へ非破壊移行する #985 fixture との並行変更リスク(sequence-after)
Activity
squne121 commentedon Jun 21, 2026
判定
REQUEST_CHANGES。#1090 の問題意識は正しいが、現契約のまま実装すると、scope_signal_guard の誤停止を減らすどころか、既存の anchor reframe / scope_context / fail-closed 系と競合する危険が高いです。
#1090 は、#985 で
EnemySpawnSystem.tsが Allowed Paths 外のnew_allowed_path_layerとして検出された件、#1060 で新規 skill directory 追加が human judgment を要求した件を直接の背景にし、new_runtime_path_layer/new_skill_or_docs_layer/new_hook_or_agent_layer/missing_scope_delta_approvalへ lane 分割する Issue です。コメントは現時点で 0 件です。ただし、関連履歴を見ると、#1090 は 単独の新判定器として作るべきではありません。#550/PR #554 で既に「語彙一致ではなく
scope_context/domain_flags/ordering_constraintで構造的に判定する」「security gate とは分離する」という方針が merged されています。 さらに #920 はexcluded_by_anchor_reframeを扱う anchor reframe schema の未整備を既に Issue 化しており、#1027 は scope_signal を差分ベース診断にする Issue です。Blocker 1: #1090 は #920 / #1027 と順序依存を明示していない
#1090 は
Scope Delta Approval/Allowed Paths Expansion Rationaleという新しい marker を契約化しようとしていますが、既存には #920 のanchor scope reframe comment schemaがあり、excluded_by_anchor_reframe=true、対象 Issue 外 URL の fail-closed、OWNER 相当 author が必要、という前提が既に定義されています。加えて、検索上
Scope Delta Approval/Allowed Paths Expansion Rationaleは #1090 以外に実績がありません。 つまり現契約のままでは、既存のANCHOR_SCOPE_REFRAME系と新 marker 系が並立し、agent が「どちらを正本にすべきか」を誤読します。修正要求:
または、#1090 に #920/#1027 相当の実装まで含めるなら、Allowed Paths と AC を拡張し、C2/C3 scope collision として contract-review をやり直すべきです。
Blocker 2:
proceed_with_notesが hard gate を迂回する危険がある#1090 は anchor comment reframe があれば
proceed_with_notesを返す設計ですが、現行 workflow ではissue-contract-review status: goが実装着手の hard gate であり、Issue body が human escalation 後に変わった場合、過去の contract-review result は stale と明記されています。したがって
proceed_with_notesは「実装してよい」ではなく、contract patch を作って再レビューへ進めてよい程度に抑える必要があります。そうしないと、#1071 のレビューコメントで出ていたような「Allowed Paths 外ファイルを Scope Delta 人間承認で進める」経路が、承認済み gate と未承認 gate の混在を起こします。修正要求:
Blocker 3: #1086 とファイル・fixture が衝突している
#1086 は
build_refinement_phase_state.py、issue-refinement-loop tests、#985 再現 fixture を扱う一方で、Out of Scope にscope_signal_guard変更を明示しています。 #1090 もbuild_refinement_phase_state.py、fixtures/golden、#985/#1060 regression fixture を扱うため、同時進行すると「compact/replay 側の human escalation」と「scope_signal_guard 側の human escalation」が同じ fixture を別の意味で直す状態になります。修正要求:
#1086 が未完なら、#1090 は
build_refinement_phase_state.py変更を避け、plan_refinement_loop.pyとscope-signal-guard.mdの contract/schema 追加に絞る方が安全です。Blocker 4: lane 分類が path prefix ベースだけだと再び false positive になる
#1090 の lane 案は runtime/docs/skill/hook/agent/test の分類ですが、#550/PR #554 の教訓は「単語一致・同一ファイル一致・prefix overlap だけでは不十分」という点です。PR #554 では
same_anchor_conflicting_operation/same_file_disjoint_anchor/uncertainのようなscope_context.conflict_typeと、security_match_evidenceは audit 記録のみという設計で approve されています。#1090 も同じ構造に寄せるべきです。推奨 schema:
JSON Schema を使うなら、未知 field を許すか閉じるかを明示してください。
additionalProperties: falseは未定義 property を不正にできますが、allOfなどで schema を拡張する場合は意図せず拡張 property を拒否しやすい点に注意が必要です。(JSON Schema)Blocker 5: security / secret / permission を Scope Delta Approval で承認してはいけない
#558 は、#550/PR #554 の結果として「scope rollup は security gate ではない」「real-security-risk は別 gate の責務」と明示しています。
したがって #1090 の
new_hook_or_agent_layerやnew_runtime_path_layerが secret / token / GitHub Actions secrets / permission / access-control に触れる場合、Scope Delta Approvalだけで proceed させてはいけません。これは scope expansion ではなく security/permission risk です。修正要求:
Python 側の JSON artifact では NaN/Infinity を出さないようにしてください。Python の
json.dump(s)はallow_nan=Falseで NaN/Infinity の直列化をValueErrorにでき、parse_constantでNaN/Infinity/-Infinityを reject できます。([Python documentation]2)Blocker 6: anchor comment の author / target issue 検証が AC に不足している
#920 は anchor comment が対象 Issue 外なら fail-closed、OWNER 相当 author が必要、scope 拡張の自動承認は禁止、という条件を持っています。 #1090 もこれを AC に入れるべきです。
GitHub REST の issue comment response には
issue_urlとauthor_associationが含まれるため、少なくとも「コメントが同一 Issue のものか」「author association が許可された値か」は deterministic に検証できます。([GitHub Docs]3)追加 AC:
Blocker 7: Verification が弱い
#1090 の現 VC は
pytest ... -k "scope_signal_guard or loop_state or termination"という広めの指定と canonical gates 中心です。これだと、対象 fixture が実際に #985/#1060 を再現しているか、anchor approval が target issue / owner / stale body を検証しているかが抜けます。最低限、次の targeted tests を AC に落とすべきです。
加えて、CI artifact を evidence にするなら、artifact name、artifact-id、artifact-url、artifact-digest、retention-days、run id を出すべきです。
actions/upload-artifactはartifact-id/artifact-url/artifact-digestを output として提供し、retention-daysは通常 1〜90 日の範囲で指定できます。([GitHub]4) ([GitHub]4)推奨する #1090 契約修正
そのまま貼れるレビューコメント案
結論として、#1090 は 必要だが、先に契約を tightening すべき Issue です。特に #920 と #1027 を前提化し、#550/PR #554 の
scope_contextに統合するのが最短です。squne121 commentedon Jun 21, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jun 21, 2026
ANCHOR_SCOPE_REFRAME
Scope Delta Approval — Allowed Paths へのテストファイル追加を承認する。
本コメントは issue-refinement-loop の scope_signal_guard 停止(iteration 0)への応答として、以下の Allowed Paths 追加を明示的に承認する:
.claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_termination.py(新規作成 AC 検証用).claude/skills/issue-refinement-loop/tests/test_plan_refinement_loop.py(既存テスト拡張)これらは anchor comment(#issuecomment-4761615763)の Blocker 7 で明示的に要求されたテストファイルであり、AC8〜AC13 の検証に必要。runtime scope expansion ではなく test/docs layer の追加であるため proceed_with_notes 対象とする。
Allowed Paths Expansion Rationale: 実装 AC の verification test files 追加は scope_context.path_layer = test_fixture に分類される。security-sensitive path は含まない。
squne121 commentedon Jun 21, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jun 21, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 21, 2026
Contract Snapshot — Issue #1090
status:
gostate/needs-humanなし)VC Preflight 集約
uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_guard_lane_split.py -qpnpm typecheckpnpm lintpnpm testpnpm buildWorktree / Branch
worktree-issue-1090-scope-signal-guard-lane-split.claude/worktrees/issue-1090-scope-signal-guard-lane-splitOutcome
scope_signal_guardがnew_runtime_path_layer,new_skill_or_docs_layer,new_hook_or_agent_layer,missing_scope_delta_approvalを分けて出力し、人間判断が必要なケースとproceed_with_notes可能なケースを区別する。Acceptance Criteria(13件)
new_allowed_path_layerを scope_context.path_layer として runtime / docs / skill / hook / agent / test_fixture / unknown に分類proceed_with_noteshuman_judgment_requiredauthor_association検証(OWNER/MEMBER/COLLABORATOR のみ valid)SCOPE_SIGNAL_GUARD_DECISION_V2artifact に raw_signal / scope_context / scope_delta_approval / route を保存security_risk_gate_requiredAllowed Paths
.claude/skills/issue-refinement-loop/references/scope-signal-guard.md.claude/skills/issue-refinement-loop/references/loop-state.md.claude/skills/issue-refinement-loop/references/termination-policy.md.claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py.claude/skills/issue-refinement-loop/scripts/build_loop_state.py.claude/skills/issue-refinement-loop/fixtures/blocked_by: [920, 1027]が本 Issue の Machine-Readable Contract に宣言されており、両 Issue (#920, #1027) は現在 OPEN。GitHub native dependency API はこれを自動検出しないが、実装着手は #920 と #1027 の完了後とする。squne121 commentedon Jul 1, 2026
Contract Review Result
fix(issue-refinement-loop): PR #1294 OWNER レビュー Blocker 1-4 を解消 (#1090)
feat: Refinement Loop の scope guard を人間レビュー由来の契約更新として自動反映できるようにする (#1323