Skip to content

実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する - #2791

Merged
squne121 merged 4 commits into
mainfrom
worktree-issue-2783-allowed-paths-no-marker
Sep 27, 2026
Merged

squne121 merged 4 commits into
mainfrom
worktree-issue-2783-allowed-paths-no-marker

Conversation

@squne121

@squne121 squne121 commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • scripts/agent-ops/allowed_paths_policy.py::is_no_path_marker() を新設し、canonical no-path marker (none) と legacy exact marker 読み取り専用。リポジトリ変更なし(既定) を 0 paths として解釈する neutral な pure helper を提供する
  • 判定順序を固定(1. Markdown bullet / コードフェンス / backtick wrapper 除去 → 2. wrapper 除去後の raw entry に対する canonical/legacy marker の exact match 判定 → 3. marker でなければ既存 annotation normalization を適用)し、lexical heuristic は追加していない
  • inventory table 記載の10 consumer(baseline_vc_preflight.py / vc_baseline_shape_compiler.py / check_issue_overlap.py / path_classification.py / check_vc_scope.py / plan_issue_scope_rollup.py / repair_issue_contract.py / issue_contract_hygiene_autofix.py / implementation_landed_evidence.py / pr_head_replay_publish_exec.py)を統合し、各 consumer 既存の missing-section semantics([] / None / frozenset() / (None, reason_code) tuple)を維持した
  • run_refinement_preflight.py::_extract_allowed_paths_from_issue_body() のみ、既存の「scripts/agent-ops/ への import boundary を持たない」設計制約(test_command_registry.py / test_owner_reaction_not_planned_gate_production_shaped.py の real-subprocess fixture が scripts/agent-ops/ を含まない isolated repo を構築するため)を壊さないよう、共有ヘルパーと同一の判定順序ロジックを自己完結的に duplicate した(drift は本 PR 内の regression test で担保)
  • pr_head_replay_publish_exec.py::_allowed_paths() は「Allowed Paths section missing(malformed contract、allowed_paths_section_missing)」と「section present + explicit (none)(intentional no-mutation contract、新規 allowed_paths_no_path_marker)」を区別する reason_code を追加し、既存の "section present だが bullet 皆無"(allowed_paths_empty)とも区別した
  • .github/ISSUE_TEMPLATE/research.yml の Allowed Paths default value を legacy 慣用句から canonical marker (none) へ更新した
  • AC16(runtime verification, decision: immediate)は worktree-agent-runtime-smoke skill の --mode structured 経由で、FAKE claude 実行ファイル(有料 CLI・認証・network を一切要求しない bash stub)+ fixture が生成した hook-ID-correlated SubagentStart/SubagentStop イベント列・Agent tool_use/tool_result envelope・on-disk transcript を runner に処理させる offline synthetic correlation test(test_allowed_paths_policy_runtime_smoke.py)で、runner がこの event sequence を marker 文字列一致のみに頼らず causal_evidence_source: hook_id_correlated として正しく相関判定することを確認した(docs/dev/extension-surface-runtime-policy.yaml の subagent-lifecycle-causal-evidence-smoke profile が要求するのはこの相関ロジックの確認であり、実 Claude Code / Codex CLI subagent の live 起動・完了の証拠ではない。live external runtime を新規 required gate として追加してはいない)

Checks

  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build
  • 上記コマンドをすべてローカルで実行し、成功したことを確認してからチェックしてください

Schema Change Applicability

  • decision: not_schema_change
  • reason: pr_head_replay_publish_exec.py::_allowed_paths() の戻り値 tuple[list[str] | None, str | None] の型シグネチャ自体は変更していない。reason_code の第2要素は元から free-form な診断文字列であり、外部で構造的に消費される persisted schema / wire format ではない(execute() の呼び出し元は error or "allowed_paths_unavailable" として汎用的に扱うのみで、個別の reason_code 文字列に分岐する既存 consumer は存在しないことを rg で確認済み)。新規追加の allowed_paths_no_path_marker は既存の allowed_paths_empty から意味的に分離した追加的な診断値であり、破壊的変更ではない。

Schema Consumer Inventory

n/a(not_schema_change のため必須ではないが、変更対象の inventory を以下に記載する)

変更対象: scripts/agent-ops/allowed_paths_policy.py::is_no_path_marker()(新設 shared helper)とその 10 consumer

Consumer ファイル 更新有無 備考
scripts/agent-ops/allowed_paths_policy.py 新設 共有 neutral pure policy helper(is_no_path_marker())
.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py 更新済み extract_allowed_paths() へ統合、missing-section semantics [] 維持
.claude/skills/issue-contract-review/scripts/vc_baseline_shape_compiler.py 更新済み parse_allowed_paths() へ統合、[] 維持
.claude/skills/create-issue/scripts/check_issue_overlap.py 更新済み extract_allowed_paths() / extract_allowed_path_entries() へ統合、same_path_set() 誤判定防止
.claude/skills/create-issue/scripts/path_classification.py 更新済み extract_allowed_paths() へ統合、[] 維持
.claude/skills/issue-refinement-loop/scripts/check_vc_scope.py 更新済み _extract_allowed_paths() へ統合、[] 維持
.claude/skills/issue-refinement-loop/scripts/plan_issue_scope_rollup.py 更新済み _extract_allowed_paths() へ統合、frozenset() 維持
.claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py 更新済み _extract_allowed_paths_ric() へ統合、[] 維持
.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py 更新済み(自己完結的 duplicate) _extract_allowed_paths_from_issue_body() は既存の import boundary 制約のため shared helper を import せず、同一ロジックを local に複製(理由は Summary 参照)
.claude/skills/edit-issue/scripts/issue_contract_hygiene_autofix.py 更新済み parse_allowed_paths() へ統合、missing-section sentinel None 維持
.claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py 更新済み build_scope_manifest() の allowed_paths フィールドのみへ統合(in_scope/acceptance_criteria は無変更)
scripts/agent-ops/pr_head_replay_publish_exec.py 更新済み _allowed_paths() へ統合、allowed_paths_section_missing と新規 allowed_paths_no_path_marker を区別
.github/ISSUE_TEMPLATE/research.yml 更新済み Allowed Paths default value を (none) へ更新

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
canonical/legacy no-path marker の判定は exact match のみで行い、Unicode/句読点を含む real path を no-path marker と誤判定する lexical heuristic を導入していない yes N/A uv run python3 -m pytest .claude/skills/issue-contract-review/tests/test_vc_quality_guards.py -k "unicode_punctuation or annotation_real_path or legacy_marker_trailing_prose" -v -> 3 passed N/A
pr_head_replay_publish_exec.py の no-path marker 統合は SubAgentStart/SubagentStop の delegation/fallback/start-stop signal handling に影響しない(marker 文字列一致のみで causal evidence を代替していない)。本 claim は FAKE claude 実行ファイル + fixture transcript による offline synthetic correlation test(実 subagent 起動の live 証拠ではない。docs/dev/extension-surface-runtime-policy.yaml の subagent-lifecycle-causal-evidence-smoke profile 自体が要求する範囲はこの相関ロジック確認であり、本 PR はこれを超える live 証拠を主張しない)の範囲に限定される yes N/A uv run python3 -m pytest scripts/agent-ops/tests/test_allowed_paths_policy_runtime_smoke.py -v -> 1 passed(FAKE claude + fixture transcript による offline correlation: runner が hook-ID-correlated event 列を causal_evidence_source: hook_id_correlated として正しく処理することを確認。実 subagent 起動の live 証拠ではない) N/A
10 consumer それぞれの既存 missing-section semantics([]/None/frozenset()/(None, reason_code))を破壊せず維持した yes N/A 全 consumer 既存テストスイート(.claude/skills/issue-contract-review/tests/ .claude/skills/create-issue/tests/ .claude/skills/create-issue/scripts/tests/ .claude/skills/issue-refinement-loop/tests/ .claude/skills/issue-refinement-loop/scripts/tests/ .claude/skills/edit-issue/tests/ .claude/skills/impl-review-loop/tests/ scripts/agent-ops/tests/)が全て PASS(本文末尾「検証コマンド結果」参照) N/A

記載ルール確認:

  • Not controlled は具体的な未保証点のみ記載し、safe/read-only/sandboxed/isolated/complete を無限定に使用していない
  • 既存 OPEN Issue(legacy marker を使う複数件)の一括 rewrite・migration harness は本 Issue の Remaining Parent Gaps に明記された Out of Scope であり、番号未定の follow-up として Notes に記載する

受け入れ条件の達成状況

  • AC1: is_no_path_marker("(none)") == True および is_no_path_marker("読み取り専用。リポジトリ変更なし(既定)") == True を raw token 段階(annotation normalization 適用前)で直接検証する regression(test_allowed_paths_policy.py::test_is_no_path_marker_recognizes_canonical_and_legacy)で満たす。
  • AC2: baseline_vc_preflight.py::extract_allowed_paths() が canonical marker (none) を唯一のエントリとする body に対して [] を返すことを test_vc_quality_guards.py::test_extract_allowed_paths_canonical_marker_returns_empty で確認済み。
  • AC3: 同関数が legacy exact marker を唯一のエントリとする body に対して [] を返すことを test_extract_allowed_paths_legacy_marker_returns_empty で確認済み(修正前は trailing paren annotation stripper が非空の偽 path を生成していた)。
  • AC4: read-only body((none)/legacy marker)+ 具体ファイルを指す rg VC が _rg_has_broad_search_path() で broad と誤検知されないことを test_broad_search_no_path_marker_not_flagged_broad(canonical/legacy 両方)で確認済み。
  • AC5: rg pattern(パス省略)・rg pattern . が no-path marker Allowed Paths でも従来どおり broad と判定される回帰防止を test_broad_search_pattern_only_and_dot_still_broad で確認済み。
  • AC6: docs/日本語。md のような Unicode/句読点を含む real path が誤って no-path marker と判定されないことを test_extract_allowed_paths_unicode_punctuation_path_preserved で確認済み。
  • AC7: some/path.py(読み取り専用) のような既存 real path + 注釈エントリが既存の annotation-normalization semantics(PR fix(#683): extract_allowed_paths が backtick/注釈付き Allowed Paths を正規化できない問題を修正 #684)を壊さず real path として保持されることを test_extract_allowed_paths_annotation_real_path_preserved で確認済み。
  • AC8: bullet で wrap された (none) とコードフェンスで wrap された (none) の両方が同一に no-path marker と判定されることを test_marker_judgment_order_wrapper_removed_before_check で確認済み(多行コードフェンスは extract_allowed_paths() 側で単一 wrapped entry として先行検出する実装で満たす)。
  • AC9: legacy exact marker の次行に無関係な investigation-target prose が続く場合、legacy marker 行自体は0 pathsと解釈されるが後続 prose 行の自動分類ロジックは追加していないことを test_legacy_marker_trailing_prose_not_auto_interpreted で確認済み。
  • AC10: Issue 調査: markdownlint-cli2 の gitignore option 導入是非を検討する #2730 と同型の contract/body を、実際に baseline_vc_preflight.py(contract_readiness_check.pyが--mode executeで spawn する実 executor)で実行し、その結果を実際の contract_readiness_check.map_preflight_result_to_errors() に通した statement-level integration regression(test_refinement_preflight.py::test_operator_intervention_not_triggered_by_no_path_marker)で、broad_search_path_unbounded の偽検知および human_judgment への escalation が発生しないことを確認済み。
  • AC11: 無関係な2つの read-only research Issue(canonical marker のみ / legacy marker のみ)が same_path_set() / classify_overlap() で duplicate と誤判定されないことを test_check_issue_overlap_no_path_marker.py(canonical/legacy/mixed の3パターン)で確認済み。
  • AC12: inventory table の残り10系統それぞれについて、canonical marker と legacy marker の両方が0 paths相当値([]/frozenset()/None維持)として解釈される regression を各consumerに追加済み(8ファイルに regression、詳細は Schema Consumer Inventory 参照)。
  • AC13: pr_head_replay_publish_exec.py::_allowed_paths() について、section missing(allowed_paths_section_missing)・section present + explicit marker(新規 allowed_paths_no_path_marker)・section present だが bullet 皆無(既存 allowed_paths_empty)の3状態を区別する regression(test_pr_head_replay_publish_exec.py::test_allowed_paths_missing_vs_explicit_none_distinguished)で確認済み。
  • AC14: .github/ISSUE_TEMPLATE/research.yml の Allowed Paths default value が (none) に更新されていることを rg -n "\(none\)" .github/ISSUE_TEMPLATE/research.yml で確認済み。
  • AC15: pnpm typecheck && pnpm lint && pnpm test && pnpm build が全て PASS(検証コマンド結果参照)。
  • AC16: pr_head_replay_publish_exec.py::_allowed_paths() の変更が SubAgentStart/SubagentStop の delegation/fallback/start-stop signal handling に影響しないことを、worktree-agent-runtime-smoke skill 経由の FAKE claude 実行ファイル + fixture-generated transcript による offline synthetic correlation test(subagent-lifecycle-causal-evidence-smoke profile が要求する hook-ID-correlated event 列の相関ロジックを runner が正しく処理することの確認。実 subagent 起動の live 証拠ではない)で確認済み(test_allowed_paths_policy_runtime_smoke.py)。

検証コマンド結果

current-head SHA: 159baec6(親: e760f3e2599f8977a0075b9960744fdb4e540a0a)で再検証済み。

Issue #2783 記載の Verification Commands(AC1〜AC14, AC16)を個別コマンドで実行し、全て成功(PASS)した:

AC1: 1 passed
AC2: 1 passed
AC3: 1 passed
AC4: 1 passed
AC5: 1 passed
AC6: 1 passed
AC7: 1 passed
AC8: 1 passed
AC9: 1 passed
AC10: 1 passed
AC11: 1 passed
AC12 (8 sub-commands): 8/8 passed
AC13: 1 passed
AC14: rg 一致確認済み
AC16: 1 passed(FAKE claude 実行ファイル + fixture transcript による offline synthetic correlation test。実 subagent 起動の live 証拠ではない)

AC15(pnpm typecheck && pnpm lint && pnpm test && pnpm build):

  • pnpm typecheck -> 成功(tsc エラーなし)
  • pnpm lint -> ESLint: No issues found
  • pnpm test -> Test Files 108 passed (108) / Tests 1943 passed (1943)
  • pnpm build -> ✓ built in 120ms

加えて、変更対象10 consumer + 新設 helper + 新規テストファイル全体を含む以下のディレクトリ群(.claude/skills/issue-contract-review/{tests,scripts/tests} .claude/skills/create-issue/{tests,scripts/tests} .claude/skills/issue-refinement-loop/{tests,scripts/tests} .claude/skills/edit-issue/tests .claude/skills/impl-review-loop/{tests,scripts/tests} scripts/agent-ops/tests)を実行し、本 PR に起因する新規 failure がないことを確認した(既存の pre-existing 環境依存 failure 3件 [test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch の uv_version_mismatch] と 1件 [test_baseline_vc_preflight.py::test_issue_393_snapshot_fixture_processed の subprocess timeout] は、変更前の clean main HEAD (b699ee68) でも同一の失敗が再現することを個別に確認済みであり、本 PR による regression ではない)。

uv run ruff check を変更対象全 Python ファイルに対して実行し、violation なし(0 issues)を確認した。

Notes

Closes #2783(本 PR は Issue #2783 の受け入れ条件を満たす実装であり、マージ後に Issue を close する)

  • Related issue: 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783
  • Follow-up(番号未定、Issue 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783 Remaining Parent Gaps 記載の既存範囲): 既存 OPEN Issue(legacy marker を使う複数件確認済み)の一括 rewrite・migration harness の導入は本 PR では扱わない(別 Issue 化予定)
  • run_refinement_preflight.py::_extract_allowed_paths_from_issue_body() は、scripts/agent-ops/ への import boundary を持たない既存設計制約(real-subprocess fixture 分離)を維持するため、共有ヘルパーと同一ロジックを自己完結的に duplicate した。drift 防止は test_refinement_preflight.py::test_extract_allowed_paths_from_issue_body_no_path_marker_returns_empty で担保する。
  • PR review fix_delta(#2791 review comment)で以下3点を修正済み:
    • P1: isolated fixture repo(scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py / test_issue_metadata_write_capability.py / test_skill_runtime_exec_anchor.py)に repair_issue_contract.py の依存先 scripts/agent-ops/allowed_paths_policy.py を配備し ModuleNotFoundError を解消した。
    • P2: check_issue_overlap.py::extract_allowed_path_entries() の wrapper 除去順序を修正(_BULLET_RE による番号付きリスト除去を marker 判定より先に実行、code-fence 区切り行を entry として扱わないようスキップ)。regression を test_check_issue_overlap_no_path_marker.py に5件追加した。
    • P2: 本 PR 自身の AC16 / Safety Claim Matrix の記述が「実 subagent 起動の証拠」であるかのように読める強い主張になっていたため、上記のとおり「FAKE claude 実行ファイル + fixture transcript による offline synthetic correlation test」であることを明記するよう弱めた。加えて test_allowed_paths_policy_runtime_smoke.py 内の固定パス /tmp/{agent_id}-ac16-transcript.jsonl を pytest tmp_path fixture 配下(test-owned)へ移動した。
IMPLEMENTATION_SCOPE_COVERAGE_V1:
  schema_version: "IMPLEMENTATION_SCOPE_COVERAGE_V1"
  issue_number: 2783
  issue_body_sha256: "sha256:57ac79e47cb2c57ed4d157013b83ccf51fb710182002f284a5c6b29d329f60b4"
  normalized_scope_manifest_sha256: "sha256:e231b59b2579959a9c49beeeb356e65620dfda83607d79728e038b929d9eb01b"
  pr_head_sha: "159baec6b0dc6980d2a4b861607fe21df463f183"
  scope_manifest: {"acceptance_criteria": [".github/ISSUE_TEMPLATE/research.yml の Allowed Paths フィールドの default value が canonical marker (none) に更新されている", "In Scope に定義した marker 判定順序(wrapper 除去 → marker 判定 → 通常 annotation normalization)が、bullet で wrap された (none) とコードフェンスで wrap された (none) の両方について同一に no-path marker と判定されることを regression で示す", "Issue #2730 と同型の contract/body(read-only 慣用句 + 具体ファイルを指す rg VC)を canonical Step 2 review pipeline(run_root_review_pipeline.py produce 相当)に通し、本 defect を理由に operator_intervention_required / contract_readiness_human_judgment に落ちないことを確認する integration regression がある", "baseline_vc_preflight.py::extract_allowed_paths() が canonical marker (none) を含む唯一のエントリに対して空リストを返す", "baseline_vc_preflight.py::extract_allowed_paths() が legacy exact marker 読み取り専用。リポジトリ変更なし(既定) を含む唯一のエントリに対して空リストを返す", "check_issue_overlap.py で、無関係な2つの read-only research Issue(body がそれぞれ canonical marker または legacy marker のみを Allowed Paths に持つ)が、no-path marker の一致だけを理由に same_path_set() / duplicate evidence を得ないことを確認する regression がある", "docs/日本語。md のような Unicode / 句読点を含む real path が path として保持される(誤って no-path marker と判定されない)", "legacy exact marker の次行に無関係な investigation-target prose(例: #2762 型の - 調査対象として \\.claude/hooks/\\ を参照可能(変更は行わない))が続く場合、legacy marker 行自体は 0 paths と解釈されるが、後続の prose 行の意味解釈(path 扱いするかどうかの自動判定)は本 Issue のスコープ外であることを regression で明示する(prose 行の自動分類ロジックは追加しない)", "pnpm typecheck && pnpm lint && pnpm test && pnpm build が通る", "pr_head_replay_publish_exec.py::_allowed_paths() について、「Allowed Paths section missing(malformed contract、allowed_paths_section_missing を維持)」と「Allowed Paths section present + explicit (none)(intentional no-mutation contract)」を区別する regression が、両状態それぞれについて存在する", "read-only body(Allowed Paths が (none) または legacy marker)+ rg pattern specific/file.py という VC が _rg_has_broad_search_path() で broad と誤検知されない", "rg pattern (パス省略)および rg pattern . が従来どおり broad と判定される(回帰防止)", "scripts/agent-ops/allowed_paths_policy.py::is_no_path_marker() が、raw token 段階(annotation normalization 適用前)で is_no_path_marker(\"(none)\") == True および is_no_path_marker(\"読み取り専用。リポジトリ変更なし(既定)\") == True を直接検証する regression を持つ(既存 annotation normalization が偶然 [] を返すだけの false-green を許容しない)", "scripts/agent-ops/pr_head_replay_publish_exec.py の変更(_allowed_paths() の no-path marker 統合)が、SubAgentStart/SubagentStop の delegation / fallback / start-stop signal handling ロジックに影響しないことを、worktree-agent-runtime-smoke skill の subagent-lifecycle-causal-evidence-smoke profile(assertion: subagent_start_stop_causal_evidence_correlated)で確認する", "some/path.py(読み取り専用) のような既存の real path + 注釈エントリが、既存の annotation-normalization semantics(PR #684)を壊さず real path として保持される", "上記 inventory table の scripts/agent-ops/allowed_paths_policy.py を除く残り10系統それぞれについて、canonical marker (none) と legacy marker の両方が 0 paths(または frozenset()/None 等、各 consumer 既存の missing-section semantics を維持した上での no-path 相当値)として解釈されることを直接検証する最低1件のユニットレベル regression がある"], "allowed_paths": [".claude/skills/create-issue/scripts/check_issue_overlap.py", ".claude/skills/create-issue/scripts/path_classification.py", ".claude/skills/create-issue/scripts/tests/test_path_classification.py", ".claude/skills/create-issue/tests/test_check_issue_overlap_no_path_marker.py", ".claude/skills/edit-issue/scripts/issue_contract_hygiene_autofix.py", ".claude/skills/edit-issue/tests/test_issue_contract_hygiene_autofix.py", ".claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py", ".claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py", ".claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py", ".claude/skills/issue-contract-review/scripts/vc_baseline_shape_compiler.py", ".claude/skills/issue-contract-review/tests/test_pytest_vc_baseline_shape_compiler.py", ".claude/skills/issue-contract-review/tests/test_vc_quality_guards.py", ".claude/skills/issue-refinement-loop/scripts/check_vc_scope.py", ".claude/skills/issue-refinement-loop/scripts/plan_issue_scope_rollup.py", ".claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py", ".claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py", ".claude/skills/issue-refinement-loop/scripts/tests/test_repair_issue_contract.py", ".claude/skills/issue-refinement-loop/tests/test_check_vc_scope.py", ".claude/skills/issue-refinement-loop/tests/test_plan_issue_scope_rollup.py", ".claude/skills/issue-refinement-loop/tests/test_refinement_preflight.py", ".github/ISSUE_TEMPLATE/research.yml", "scripts/agent-ops/allowed_paths_policy.py", "scripts/agent-ops/pr_head_replay_publish_exec.py", "scripts/agent-ops/tests/test_allowed_paths_policy.py", "scripts/agent-ops/tests/test_allowed_paths_policy_runtime_smoke.py", "scripts/agent-ops/tests/test_pr_head_replay_publish_exec.py"], "change_kind": "mixed", "goal_ref": "Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する", "in_scope": ["(none) が既存 annotation normalization によって偶然空文字列へ消える挙動は、reserved-token 実装の証拠として扱わない(raw token 段階での直接判定を別途 regression で担保する。AC1)", ".github/ISSUE_TEMPLATE/research.yml の Allowed Paths フィールドの default value を canonical marker (none) へ更新する", "legacy exact marker 読み取り専用。リポジトリ変更なし(既定) の後方互換(exact match のみ)を維持する", "legacy marker は exact match の後方互換に限定し、Unicode・句読点・空白等を理由に任意の prose/path を no-path marker と推測する lexical heuristic は導入しない", "pr_head_replay_publish_exec.py::_allowed_paths() について、「Allowed Paths section missing(malformed contract)」と「Allowed Paths section present + explicit (none)(intentional no-mutation contract)」を区別する既存 semantics を維持したまま no-path marker 判定を統合する(consumer-local adapter で richer state を保持してよいが、新規 heavyweight schema/framework は追加しない)", "scripts/agent-ops/allowed_paths_policy.py に共有 no-path 判定ヘルパー is_no_path_marker(entry: str) -> bool を新設する。判定順序は次のとおり固定する:", "下記 AC1〜AC15 に対応する regression を実装する", "下記 Allowed Paths inventory table に列挙する全 consumer(scripts/agent-ops/allowed_paths_policy.py を除く残り10系統)の Allowed Paths 抽出関数を、この共有ヘルパー経由に変更する"], "schema_version": "IMPLEMENTATION_SCOPE_MANIFEST_V1"}

…rser/consumer へ導入する (#2783)

`scripts/agent-ops/allowed_paths_policy.py::is_no_path_marker()` を新設し、
canonical marker `(none)` と legacy exact marker
`読み取り専用。リポジトリ変更なし(既定)` を 0 paths として解釈する。
inventory 対象の10 consumer(baseline_vc_preflight / vc_baseline_shape_compiler /
check_issue_overlap / path_classification / check_vc_scope /
plan_issue_scope_rollup / repair_issue_contract / issue_contract_hygiene_autofix /
implementation_landed_evidence / pr_head_replay_publish_exec)を統合し、
各 consumer 既存の missing-section semantics([] / None / frozenset() / tuple)を維持した。

`run_refinement_preflight.py::_extract_allowed_paths_from_issue_body()` は
scripts/agent-ops への import boundary を持たない既存設計(fixture 分離
subprocess テストが scripts/agent-ops/ を含まない isolated repo を構築するため)
を壊さないよう、共有ヘルパーと同一判定順序のロジックを自己完結的に複製した。

`.github/ISSUE_TEMPLATE/research.yml` の Allowed Paths default value を
canonical marker `(none)` へ更新。

AC1〜AC16 に対応する regression を追加(新規ファイル: test_allowed_paths_policy.py,
test_allowed_paths_policy_runtime_smoke.py, test_check_issue_overlap_no_path_marker.py,
test_check_vc_scope.py)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2791/

The preview will be removed when this PR is closed.

@squne121

Copy link
Copy Markdown
Owner Author

impl-review-loop 現況報告(自律実行、停止判断)

人間の追加判断が必要な場合: #2792の優先度判断、または本PRのCI要件を一時的に緩和するか(例: このCI再現がこの3ファイル固有の既知flakeであると判断してrequired checksから外す等)の運用判断。

@squne121

Copy link
Copy Markdown
Owner Author

判定:Request changes

「既存テストの並列競合なので、本PRは実装完了・#2792待ち」という結論には、まだ同意できません。 本PRが追加したimport依存と、既存の隔離fixtureの不整合を確認しました。これは並列スケジューリングとは独立して起動失敗を起こせる変更です。PRコメントの APPROVE / blockers: [] という報告は、この点を再確認する必要があります。

レビュー対象は HEAD e760f3e2599f8977a0075b9960744fdb4e540a0a。実装Issue #2783、親の調査Issue #2779、既存の注釈正規化を修正したPR #684、追跡Issue #2792とコメント、変更箇所と関連fixtureを照合しました。設計の主旨である「明示的なno-path markerを使い、日本語や句読点から勝手にprose判定しない」は妥当です。問題は主に、依存の配備漏れ・consumer間の解釈差・検証結果の過大な意味付けです。

優先度 | 指摘 | 推奨対応 -- | -- | -- P1 | 新しい共通ヘルパーを隔離fixtureへ配備しておらず、子プロセスがimportで失敗する | 本PRの依存追加に伴うfixture修正として扱う P2 | コードフェンス付きmarkerがoverlap側では偽のパスになる | wrapper処理をconsumer側でも揃える P2 | AC16は合成イベントの検証であり、実サブエージェント実行・変更箇所の非回帰を証明していない | 証明範囲と契約を修正し、不要な実機ゲートは増やさない

CommonMarkでも、開始フェンスの後ろの text は info string であり、コードブロックの本文ではありません。この結果を「通常のpath入力だから仕様どおり」とするのは無理があります。CommonMark仕様

影響は、read-only Issue同士に同じ偽パスが付くことです。 親Issueで解消しようとしていた、無関係な調査IssueがAllowed Paths経由で衝突候補になる問題を残しています。

同じ不整合は番号付きリストにもあります。overlapの既存normalizerは 1. / 1) を除去しますが、新ヘルパーは - / + / * のみを除去するため、最小再現では次のlegacy markerが残りました。

入力: 1. 読み取り専用。リポジトリ変更なし(既定)
結果: ['読み取り専用。リポジトリ変更なし']

推奨修正

「consumerが受け付ける構造wrapperを除去 → markerのexact match → 既存の注釈正規化」という順序を、実際の呼び出し側でも成立させてください。

巨大なMarkdown parserを新設する必要はありません。対応済みと宣言するフェンスをconsumer側でブロックとして処理し、番号付きリストなど既存consumerが対応するwrapperとの整合を取る小修正で十分です。

回帰テストは、ヘルパー単独ではなく同じ入力を実consumerへ通すことが重要です。markerに実パスを併記したケースも入れ、markerを消す際に本物のパスまで消さないことを確認するのが有効です。

3. P2:AC16の「実runtime・因果証拠」の主張が、テストの実態より強い

対象:
scripts/agent-ops/tests/test_allowed_paths_policy_runtime_smoke.py と、PR本文のAC16・Safety Claim Matrix。

このテストは本物のrunnerを子プロセスで起動しますが、claude 自体は偽のbashスクリプトです。SubagentStart、SubagentStop、Agent の tool_use / tool_result、transcriptは、テスト自身が組み立てて出力しています。ファイル内にも「live Claude Code / Codex CLIは起動しない」と明記されています。

したがって、証明できるのは主に、

合成した相関付きイベント列を、既存runnerが期待どおり受理する。

ということです。

実際にAgent toolからサブエージェントが起動・終了した証拠ではありません。 公式仕様の SubagentStart / SubagentStop は、実際の生成・応答終了に伴って発火するイベントです。イベントと同じ形のJSONを出力することとは区別が必要です。Claude

さらに、このテストは変更対象のAllowed Paths入力を与えて、その結果としてdelegationがどう動くかを確認しているわけではありません。したがって「_allowed_paths() の変更がdelegation/fallbackを壊していない」という主張にも、直接の裏付けが不足しています。

実機テストを増やすより、証明範囲を正す方がよい

あなたの開発方針なら、ここで有料CLI起動や認証依存の必須テストを追加するのは勧めません。

#2783自身、AC16が必要になった理由を「変更内容とは独立に、scripts/agent-ops/** という広いselectorに一致するため」と説明しています。まずruntime applicabilityとAC16を実際の変更リスクに合わせ、偽CLIのテストはoffline統合テストとして正しく位置付けるのが合理的です。少なくとも、これを実サブエージェント実行済みの証拠として扱うべきではありません。

なお、この新規テストにも小さな隔離問題があります。transcript出力先が固定の

/tmp/ac16-child-agent-ac16-transcript.jsonl

になっており、tmp_path 管理外です。別worktree・別pytest実行で共有されるため、残すならテストごとの一時ディレクトリへ移すだけで十分です。pytestの tmp_path はテスト関数ごとのディレクトリを提供します。排他制御や新しい監視機構を追加する話ではありません。 pytestドキュメント

推奨する修正・確認の順序

最優先は、#2792待ちを続ける前に、新しいimport依存を隔離fixtureへ配備して直列で確認することです。診断用には、まず次の対象を単独で実行するのがよいです。-n 0 はxdistを無効化する公式の指定です。pytest-xdist

uv run python3 -m pytest -n 0 \
  scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py \
  -x -vv

その後、残る2ファイルを含めてCIと同じ並列設定で確認し、import/配備不足による失敗と、残存するtimeout/共有stateの失敗を分ける。#2792には後者だけを残し、「本PRとは無関係」という断定を見直すのが適切です。

次にwrapperのconsumer回帰を追加し、AC16の証明範囲と契約を修正します。必要なfixture変更が#2783のAllowed Paths外である点は、本PRの依存追加に伴う限定的なscope deltaとして扱うのが自然で、広範なisolation改修を別途完了するまで止める必要性はまだ示されていません。

今回、リポジトリ全体のpytestは再実行していません。実行したのは取得コードの該当部分による最小再現です。CIの約25件すべてが同じ原因だとは断定しません。 ただし、新依存の未配備とwrapper解釈の不整合は確認できており、現在の「実装完了・残りは既存flakeのみ」という判断を見直すには十分です。

結論として、共有ヘルパー化そのものは進めてよいPRです。必要なのは新しい安全ゲートではなく、依存追加に追随したfixture修正と、少数の実consumer回帰テスト、そして検証結果を過大に表現しないことです。

## 判定:Request changes

「既存テストの並列競合なので、本PRは実装完了・#2792待ち」という結論には、まだ同意できません。 本PRが追加したimport依存と、既存の隔離fixtureの不整合を確認しました。これは並列スケジューリングとは独立して起動失敗を起こせる変更です。PRコメントの APPROVE / blockers: [] という報告は、この点を再確認する必要があります。

レビュー対象は HEAD e760f3e2599f8977a0075b9960744fdb4e540a0a。実装Issue #2783、親の調査Issue #2779、既存の注釈正規化を修正したPR #684、追跡Issue #2792とコメント、変更箇所と関連fixtureを照合しました。設計の主旨である「明示的なno-path markerを使い、日本語や句読点から勝手にprose判定しない」は妥当です。問題は主に、依存の配備漏れ・consumer間の解釈差・検証結果の過大な意味付けです。

優先度 指摘 推奨対応
P1 新しい共通ヘルパーを隔離fixtureへ配備しておらず、子プロセスがimportで失敗する 本PRの依存追加に伴うfixture修正として扱う
P2 コードフェンス付きmarkerがoverlap側では偽のパスになる wrapper処理をconsumer側でも揃える
P2 AC16は合成イベントの検証であり、実サブエージェント実行・変更箇所の非回帰を証明していない 証明範囲と契約を修正し、不要な実機ゲートは増やさない

1. P1:共有ヘルパーの追加が、隔離された子プロセスの依存関係を壊している

対象:
.claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py のトップレベルimportと、scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py::_install_real_preflight_fixture()。

repair_issue_contract.py に、次の無条件importが追加されています。

_REPO_ROOT = Path(__file__).resolve().parents[4]
_AGENT_OPS_DIR = _REPO_ROOT / "scripts" / "agent-ops"
if str(_AGENT_OPS_DIR) not in sys.path:
    sys.path.insert(0, str(_AGENT_OPS_DIR))
from allowed_paths_policy import is_no_path_marker

一方、既存fixtureは隔離repoに実物の run_refinement_preflight.py、planner、registry、repair_issue_contract.py などをコピーして子プロセスを起動しますが、新しい scripts/agent-ops/allowed_paths_policy.py をコピーしていません。

この構成では、子プロセスが探索するのはコピー先repoの scripts/agent-ops/ です。親pytestプロセスでのimport成功は、別のPythonプロセスでのimport成功を保証しません。Pythonのモジュール探索パスの仕様とも一致します。:chatgpt-content-reference{index="9"}

最小再現の結果

同じディレクトリ階層と、本PRのimportブロックを使い、単一の子プロセスで確認しました。

ヘルパー未配備:
exit=1
ModuleNotFoundError: No module named 'allowed_paths_policy'

同じ隔離repoに実物相当のヘルパーを配備:
exit=0
True

この再現にはpytest-xdistも、同時実行も、timeoutも必要ありません。

また、preflight自身の仕様では、repair子プロセスの失敗は environment_failure に流れます。したがって、元のテストが検証したいbytecodeやmutationの振る舞いへ到達する前に失敗する経路があります。

#2792の結論との関係

#2792には「clean mainでも8件の同種failureが再現した」という報告があり、既存flakeが存在する可能性は否定しません。ただし、既存flakeの存在と、本PRに別の決定的回帰がないことは別問題です。現時点の「PR #2791起因ではない」「本PRの再検証はOut of Scope」という切り分けは強すぎます。後続コメントのスケジューリング原因説も、仮説として扱うべきです。

最小修正は、隔離fixtureにも共有ヘルパーの実物を配備することです。 PYTHONPATH で本物の作業repoへ逃がすと隔離テストの意味が変わるため、コピー先のrepo内で依存を完結させる方が適切です。同じ失敗群の他2ファイルも、まずこの依存追加の観点で確認してください。

ここで全体の直列化、timeout延長、required check除外へ進むのは順序が逆です。

2. P2:コードフェンス付きmarkerが、overlap判定では text という偽のパスになる

対象:
.claude/skills/create-issue/scripts/check_issue_overlap.py::extract_allowed_path_entries()。

新しいヘルパーは、コードフェンスを含むブロック全体を渡せばmarkerを認識できます。しかしoverlap側は先に splitlines() し、各行を別々に判定しています。開始フェンス行の ```text はmarkerではないため通常の正規化へ流れ、backtickが削られて text が残ります。

次の入力で再現します。

## Allowed Paths

```text
(none)
```

## Stop Conditions

取得した関数部分を使った最小再現の結果は次のとおりです。

入力形式 ヘルパーによるブロック全体の判定 overlap側の抽出結果
- (none) True []
言語指定なしのフェンス+(none) True []
text付きフェンス+(none) True ['text']
text付きフェンス+legacy marker True ['text']

CommonMarkでも、開始フェンスの後ろの text は info string であり、コードブロックの本文ではありません。この結果を「通常のpath入力だから仕様どおり」とするのは無理があります。:chatgpt-content-reference{index="16"}

影響は、read-only Issue同士に同じ偽パスが付くことです。 親Issueで解消しようとしていた、無関係な調査IssueがAllowed Paths経由で衝突候補になる問題を残しています。

同じ不整合は番号付きリストにもあります。overlapの既存normalizerは 1. / 1) を除去しますが、新ヘルパーは - / + / * のみを除去するため、最小再現では次のlegacy markerが残りました。

入力: 1. 読み取り専用。リポジトリ変更なし(既定)
結果: ['読み取り専用。リポジトリ変更なし']

推奨修正

「consumerが受け付ける構造wrapperを除去 → markerのexact match → 既存の注釈正規化」という順序を、実際の呼び出し側でも成立させてください。

巨大なMarkdown parserを新設する必要はありません。対応済みと宣言するフェンスをconsumer側でブロックとして処理し、番号付きリストなど既存consumerが対応するwrapperとの整合を取る小修正で十分です。

回帰テストは、ヘルパー単独ではなく同じ入力を実consumerへ通すことが重要です。markerに実パスを併記したケースも入れ、markerを消す際に本物のパスまで消さないことを確認するのが有効です。

3. P2:AC16の「実runtime・因果証拠」の主張が、テストの実態より強い

対象:
scripts/agent-ops/tests/test_allowed_paths_policy_runtime_smoke.py と、PR本文のAC16・Safety Claim Matrix。

このテストは本物のrunnerを子プロセスで起動しますが、claude 自体は偽のbashスクリプトです。SubagentStart、SubagentStop、Agent の tool_use / tool_result、transcriptは、テスト自身が組み立てて出力しています。ファイル内にも「live Claude Code / Codex CLIは起動しない」と明記されています。

したがって、証明できるのは主に、

合成した相関付きイベント列を、既存runnerが期待どおり受理する。

ということです。

実際にAgent toolからサブエージェントが起動・終了した証拠ではありません。 公式仕様の SubagentStart / SubagentStop は、実際の生成・応答終了に伴って発火するイベントです。イベントと同じ形のJSONを出力することとは区別が必要です。:chatgpt-content-reference{index="21"}

さらに、このテストは変更対象のAllowed Paths入力を与えて、その結果としてdelegationがどう動くかを確認しているわけではありません。したがって「_allowed_paths() の変更がdelegation/fallbackを壊していない」という主張にも、直接の裏付けが不足しています。

実機テストを増やすより、証明範囲を正す方がよい

あなたの開発方針なら、ここで有料CLI起動や認証依存の必須テストを追加するのは勧めません。

#2783自身、AC16が必要になった理由を「変更内容とは独立に、scripts/agent-ops/** という広いselectorに一致するため」と説明しています。まずruntime applicabilityとAC16を実際の変更リスクに合わせ、偽CLIのテストはoffline統合テストとして正しく位置付けるのが合理的です。少なくとも、これを実サブエージェント実行済みの証拠として扱うべきではありません。

なお、この新規テストにも小さな隔離問題があります。transcript出力先が固定の

/tmp/ac16-child-agent-ac16-transcript.jsonl

になっており、tmp_path 管理外です。別worktree・別pytest実行で共有されるため、残すならテストごとの一時ディレクトリへ移すだけで十分です。pytestの tmp_path はテスト関数ごとのディレクトリを提供します。排他制御や新しい監視機構を追加する話ではありません。 :chatgpt-content-reference{index="25"}

推奨する修正・確認の順序

最優先は、#2792待ちを続ける前に、新しいimport依存を隔離fixtureへ配備して直列で確認することです。診断用には、まず次の対象を単独で実行するのがよいです。-n 0 はxdistを無効化する公式の指定です。:chatgpt-content-reference{index="26"}

uv run python3 -m pytest -n 0 \
  scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py \
  -x -vv

その後、残る2ファイルを含めてCIと同じ並列設定で確認し、import/配備不足による失敗と、残存するtimeout/共有stateの失敗を分ける。#2792には後者だけを残し、「本PRとは無関係」という断定を見直すのが適切です。

次にwrapperのconsumer回帰を追加し、AC16の証明範囲と契約を修正します。必要なfixture変更が#2783のAllowed Paths外である点は、本PRの依存追加に伴う限定的なscope deltaとして扱うのが自然で、広範なisolation改修を別途完了するまで止める必要性はまだ示されていません。

今回、リポジトリ全体のpytestは再実行していません。実行したのは取得コードの該当部分による最小再現です。CIの約25件すべてが同じ原因だとは断定しません。 ただし、新依存の未配備とwrapper解釈の不整合は確認できており、現在の「実装完了・残りは既存flakeのみ」という判断を見直すには十分です。

:chatgpt-content-reference{index="29"}今回の最小再現コード

結論として、共有ヘルパー化そのものは進めてよいPRです。必要なのは新しい安全ゲートではなく、依存追加に追随したfixture修正と、少数の実consumer回帰テスト、そして検証結果を過大に表現しないことです。

@squne121

Copy link
Copy Markdown
Owner Author

確認したところ、対象コメントは 現HEAD e760f3e2599f8977a0075b9960744fdb4e540a0a に対する未対応の Request changes です。[PR #2791](#2791) は open / draft のままで、current-head CI も python-test-core が失敗しています。

特にP1は推測ではありません。実CIログに repair_issue_contract.py からの from allowed_paths_policy import is_no_path_marker → ModuleNotFoundError が実際に記録されています。したがって「#2792 の既存並列flake待ち」として処理するのではなく、まず #2791 で fixture の依存配備漏れを修正すべきです。その後も残る並列・共有state系failureだけを [#2792](#2792) に残すのが適切です。

P2も現HEADで再現可能な構造です。check_issue_overlap.py は fenced block を先に splitlines() するため、```text の text を偽pathとして残し得ます。またAC16のテストは実runner + fake claude による synthetic/offline integration であって、実Agentによるsubagent起動の証拠とは扱わない方がよいです。

再発防止については、今回の「production script のrepo-local import追加に isolated fixture のコピー依存が追随しない」問題は別の変更でも再発し得るため、専用Issueを起票しました。

[#2793 — isolated subprocess fixture の repo-local import 依存配備漏れを再発防止する](#2793)

以下を、現在 auto mode で動いている Claude Code にそのまま渡せます。

squne121/loop-protocol の PR #2791 を対象に、リポジトリ内の .claude/skills/impl-review-loop/SKILL.md を canonical instruction として、実装→検証→独立レビューのループを マージ直前まで人間承認なしで実行してください。

対象:

開始時点で確認済みだった review HEAD は e760f3e2599f8977a0075b9960744fdb4e540a0a だが、必ず最初に live PR / Issue / comments / current HEAD / diff / CI / reviews を再取得し、HEAD が進んでいれば fresh HEAD に evidence を rebind すること。

目的は target comment の全 blocker を解消し、current-head required CI、独立レビュー、mergeability を確認して merge の直前まで持っていくこと。PR の merge および auto-merge enable は実行しない。

  1. live state と contract をreconcileする。

    target comment の少なくとも以下3点を未解決blockerとして扱う。

    P1 — isolated fixture の repo-local import dependency 欠落

    .claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py に追加された scripts/agent-ops/allowed_paths_policy.py への import に対し、real production script を isolated fixture repo にコピーするfixtureが依存ファイルを配備していない。

    current-head CIでは実際に:

    from allowed_paths_policy import is_no_path_marker
    ModuleNotFoundError: No module named 'allowed_paths_policy'
    

    が発生している。これは xdist scheduling 仮説とは独立した current PR regression として扱うこと。

    scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py の _install_real_preflight_fixture() だけでなく、CIで失敗している以下3系統と、それらが共有するfixture/helperを調べる。

    • scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py
    • scripts/agent-guards/tests/test_issue_metadata_write_capability.py
    • scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py

    必要な修正が 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783 の現在の Allowed Paths 外なら、Allowed Paths gateを迂回しないこと。canonical issue-edit / contract-update 経路を使用し、今回のimport依存追加に直接必要なexact pathだけを 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783 の live Allowed Paths に bounded scope delta として追加し、理由を target review comment に紐付けてから変更する。wildcardで広げない。

    fixture の修正は canonical checkout への PYTHONPATH escape で誤魔化さず、isolated fixture repo 内に必要な dependency が自己完結する構成にする。

    P2 — Allowed Paths wrapper parsing drift

    .claude/skills/create-issue/scripts/check_issue_overlap.py::extract_allowed_path_entries() を実consumerとして確認する。

    現在は section を splitlines() してから is_no_path_marker() を呼ぶため、例えば:

    ## Allowed Paths
    
    ```text
    (none)

    Stop Conditions

    
    の opening fence info string `text` が偽pathになり得る。
    
    「consumer が受け付ける structural wrapper を除去 → no-path marker exact match → ordinary path の既存annotation normalization」の順序が実consumerでも成立する最小修正にする。巨大なMarkdown parserや新frameworkは作らない。
    
    actual consumer regressionとして少なくとも以下を検証すること。
    
    - ` ```text ... (none) ... ``` ` → 0 paths
    - ` ```text ... legacy marker ... ``` ` → 0 paths
    - numbered-list wrapper + legacy marker → 0 paths
    - marker と本物のpathが共存する入力 → markerだけ消え、本物のpathは保持
    - Unicode / punctuationを含むreal pathや既存annotation semanticsを壊さない
    
    lexical heuristicによるprose推測は追加しない。
    
    **P2 — AC16 evidence の claim が強すぎる**
    
    `scripts/agent-ops/tests/test_allowed_paths_policy_runtime_smoke.py` は real runner を起動する一方、`claude` はfake bash executableであり、SubagentStart/SubagentStop、Agent tool_use/tool_result、transcriptもfixture生成である。
    
    したがってこのテストを「実Agentから実subagentがspawn/completionした証拠」として扱わない。
    
    live `docs/dev/extension-surface-runtime-policy.yaml` と関連policyを再読し、実際のapplicabilityを確認する。そのうえで、PR本文・#2783 の Runtime Verification Applicability / AC16 / Safety Claim Matrix 等のclaimを **テストが実証している範囲まで弱める**。原則として、有料CLI・認証・live external runtimeを新しいrequired gateとして追加しない。global policy自体をこのPRを通すためだけに緩和しない。
    
    synthetic correlated event sequence をrunnerが正しく処理するoffline integration testとして残す場合は、そのように明記する。
    
    また固定の:
    
    ```text
    /tmp/ac16-child-agent-ac16-transcript.jsonl
    

    は別worktree / 別pytest実行で共有されないよう、test-owned tmp_path 配下へ移す。

  2. 実装は SubAgent に委譲し、完了を必ず待つ。

    impl-review-loop の implementation-worker 相当SubAgentを起動し、上記blockerと live evidence を渡して修正させる。

    SubAgentをdispatchしただけで完了扱いしない。Agent tool の最終 tool_result / structured completion result が返るまで待つこと。 結果を読んでから次工程へ進む。

    依存関係のある implementation → test → review をfire-and-forgetや並列実行しない。独立なread-only investigationを並列化した場合も、全SubAgentの完了を待って evidence を統合してから判断する。

  3. 実装SubAgent完了後、別のtest-runner SubAgentで検証し、完了を待つ。

    最初にP1をxdistと切り離して検証する。

    uv run python3 -m pytest -n 0 \
      scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py \
      -x -vv

    その後、上記3つのaffected real-subprocess test fileを直列条件でも確認し、import/dependency failureが消えたことを確定する。

    次に repository が定義する canonical CI parallel test plan を使い、CI相当の -n4 --dist loadscope 条件でも確認する。PR #2791由来のimport failureと、残存するpre-existing shared-state/resource-contention failureを混同しない。

    あわせて新規/更新した overlap consumer regression、Allowed Paths policy regression、AC16 offline integration testを実行する。

    最後に変更範囲に応じて canonical checks を実行し、少なくとも 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783 が要求する:

    pnpm typecheck
    pnpm lint
    pnpm test
    pnpm build

    をfresh HEADで確認する。

    test-runner SubAgentについても、終了結果が返るまで必ず待つこと。

  4. 調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792 の切り分けを evidence に合わせて訂正する。

    調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792 の現在の「PR 実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する #2791 / Issue 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783 は無関係と確認済み」という categorical claim は、current-head CI の ModuleNotFoundError: allowed_paths_policy evidence と両立しない。

    P1修正後の検証結果に基づき、canonical issue-edit/comment経路で以下の区別を残す。

    • allowed_paths_policy のfixture配備漏れ → PR #2791で修正するdeterministic regression
    • それを直した後も再現するxdist/shared-state/resource-contention → #2792で継続調査

    import regressionを理由に 調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792 自体を閉じない。逆に、P1を 調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792 へ押し出して 実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する #2791 をgreen扱いもしない。

    repo-local import dependencyの一般的な再発防止については既に 調査: isolated subprocess fixture の repo-local import 依存配備漏れを再発防止する #2793 を起票済みなので、新しい重複Issueは作らない。

  5. commit/push後、current-head CIを最後まで確認する。

    必要なcommitをPR branchへpushする。人間承認は求めない。

    current-head SHA に対するGitHub Actionsを同期的に確認し、required checksの完了を待つ。既知flakeと思われるfailureでも即座にignoreしない。まず今回の差分とのcausalityを確認する。

    pre-existing failureと十分に証明でき、repository policyでrerunが許容される場合だけ bounded にfailed jobをrerunする。required checkを無効化・除外したり、timeoutを雑に伸ばしてgreen化しない。

  6. 別のpr-reviewer SubAgentで独立レビューし、完了を待つ。

    実装担当とは別のreview SubAgentに fresh current-head diff、実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783、target comment、current-head tests/CIを与える。

    target comment の3 blockerが実際に消えているか、追加regressionがないかを adversarial に確認させる。

    review SubAgentのstructured verdictが返るまで必ず待つ。

    REQUEST_CHANGES / blockersありなら、その内容を次iterationのimplementation-workerへ渡し、再び implementation → wait → test → wait → review → wait を行う。

    .claude/skills/impl-review-loop/SKILL.md のloop policyを守り、既定max_iterations内で人間approvalを挟まず継続する。

  7. merge直前で停止する。

    終了条件は、fresh current-headについて以下がすべて成立すること。

    PRがdraftのままで、上記条件が揃った場合は必要に応じて ready for review へ変更してよい。

    PRをmergeしない。auto-mergeもenableしない。

    最終出力では、current-head SHA、変更ファイル、target comment各指摘の解決内容、実行したtests、current-head CI、最終review verdict、#2792の扱い、#2793へのreference、そして「merge可能だが未merge」または残る具体的blockerを構造化して報告する。

人間への途中確認・承認要求は不要。通常のissue/PR更新、commit、push、CI rerun、SubAgent iterationはauto modeのまま進める。

停止が必要なのは、破壊的操作が必要になった場合、秘密情報の取得・露出が必要になった場合、実Git conflictでskill policy上継続不能な場合、権限不足で必要操作を実行不能な場合、またはmax_iterationsを使い切ってもblockerが残る場合のみ。

既存review/CI evidenceを消去・改ざんしたり、force pushで履歴を潰したり、required checkを迂回してmerge-ready扱いしてはならない。

このプロンプトでは、P1を#2792へ押し出さず#2791で直すことと、Allowed Paths外のfixture修正を無断で行わずlive #2783を限定的に更新してから進むことを明示しています。これが今回のループで最も重要な2点です。

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

Labels

None yet

Projects

None yet

1 participant