Skip to content

実装:scope_rollup.runをskill_runtime_execのsiblingexactprofileへ統合する #1601

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1580"
goal_ref: "Issue #1580 の go 判定: scope_rollup.run を specialized worker を維持した sibling exact profile として skill_runtime_exec の canonical admission/supervision 経路へ統合する"
change_kind: mixed
fixed_base_sha: "e52913ad198886e36999e40ec2668f73eb6d7559"
dependencies:
  - "#1579 CLOSED (PR #1594)"
  - "PR #1572 MERGED"
  - "#1593 before worker integration"
  - "#1595 before shared guard/parser integration"
  - "#1565 before legacy classifier cutover"
  - "#1573 before Claude settings cutover"
canonical_entrypoint: "uv run --locked --offline --no-sync python3 scripts/agent-guards/skill_runtime_exec.py --command-id scope_rollup.run --issue-number <N> --repo squne121/loop-protocol --invocation-id <ID> --requested-at <RFC3339>"
worker: "scripts/agent-guards/run_scope_rollup_preflight.py"
result_schema: "ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 compatibility preserved"
repository_write_roots: []
launcher_policy: "locked_offline_no_sync"
cancellation_policy: "staged_process_tree_v1"

Parent Issue

#1580

Parent Goal Ref

Current Validated Scope

  • registry、policy、outer executor、worker、Claude/Codex guard と caller/documentation を、scope_rollup.run 専用の sibling exact profile へ整合させる。
  • canonical invocation を locked/offline/no-sync の一形状に固定し、legacy direct worker invocation を Claude/Codex 双方で fail-closed deny に切り替える。
  • outer executor に profile ごとの zero repository write-root、bounded streaming、global deadline、検証可能な process-tree cancellation と cleanup を実装する。

Remaining Parent Gaps

Outcome

scope_rollup.run が実 subprocess 境界で canonical outer executor から specialized worker を起動し、repository write root なし・bounded output・deadline/cancellation・cleanup・Claude/Codex legacy deny をテストで実証した 1 PR として main に取り込める状態。

In Scope

  • command_registry.py を child worker argv の唯一の renderer とし、invocation_id と requested_at をそのまま child に渡す profile metadata を追加する。
  • skill_runtime_command_policy.py を profile-driven に拡張し、canonical outer invocation、placeholder/type validation、child identity、required cwd/branch/repo、network effect、empty write roots を相互検証する。
  • skill_runtime_exec.py に sibling profile dispatcher を実装する。scope 専用巨大分岐、domain transaction の移植、argv template 三重定義は行わない。
  • outer executor で stdout/stderr を独立 bounded streaming し、単一 global deadline、graceful cancellation、bounded grace、hard termination を管理する。worker の別 session child/grandchild 残存を実プロセス試験で検証する。
  • run_scope_rollup_preflight.py の GitHub inventory、pagination、planner/verifier、private invocation directory、domain result 構築を維持し、outer cancellation と cleanup failure を安全に伝播できるようにする。
  • profile ごとに write audit を分離し、scope_rollup.run は allowed_write_roots: [] とする。既存 artifact/exclusion roots を暗黙継承しない。
  • Claude settings/local-main/worktree/fastpath と Codex rules/execpolicy を canonical allow、legacy direct deny、malformed deny に揃える。
  • runner/preparation/documentation の canonical command を差し替え、旧 direct command は許可例として残さない。
  • listed test files で registry-policy parity、positive/negative exact parser、legacy deny、zero-write、output cap、deadline/process tree、cleanup、pagination/domain regression、real E2E identity を追加する。

Out of Scope

  • GitHub inventory、pagination、planner、verifier、private artifact の domain logic を skill_runtime_exec.py へ移植する generic engine refactor。
  • if command_id == "scope_rollup.run" だけの一時分岐。
  • scope-rollup の result schema 意味変更、consumer migration、compatibility version bump。
  • registry を data-only manifest に置換すること、GitHub credential store/認証方式の変更、Codex hook topology の変更。
  • Allowed Paths 外の test fixture、lockfile、.venv、repository write root を必要とする方式。

Acceptance Criteria

  • AC1: canonical command は uv run --locked --offline --no-sync python3 scripts/agent-guards/skill_runtime_exec.py --command-id scope_rollup.run --issue-number <N> --repo squne121/loop-protocol --invocation-id <ID> --requested-at <RFC3339> の一形状だけで、registry render、policy parser、runner、Claude/Codex guard が同じ token order を受理する。
  • AC2: scope_rollup.run profile は allowed_write_roots: [] を policy/registry/executor の相互検証で固定し、repo 内 create/update/delete/rename、既存 race-tolerant exclusions、uv.lock、.venv の mutation を fail-closed にする。
  • AC3: direct run_scope_rollup_preflight.py invocation は Claude と Codex の全対象 surface で deny され、absolute path、./、uv option 変形、wrapper、env assignment、flag missing/duplicate/order change/equals/extra/wrong repo/invalid issue/invocation_id/requested_at は allow に落ちない。
  • AC4: outer executor は worker の stdout/stderr を independent bounded streaming し、cap exceed の stable reason code、single global deadline、remaining budget を持つ stage timeout、graceful-to-hard cancellation を実装する。worker/child/new-session grandchild の PID が timeout 後に残らず、private artifacts は success/error/inner timeout/outer timeout/cap/malformed output/cancellation/cleanup failure の全経路で残らない。
  • AC5: worker は GitHub inventory、server totalCount、PR files pagination、planner/verifier、SCOPE_ROLLUP_RUN_RESULT_V1/ISSUE_SCOPE_ROLLUP_RUN_RESULT_V1 構築を所有し続ける。producer→outer→worker→parser の実 subprocess E2E で invocation_id、requested_at、payload_sha256、candidates payload、既存 consumer compatibility を確認する。
  • AC6: Claude/Codex parity と documentation/caller cutover が完了し、legacy direct command は許可例として残らない。Codex hooks topology に変更が不要なら変更しない。
  • AC7: Allowed Paths だけを変更し、Ruff、targeted Python suites、guard/hook/Codex matrix、pnpm typecheck/lint/test/build、repository CI required lanes が current head で成功する。
  • AC8: fixed_base_sha と dependency state を実装開始直前・push 前・merge 前に readback し、変更時は 調査: scope_rollup.run exact executor を registry SSOT 経路(skill_runtime_exec 相当)へ統合すべきか検討する #1580 の再レビューへ戻る。PR body に schema compatibility、safety evidence、rollback、Closes 本 Issue、Refs 調査: scope_rollup.run exact executor を registry SSOT 経路(skill_runtime_exec 相当)へ統合すべきか検討する #1580 を記録する。

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_command_registry.py scripts/agent-guards/tests/test_skill_runtime_command_policy_anchor.py scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py -v
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py tests/codex/test_scope_rollup_run_exact_executor.py -v
# AC3
$ uv run --locked pytest scripts/agent-guards/tests/test_local_main_branch_guard.py .claude/hooks/tests/test_local_main_branch_guard.py .claude/hooks/tests/test_worktree_scope_guard.py tests/codex/test_local_main_branch_guard.py -v
# AC4
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py tests/codex/test_run_scope_rollup_preflight.py -v
# AC5
$ uv run --locked pytest tests/codex/test_run_scope_rollup_preflight.py .claude/skills/issue-refinement-loop/tests/test_verify_scope_rollup_result.py -v
# AC6
$ uv run --locked pytest scripts/agent-guards/tests/test_pretool_fastpath_classifier.py scripts/ci/tests/test_codex_execpolicy_matrix.py tests/codex/test_execpolicy_matrix.py -v
# AC7
$ uv run --locked ruff check .claude/skills/issue-refinement-loop/scripts/command_registry.py scripts/agent-guards/skill_runtime_command_policy.py scripts/agent-guards/skill_runtime_exec.py scripts/agent-guards/run_scope_rollup_preflight.py scripts/agent-guards/local_main_branch_guard.py scripts/agent-guards/pretool_fastpath_classifier.py
# Regression lane
$ pnpm typecheck
# Regression lane
$ pnpm lint
# Regression lane
$ pnpm test
# Regression lane
$ pnpm build
# AC8
$ git diff --check

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/command_registry.py
  • .claude/skills/issue-refinement-loop/tests/test_command_registry.py
  • scripts/agent-guards/skill_runtime_command_policy.py
  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/run_scope_rollup_preflight.py
  • scripts/agent-guards/local_main_branch_guard.py
  • scripts/agent-guards/pretool_fastpath_classifier.py
  • scripts/agent-guards/tests/test_skill_runtime_command_policy_anchor.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py
  • scripts/agent-guards/tests/test_local_main_branch_guard.py
  • scripts/agent-guards/tests/test_pretool_fastpath_classifier.py
  • .claude/hooks/worktree_scope_guard.py
  • .claude/hooks/tests/test_worktree_scope_guard.py
  • .claude/hooks/tests/test_local_main_branch_guard.py
  • .claude/settings.json
  • .codex/rules/default.rules
  • scripts/ci/codex_execpolicy_matrix.py
  • scripts/ci/tests/test_codex_execpolicy_matrix.py
  • tests/codex/test_scope_rollup_run_exact_executor.py
  • tests/codex/test_local_main_branch_guard.py
  • tests/codex/test_run_scope_rollup_preflight.py
  • .claude/agents/scope-rollup-runner.md
  • .claude/skills/impl-review-loop/steps/preparation.md
  • docs/dev/hook-boundaries.md
  • docs/dev/agent-skill-boundaries.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合は、根拠、追加 path、rollback、追加 test を Issue の Scope Delta に先に記録する。
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合は、互換性判断と migration を Issue に先に記録する。
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)は、本 Issue を広げず narrow follow-up Issue に分離する。
  • 後続 Phase / 別スコープへの波及が判明した場合は、current base SHA と dependency state を再読して 調査: scope_rollup.run exact executor を registry SSOT 経路(skill_runtime_exec 相当)へ統合すべきか検討する #1580 の Decision Record を更新する。
  • nested SubAgent delegation が必要になった場合は、owner 相当の evidence review を Issue/PR に記録し、repository-native control を維持する。
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合は、追加課金・権限迂回を行わず、実行可能な local/CI test に限定する。

Required Skills

なし

Required Design References

Scope Delta(任意)

N/A

Scope Collision Evidence

Overlap preflight は C1(comment required)で完了した。#1593 は worker の pagination 専用変更、#1595 は shared launcher parser 抽出、#1565 は existing runtime classifier の argv-aware 化、#1573 は Claude settings の path anchoring を所有する。本 Issue はこれらを再実装せず、各 merge 後の main を再読して profile 統合と cutover の差分だけを実装する。#1598、#1588、#1429 および古い docs-only/issues は path のみ重複するが、command profile の outcome を所有しないため dependency にはせず、push 前に current main へ更新して conflict を解消する。

Delivery Rule

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jul 18, 2026
  2. squne121 commented on Aug 19, 2026

    @squne121
    OwnerAuthor

    OWNER Decision(2026-08-19、Issue #2193 refinement 経由)

    OWNER_DECISION_V1:
      status: re_review_required_before_implementation
      precedence: "#2193 before #1601"
      retained_candidate:
        - integrate_sibling_profile
      superseded_as_authority:
        - Claude project hook wiring as security/admission authority
        - stale fixed-base/dependency assumptions without current-main readback
        - hook-boundaries.md as unquestioned active-topology SSOT
      policy_authority:
        - "#1690"
        - "#1860"
        - "#1732"
      implementation_allowed_now: false

    背景

    Issue #2193(pr-reviewer.md/scope-rollup-runner.md 等の stale hook enforcement claim 訂正)の refinement loop 中、anchor review comment(issuecomment 5334693502)が #1601 との semantic collision を指摘した。OWNER 判断として以下を確定する。

    #1601 の実装着手条件

    #1601 は実装着手前に、current main / #1690 / #1860 / #1732 を基準とした fresh な issue-refinement-loop の再実行を要する。特に以下の古い前提を再評価すること:

    • hook-wiring を enforcement authority とする記述
    • settings-cutover を前提にした dependency/fixed-base 記述

    本コメントは調査結果(read-only SubAgent調査: current main 上の command_registry.py / skill_runtime_command_policy.py / skill_runtime_exec.py を確認した結果、scope_rollup.run は現在も独立レーンであり skill_runtime_exec.py に統合されていないことを確認済み)に基づく。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions