Repository navigation
feat(#2197): control-plane remote default-ref observe/fetch/pin/verify プロトコル - #2482
Conversation
…/pin/verify protocol Adds the closed S1=observe(ref1,oid1) -> fetch(ref1) -> F=private-ref readback -> (optional one) S2 remote-binding state machine on top of the existing #2378 closed Git executor seam in skill_runtime_exec.py: - `CONTROL_PLANE_CANONICAL_REMOTE_URL`: the sole code-owned production remote authority (derived from the already-trusted `TRUSTED_REPO_SLUG`), never sourced from `origin` or a caller argument. - `parse_control_plane_default_ref_symref`: a focused, single-purpose parser for `git ls-remote --exit-code --symref <literal> HEAD` (not a generic ls-remote/symref parsing framework). - `run_control_plane_remote_default_ref_binding`: the S1/fetch/F/S2 state machine. Refetch never happens; a changed symbolic target between fetch and S2 is always fail-closed. Every exception raised once the fetch has succeeded triggers a builder-owned best-effort CAS delete of that exact private ref before propagating; a cleanup failure itself is reported as `ControlPlaneUnavailable`, chained from the underlying error. - `run_control_plane_git_read_worktree_status_porcelain` / `run_control_plane_git_remove_existing_detached_locked_worktree`: narrow wrappers around the existing closed operation-kind surface (not a new generic status/force-remove API). worktree_bootstrap_exec.py adds the fixed dedicated worktree crash/rerun recovery (`recover_or_create_fixed_control_plane_worktree`: absent->create, verified identity+same OID->reuse, verified identity+clean+different OID->controlled refresh, dirty->fail-closed, unknown owner/linkage mismatch->fail-closed) and the session/context-manager seam (`run_control_plane_preflight_session`) that holds the existing #2198 process-scoped flock guard from before the first remote operation through worktree handoff and bounded terminal cleanup, releasing only after that completes. The session entry point has no caller-overridable remote URL parameter (AC1): it always binds to the fixed canonical literal. #2199 (actual child execution/dispatch) and #2200 (stdout/artifact validation, confinement, E2E ordering) remain out of scope. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Preview URLPreview removed (PR #2482 closed). |
impl-review-loop: Step 4 PR Review (iteration 0)Mergeability: implementation content verified sound (AC1-AC10 behavioral review, 94/94 tests, ruff clean, Allowed Paths compliant, required CI passed, no #2199/#2200/schema leakage). Evidence Check: 独立で AC1-AC10 の実装意味論を再確認済み。S1/fetch/F/S2 state machine、CAS cleanup on all terminal exception paths、flock guard lifetime、fixed worktree crash/rerun recovery、いずれも実装で確認。 Blockers: PR body に必須セクションが欠落( Non-blockers: なし。 verdict: REQUEST_CHANGES
reviewed_head_sha: "17eae85d59d6dda9d63bc66be17467833bb1ad45"
blockers:
- "PR body missing required section `## 受け入れ条件の達成状況` with per-AC (AC1-AC10) [x]/[ ] + rationale; existing `## Checks` section groups results by AC range but is not a per-AC coverage table."
- "PR body missing required section `## 検証コマンド結果` (VC results recorded under a differently-named `## Checks` heading instead)."
- "PR body missing required section `## Allowed Paths 遵守`."
- "Issue #2197 Runtime Verification Applicability decision is `immediate`, but PR body has no dedicated `## Runtime Verification Evidence` section (only prose under `## Checks`)."
warnings: [] |
impl-review-loop: Step 4 PR Review (iteration 1, PR body hygiene fix 後の再レビュー)Mergeability: 実装内容は iteration 0 で既に健全性確認済み(head SHA 不変)。今回は PR body 4セクション(受け入れ条件の達成状況 / 検証コマンド結果 / Allowed Paths 遵守 / Runtime Verification Evidence)の追加を再確認。 Evidence Check: Blockers: なし。 Non-blockers: なし。 verdict: APPROVE
reviewed_head_sha: "17eae85d59d6dda9d63bc66be17467833bb1ad45"
blockers: []
warnings: [] |
結論PR #2482 は P0 — dirty + same accepted OID がそのまま reuse されるIssue #2197 AC5 は、fixed worktree が dirty なら OID に関係なく fail-closed、same accepted OID の reuse は verified dedicated identity を前提とする契約です。 しかし実装は さらに追加テスト 修正は小さくできます。 にしてください。新規テストは remote を advance せず、worktree に untracked file を1個置いた状態で同じ P0 — fetch が成功した後の hooks cleanup failure で private ref がリークするこちらの方が構造的です。Issue #2197 AC4 は特に、fetch 成功後、semantic executor / hooks directory cleanup を含む、caller に private ref を返せない全 terminal exception path で builder-owned CAS cleanup を行うことを要求しています。 現在 一方 Python の仕様上、 したがって次の経路が成立します。 実際、remote-binding の Git の refspec は ここは単にテストを足すだけでは駄目です。resource acquisition と compensation の ownership を同じレイヤーに置く必要があります。おすすめは、post-command cleanup failure を「Git command が成功済みか」「operation/private-ref は何か」という内部情報を保持する typed exception として上へ運ぶか、fetch builder 自身が nonce ref を最後まで所有して cleanup まで完結する構造です。raw argv や caller-selected ref を開く必要はありません。 回帰テストでは real bare fixture の fetch を成功させた後、trusted hooks dir の が空であることを確認すべきです。 P1 — cleanup 用に予約した時間を private-ref cleanup が使えない
ところが そのため典型的な timeout path は、 となります。 worktree add rollback には既に ここは新しい大規模 harness は不要です。通常 operation 用の
|
| 優先度 | Finding | 判定 |
|---|---|---|
| P0 | same-OID の dirty worktree が reused される |
merge blocker |
| P0 | fetch 成功後の hooks-dir cleanup failure で nonce private ref を回収不能 | merge blocker |
| P1 | cleanup_reserve_seconds を CAS cleanup 自身が使用できない |
merge 前修正推奨 |
| P1 | existing worktree の locked / prunable state を recovery が確認しない |
#2199 を hard dependency とするなら follow-up 可 |
| P2 | git status が optional index lock を取る |
workflow friction を減らす小改善 |
P0 — dirty + same accepted OID がそのまま reuse される
Issue #2197 AC5 は、fixed worktree が dirty なら OID に関係なく fail-closed、same accepted OID の reuse は verified dedicated identity を前提とする契約です。
しかし実装は current_head を読み、current_head == accepted_oid なら git status を実行する前に即 reused を返しています。docstring 自身は “dirty ... regardless of OID match” と書いているため、コメントと実装も矛盾しています。
さらに追加テスト test_given_verified_identity_but_dirty_when_recovered_then_fails_closed_regardless_of_oid は名前とは異なり、dirty にした後で remote に新 commit を push し、different-OID + dirty しか検証していません。same-OID + dirty の負例が抜けています。
修正は小さくできます。read_worktree_status_porcelain() と dirty 判定を current_head == accepted_oid 分岐より前へ移し、
verified linkage
→ read HEAD
→ read status
→ dirtyなら常に fail
→ HEAD == accepted OID なら reuse
→ otherwise controlled refresh
にしてください。新規テストは remote を advance せず、worktree に untracked file を1個置いた状態で同じ accepted_oid を渡し fixed_worktree_dirty を期待すれば十分です。Git の porcelain status はスクリプト向けに安定した形式です。 (Git)
P0 — fetch が成功した後の hooks cleanup failure で private ref がリークする
こちらの方が構造的です。Issue #2197 AC4 は特に、fetch 成功後、semantic executor / hooks directory cleanup を含む、caller に private ref を返せない全 terminal exception path で builder-owned CAS cleanup を行うことを要求しています。
現在 run_control_plane_git_fetch_default_ref() は nonce private_ref を内部生成し、_execute_semantic_git() が正常に戻った後で初めて caller に返します。
一方 _execute_semantic_git() は Git subprocess の結果を return しようとした後、finally で shutil.rmtree(hooks_dir) を実行し、これが失敗すると GitProtocolProcessGroupCleanupFailed("git_subprocess_hooks_cleanup_failed") を送出します。
Python の仕様上、return で関数を抜ける途中でも finally は実行され、そこで例外が発生すれば正常 return には到達しません。 ([Python documentation]2)
したがって次の経路が成立します。
nonce private_ref R を生成
→ git fetch refs/heads/main:R が exit 0
→ R はローカル ref として更新済み
→ hooks_dir の rmtree が失敗
→ fetch helper が R を返さず例外
→ remote-binding 側の `private_ref = ...` 代入が完了しない
→ しかも CAS cleanup 用 try ブロックは fetch 呼び出し「後」から開始
→ R の名前を知る owner が消える
実際、remote-binding の try: は run_control_plane_git_fetch_default_ref() が返った後から始まっています。
Git の refspec は <src>:<dst> の <dst> を local ref として更新します。また git update-ref -d <ref> <old-oid> は expected OID が一致した場合だけ削除するため、現在目指している CAS cleanup 方式自体は正しいです。問題は CAS に必要な nonce ref の ownership が例外境界を跨げていないことです。 ([Git]3) ([Git]4)
ここは単にテストを足すだけでは駄目です。resource acquisition と compensation の ownership を同じレイヤーに置く必要があります。おすすめは、post-command cleanup failure を「Git command が成功済みか」「operation/private-ref は何か」という内部情報を保持する typed exception として上へ運ぶか、fetch builder 自身が nonce ref を最後まで所有して cleanup まで完結する構造です。raw argv や caller-selected ref を開く必要はありません。
回帰テストでは real bare fixture の fetch を成功させた後、trusted hooks dir の shutil.rmtree だけを意図的に失敗させ、終了後に
refs/loop-protocol/control-plane/default-ref/*
が空であることを確認すべきです。
P1 — cleanup 用に予約した時間を private-ref cleanup が使えない
GitProtocolDeadline.execution_seconds() は残り時間が cleanup_reserve_seconds 以下になると command spawn を拒否し、それより多い場合も remaining - cleanup_reserve だけを実行可能時間として返します。つまり reserve は正常系 operation から確保されています。
ところが run_control_plane_git_delete_private_ref_cas() も普通の _execute_semantic_git(... deadline=deadline) を通ります。cleanup operation 自身にも同じ reserve 判定が適用されます。
そのため典型的な timeout path は、
read/S2/etc が cleanup reserve 境界まで時間を消費
→ GitProtocolDeadlineExhausted
→ except で CAS cleanup 開始
→ CAS cleanup も execution_seconds()
→ 「cleanup reserve を守るため」CAS command を spawn できない
→ cleanup_failed
→ private ref 残存
となります。
worktree add rollback には既に _rollback_deadline() という compensation 専用 lane が存在するのに、private-ref cleanup には相当する lane がありません。
ここは新しい大規模 harness は不要です。通常 operation 用の execution_seconds() と、既に予約済みの残時間を使える bounded cleanup mode を明示的に分けるのが自然です。cleanup が original deadline を無制限に延長する必要はありません。
locked state は production wiring 前には埋めるべき
親 #2190 の worktree identity contract は detached: true に加えて locked: true、prunable: false を要求しています。Issue #2199 は dedicated identity probe と production profile migration を担当し、#2200 が最終統合検証を担当する設計です。
一方、現行 worktree_catalog.py は porcelain の detached は記録しますが、locked / prunable を schema に取り込んでいません。
Git は worktree list --porcelain で locked / prunable を明示的に提供します。また lock は metadata の prune を防ぎ、move/delete も防ぎます。 worktree add --lock は add と lock の間の race を避ける公式手段です。 (Git)
これは #2199 を #2482 の production consumer に対する hard dependency とするなら、#2482 単体の merge blockerにはしなくてよいと判断します。ただし #2199 の identity probe に locked && !prunable の実証を明示的に入れるべきです。現在の #2482 の recover_or_create_fixed_control_plane_worktree() 単体を「verified dedicated identity」と表現するのは少し強すぎます。
workflow friction を減らす小改善
dirty check の git status --porcelain --untracked-files=all は正しい選択ですが、Git は通常 status 時に index の stat cache を refresh して書き戻すため、background/script 利用では index lock contention が起こり得ます。Git 公式もその用途では git --no-optional-locks status を検討するよう案内しています。 (Git)
この dedicated lane では頻度も低いため merge blockerではありません。ただ、個人開発で「ハーネスのせいで作業が止まる」ことを減らしたいなら、closed operation の固定形を git --no-optional-locks status ... にするのは相性が良い改善です。
既存の古い指摘について
以前 #2197 の敵対的レビューで挙がっていた「lazy fetch」「子プロセスの timeout cleanup」「raw argv / builder 不足」は、今回あらためて blocker としては挙げません。#2378 がそれらを前提修正する Issue として完了しており、現コードにも GIT_NO_LAZY_FETCH=1、capability/promisor handling、closed semantic operation、process-group supervisor が入っています。
また #2199 の actual production-profile wiring、#2200 の artifact confinement を #2482 に前倒しで詰め込むことも勧めません。今回見つかった P0 はどちらも #2197 自身が明文化済みの contract を最小修正で満たすためのもので、security subsystem や追加の重い harness を導入する話ではありません。
推奨アクションは、#2482 を Draft のまま維持し、まず (1) dirty check の順序修正+same-OID regression、(2) fetch-side-effect 後の hooks cleanup exceptionでも nonce ref ownershipを失わない構造化、(3) cleanup reserve を CAS cleanup が実際に使える deadline lane、の3点を同一 PR で直して再レビューです。 これらが通れば、#2199/#2200 へ進める設計としてはかなり筋が良いです。
|
推奨は、Issue #2197 を対象に 今回のコメントは、旧 PR #2482 は現在 open / draft / unmerged なので、新規PRを作らず既存PRを継続し、修正・commit・push・CI・PR本文更新・必要なら Ready 化まで自動許可、merge/auto-merge だけ禁止という境界が適切です。 そのまま Claude Code の新規セッションに投入するなら、以下を推奨します。 を trusted human context / OWNER review context として扱い、Issue #2197 / PR #2482 に対する 目的は、指定コメントで発見された blocker を live repository state 上で検証・修正し、実装 → 独立検証 → PR review のループを、人間承認なしで「マージ操作の直前」まで完遂することです。 最重要方針
自律実行を許可する操作以下について途中の人間承認を求めず実行してよい。
ただし、以下は実行禁止。ここだけは人間判断を残すこと。
最終状態は 「全 blocker 解消、current-head verification pass、required CI pass、current-head PR review APPROVE、mergeability を確認済みで、人間が merge を押すだけ」 とする。 SubAgent 実行ルール
root/main thread 自身が implementation / test / review を全部代行して、SubAgent を省略してはならない。 Step 1
SubAgent を background で起動した場合、その完了通知・最終 report を必ず待つこと。 Step 2実装担当とは分離した test-runner の作業完了を必ず待ち、実際の終了状態と VC adjudication を取得してから Step 4 に進むこと。 Step 4current HEAD を対象に pr-reviewer の完了を必ず待つこと。 Step 5canonical router で verdict を処理する。
SubAgent が単に SubAgent からさらに nested SubAgent を起動させないこと。 今回の優先 fix_delta指定 human-context comment の finding を、最低限以下の順で独立検証すること。 P0-1: same-OID dirty worktree reuse
という Issue #2197 AC5 の意味論になっているか確認する。 現在も cleanliness check より 必須 regression test:
既存の different-OID + dirty test だけで AC5 を満たしたことにしない。 P0-2: fetch 成功後 hooks-dir cleanup failure による nonce private-ref leak以下の exception boundary を重点的に検証する。 Issue #2197 AC4 は、fetch side effect 成功後、caller へ private ref を返せない terminal exception path でも builder-owned CAS cleanup が成立することを要求している。 resource acquisition と compensation ownership を同じレイヤーで閉じる最小設計にすること。 候補はあくまで候補であり、現在コードを調査して最小かつ明確な方法を選ぶこと。
raw argv authority、caller-selected ref、generic Git API を再導入してはならない。 必須 regression test:
P1: cleanup reserve が private-ref CAS cleanup に利用できない問題
通常 operation のため確保した 問題が成立する場合、
を明確に分離する。 既存の 新規 daemon、lease、TTL、cleanup retention、大規模 harness は追加しない。 必須テストでは、通常 operation が cleanup-reserve boundary まで deadline を消費した後でも、予約済み bounded cleanup lane により CAS deletion が試行・成功できることを示す。 非 blocker の扱いlocked / prunableexisting worktree の #2199 を hard dependency として安全に defer できるなら、#2482 の scope を広げてまで実装しない。 ただし PR #2482 の説明で「verified dedicated identity」と過剰主張している場合は、必要な文言修正を行う。
|
…leanup through terminal exception paths adversarial re-review found: (1) recover_or_create_fixed_control_plane_worktree reused a dirty fixed worktree whenever HEAD already matched accepted_oid, since the dirty check only ran on the different-OID branch (AC5 requires dirty -> fail closed regardless of OID match); (2) a fetch success followed by a hooks-dir cleanup failure lost ownership of the nonce private ref before the outer remote-binding protocol's own CAS cleanup could ever run, since _execute_semantic_git's finally-block failure overrides a successful return (AC4); (3) that same CAS cleanup was denied by the very cleanup_reserve_seconds boundary reserved for it once normal protocol time was exhausted down to that boundary. run_control_plane_git_fetch_default_ref now owns its own private ref's cleanup lifecycle end to end for every exception inside the fetch call, and _rollback_deadline is generalized to _cleanup_deadline and reused to give cleanup-class operations (CAS delete, worktree-add rollback) their own bounded lane instead of sharing the reserve they are meant to spend.
impl-review-loop: Step 4 PR Review (iteration 2, human-context adversarial finding への fix_delta 後の再レビュー)Mergeability: P0-1(same-OID dirty worktree reuse順序バグ)、P0-2(fetch成功後hooks-dir cleanup失敗によるnonce private ref leak)、P1(CAS cleanupがcleanup_reserve境界に阻まれる設計欠陥)の3件を、独立に control flow を line-by-line で再確認済み。全て genuine fix であり cosmetic ではない。 Evidence Check: 98/98 tests passed(独立再実行)、ruff clean、Allowed Paths gate: ok / violations: []。required CI は初回スナップショットで stale cancelled run による false failure を検出したが、fresh rerun 完了後に再確認し全 required checks passed。 Blockers: なし。 Non-blockers:
verdict: APPROVE
reviewed_head_sha: "2a40838717c11af91d2773f2a9fb1b9d1237ffaa"
blockers: []
warnings:
- "Initial wait_ci_checks.py read showed python-test FAILURE due to a stale cancelled run superseded by a fresh rerun at the identical head SHA; re-verification after the fresh run completed showed all required checks passed."
- "mergeStateStatus is BEHIND (base branch has moved ahead); not a reviewer blocker per policy."
- "run_control_plane_git_fetch_default_ref's fallback exception message uses 'fetch_failed:{exc}' prefix even in the pure post-success-cleanup-failure case; cosmetic wording only." |
impl-review-loop: Step 4 PR Review (iteration 3, update_branch 後の再レビュー)Mergeability: Evidence Check: 98/98 tests passed(独立再実行、 Blockers: なし。 Non-blockers: PR body の「対象 head SHA」記載が iteration 2 の head( verdict: APPROVE
reviewed_head_sha: "50acb9554540da54aa2b85d80b6cb77b5375bc5f"
blockers: []
warnings:
- "PR body still references head SHA 2a40838717c11af91d2773f2a9fb1b9d1237ffaa (iteration-2 head) in the '対象 head SHA' line and Notes/Runtime-Evidence sections, stale after the mechanical update_branch merge to 50acb9554540da54aa2b85d80b6cb77b5375bc5f. Substantive content (diff, AC evidence, VC results, Allowed Paths) is byte-for-byte unchanged and independently re-verified at the current head." |
Summary
この PR は Issue #2197 の実装です。#2378 の closed Git executor seam(
run_control_plane_git_fetch_default_ref()等)と #2198 の process-scopedflockguard の上に、canonical remote の default-ref を一度 observe し、一度だけ nonce private ref へ fetch して readback するS1=observe(ref1, oid1) -> fetch(ref1) -> F=private-ref readback -> (accept if F==oid1, else bounded one-shot S2)の remote-binding protocol を実装します。scripts/agent-guards/skill_runtime_exec.py:CONTROL_PLANE_CANONICAL_REMOTE_URL(TRUSTED_REPO_SLUGから導出する code-owned な唯一の production remote authority)、parse_control_plane_default_ref_symref(git ls-remote --exit-code --symref <literal> HEAD専用の focused parser)、run_control_plane_remote_default_ref_binding(S1/fetch/F/S2 state machine。fetch 成功後の全 terminal exception path で builder-owned CAS cleanup を試行し、cleanup 失敗はControlPlaneUnavailableとして fail-closed)、およびread_worktree_status_porcelain/remove_existing_detached_locked_worktreeの narrow wrapper(既存 closed operation kind の再利用であり、generic な force-remove/status API ではない)を追加しました。scripts/agent-ops/worktree_bootstrap_exec.py: fixed dedicated worktree(.claude/worktrees/control-plane-preflight)の crash/rerun recovery(recover_or_create_fixed_control_plane_worktree: absent なら create、verified identity かつ same OID なら reuse、verified identity かつ clean かつ different OID なら controlled refresh、dirty なら fail-closed、unknown owner/linkage mismatch なら fail-closed)と、既存の 実装: control-plane preflight lifecycle 用 git-common-dir スコープ排他ロックを実装する #2198 process-scopedflockguard を first remote operation より前から worktree handoff・bounded terminal cleanup まで保持して release する session/context-manager seam(run_control_plane_preflight_session)を追加しました。session entry point には caller が remote URL を上書きできるパラメータを設けていません(AC1: caller arbitrary URL を受け付けない)。#2199(actual child execution/dispatch)と#2200(stdout/artifact validation、confinement、E2E release ordering)は Out of Scope のまま変更していません。WORKTREE_CATALOG_ENTRY_V1のスキーマも変更していません。recover_or_create_fixed_control_plane_worktreeが、fixed worktree の HEAD がaccepted_oidと一致する場合に、dirty working tree のチェックより前にstate: reusedを返してしまう欠陥(AC5 は OID 一致有無に関わらず dirty なら fail-closed を要求)。(2) fetch 成功後に trusted hooks-dir cleanup が失敗すると、_execute_semantic_gitのfinally節の例外が正常な return を上書きしてしまい、run_control_plane_git_fetch_default_refの呼び出し元が private ref 名を一度も知らないまま terminal exception path へ抜けてしまう欠陥(AC4 の builder-owned CAS cleanup 保証を破る)。あわせて、CAS cleanup 自体がcleanup_reserve_secondsの境界に阻まれて実行できなくなる P1 の関連欠陥(cleanup 用に確保した reserve がそのまま cleanup 自身を拒否してしまう)も修正しました。run_control_plane_git_fetch_default_refは自身が生成した private ref のクリーンアップを呼び出し内で完結させるようになり、_rollback_deadlineは_cleanup_deadlineとして汎化し、CAS delete と worktree-add rollback の両方が bounded cleanup-scoped deadline を共有するようになりました。受け入れ条件の達成状況
対象 head SHA:
2a40838717c11af91d2773f2a9fb1b9d1237ffaaCONTROL_PLANE_CANONICAL_REMOTE_URLは code-owned constant のみで、session entry point に remote URL 上書きパラメータが無いことをコードで確認済み。test_control_plane_worktree_remote_binding.py(33 passed)に caller arbitrary URL 拒否のケースを含む。parse_control_plane_default_ref_symrefは HEAD symref 1件・full OID 1件のみ受理し、unborn/direct HEAD、symref 不在、重複、malformed、invalid symbolic target、abbreviated/invalid OID を fail-closed で拒否する focused parser。同 test ファイルの parser ケースで検証。run_control_plane_remote_default_ref_bindingは S1/fetch(1回)/F/one-shot S2 state machine を実装し、F==oid1accept、S2.ref==ref1 && S2.oid==Fのみ accept、それ以外はcontrol_plane_unavailable。refetch なし・symbolic target change fail-closed を同 test ファイルで検証。ControlPlaneUnavailableとして fail-closed。iteration 2 でrun_control_plane_git_fetch_default_ref自身が fetch 呼び出し内で発生した terminal exception(trusted hooks-dir cleanup 失敗を含む)に対しても private ref の cleanup を own するように修正し、CAS cleanup がcleanup_reserve_seconds境界に阻まれず実行できるよう_cleanup_deadline(旧_rollback_deadlineを汎化)を適用しました。同 test ファイルの exception-path cleanup ケース(hooks-dir cleanup 失敗単独/cleanup-of-cleanup 失敗の両方)で検証。recover_or_create_fixed_control_plane_worktreeは absent→create、verified+same OID→reuse、verified+clean+different OID→controlled refresh、dirty→fail-closed、unknown owner/linkage mismatch→fail-closed を実装。generic force-remove API は未使用。iteration 2 で dirty チェックを same-OID reuse 判定より前に移動し、HEAD がaccepted_oidと一致していても dirty なら fail-closed になるよう修正しました(test_given_verified_identity_same_oid_but_dirty_when_recovered_then_fails_closed)。同 test ファイルの recovery ケースで検証。flockguard を first remote operation 前にassert_heldし、body/remote binding/private-ref cleanup/worktree handoff/exception cleanup の間 held を維持。foreign/released/key mismatch/ownership-token mismatch は fail-closed。test_control_plane_worktree_concurrency.py(6 passed)で検証。control_plane_unavailableで fail-closed とし、cleanup retention や daemon を残さず bounded terminal cleanup 完了後に guard を release。actual child dispatch / artifact validation は本 PR に含まれない(#2199/#2200 に温存)。test_control_plane_worktree_remote_binding.pyの cleanup-then-release ケースで検証。run_control_plane_git_fetch_default_ref()、process-scopedflockguard)とtest_worktree_bootstrap_exec.py(10 passed)の focused test を source/development prerequisite として使用し、GitHub Issue state には依存していない。scripts/agent-guards/skill_runtime_exec.pyの追加関数は既存 builder focused testscripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py(49 passed)が最小 Allowed Paths 内で closed executor seam を消費する形で検証している。pnpm typecheck/pnpm lint/pnpm test/pnpm buildと model-routing test は本 Issue の local proof に含めていない(CI green merge condition として別途評価)。Allowed Paths 内の変更 Python は CI の Ruff gate で quality check する。検証コマンド結果
Issue #2197 の
## Verification Commandsに記載された実体は以下の 4 コマンドに集約される(AC ごとに重複参照)。すべて head2a40838717c11af91d2773f2a9fb1b9d1237ffaaで実行し PASS。合計 98/98 passed(iteration 1 の 94 + iteration 2 で追加した 4 件の regression test)。加えて
uv run ruff check(対象ファイルすべて 0 件)を実行済み。Allowed Paths 遵守
本 PR で実際に変更したファイルは以下の 4 件で、いずれも Issue #2197 の
## Allowed Pathsに列挙された範囲内である。scripts/agent-guards/skill_runtime_exec.pyscripts/agent-guards/tests/test_skill_runtime_control_plane_exec.pyscripts/agent-ops/worktree_bootstrap_exec.pytests/agent_ops/test_control_plane_worktree_remote_binding.pyAllowed Paths に列挙された
scripts/agent-ops/worktree_catalog.py・tests/agent_ops/test_worktree_bootstrap_exec.py・tests/agent_ops/test_control_plane_worktree_concurrency.pyは本 PR では変更していない(許可範囲内で未使用のまま)。Allowed Paths 外のファイル変更は無い。Runtime Verification Evidence(動作検証証跡)
Issue #2197 の
## Runtime Verification Applicabilityはdecision: immediateであり、execution_environmentは「git binary、Python、pytest、Ruff を備えた local checkout。canonical production remote へ接続せず、test fixture の bare repository を用いる」と定義されている。artifact_requirementsは pytest/Ruff の終了状態を local proof とし、fixture OID・private-ref・stdout の persistent log/artifact 保存までは要求していない。2a40838717c11af91d2773f2a9fb1b9d1237ffaauv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q→ exit 0, 33 passed(AC1-AC5, AC7 の remote-binding state machine・fixed worktree recovery を isolated bare-origin fixture で検証。iteration 2 で fault-injection ベースの新規 regression test 4 件を追加)uv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q→ exit 0, 6 passed(AC6 の process-scopedflockguard lifetime を検証)uv run --locked pytest tests/agent_ops/test_worktree_bootstrap_exec.py -q→ exit 0, 10 passed(AC8 の current-main capability evidence を検証)uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -q→ exit 0, 49 passed(AC9/AC10 の closed executor seam consumption を検証)uv run ruff check→ exit 0(対象ファイルすべて 0 件)skip_conditions(git binary が存在しない場合のみ exit 77 で SKIP)には該当せず、今回はローカルに git が存在したため全 focused pytest を実行して PASS した。fallback_policy(remote identity・guard ownership・private-ref cleanup・worktree identity のいずれかを確認できなければcontrol_plane_unavailableで fail-closed とし、fallback 成功を許容しない)は state machine 実装(run_control_plane_remote_default_ref_binding、run_control_plane_preflight_session)に組み込まれており、上記 pytest の exception-path ケースで検証している。Checks
uv run --locked pytest tests/agent_ops/test_control_plane_worktree_remote_binding.py -q(AC1-AC5, AC7 — 33 passed)uv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q(AC6 — 6 passed)uv run --locked pytest tests/agent_ops/test_worktree_bootstrap_exec.py -q(AC8 — 10 passed)uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -q(AC9/AC10 — 49 passed)uv run ruff check(対象ファイルすべて 0 件)Issue #2197 の
## Runtime Verification Applicabilityはdecision: immediateですが、実行環境は「git binary、Python、pytest、Ruff を備えた local checkout」であり、canonical production remote へは接続せず isolated bare-origin test fixture のみで検証します(skip_conditions: git binary が存在しない場合のみ exit 77)。今回はローカルに git が存在したため上記の focused pytest(実 fixture ベースの behavioral test を含む)を実際に実行し、証跡として PASS しています。pnpm typecheck/pnpm lint/pnpm test/pnpm buildと model-routing test は AC10 により本 Issue の local AC proof の対象外です(CI green merge condition としては別途評価されます)。詳細な per-AC 内訳は## 受け入れ条件の達成状況と## 検証コマンド結果を参照してください。Schema Change Applicability
WORKTREE_BOOTSTRAP_RESULT_V1/WORKTREE_CATALOG_ENTRY_V1schema は変更していません。追加したのは新しい関数・定数のみで、既存 consumer が受け取る入出力契約に変更はありません。Schema Consumer Inventory
N/A
reason: schema_change ではなく、既存 consumer の before/after 差分も発生しないためです。
Safety Claim Matrix
N/A
reason: 変更対象ファイル(
scripts/agent-guards/skill_runtime_exec.py、scripts/agent-ops/worktree_bootstrap_exec.py、関連 test)はtransport/permission/sandbox/auth/mcp/.claude/skills//.github/workflows/のいずれの safety-sensitive path pattern にも該当しません。Notes
17eae85d59d6dda9d63bc66be17467833bb1ad45のまま)。2a40838717c11af91d2773f2a9fb1b9d1237ffaaです。WORKTREE_CATALOG_ENTRY_V1へのlocked/prunablefield 追加、git statusの--no-optional-locks化、実装: control-plane preflight を dedicated linked worktree の identity probe と command class 分離で 4 production profile へ移行する #2199/実装: control-plane preflight の artifact confinement と #2190 全AC最終検証を実装する #2200 関連の変更はいずれも本 iteration の Non-blocker として対応していません。