Skip to content

調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "#1526 (PR #2364) の runtime guard 修正が canonical control-plane 経路で pytest VC preflight を実際に復旧させたことを確認する"
change_kind: research-only

Parent Issue

なし(単独改善)

Outcome

PR #2364 の merge commit(cc5e3633d3992c0ff9ea99691a15332f39930179)を含む canonical main から、本 Issue(#2369)自身を対象として registry-defined bare preflight.run(command ID: preflight.run。呼び出しコマンドは LOOP_PLANNED_OPERATIONS_JSON='[{"phase":"canary_verification","actor_role":"orchestrator","operation":"preflight_run_self_canary","requires_mutation":false}]' uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py --command-id preflight.run --issue-number 2369 --repo squne121/loop-protocol。.claude/skills/issue-refinement-loop/scripts/command_registry.py で定義、mutation: false / network_effect: github_read_only、内部的に workflow_start_entry.py を起動。workflow_start_entry.py の capability-request gate(#2311 / PR #2320 / PR #2328)は LOOP_PLANNED_OPERATIONS_JSON の1回限りの env var 宣言(non-empty JSON array)を必須とし、未宣言のまま実行すると CapabilityRequestError: planned_operations_missing により STATUS: blocked / exit code 2 で inner preflight に到達せず fail-closed する。上記の env var 宣言を付けることでこの gate を通過し、inner preflight が実際に起動することを本 Issue の canary 実行前に確認済み)を一度実行する。本 Issue に記載された focused pytest Verification Command は、上記の canonical executor 呼び出しに先立って(または同一手順内で)実行され、unauthorized_write_path を発生させず完了し、tested HEAD・command ID・exit code・canonical stdout/stderr・tracked tree delta を含む結果コメントが本 Issue に記録された状態を完了とする。Step 0f より後の refinement loop(reviewer 起動・本文書き換え・follow-up 起票・impl-review-loop 起動等)は実行しない。

In Scope

  • canonical main(bootstrap bypass なし)から registry-defined bare preflight.run(command ID を1つに固定、preflight.run.with_human_context 等の別経路とは相当扱いしない)を本 Issue(調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369)自身に対して一度実行し、unauthorized_write_path で fail-close しないことを確認する
  • 本 Issue に記載された focused pytest regression(下記 Verification Commands)を実行し、結果を記録する
  • 実行前後で tracked / staged repository content に差分がないことを確認する
  • 上記の実行結果(PASS/FAIL/INCONCLUSIVE、tested HEAD、command ID、executor exit code、STATUS、NEXT_ACTION、関連 blocker、stdout/stderr)を本 Issue のコメントとして記録する

Out of Scope

Acceptance Criteria

  • AC1: PR fix: runtime guard が repo-root .pytest_cache/** を peer pytest の disposable state として誤帰属しないようにする #2364 の merge commit cc5e3633d3992c0ff9ea99691a15332f39930179 がリポジトリに存在する(git show で存在確認。本リポジトリは force-push/rebase を禁止する branch protection 下の単一 main であるため、履歴に存在する = 現在の HEAD の ancestor であることを意味する)
  • AC2(手動確認、詳細は Notes for Reviewer): canonical main root から registry-defined preflight.run を本 Issue(調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369)に対して一度だけ実行し、inner preflight(workflow_start_entry.py 経由の実際の preflight 実行)が起動される
  • AC3: 本 Issue の focused pytest VC(test_independent_pytest_process_writes_real_pytest_cache_and_is_permitted / test_pytest_cache_cold_start_temp_dir_race_is_permitted)が exit code 0 で完了し、executor output に unauthorized_write_path が存在しない
  • AC4(手動確認、詳細は Notes for Reviewer): canary 前後で tracked / staged repository content に差分がない
  • AC5(手動確認、詳細は Notes for Reviewer): PASS / FAIL / INCONCLUSIVE、tested HEAD、command ID、executor exit code、STATUS、NEXT_ACTION、関連 blocker、stdout/stderr が本 Issue のコメントに記録されている

Verification Commands

# AC1
# baseline-expect: pass
$ git show --no-patch --format=%H cc5e3633d3992c0ff9ea99691a15332f39930179

# AC2
# baseline-expect: pass
$ true

# AC3
# baseline-expect: pass
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_independent_pytest_process_writes_real_pytest_cache_and_is_permitted scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_pytest_cache_cold_start_temp_dir_race_is_permitted -q

# AC4
# baseline-expect: deferred
$ git diff --quiet HEAD

# AC5
# baseline-expect: pass
$ true

Allowed Paths

Stop Conditions

  • Outcome / Scope / AC が検索可能な形で記載されていない場合は即停止
  • Allowed Paths 外への書き込みを試みた場合は即停止
  • 権限不足(permission denied)により操作が完了できない場合は即停止
  • 成果物の書き込みに失敗した場合(I/O エラー等)は即停止
  • 判定が INCONCLUSIVE の場合、自動的に FAIL または follow-up Issue 化として扱わない(再現性と 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526 との因果が確認できた場合のみ follow-up を起票する)

Handoff Contract

Notes for Reviewer

  • 判定は PASS / FAIL / INCONCLUSIVE の三値。GitHub auth/rate limit、wrong branch/checkout、merge commit 不在、capability request 不正、permission/runtime/dependency 環境不良、inner preflight 未起動などは INCONCLUSIVE とし、FAIL として自動的に follow-up Issue 化しない。
  • 結果コメントは新しい schema/validator/publisher を作らず、fenced YAML(result / tested_head_sha / required_merge_commit / required_merge_is_ancestor / target_issue / command_id / executor_exit_code / inner_preflight_invoked / status / next_action / unauthorized_write_path_observed / tracked_tree_changed)と実際の stdout/stderr で十分である。
  • canary 実行中に regression が発見された場合は、本 Issue のスコープを超えるため別途 follow-up 実装 Issue を起票すること。
  • AC2(手動確認): preflight.run(command ID: preflight.run、呼び出しコマンド LOOP_PLANNED_OPERATIONS_JSON='[{"phase":"canary_verification","actor_role":"orchestrator","operation":"preflight_run_self_canary","requires_mutation":false}]' uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py --command-id preflight.run --issue-number 2369 --repo squne121/loop-protocol、.claude/skills/issue-refinement-loop/scripts/command_registry.py で定義、mutation: false / network_effect: github_read_only、内部的に workflow_start_entry.py を起動)は VC preflight allowlist(git read-only サブコマンドと pytest 限定)の対象外の自動化スクリプト実行であるため、Verification Commands 節の VC としては自動実行できない($ true はプレースホルダ)。LOOP_PLANNED_OPERATIONS_JSON の env var 宣言を省略すると workflow_start_entry.py の capability-request gate(実装: issue-refinement-loop の Step 0 で workflow capability preflight をSubAgent起動前に実行する #2311 / PR feat: canonical preflight.run に workflow capability preflight gate を配線する #2320 / PR fix: preflight.run の blocked/malformed 経路の stdout を compact line grammar へ統一 #2328)により CapabilityRequestError: planned_operations_missing で STATUS: blocked(exit code 2)となり inner preflight に到達しないため、必ず上記の宣言を付けて実行すること。 実行者がこのコマンドを1回実行し、inner preflight が起動したことを exit code・STATUS/NEXT_ACTION 出力から目視確認すること。
  • AC4(手動確認): git diff --quiet HEAD は baseline-expect: deferred により自動実行を保留している。canary 実行前後で tracked/staged repository content に差分がないことは、実行者が canary 実行の直前・直後にこのコマンド(または git status --porcelain)を手動で実行し、比較すること。
  • AC5(手動確認): $ true はプレースホルダであり、自動検証コマンドを持たない。実行者が本 Issue への結果コメント(PASS/FAIL/INCONCLUSIVE、tested HEAD、command ID、exit code、STATUS、NEXT_ACTION、stdout/stderr を含む)投稿を目視で確認すること。

Source

Activity

  1. added
    phase/research
    state/queued
    agent/research
    on Aug 28, 2026
  2. squne121 commented on Aug 28, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES — contract_update_required / reframe_in_place

    Issue #2369 の目的自体は妥当です。PR #2364 はマージ済みで、runtime guard 修正を canonical control-plane 上で一度確認する価値があります。しかし、現在の契約をそのまま実行すると、canary が false-green になるか、進行中の Issue #2339 を不必要に変更する可能性が高いため、実行前にリフレームが必要です。現時点では #2369 に canary 結果コメントもありません。

    主要な指摘

    優先度 | Finding | 影響 | 必須修正 -- | -- | -- | -- P0 | Verification Commands が AC1・AC2を検証していない | 実行前から成功する false-green | 実際の pytest VC と canonical preflight 実行結果を検証対象にする P0 | Step 0f の確認に full issue-refinement-loop を使っている | Issue 本文・ラベル・コメント・後続実装を変更し得る | preflight.run で停止する P0 | #2339 は既に PR #2370 で実装中 | live worktree/PR/契約更新と衝突する | #2339 を canary 対象から外す P1 | with_human_context と「相当経路」を同一視している | 何を証明したか不明確になる | command ID を一つに固定する P1 | tested HEAD・merge commit・exit code の記録がない | 古い main や無関係な実行でも PASS 扱いできる | provenance を AC に追加する P1 | PASS/FAIL 二値しかない | auth・rate limit・環境故障を regression と誤分類する | INCONCLUSIVE を追加する P1 | 「読み取り専用」と予定される書き込みが矛盾 | artifact/pytest cache/結果コメントが Stop Condition に触れる | tracked-source 非変更という意味に限定する P2 | regression test の説明が一部古い | 将来の調査で誤った前提になる | コメントだけ小さく修正する

    P0-1 — 現在の Verification Commands は完全に false-green

    現在の AC1・AC2 は、実際には次のコマンドで検証される契約です。

    gh issue view 2339 --json comments
    gh issue view 2339 --json state

    しかし gh issue view は Issue のタイトル・本文・状態・コメントなどを表示するだけのコマンドです。preflight を実行せず、executor の exit code も、pytest VC の成否も、unauthorized_write_path の有無も証明しません。(GitHub CLI)

    さらに #2339 には既に複数のレビューコメントが存在するため、--json comments は canary 未実行でも成功します。--json state も Issue が OPEN であることしか確認しません。THIS_ISSUE_NUMBER についても置換規則が定義されていないため、記載どおりには実行不能です。

    これは AC の不足ではなく、現在の Verification Commands が canary 実行の有無を全く区別できないという blocker です。


    P0-2 — full issue-refinement-loop は canary として破壊範囲が広すぎる

    Issue #2369 が確認したいのは Step 0f の preflight recovery です。それにもかかわらず AC2 は、通常の issue-refinement-loop 全体を実行するよう要求しています。

    現在の issue-refinement-loop は単なる read-only review ではありません。

    • Step 0 で stale label を除去し得る

    • needs-fix なら Step 4 で Issue 本文を書き換える

    • Step 4.5 で child/follow-up Issue を作成し得る

    • approve 時は終了コメントを投稿し、条件次第で直ちに impl-review-loop を起動する

    したがって、Step 0f が通るかを確かめるために full loop を回すのは、診断対象より後段の副作用を大量に含む不適切な canaryです。後段 reviewer や GitHub mutation が失敗した場合、#1526 の regression なのか別の失敗なのかも区別できなくなります。

    preflight.run は registry 上 mutation: false、network_effect: github_read_only と定義されています。canary はこの command ID の完了時点で停止すべきです。


    P0-3 — #2339 は既に canary として失効している

    Issue #2369 は #2339 を候補にしていますが、現在 #2339 には実装 PR #2370 が存在します。PR #2370 は OPEN・Draft で、明示的に Closes #2339 を持ち、複数回の OWNER review/fix_delta まで進行しています。

    つまり、state: open だけでは canary 適格性を判定できません。最低でも次を除外条件にする必要があります。

    - closing PR が存在する
    - active worktree / implementation branch が存在する
    - state/in-progress 相当
    - 最新コメントが実装・fix_delta・review の進行を示す

    #2339 に full loop を再実行すると、既に調整済みの契約を再レビュー・再書換えしたり、PR #2370 と別の implementation handoff を作ったりする可能性があります。


    P1-1 — preflight.run.with_human_context と bare preflight.run は「相当経路」ではない

    Issue は、

    preflight.run.with_human_context(または相当の canonical executor 経路)

    としていますが、現在の実装では両者の上位経路が異なります。

    • bare preflight.run は workflow_start_entry.py を first hop とし、capability preflight を経由する

    • preflight.run.with_human_context は exact anchor comment URL を必要とし、直接 run_refinement_preflight.py 側へ入る

    • human-context profile は --anchor-comment-url と --human-context-comment-url を同一 URL に束縛する

    runtime guard の snapshot 誤検知だけを検証するなら、どちらも共通の skill_runtime_exec.py を通るため一方で足ります。しかし「canonical control-plane 全体」を証明するなら、異なる経路を「相当」として扱うことはできません。

    今回の最小解は、bare preflight.run に固定することです。human-context anchor の provenance、contract patch plan、origin lane といった無関係な変数を canary へ持ち込む必要はありません。


    P1-2 — 「読み取り専用」の意味が不正確

    現在の Allowed Paths は「読み取り専用。リポジトリ変更なし」ですが、予定されている操作には次の書き込みがあります。

    preflight registry 自体も .claude/artifacts/issue-refinement-loop/{active_issue}/ を allowed write root としています。

    したがって、契約は次のように書き換えるべきです。

    tracked source/staged source/Issue #2369 以外の GitHub entity は変更しない。canonical operational artifact、pytest の disposable cache state、#2369 の evidence comment は予定された副作用として許可する。

    「repo 内に一切書かない」と定義すると、今回確認したい修正が許可した .pytest_cache 自体と矛盾します。


    #1526/PR #2364 の技術判断

    PR #2364 の最終的な実装方針は妥当です。マージ後の production code は、次を区別しています。

    • repo-root の .pytest_cache/**:disposable state として除外

    • repo-root 直下の pytest-cache-files-*:pytest の atomic cold-start 用一時ディレクトリとして除外

    • nested sub/pytest-cache-files-* や .pytest_cache2/**:引き続き audit 対象

    • tracked source や .mypy_cache 等:引き続き unauthorized write

    この境界は pytest の実装とも一致します。pytest の cacheprovider は既定で有効で、他の plugin も公開 config.cache API に JSON 化可能な任意の値を保存できます。--cache-clear は通常は不要な cleanup option とされています。(pytestドキュメント)

    また pytest は cache directory を cold-start する際、pytest-cache-files- prefix の一時ディレクトリを同じ親に作成し、supporting files を配置した後で target へ rename します。したがって top-level prefix の狭い例外は必要です。(pytestドキュメント)

    ここに追加の security harness は不要です。 以下は品質を上げるより、個人開発の通常フローを重くします。

    • process-level syscall attribution

    • strace/fanotify 監視

    • cacheprovider の無効化

    • production cache_dir の強制 relocation

    • .pytest_cache 内の key 単位 allowlist

    • cache 用 ledger/receipt/schema validator

    PR #2364 の review でも、必要だったのは exact temp prefix と真の sibling peer test までであり、それ以上の strict attribution は不要と整理されています。

    小さな残存不整合

    production comment は既に正しく、lastfailed は保存値が変化した場合だけ書かれると説明しています。一方、regression test ファイルの冒頭コメントには、現在も nodeids と lastfailed が「unconditionally」書かれるという古い説明が残っています。

    pytest 本体も saved_lastfailed != self.lastfailed の場合だけ cache.set() しています。(pytestドキュメント)

    これは canary blocker ではありません。次に当該 test を触る際、コメントだけ修正すれば十分です。専用 follow-up Issue や追加テストは不要です。


    推奨する最小リフレーム

    1. #2369 自身を canary にする

    進行中の別 Issue を利用せず、#2369 の Verification Commands に focused pytest VC を持たせ、#2369 に対して bare preflight.run を1回実行します。

    これにより、

    • unrelated implementation Issue を変更しない

    • canary の目的・VC・結果を1 Issue に閉じ込められる

    • Step 0f より後を実行しない

    • active PR collision 判定が不要になる

    という利点があります。

    2. Verification Commands の置換案

    現在の gh issue view 3本は削除し、以下の focused regression のみにします。

    uv run --locked pytest \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_independent_pytest_process_writes_real_pytest_cache_and_is_permitted \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_pytest_cache_cold_start_temp_dir_race_is_permitted \
      -q

    この2本は、PR review で問題になった真の sibling pytest process と cold-start temp directory race を直接扱う既存テストです。

    full test file、repo 全体 test、full refinement loop は canary として不要です。

    3. Outcome の置換案

    PR #2364 の merge commit を含む canonical main から、Issue #2369 を対象として registry-defined bare preflight.run を一度実行する。#2369 に記載された focused pytest Verification Command が canonical executor 内で実行され、unauthorized_write_path を発生させず完了し、tested HEAD・command ID・exit code・canonical stdout/stderr・tracked tree delta を含む結果コメントが #2369 に記録された状態を完了とする。Step 0f より後の refinement loop は実行しない。

    4. Acceptance Criteria の置換案

    - [ ] AC1: canary 実行時の `HEAD` が PR #2364 の merge commit
          `cc5e3633d3992c0ff9ea99691a15332f39930179` を ancestor に持つ
    
    • AC2: canonical main root から registry-defined preflight.run
      を Issue #2369 に対して一度だけ実行し、inner preflight が起動される

    • AC3: 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の focused pytest VC が exit code 0 で完了し、
      executor output に unauthorized_write_path が存在しない

    • AC4: canary 前後で tracked / staged repository content に差分がない

    • [ ] AC5: PASS / FAIL / INCONCLUSIVE、tested HEAD、command ID、
      executor exit code、STATUS、NEXT_ACTION、関連 blocker、
      stdout/stderr が #2369 のコメントに記録されている

    PR #2364 の merge commit は cc5e3633d3992c0ff9ea99691a15332f39930179 です。

    5. 結果判定を三値にする

    PASS

    • required merge commit を含む正しい canonical main

    • inner preflight が実際に起動

    • focused pytest VC が成功

    • unauthorized_write_path なし

    • tracked tree delta なし

    FAIL

    • 正しい HEAD と canonical executor 経路で再現

    • pytest VC 実行中に unauthorized_write_path が発生

    • または runtime guard 修正が原因で focused VC が失敗

    INCONCLUSIVE

    • GitHub auth/rate limit

    • wrong branch/wrong checkout/merge commit 不在

    • capability request 不正

    • permission/runtime/dependency 環境不良

    • unrelated contract-readiness failure

    • inner preflight 未起動

    INCONCLUSIVE を FAIL として自動的に follow-up Issue 化してはいけません。再現性と #1526 との因果が確認できた場合だけ follow-up を起票すべきです。

    6. 結果コメントの最小形式

    新しい schema、validator、publisher は作らず、単純な fenced YAML と出力で十分です。

    ## Canonical control-plane canary result

    result: pass | fail | inconclusive
    tested_head_sha: "<sha>"
    required_merge_commit: "cc5e3633d3992c0ff9ea99691a15332f39930179"
    required_merge_is_ancestor: true
    target_issue: 2369
    command_id: preflight.run
    executor_exit_code: 0
    inner_preflight_invoked: true
    status: pass
    next_action: proceed
    unauthorized_write_path_observed: false
    tracked_tree_changed: false</code></pre><pre><code class="language-text">&lt;actual output&gt;</code></pre><hr><h2>Allowed Paths/副作用の推奨定義</h2><pre><code class="language-markdown">## Allowed Effects
    
    - tracked repository files: none
    - staged repository files: none
    - expected local generated state:
      - `.claude/artifacts/issue-refinement-loop/2369/**`
      - `.pytest_cache/**`
      - repo-root `pytest-cache-files-*` transient directories
    - permitted GitHub mutation:
      - Issue #2369 への canary result comment
      - PASS 時の Issue #2369 close
    - forbidden:
      - Issue #2339 その他の Issue 本文・label・comment の変更
      - child/follow-up Issue の自動作成
      - implementation handoff
      - `impl-review-loop` の起動</code></pre><h2>最終結論</h2><p><strong>#2369 は閉じるべき Issue ではなく、実行前にその場でリフレームすべき Issueです。</strong></p><p>最小かつ信頼できる形は、<strong>#2339 と full <code inline="">issue-refinement-loop</code> を契約から外し、#2369 自身の focused pytest VC を bare <code inline="">preflight.run</code> で一度だけ検証すること</strong>です。PR #2364 の実装には追加の security harness を要求せず、canary の証拠能力と副作用境界だけを修正するのが適切です。</p></body></html><!--EndFragment-->
    </body>
    </html>## 判定
    
    **REQUEST_CHANGES — `contract_update_required / reframe_in_place`**
    
    Issue #2369 の目的自体は妥当です。PR #2364 はマージ済みで、`runtime guard` 修正を canonical control-plane 上で一度確認する価値があります。しかし、**現在の契約をそのまま実行すると、canary が false-green になるか、進行中の Issue #2339 を不必要に変更する可能性が高い**ため、実行前にリフレームが必要です。現時点では #2369 に canary 結果コメントもありません。
    
    ## 主要な指摘
    
    | 優先度    | Finding                                          | 影響                                                | 必須修正                                             |
    | ------ | ------------------------------------------------ | ------------------------------------------------- | ------------------------------------------------ |
    | **P0** | Verification Commands が AC1・AC2を検証していない          | 実行前から成功する false-green                             | 実際の pytest VC と canonical preflight 実行結果を検証対象にする |
    | **P0** | Step 0f の確認に full `issue-refinement-loop` を使っている | Issue 本文・ラベル・コメント・後続実装を変更し得る                      | `preflight.run` で停止する                            |
    | **P0** | #2339 は既に PR #2370 で実装中                          | live worktree/PR/契約更新と衝突する                        | #2339 を canary 対象から外す                            |
    | **P1** | `with_human_context` と「相当経路」を同一視している             | 何を証明したか不明確になる                                     | command ID を一つに固定する                              |
    | **P1** | tested HEAD・merge commit・exit code の記録がない        | 古い main や無関係な実行でも PASS 扱いできる                      | provenance を AC に追加する                            |
    | **P1** | PASS/FAIL 二値しかない                                 | auth・rate limit・環境故障を regression と誤分類する           | `INCONCLUSIVE` を追加する                             |
    | **P1** | 「読み取り専用」と予定される書き込みが矛盾                            | artifact/pytest cache/結果コメントが Stop Condition に触れる | tracked-source 非変更という意味に限定する                     |
    | **P2** | regression test の説明が一部古い                         | 将来の調査で誤った前提になる                                    | コメントだけ小さく修正する                                    |
    
    ---
    
    ## P0-1 — 現在の Verification Commands は完全に false-green
    
    現在の AC1・AC2 は、実際には次のコマンドで検証される契約です。
    
    ```bash
    gh issue view 2339 --json comments
    gh issue view 2339 --json state
    

    しかし gh issue view は Issue のタイトル・本文・状態・コメントなどを表示するだけのコマンドです。preflight を実行せず、executor の exit code も、pytest VC の成否も、unauthorized_write_path の有無も証明しません。([GitHub CLI]1)

    さらに #2339 には既に複数のレビューコメントが存在するため、--json comments は canary 未実行でも成功します。--json state も Issue が OPEN であることしか確認しません。THIS_ISSUE_NUMBER についても置換規則が定義されていないため、記載どおりには実行不能です。

    これは AC の不足ではなく、現在の Verification Commands が canary 実行の有無を全く区別できないという blocker です。


    P0-2 — full issue-refinement-loop は canary として破壊範囲が広すぎる

    Issue #2369 が確認したいのは Step 0f の preflight recovery です。それにもかかわらず AC2 は、通常の issue-refinement-loop 全体を実行するよう要求しています。

    現在の issue-refinement-loop は単なる read-only review ではありません。

    • Step 0 で stale label を除去し得る
    • needs-fix なら Step 4 で Issue 本文を書き換える
    • Step 4.5 で child/follow-up Issue を作成し得る
    • approve 時は終了コメントを投稿し、条件次第で直ちに impl-review-loop を起動する

    したがって、Step 0f が通るかを確かめるために full loop を回すのは、診断対象より後段の副作用を大量に含む不適切な canaryです。後段 reviewer や GitHub mutation が失敗した場合、#1526 の regression なのか別の失敗なのかも区別できなくなります。

    preflight.run は registry 上 mutation: false、network_effect: github_read_only と定義されています。canary はこの command ID の完了時点で停止すべきです。


    P0-3 — #2339 は既に canary として失効している

    Issue #2369 は #2339 を候補にしていますが、現在 #2339 には実装 PR #2370 が存在します。PR #2370 は OPEN・Draft で、明示的に Closes #2339 を持ち、複数回の OWNER review/fix_delta まで進行しています。

    つまり、state: open だけでは canary 適格性を判定できません。最低でも次を除外条件にする必要があります。

    - closing PR が存在する
    - active worktree / implementation branch が存在する
    - state/in-progress 相当
    - 最新コメントが実装・fix_delta・review の進行を示す
    

    #2339 に full loop を再実行すると、既に調整済みの契約を再レビュー・再書換えしたり、PR #2370 と別の implementation handoff を作ったりする可能性があります。


    P1-1 — preflight.run.with_human_context と bare preflight.run は「相当経路」ではない

    Issue は、

    preflight.run.with_human_context(または相当の canonical executor 経路)

    としていますが、現在の実装では両者の上位経路が異なります。

    • bare preflight.run は workflow_start_entry.py を first hop とし、capability preflight を経由する

    • preflight.run.with_human_context は exact anchor comment URL を必要とし、直接 run_refinement_preflight.py 側へ入る

    • human-context profile は --anchor-comment-url と --human-context-comment-url を同一 URL に束縛する

    runtime guard の snapshot 誤検知だけを検証するなら、どちらも共通の skill_runtime_exec.py を通るため一方で足ります。しかし「canonical control-plane 全体」を証明するなら、異なる経路を「相当」として扱うことはできません。

    今回の最小解は、bare preflight.run に固定することです。human-context anchor の provenance、contract patch plan、origin lane といった無関係な変数を canary へ持ち込む必要はありません。


    P1-2 — 「読み取り専用」の意味が不正確

    現在の Allowed Paths は「読み取り専用。リポジトリ変更なし」ですが、予定されている操作には次の書き込みがあります。

    • canonical preflight artifact
    • pytest の .pytest_cache/**
    • cold-start 時の一時的な pytest-cache-files-*
    • #2369 への結果コメント
    • PASS 時に close するなら Issue state の変更

    preflight registry 自体も .claude/artifacts/issue-refinement-loop/{active_issue}/ を allowed write root としています。

    したがって、契約は次のように書き換えるべきです。

    tracked source/staged source/Issue #2369 以外の GitHub entity は変更しない。canonical operational artifact、pytest の disposable cache state、#2369 の evidence comment は予定された副作用として許可する。

    「repo 内に一切書かない」と定義すると、今回確認したい修正が許可した .pytest_cache 自体と矛盾します。


    #1526/PR #2364 の技術判断

    PR #2364 の最終的な実装方針は妥当です。マージ後の production code は、次を区別しています。

    • repo-root の .pytest_cache/**:disposable state として除外

    • repo-root 直下の pytest-cache-files-*:pytest の atomic cold-start 用一時ディレクトリとして除外

    • nested sub/pytest-cache-files-* や .pytest_cache2/**:引き続き audit 対象

    • tracked source や .mypy_cache 等:引き続き unauthorized write

    この境界は pytest の実装とも一致します。pytest の cacheprovider は既定で有効で、他の plugin も公開 config.cache API に JSON 化可能な任意の値を保存できます。--cache-clear は通常は不要な cleanup option とされています。([pytestドキュメント]2)

    また pytest は cache directory を cold-start する際、pytest-cache-files- prefix の一時ディレクトリを同じ親に作成し、supporting files を配置した後で target へ rename します。したがって top-level prefix の狭い例外は必要です。([pytestドキュメント]3)

    ここに追加の security harness は不要です。 以下は品質を上げるより、個人開発の通常フローを重くします。

    • process-level syscall attribution
    • strace/fanotify 監視
    • cacheprovider の無効化
    • production cache_dir の強制 relocation
    • .pytest_cache 内の key 単位 allowlist
    • cache 用 ledger/receipt/schema validator

    PR #2364 の review でも、必要だったのは exact temp prefix と真の sibling peer test までであり、それ以上の strict attribution は不要と整理されています。

    小さな残存不整合

    production comment は既に正しく、lastfailed は保存値が変化した場合だけ書かれると説明しています。一方、regression test ファイルの冒頭コメントには、現在も nodeids と lastfailed が「unconditionally」書かれるという古い説明が残っています。

    pytest 本体も saved_lastfailed != self.lastfailed の場合だけ cache.set() しています。([pytestドキュメント]3)

    これは canary blocker ではありません。次に当該 test を触る際、コメントだけ修正すれば十分です。専用 follow-up Issue や追加テストは不要です。


    推奨する最小リフレーム

    1. #2369 自身を canary にする

    進行中の別 Issue を利用せず、#2369 の Verification Commands に focused pytest VC を持たせ、#2369 に対して bare preflight.run を1回実行します。

    これにより、

    • unrelated implementation Issue を変更しない
    • canary の目的・VC・結果を1 Issue に閉じ込められる
    • Step 0f より後を実行しない
    • active PR collision 判定が不要になる

    という利点があります。

    2. Verification Commands の置換案

    現在の gh issue view 3本は削除し、以下の focused regression のみにします。

    uv run --locked pytest \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_independent_pytest_process_writes_real_pytest_cache_and_is_permitted \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_pytest_cache_cold_start_temp_dir_race_is_permitted \
      -q
    

    この2本は、PR review で問題になった真の sibling pytest process と cold-start temp directory race を直接扱う既存テストです。

    full test file、repo 全体 test、full refinement loop は canary として不要です。

    3. Outcome の置換案

    PR #2364 の merge commit を含む canonical main から、Issue #2369 を対象として registry-defined bare preflight.run を一度実行する。#2369 に記載された focused pytest Verification Command が canonical executor 内で実行され、unauthorized_write_path を発生させず完了し、tested HEAD・command ID・exit code・canonical stdout/stderr・tracked tree delta を含む結果コメントが #2369 に記録された状態を完了とする。Step 0f より後の refinement loop は実行しない。

    4. Acceptance Criteria の置換案

    - [ ] AC1: canary 実行時の `HEAD` が PR #2364 の merge commit
          `cc5e3633d3992c0ff9ea99691a15332f39930179` を ancestor に持つ
    
    - [ ] AC2: canonical main root から registry-defined `preflight.run`
          を Issue #2369 に対して一度だけ実行し、inner preflight が起動される
    
    - [ ] AC3: #2369 の focused pytest VC が exit code 0 で完了し、
          executor output に `unauthorized_write_path` が存在しない
    
    - [ ] AC4: canary 前後で tracked / staged repository content に差分がない
    
    - [ ] AC5: PASS / FAIL / INCONCLUSIVE、tested HEAD、command ID、
          executor exit code、STATUS、NEXT_ACTION、関連 blocker、
          stdout/stderr が #2369 のコメントに記録されている
    

    PR #2364 の merge commit は cc5e3633d3992c0ff9ea99691a15332f39930179 です。

    5. 結果判定を三値にする

    PASS

    • required merge commit を含む正しい canonical main
    • inner preflight が実際に起動
    • focused pytest VC が成功
    • unauthorized_write_path なし
    • tracked tree delta なし

    FAIL

    • 正しい HEAD と canonical executor 経路で再現
    • pytest VC 実行中に unauthorized_write_path が発生
    • または runtime guard 修正が原因で focused VC が失敗

    INCONCLUSIVE

    • GitHub auth/rate limit
    • wrong branch/wrong checkout/merge commit 不在
    • capability request 不正
    • permission/runtime/dependency 環境不良
    • unrelated contract-readiness failure
    • inner preflight 未起動

    INCONCLUSIVE を FAIL として自動的に follow-up Issue 化してはいけません。再現性と #1526 との因果が確認できた場合だけ follow-up を起票すべきです。

    6. 結果コメントの最小形式

    新しい schema、validator、publisher は作らず、単純な fenced YAML と出力で十分です。

    ## Canonical control-plane canary result
    
    ```yaml
    result: pass | fail | inconclusive
    tested_head_sha: "<sha>"
    required_merge_commit: "cc5e3633d3992c0ff9ea99691a15332f39930179"
    required_merge_is_ancestor: true
    target_issue: 2369
    command_id: preflight.run
    executor_exit_code: 0
    inner_preflight_invoked: true
    status: pass
    next_action: proceed
    unauthorized_write_path_observed: false
    tracked_tree_changed: false
    
    Canonical stdout / stderr
    <actual output>
    
    ```

    Allowed Paths/副作用の推奨定義

    ## Allowed Effects
    
    - tracked repository files: none
    - staged repository files: none
    - expected local generated state:
      - `.claude/artifacts/issue-refinement-loop/2369/**`
      - `.pytest_cache/**`
      - repo-root `pytest-cache-files-*` transient directories
    - permitted GitHub mutation:
      - Issue #2369 への canary result comment
      - PASS 時の Issue #2369 close
    - forbidden:
      - Issue #2339 その他の Issue 本文・label・comment の変更
      - child/follow-up Issue の自動作成
      - implementation handoff
      - `impl-review-loop` の起動
    

    最終結論

    #2369 は閉じるべき Issue ではなく、実行前にその場でリフレームすべき Issueです。

    最小かつ信頼できる形は、#2339 と full issue-refinement-loop を契約から外し、#2369 自身の focused pytest VC を bare preflight.run で一度だけ検証することです。PR #2364 の実装には追加の security harness を要求せず、canary の証拠能力と副作用境界だけを修正するのが適切です。

  3. squne121 commented on Aug 28, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 完了報告

    判定: approved(go)

    OWNER のレビューコメント(issuecomment-5453078382、REQUEST_CHANGES — contract_update_required / reframe_in_place)を起点に、契約を全面リフレームしました。

    反映した変更点

    1. Canary 対象の変更: 既に実装 PR feat: extension_surface_policy_matcher の has_match:false 経路を project-local unclassified candidate perimeter 限定の non-blocking advisory に再設計する #2370(Closes #2339)が進行中の Issue 実装: extension_surface_policy_matcher の has_match:false 経路に unknown_surface_policy セマンティクスを実装する #2339 を canary 対象から外し、本 Issue(調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369)自身を canary にした。
    2. 実行範囲の縮小: 副作用の大きい full issue-refinement-loop の代わりに、mutation: false / network_effect: github_read_only の registry-defined bare preflight.run に限定した。
    3. false-green だった Verification Commands の修正: gh issue view 系(canary 実行有無を検証しない)を、AC ごとに個別に主張を検証するコマンド(git show による merge commit 存在確認、focused pytest regression、git diff --quiet HEAD 等)に差し替えた。
    4. PASS/FAIL 二値から PASS/FAIL/INCONCLUSIVE の三値判定へ変更。
    5. Semantic design review(Step 2.5)で検出・修正した2件の blocker:
      • AC1/AC2/AC4/AC5 の VC が全て同一コマンドの使い回しで各 AC の主張を検証していなかった問題 → AC ごとの個別コマンドへ差し替え。
      • preflight.run の呼び出しコマンドが workflow_start_entry.py の capability-request gate(LOOP_PLANNED_OPERATIONS_JSON の env var 宣言必須)を欠いており、そのまま実行すると CapabilityRequestError: planned_operations_missing で inner preflight に到達しない問題 → 実際にコマンドを実行して再現・修正後の成功を確認した上で、必須の env var 宣言を Outcome / AC2 / Notes for Reviewer に追記。
    6. VC 実行エンジン(baseline_vc_preflight.py)との整合: # trivially_pass: 注記(静的 lint 専用)は実行エンジンに認識されないため、# baseline-expect: pass|deferred へ統一。AC4 はリポジトリ作業ディレクトリの無関係な既存汚染で false failure したため deferred(手動の前後比較に委譲)とした。

    検証

    • 最終本文で run_root_review_pipeline.py produce: VERDICT: approve、blocker 0件。
    • baseline_vc_preflight.py --strict の実ドライラン: 全 AC が go(AC1/AC2/AC3/AC5: expected_pass、AC4: skipped/deferred)。
    • Step 2.5 semantic design review を3回実施(初回で false-green VC を検出、2回目で capability-gate 未宣言を検出、3回目で assessment: clear に収束)。
    • 各修正はコントロールプレーンが独立に codebase 調査・実コマンド実行で裏付け済み。

    最終 body_sha256: sha256:b7c7d0f328558883bbe66370b77fda6f69c8bc4435ee52a5358755821b38d82f

    本 Issue(research/standalone、parent_issue: none)は refinement のみが対象であり、impl-review-loop への自動 handoff は行いません。実際の canary 実行(preflight.run の起動・pytest VC 実行・結果コメント記録)は本 Issue の Outcome/Handoff Contract に記載された手順に従い、別途実行者が行ってください。

  4. squne121 commented on Aug 28, 2026

    @squne121
    OwnerAuthor

    確認した限り、#2369 は現在も OPEN の research-only Issue で、契約はすでにリフレーム済みです。実施すべき本線は「#2369 自身に対して bare preflight.run を一度 canary 実行し、focused pytest・inner preflight・tracked/staged delta・stdout/stderr を証跡化し、PASS なら閉じる」です。直前の issue-refinement-loop も approved (go) まで収束しており、実 canary だけが未実施です。

    前提となる PR #2364 はマージ済みで、merge commit は cc5e3633d3992c0ff9ea99691a15332f39930179 です。最終 head 4be62fb... の ci run #5491 は success まで到達しています。 調査時点の main は f6ad7a09... まで進んでおり、以前 #2369 の canary 候補から除外された #2339 の PR #2370 も既にマージ済みです。

    また現在の preflight.run は引き続き workflow_start_entry.py を first hop にしており、LOOP_PLANNED_OPERATIONS_JSON が欠けると inner preflight より前で fail-close する契約も現存します。 Claude Code の現行ドキュメント上、サブエージェントは Agent tool で起動し、foreground 実行ならメイン会話は完了までブロックされるため、下のプロンプトでは foreground 起動と完了待ちを明示しています。([Claude]1)

    そのまま Claude Code に渡せる形です。

    対象リポジトリ: squne121/loop-protocol
    対象 Issue: #2369

    あなたはこの作業の root orchestrator です。このメッセージはオペレーターからの明示的な実行承認です。追加の人間承認を待たず、Issue #2369 の完了条件を満たすところまで自律的に進めてください。

    調査時点では #2369 は issue_kind: research / change_kind: research-only で、既に issue-refinement-loop が approved (go) まで完了しています。目的は PR #2364 / Issue #1526 の runtime guard 修正を canonical control-plane で実証することです。PR #2364 は merge 済みで、required merge commit は cc5e3633d3992c0ff9ea99691a15332f39930179。ただし、この情報を固定前提にはせず、開始時に GitHub・origin/main・Issue 本文・コメント・CI・関連 PR を live に再取得してください。

    停止して人間に確認してよい条件は次の2種類だけです。 破壊的操作が必要になる場合、または秘密情報を扱う必要が生じる場合です。破壊的操作とは、force push、履歴書き換え、未保存作業を失う reset --hard、無関係な branch/tag/Issue/PR/file の削除、branch protection の強制 bypass、未マージ作業を含む worktree の強制削除などを指します。秘密情報とは token、password、private key、GitHub Secrets、credential、.env 等の secret value の閲覧・表示・コピー・送信を指します。通常の scoped edit、worktree/branch 作成、commit/push、Issue/PR/comment 作成、テスト、CI rerun、review 対応、通常の squash merge、完了済み Issue の close は承認済みであり停止理由にしないでください。secret をログや GitHub comment に露出させないでください。

    1. 最初に live state を再構築する。 git fetch --prune origin を行い、canonical repo root、current branch、HEAD、origin/main、worktree 一覧、tracked/staged/untracked state を確認してください。Issue 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の最新本文・全コメント、Issue 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526、PR fix: runtime guard が repo-root .pytest_cache/** を peer pytest の disposable state として誤帰属しないようにする #2364 の diff・コメント・review・CI、調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 を参照する PR、関連する open PR、現在の main の CI 状況も確認してください。PR fix: runtime guard が repo-root .pytest_cache/** を peer pytest の disposable state として誤帰属しないようにする #2364 の merge commit が現在の canonical main の ancestor であることを git merge-base --is-ancestor 等で実証してください。ローカル main が単純に behind なら --ff-only で更新して構いません。既存作業を失う操作は禁止です。

    2. ここで必ず foreground SubAgent を起動し、その完了を待つ。 Claude Code の Agent tool を使い、read-only の Explore 系 SubAgent に「調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369、実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526、PR fix: runtime guard が repo-root .pytest_cache/** を peer pytest の disposable state として誤帰属しないようにする #2364、関連コメント、CI、command registry、workflow_start_entry.py、skill_runtime_exec.py、focused pytest tests、現在の main との差分」を独立調査させてください。background に投げっぱなしにせず foreground で完了を待ち、返却 report を読んでから次へ進んでください。メインスレッド自身の調査結果と矛盾があれば、実データで解消してください。部分結果だけで canary を開始しないでください。

    3. 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の現契約を authoritative として canary 前提を確認する。 既に有効な canary result comment が存在して PASS 済みなら重複実行せず証跡を検証して close 状態まで確認してください。未実施なら続行してください。canary 前の tracked/staged state を保存し、少なくとも git status --porcelain=v1、tracked diff、cached diff の before state を後で同一条件比較できる形で保持してください。既存の無関係な dirty state を勝手に消さないでください。

    4. focused regression を実行する。 現在の Issue 本文を再確認した上で、少なくとも以下を canonical main 上で実行してください。

    uv run --locked pytest \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_independent_pytest_process_writes_real_pytest_cache_and_is_permitted \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_pytest_cache_cold_start_temp_dir_race_is_permitted \
      -q

    exit code と出力を保存してください。unauthorized_write_path の有無を明示的に確認してください。

    1. canonical bare preflight.run canary を実行する。 Issue 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の最新本文に別の canonical command が明示されていない限り、次をそのまま使用してください。LOOP_PLANNED_OPERATIONS_JSON を省略してはいけません。
    LOOP_PLANNED_OPERATIONS_JSON='[{"phase":"canary_verification","actor_role":"orchestrator","operation":"preflight_run_self_canary","requires_mutation":false}]' \
    uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py \
      --command-id preflight.run \
      --issue-number 2369 \
      --repo squne121/loop-protocol

    executor exit code、STATUS、NEXT_ACTION、BLOCKERS、stdout、stderr を保存し、workflow_start_entry.py を経て inner preflight が実際に起動したことを確認してください。初回 canary の結果を都合よく再分類するために無意味な再実行を繰り返さないでください。

    1. canary 後の repository state を before state と比較する。 tracked/staged content に canary 起因の delta がないことを確認してください。.claude/artifacts/issue-refinement-loop/2369/**、.pytest_cache/**、repo-root の pytest-cache-files-* など契約で許可された generated/disposable state は tracked source delta と混同しないでください。

    2. 独立した判定 SubAgent を foreground で起動し、必ず完了を待つ。 ここまでの raw evidence を渡し、PASS / FAIL / INCONCLUSIVE のどれに該当するか独立判定させてください。メインスレッドは report を鵜呑みにせず Issue AC と突き合わせて最終判定してください。PASS は required merge が ancestor、focused pytest 成功、inner preflight 起動、unauthorized_write_path なし、tracked/staged canary delta なしの場合です。FAIL は正しい canonical main と canonical executor 経路で 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526 修正に因果的な regression が再現した場合だけです。auth/rate-limit、wrong checkout、capability-request 不正、dependency/runtime failure、inner preflight 未起動等は INCONCLUSIVE であり、コード regression と捏造しないでください。

    3. PASS なら PR は作らず 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 を完了させる。 Issue 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 に ## Canonical control-plane canary result コメントを投稿し、fenced YAML で result、tested_head_sha、required_merge_commit、required_merge_is_ancestor、target_issue、command_id、executor_exit_code、inner_preflight_invoked、status、next_action、unauthorized_write_path_observed、tracked_tree_changed を記録してください。その後に実際の stdout/stderr を、secret を含まないことを確認した上で添付してください。AC1〜AC5 がすべて成立したことを再確認し、Issue 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 を completed として close してください。コード変更や「念のため」の追加 harness は不要です。

    4. INCONCLUSIVE ならコード変更を捏造しない。 非破壊的に解消可能な auth/rate-limit/runtime/dependency/checkout 問題は自律的に調査・再確認してください。ただし secret の取得や branch protection bypass はしないでください。最終的にも外部条件により証明不能なら、調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 に INCONCLUSIVE の raw evidence を残し、Issue は open のままにしてください。これは人間承認待ちではなく、検証不能という事実上の terminal result として報告してください。

    5. FAIL なら canary phase と修正 phase を分離し、その後は人間承認なしで修正を完遂する。 まず 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 に FAIL 証跡を記録してください。調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の canary 契約中は実装や impl-review-loop を混在させません。その canary phase を終了した後、このオペレーター指示を別フェーズの明示 authorization として扱い、foreground の root-cause SubAgent を起動して完了を待ってください。再現性と 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526/runtime-guard との因果を確認できた場合のみ、canonical Issue 作成手順で standalone implementation follow-up Issue を作成してください。新 Issue には 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 / 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526 / PR fix: runtime guard が repo-root .pytest_cache/** を peer pytest の disposable state として誤帰属しないようにする #2364 を provenance として結び、Outcome、In/Out of Scope、AC、Verification Commands、Allowed Paths、Delivery Rule を具体化してください。過剰な security harness は追加せず、通常ワークフローの有用性と回帰防止に必要な最小修正を優先してください。

    その follow-up Issue を issue-refinement-loop で実装可能な契約まで収束させ、続けて repo-native の impl-review-loop / implement-issue を使用して dedicated worktree/branch で実装してください。実装・検証・PR review はそれぞれ SubAgent に委譲し、各 SubAgent の終了を必ず待ってから次の Step に進んでください。PR は最初 Draft で構いませんが、本文に必ず Closes #<follow-up Issue番号> を含め、#2369 / #1526 / PR #2364 も関連資料として記載してください。

    PR 作成後は current head に対する focused tests、関連 regression、プロジェクト標準検証、GitHub Actions を確認し、review comments・inline threads・REQUEST_CHANGES をすべて回収してください。妥当な blocker は修正し、再テスト・push・再レビューを反復してください。CI failure が変更と無関係な一時的外部障害ならコードを歪めず rerun 等で evidence を取り直してください。reviewer が APPROVE、blocker が空、current-head CI が必要条件を満たし、live mergeability が正常になるまで終了しないでください。

    通常の repo 手順に「PR は人間がマージ判断」とある場合でも、このセッションではこのオペレーター指示が追加承認に相当します。追加確認は要求しないでください。branch protection を bypass せず、force merge せず、リポジトリで許可される通常の merge method を使ってください。現状 squash merge のみが許可されているなら squash merge を使用してください。follow-up PR を merge 後、Closes #N により follow-up Issue が閉じたことを確認し、閉じていなければ AC 達成を確認して正常 close してください。

    1. 修正が入った場合は最後に 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の目的へ戻る。 merge 済みの最新 origin/main を canonical root に反映し、調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 の focused regression と bare preflight.run を改めて実行してください。最初の FAIL と修正後 PASS を両方 provenance として残し、最終 canary が PASS した場合だけ 調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 に最終結果コメントを投稿して AC1〜AC5 を再確認し、調査: #1526 runtime guard 修正の canonical control-plane recovery を canary 検証する #2369 を close してください。

    作業終了時は、最終状態として tested main SHA、#2369 の verdict/state、作成した follow-up Issue/PR(存在する場合)、merge SHA、実行した主要テスト、CI 状態、処理した review blocker、残存 blocker の有無を簡潔に報告してください。「人間の確認待ち」で止めないでください。停止が許されるのは冒頭で定義した破壊的操作または秘密情報が必要な場合だけです。

    この Issue については、正常系なら「実装→PR」には進まず canary PASS → コメント → close が正解です。コード変更フローは、canonical canary が再現可能な FAIL を出した場合だけ起動するようにしてあります。

  5. squne121 commented on Aug 28, 2026

    @squne121
    OwnerAuthor

    Canonical control-plane canary result

    result: PASS
    tested_head_sha: f6ad7a09a92bdc24270407423a2c59119cdd05ac
    required_merge_commit: cc5e3633d3992c0ff9ea99691a15332f39930179
    required_merge_is_ancestor: true
    target_issue: 2369
    command_id: preflight.run
    executor_exit_code: 0
    inner_preflight_invoked: true
    status: pass
    next_action: proceed
    unauthorized_write_path_observed: false
    tracked_tree_changed: false

    AC1: merge commit ancestor確認

    $ git merge-base --is-ancestor cc5e3633d3992c0ff9ea99691a15332f39930179 HEAD && echo IS_ANCESTOR=true
    IS_ANCESTOR=true
    $ git log --oneline -1 cc5e3633d3992c0ff9ea99691a15332f39930179
    cc5e3633 fix: runtime guard が repo-root .pytest_cache/** を peer pytest の disposable state として誤帰属しないようにする (#2364)
    

    現在の main HEAD (f6ad7a09a92bdc24270407423a2c59119cdd05ac) は origin/main と同一(ahead/behind 0)。

    AC2: canonical bare preflight.run canary 実行

    実行コマンド:

    LOOP_PLANNED_OPERATIONS_JSON='[{"phase":"canary_verification","actor_role":"orchestrator","operation":"preflight_run_self_canary","requires_mutation":false}]' \
    uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py \
      --command-id preflight.run \
      --issue-number 2369 \
      --repo squne121/loop-protocol
    

    executor exit code: 0

    stdout:

    STATUS: pass
    NEXT_ACTION: proceed
    MUST_READ:
      - .claude/skills/issue-refinement-loop/scripts/command_registry.py
      - scripts/agent-guards/skill_runtime_exec.py
    COMMANDS_JSON: [{"id":"run_preflight","argv":["uv","run","python3",".claude/skills/issue-refinement-loop/scripts/workflow_start_entry.py","--issue-number","2369","--repo","squne121/loop-protocol"],"shell":false,"cwd_policy":"repo_root","stdin_contract":"none","stdout_contract":"unknown","timeout_seconds":120,"mutation":false}]
    COMMANDS_DISPLAY:
      display: [run_preflight] uv run python3 .claude/skills/issue-refinement-loop/scripts/workflow_start_entry.py --issue-number 2369 --repo squne121/loop-protocol
    ARTIFACT:
      planner_input: /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refinement-loop/2369/planner_input.json
      raw_issue_snapshot: /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refinement-loop/2369/raw_issue_snapshot.json
      refinement_preflight_result_v1: /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refinement-loop/2369/refinement_preflight_result_v1.json
    

    stderr: 空。

    inner preflight (workflow_start_entry.py) の実起動は、生成された refinement_preflight_result_v1.json の内容(live Issue #2369 本文の original_updated_at: "2026-08-28T18:52:24Z" を実際に取得・処理、planner_exit_code: 0, blockers: [], status: pass)と、3成果物のファイルサイズ・mtimeが実行時刻と一致することで実証済み。

    AC3: focused pytest regression

    $ uv run --locked pytest \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_independent_pytest_process_writes_real_pytest_cache_and_is_permitted \
      scripts/agent-guards/tests/test_skill_runtime_exec_pytest_cache.py::test_pytest_cache_cold_start_temp_dir_race_is_permitted \
      -q
    ..                                                                       [100%]
    2 passed in 1.66s
    

    exit code: 0。stdout/stderr全体を検索しても unauthorized_write_path は出現しない。

    AC4: canary前後の tracked/staged 差分比較

    canary実行前(git status --porcelain=v1):

     M .claude/artifacts/context-mode/deny-negative-test.json
    ?? .claude/.investigation-context-2360.md
    

    (この2件は本canary着手前から存在した無関係な既存 dirty state)

    canary実行後(git status --porcelain=v1):

     M .claude/artifacts/context-mode/deny-negative-test.json
    ?? .claude/.investigation-context-2360.md
    

    git diff HEAD --stat / git diff --cached --stat も canary前後で完全に同一。canary実行による新規 tracked/staged 差分はゼロ。.claude/artifacts/issue-refinement-loop/2369/** 配下の生成物は Issue 契約上の許可された local generated state であり、tracked git内容には影響しない。

    独立判定

    read-only の独立判定 SubAgent(本セッションの調査結果とは別プロセス)が上記 raw evidence を精査し、AC1〜AC4 すべて PASS、causal regression なしと判定した。

    結論

    AC1〜AC5 すべて成立(AC5は本コメント自体で充足)。PR #2364(#1526 修正)は canonical main・canonical control-plane 経路(registry-defined bare preflight.run → workflow_start_entry.py)で正しく機能しており、.pytest_cache 関連の unauthorized_write_path 誤帰属は再現しない。本 Issue を completed として close する。

  6. squne121 commented on Aug 28, 2026

    @squne121
    OwnerAuthor

    AC1〜AC5 すべて PASS。canonical control-plane canary(registry-defined bare preflight.run → workflow_start_entry.py)で PR #2364(#1526 修正)が正しく機能していることを実証したため close します。詳細は上記の canary result コメントを参照。

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/researchphase/researchstate/queued

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions