Repository navigation
feat: add control-plane lifecycle mutex - #2395
Conversation
Derive a fixed common-dir-scoped advisory mutex from trusted Git state and verify its process lifecycle boundaries. Co-Authored-By: Claude Code <[email protected]>
Preview URLPreview removed (PR #2395 closed). |
Name the existing AC1, AC4, and AC5 coverage so the independent iteration selectors execute their contract coverage without changing the live verification commands. Co-Authored-By: Claude Code <[email protected]>
敵対的レビュー結果verdict: REQUEST_CHANGES
disposition: fix_in_place
confidence: high
reviewed_head: 0478d87315b9caab292abca38525eabf19d40a66
blocking_findings:
- P0-1: fork 子プロセスに継承された FD が holder death 後も mutex を保持する
- P1-1: caller の absolute deadline が git-common-dir 導出へ伝播していない
- P1-2: AC3・AC4・AC6 のテスト証拠が一部 false-green
scope_expansion_required: false
new_dependency_required: false確認中にmain取り込みコミットが追加され、現行headは スコープ判断#2197のremote observe/fetch/pin/verifyやconsumer orderingをこのPRに含めていない点は正しいです。 #2198はmutex primitiveだけを所有し、実際の P0-1:
|
Close inherited child mutex FDs without unlocking the parent, propagate the public deadline to common-dir resolution, and make focused evidence observe contention, ownership boundaries, and same-process FD cleanup. Co-Authored-By: Claude Code <[email protected]>
|
現状では、実装を追加するより、PR #2395 の current-head に対して 前回は head また、 したがって、Claude Code には「 PR #2395 / Issue #2198 の 対象:
目的は、PR #2395 を current head に対して再検証・再レビューし、マージ直前の状態まで持っていくことです。 重要:
現在までの既知状態参考情報であり、必ず live state を再取得してください。
ただし、上記 SHA・CI・mergeability は stale になり得ます。 今回の明示的なローカル操作承認
必要に応じて
例: これらの ephemeral local file の作成について人間承認を再要求しないでください。 ただし、
という条件を守ってください。 実行方針まず 既存セッションの記憶だけを信用せず、以下を live 取得してください。
PR bodyに書かれている Step 2: fresh verificationcurrent head に対して Issue #2198 の live Verification Commands を、そのまま literal command として渡してください。 test-runner は read-only とし、実装変更、commit、push、PRコメント投稿をさせないでください。 SubAgent 完了後:
前回実行済み test-runner result が current binding tuple に完全一致し、canonical loop state から正当に再利用できる場合だけ再利用して構いません。 CIStep 4 の前に current reviewed head に対する required CI を待ってください。 canonical helper: を使用し、必ず current head SHA を binding してください。 現在 fresh CI が進行中である可能性があります。 head が途中で変化した場合は stale evidence として Step 2 へ戻ってください。 Step 4: current-head PR review
pr-reviewer には以下を実値で渡してください。
特に OWNER review の以下を current implementation で再判定してください。
また、修正によって新しい blocker が入っていないかもレビューしてください。 ただし #2197 が所有する pr-reviewer 完了後も、 Step 5 routinglive mergeability と reviewer verdict を canonical
implementation-worker を起動した場合も必ず作業完了まで待ってください。 PR body cleanupcurrent-head verification/review が APPROVE まで通った場合、PR body に残っている古い
等の evidence binding が current head と不整合なら、最終 current-head evidence に合わせて PR body を更新してください。 ただし過去の証拠を current head で実行したように捏造せず、fresh verification の実測結果だけを書くこと。
停止条件通常の実装・テスト・commit・push・PR body/comment 更新・CI待機・一時ファイル作成について人間承認を求めないでください。 ただし次の場合のみ停止して明示的に報告してください。
単なる advisory artifact、session manifest、launch ledger、materialization convenience file の不足は停止条件にしないでください。 最終報告最終的に以下を簡潔に報告してください。
PRのmergeは実行せず、merge直前で停止してください。 このプロンプトなら、前回止まった |
Summary
fork()子では at-fork callback が継承された lifecycle mutex FD の子側コピーだけを plainclose()し、LOCK_UNを実行せず copied guard/registry state を無効化します。git-common-dir導出へそのまま伝播し、期限切れでは Git subprocess を起動しません。Checks
Issue #2198 の live Verification Commands を現行修正 commit で実行しました。
uv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q -k canonical_common_dir_and_fixed_key—1 passed, 5 deselecteduv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q -k competing_processes_by_common_dir—1 passed, 5 deselecteduv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q -k bounded_timeout_and_explicit_release—1 passed, 5 deselecteduv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q -k owner_token_foreign_released_or_key_mismatch—1 passed, 5 deselecteduv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q -k holder_death_reacquire_and_primary_invariant—1 passed, 5 deselecteduv run --locked pytest tests/agent_ops/test_control_plane_worktree_concurrency.py -q -k context_manager_exception_and_fd_close—1 passed, 5 deselectedpnpm typecheck— passpnpm lint— passpnpm test—112 files / 1887 testspassedpnpm build— passuv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py -q—24 passeduv run --locked ruff check scripts/agent-ops/worktree_bootstrap_exec.py tests/agent_ops/test_control_plane_worktree_concurrency.py— pass受け入れ条件の達成状況
現行 head
8c22eec0ac57157171d227ed64d659aec9510151で、上記 Checks に記録した focused pytest(各1 passed, 5 deselected)に対応する Issue #2198 の node-ID VC は次のとおりです。tests/agent_ops/test_control_plane_worktree_concurrency.py::test_given_primary_or_linked_worktree_when_acquired_then_canonical_common_dir_and_fixed_keytests/agent_ops/test_control_plane_worktree_concurrency.py::test_given_competing_primary_and_linked_processes_when_acquired_then_competing_processes_by_common_dirtests/agent_ops/test_control_plane_worktree_concurrency.py::test_given_busy_lock_when_owner_releases_after_observed_contention_then_bounded_timeout_and_explicit_releasetests/agent_ops/test_control_plane_worktree_concurrency.py::test_given_guard_when_foreign_released_or_key_tampered_then_owner_token_foreign_released_or_key_mismatchtests/agent_ops/test_control_plane_worktree_concurrency.py::test_holder_death_reacquire_and_primary_invariant_with_long_lived_fork_childtests/agent_ops/test_control_plane_worktree_concurrency.py::test_context_manager_exception_and_fd_close_for_same_process_timeoutRuntime Verification Evidence(動作検証の証跡)
Issue #2198 は
decision: immediateです。isolated temporary Git repositories と実 process を使い、artifact の代替成功や SKIP を使わずに focused pytest を実行しました。assert_held()とrelease()は拒否され、その後の external contender も parent lock により busy となるsubprocess.runを 0 回に保ち、probe 前の 150ms 遅延後も Git timeout は残余 caller budget 以下となるEACCES/EAGAINを pipe/stdout handshake で通知してから owner release を待つ/proc/self/fdを前後比較する実行環境 preflight は
python3、uv、gitを確認し、worktree 配下artifacts/の書込み可能性と realpath confinement を確認しました。primary checkout は AC5 snapshot 前後で branch、HEAD、status が不変です。Schema Change Applicability
not_schema_changeWORKTREE_BOOTSTRAP_RESULT_V1とWORKTREE_CATALOG_ENTRY_V1を変更せず、新しい外部 schema を追加しません。Schema Consumer Inventory
変更対象 schema はありません。schema consumer の更新、migration、互換性対応は不要です。
Compatibility Decision
互換性の判断は、外部 schema に変更がないため既存 consumer への影響なしです。
N/AN/AN/AN/ASafety Claim Matrix
Notes
REQUEST_CHANGES / fix_in_placeat feat: add control-plane lifecycle mutex #2395 (comment).scripts/agent-ops/worktree_bootstrap_exec.py,tests/agent_ops/test_control_plane_worktree_concurrency.py.