Repository navigation
Open
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: "scope rollup planner が弱い lexical 一致だけで人間判断停止へ倒れる誤判定を是正する(単独改善)"
change_kind: code
dedupe_key: "issue-refinement-loop:scope-rollup-weak-lexical-anchor-not-hard-conflict:v1"
request_dedupe_key: "follow-up:squne121/loop-protocol:https://github.com/squne121/loop-protocol/issues/2850#issuecomment-5931647648:scope-rollup-weak-anchor"Parent Issue
none
Parent Goal Ref
- Goal: scope rollup planner が、同時に実装すべき Issue を説明文中の識別子の一致だけで人間判断へ停止させない状態にする。
- Desired Destination: 単独改善(親なし)。実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 の classifier 実装とは別 PR で扱い、実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 を blocker にしない。
Current Validated Scope
.claude/skills/issue-refinement-loop/scripts/plan_issue_scope_rollup.pyの anchor 判定(_extract_anchor_tokens/_build_scope_context)を、強い根拠と advisory 根拠に分けて扱うよう修正する。.claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.pyに fixture ベースの回帰テストを追加する。.claude/skills/issue-refinement-loop/references/scope-rollup-policy.mdのsame_anchor_conflicting_operationの定義を新しい evidence 階層へ更新する。
Remaining Parent Gaps
なし(親 Issue なし)。AST / tree-sitter / 意味類似度による判定は本 Issue では扱わず、必要になれば別 Issue とする。
Background
- 現在の main(HEAD 227e1d8)の
plan_issue_scope_rollup.pyでは、_extract_anchor_tokens()が title と body 全体から JSON Pointer とバッククォート識別子(拡張子付き path は除外)を抽出する。 _build_scope_context()は、exact path 一致に加えて anchor を 1 つでも共有するとsame_anchor_conflicting_operation/escalation_required: trueとする。実際に操作が両立不能かどうかは比較しない。docstring 自身が「lexical coordination detector であり semantic merge detector ではない」と明記している。- その結果、Out of Scope や検証説明で言及されただけの識別子でも hard conflict になる。実測(本 Issue 起票時の control-plane 調査)では、実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850(統合後本文)と 実装: Task Context classifier の日本語 reference-only marker 直後の列挙(参考: #10、#11)が ACTIVE rebind の primary 候補になる残余を是正する #2855 を
--current-issue 2850で与えるとsuggested_action: human_review_required、conflict_type: same_anchor_conflicting_operation、conflicting_anchors: [_clause_delimiters, _clause_spans, _marker_segment_spans, _primary_occurrences, classify]、signals: [exact_allowed_paths_equal]になった。_clause_delimitersと_clause_spansは 実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 の Out of Scope(変更しない対象)で言及されているだけである。 - 実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 の refinement が実際にこの理由で停止したかは未確認であり、本 Issue では「到達条件が成立する」ことのみを事実とする。
conflict_type/escalation_required/same_anchor_conflicting_operation/conflicting_anchorsを参照するファイルは、planner 本体、テスト、scope-rollup-policy.mdの 3 ファイルのみ(git grepで確認済み)。verify_scope_rollup_result.pyは参照しない。.agents/skillsは.claude/skillsへの symlink であり別 mirror の同期は不要。- 関連するが別 scope の既存 Issue: 実装: scope_rollup.run の GraphQL inventory query を分割し partial-error 耐性を上げる #1659(GraphQL inventory query の partial-error 耐性)、設計: scope rollup から security escalation を分離した専用 security-risk gate skill を検討する #558(security escalation を scope rollup から分離する設計検討)。
Outcome
plan_issue_scope_rollup.py が、識別子・file・path の弱い lexical 一致を same_anchor_conflicting_operation(escalation_required: true → human_review_required)の根拠にせず advisory evidence として出力に残し、両立不能な変更が機械可読に宣言された場合のみ hard conflict とする状態になり、追加した fixture テストを含む pytest が全件 PASS している。
Runtime Verification Applicability
- decision: immediate
- reason:
.claude/skills/**/scripts/**の script 実行ロジック変更はdocs/dev/extension-surface-runtime-policy.yamlの ruleskill-invocation-procedure-or-contract-change(default_decision: immediate)に該当しうるため、推測で not_applicable としない。CLI を subprocess で実行する end-to-end 検証を 1 件含める。新しい live-Claude harness は要求しない。最終判定は review-issue / checker の結果に従う。
In Scope
- 抽出した anchor を「強い根拠」と「advisory(調整情報)evidence」に分け、aggregation の主要 evidence を「同じ利用者向け failure」「共有する decision pipeline」「diff/test の相互作用」「一度の review で説明可能か」に置く。単なる identifier / file / path の一致は人間判断停止へ昇格させない。
- 両立不能な変更が機械可読に宣言されている場合(同一 anchor に対し相反する操作を宣言した場合)のみ、従来どおり
same_anchor_conflicting_operationとして escalation する。宣言形式は既存の Machine-Readable Contract の延長で定義し、planner のテストで固定する。 - 弱い一致は advisory evidence として出力に残し(audit 可能)、単独では hard conflict に昇格させない。既存の出力キーは削除せず追加のみとする。
scope-rollup-policy.mdのsame_anchor_conflicting_operationの定義(現在は「同一ファイル + 共有 sub-file anchor」)と 3.5 節の適用条件を新しい evidence 階層に整合させる。- 回帰 fixture の追加: (a) 実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 + 実装: Task Context classifier の日本語 reference-only marker 直後の列挙(参考: #10、#11)が ACTIVE rebind の primary 候補になる残余を是正する #2855 を縮小した positive fixture、(b) PR feat: Claude-GPT Auto に canonical workflow delegation context を追加し canary で測定する #2851 相当の negative fixture、(c) 明示的に両立不能な宣言の fixture。
Out of Scope
- AST / tree-sitter / 意味類似度サービス / LLM の導入、新 framework、新しい認可層。
verify_scope_rollup_result.pyやscope-rollup-runneragent の責務変更。- 実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 / 実装: Task Context classifier の日本語 reference-only marker 直後の列挙(参考: #10、#11)が ACTIVE rebind の primary 候補になる残余を是正する #2855 の classifier 実装、複数 closing Issue 対応、PR feat: Claude-GPT Auto に canonical workflow delegation context を追加し canary で測定する #2851 の取り込み。
issue-refinement-loopの ready 判定・state machine の変更。- 既存の 実装: agent_session_manifest schema の phase_instance_id を CI-native 形式(ci:<workflow>:<run_id>:<run_attempt>)に対応させる #547 / 実装: agent-session-manifest.schema.json の root required に secret_policy を追加する #549
same_file_disjoint_anchor契約の意味変更。
Acceptance Criteria
- AC1: positive fixture(実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 統合後本文と 実装: Task Context classifier の日本語 reference-only marker 直後の列挙(参考: #10、#11)が ACTIVE rebind の primary 候補になる残余を是正する #2855 を縮小したもの。同じ 2 Allowed Paths を持ち、
classify/_clause_spans等の識別子が共有されるが Out of Scope や検証説明での言及にすぎない)がhuman_review_required/ hard conflict にならず、既存の調整系 action(proceed_with_coordination/amend_current_issueなど現行語彙)になる。 - AC2: negative fixture(PR feat: Claude-GPT Auto に canonical workflow delegation context を追加し canary で測定する #2851 相当。Auto mode / 委譲 policy で classifier と semantic interaction がなく、同一 file・識別子の偶然の一致のみ)が
merge_into_current_pr/amend_current_issueに昇格せず over-merge されない。 - AC3: 同一 anchor に対し相反する操作が機械可読に宣言された fixture は、従来どおり
same_anchor_conflicting_operation/escalation_required: true/human_review_requiredになる。 - AC4: 識別子・file・path の弱い一致が advisory evidence として planner 出力に残り、かつ単独では hard conflict の根拠にならない。
scope-rollup-policy.mdのsame_anchor_conflicting_operationの定義が新しい evidence 階層に更新されている。 - AC5: 既存の
test_plan_issue_scope_rollup.pyとtest_verify_scope_rollup_result.pyの全 test が PASS する(実装: agent_session_manifest schema の phase_instance_id を CI-native 形式(ci:<workflow>:<run_id>:<run_attempt>)に対応させる #547 / 実装: agent-session-manifest.schema.json の root required に secret_policy を追加する #549 のsame_file_disjoint_anchor契約を含む)。 - AC6 : planner の CLI(
--issues-json/--prs-json/--current-issue)を subprocess で実行する end-to-end test が、AC1 の fixture で hard conflict にならない結果を返す。skip / fallback で PASS 扱いにしない。
Verification Commands
# AC1
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py -k test_weak_lexical_anchor_not_hard_conflict
# AC2
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py -k test_unrelated_same_anchor_no_overmerge
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py -k test_explicit_incompatible_operation_still_escalates
# AC4
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py -k test_weak_anchor_advisory_evidence_recorded
$ rg -c "advisory" .claude/skills/issue-refinement-loop/references/scope-rollup-policy.md
# AC5
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py .claude/skills/issue-refinement-loop/tests/test_verify_scope_rollup_result.py
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py -k test_cli_end_to_end_weak_anchor_subprocessAllowed Paths
- .claude/skills/issue-refinement-loop/scripts/plan_issue_scope_rollup.py
- .claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py
- .claude/skills/issue-refinement-loop/references/scope-rollup-policy.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合(例:
verify_scope_rollup_result.pyや他 consumer の変更が必要になった場合) - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合(出力キーの削除・意味変更を含む)
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 両立不能宣言の機械可読形式に新しい schema や framework が必要になった場合
Required Skills
なし
Required Design References
- .claude/skills/issue-refinement-loop/references/scope-rollup-policy.md
- docs/dev/runtime-verification-policy.md
- docs/dev/extension-surface-runtime-policy.yaml
Scope Delta(任意)
N/A
Delivery Rule
1 Issue = 1 PR。実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 の PR とは別 PR とし、実装: Task Context の primary-target classifier が、番号直後の日本語表記を参照として認識できず、日本語 reference-only marker 直後の列挙を primary 候補に残す欠陥を是正する(#2855 を吸収) #2850 の classifier 実装を blocker にしない(GitHub native blockedBy は設定しない)。- worktree を使用し、Draft PR を既定とする。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity