Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "#2785: trusted human-context directive の Allowed Paths boundary と patch operation を同一 section-local authority に束縛する"
change_kind: workflowParent Issue
なし(#2785 research からの単独実装 follow-up。GitHub native parent は設定しない)
Parent Goal Ref
- Goal: 調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785 の研究結論である source binding / locality preservation を実装し、実装: trusted human contract feedback を controlled editor handoff に接続する #2620 の既存 editor handoff に安全に接続する。
- Desired Destination: 調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785 の section-local authority のみが Allowed Paths boundary と exact operation の共通 source になり、別 section の inventory path は mutation に転用しない。研究 Issue を作業親にはしない。
Current Validated Scope
scope_signal_delta.pyの boundary / marker / item / operation producer と対応 classifier tests。run_refinement_preflight.pyの evidence join、production-reachable patch-plan consumer と対応 preflight tests。decide_rewrite_route.pyの既存operations_emptyroute と対応 tests(route invariant は維持し、修正が必要な場合のみ編集)。
Remaining Parent Gaps
- 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の consumer integrity、URL/path 抽出、unsafe raw append の独立対策は本 Issue で代替しない。
- 調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778 の HTML paste / ordered-list representation extraction・classification は本 Issue に含めない。
- 調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785 research のクローズ判断・リンクコメントは本 Issue の実装 PR で行わず別途判断する。
Source
- origin_skill: issue-refinement-loop
- source_url: 調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785
- source_note_id: 1
- dedupe_key: follow-up:squne121/loop-protocol:調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785
Background
#2785 の live source contract と縮小 #2779 再現では、全文で Allowed Paths の概念を説明し、別 section に parser inventory path を列挙すると、全文 marker と無関係の item が cross join され false expands_allowed_paths と erroneous append operation を生成する。valid investigation_derived_path_literals は boundary-clearing evidence であって operation source ではなく、追加しても誤 operation は残る。detect_boundary_flags() / extract_directive_markers() / extract_directive_items() / derive_contract_patch_operations() の authority を局所化し、_build_scope_delta_authority_evidence() の join と consume_trusted_anchor_contract_patch_plan() の接続を回帰検証する。
決定論的修正を採用する。小さな pure helper で recognized ## Allowed Paths heading の直下の exact path list、または同一 directive item 内の explicit mutation verb + Allowed Paths + exact literal を source-bound に扱う。boundary flag と operation は同じ局所 source semantics を共有する。単に prompt 注記で unrelated bullets を避ける運用 workaround は誤判定を実装境界で止められないため採用しない。heavyweight Markdown parser / daemon / 新 schema / approval layer を追加せず、既存 #2620 の operations_empty editor route を維持する。section-local exact operation が無い explicit trusted directive のみ editor handoff とし、unsafe input は fail-closed に保つ。
類似 scope: #2842 は freeform unsafe raw append・URL/path span extraction・consumer integrity と失敗理由を所有する。ここで要求する #2842 型 unrelated bullet の producer regression は cross-section source binding に限定し、#2842 の consumer gate を再実装しない。#2778 は HTML/ordered-list 表現の検出 gap を所有し、この Issue はその parser 拡張を行わない。両 Issue と同じ script path を含むため着手時に同一ファイルの変更を直列化し、必要なら依存を調整する。#2620 / #2724 は既存 route の先例であって再設計対象ではない。
Scope Collision (C1 advisory)
- related_issue: 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842, 実装: cross-contract semantic review に親Goal traceabilityを追加し safety fix のnormal-flow driftを防ぐ #2829, 再発防止: issue-refinement-loopで既存fieldの意味拡張時にreader/consumer inventoryを早期要求する #2828, 調査: follow-up Issue の contract_schema_version: 1 反復生成経路を特定し v1 強制策を決定する #2787, 実装: issue-refinement-loop handoff の title_prefix_ready を live title readback で保証する #2776, 実装: run_refinement_preflight.py の結果に decisions フィールドを出力しSKILL.mdとのSSOT乖離を解消する #1556, 実装: fix(issue-refinement-loop): no-human-approval autonomy mode を loop state routing に明示する #1007, 実装: issue-refinement-loop の preflight result から LOOP_STATE を生成する route wrapper を追加し CLI/schema 迷走を防ぐ #1006, feat(agent-ops): issue-contract-fixer SubAgent を追加し、LLM rewrite 前に deterministic contract repair を完了させる #998, feat(issue-refinement-loop): LOOP_ITERATION_CAPSULE_V1 を導入し、raw body / raw log の main context 流入を禁止する #997, 実装: issue-refinement-loop の rewrite routing が既存 blocker contract を consume して non-body-author-fixable blocker を早期停止できるようにする #944, test: scope_signal_guard termination の publisher-level 回帰テストを追加する #926, 実装: decide_rewrite_route.py に --print-schema / --example-input / --from-file を追加し入力 state 契約を self-describe 可能にする #917 (overlap preflight; exact title/outcome duplicate はなし)。
- overlapping_paths:
.claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py,run_refinement_preflight.py,decide_rewrite_route.pyおよび上記三つの既存 tests。 - non_conflict_reason / edit_intent: 本 Issue は 調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785 の section-local authority 導出と 実装: trusted human contract feedback を controlled editor handoff に接続する #2620 handoff 接続のみを変更する。実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 consumer integrity・URL/path extraction と 調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778 list representation は別所有。その他 matched Issue は別の outcome または broad directory scope。
- dependency ordering: 同一 file の PR は並列編集せず直列化し、先行 PR merge 後の main で双方の regression を再実行する。hard predecessor が確定していないため native dependency は付けない。
Outcome
更新された source-binding producer / preflight connector と回帰 tests を含む 1 PR で、trusted human-context の Allowed Paths mutation が同一 section-local authority 由来の exact operation のみを通常 patch し、安全な operation 不在なら issue_editor_required / writes=0 / live body unchanged、unsafe input なら fail-closed となることを検証可能にする。
Runtime Verification Applicability
- decision: not_applicable
- reason: in-process production-reachable preflight / classifier / consumer / route の fixture regression と既存 quality gates で判定し、実 GitHub mutation や外部 agent process の動作検証は acceptance に不要。
In Scope
- section-local source binding を boundary / marker / item / operation で一貫させ、conceptual prose と別 section の parser inventory path を mutation authority と結合しない。
- genuine exact mutation directive と canonical heading-path list を局所 exact operations に写像し、valid investigation literals を operation source に昇格させない。
- preflight evidence join から patch-plan consumer と既存 実装: trusted human contract feedback を controlled editor handoff に接続する #2620 editor route まで production-reachable regression を追加する。別 scope の boundary は保存する。
- 同一 producer files を変更する 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 / 調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778 との ownership を保ち、衝突時は serial execution とする。
Out of Scope
- 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の URL/path extraction、consumer integrity・汎用 raw append 対策、reason-code / producer command policy 修正。
- 調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778 の HTML / ordered-list representation parser の拡張。
operations_emptyinvariant の緩和、unsafe directive の patch 強行、investigation literals の operation 転用。- 調査: trusted human-context directive の Allowed Paths boundary/operation が section-local source binding を失う #2785 / 調査: read-only Issue の Allowed Paths prose が rg VC の broad-path 誤検知を起こす #2779 の既存 Issue 編集やコメント、production code 以外の新規 schema / heavyweight parser / daemon / approval layer。
Acceptance Criteria
- AC1: conceptual Allowed Paths 説明と別 section の parser inventory path の fixture は
expands_allowed_paths == false、Allowed Paths operation 0 を assertion で固定する。 - AC2: AC1 に valid investigation-derived path literals を足しても、その literals は operation source にならず、unrelated inventory item からの operation も 0 である。
- AC3: 同一 item の explicit
Allowed Paths にdocs/foo.mdを追加は source-bound exact append operation を生成する。 - AC4: canonical
## Allowed Pathsheading と直下の exact path list は local exact operation を生成する(別 section の path は採用しない)。 - AC5: safe literal と unsafe URL / absolute / traversal の mixed directive は unsafe fragment を無視して部分適用せず fail-closed、mutation writes 0 を固定する。
- AC6: destructive / external-service / issue-split boundary は investigation evidence で解除せず、従来の fail-closed を維持する。
- AC7: 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 型 unrelated / freeform bullet を raw Acceptance Criteria append operation に変換しない producer regression を追加する(consumer integrity は 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の所有)。
- AC8: production-reachable
run_preflight()→ classification →consume_trusted_anchor_contract_patch_plan()→decide_human_review_directive_editor_route()で、safe op 不在の explicit trusted directive はissue_editor_required / writes=0 / live body unchanged、exact op は通常 patch、unsafe は fail-closed。router の non-emptyoperations_emptyinvariant を維持する。新規 regression の実装前 baseline PASS を主張しない。
Verification Commands
各 AC の assertion を上記既存 tests に追加後に実行する。現時点の既存テスト PASS は未作成 regression の PASS を意味しない。各行は独立した単一コマンド。
# AC1
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC2
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC4
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC5
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC7
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
# AC8
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
# AC8
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py
# 標準ゲート
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.pyAllowed Paths
- .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py
- .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
- .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py
- .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
- .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
- .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の consumer integrity / URL-path extraction または 調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778 の HTML / ordered-list parser 拡張が必要な場合は ownership を再確認して停止。
- unsafe mixed directive の部分適用、
operations_empty緩和、investigation literals を operation source に昇格する必要が出たら停止。
Required Skills
なし
Required Design References
- docs/dev/workflow.md
- docs/dev/agent-skill-boundaries.md
- docs/dev/runtime-verification-policy.md
Delivery Rule
1 Issue = 1 PR。専用 worktree で実装し Draft PR を既定とする。- 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 / 調査: 構造化リスト(HTML貼り付け/Markdown順序付きリスト)でexplicit trusted human_review_directiveの検出に失敗しissue_editor_requiredに到達しない #2778 と同一 script path の作業は直列化し、merge 時に current-main で双方の regression を再実行する。native dependency は hard predecessor の確証がないため設定しない。
Activity