Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "partial cleanup 状態でも cleanup_exec 経由で branch-only cleanup を決定論的に完了できるようにする"
change_kind: workflowParent Issue
none
Parent Goal Ref
- Goal: partial cleanup 状態でも cleanup_exec 経由で branch-only cleanup を決定論的に完了できるようにする
- Desired Destination: post-merge-cleanup が worktree 削除済み・local branch 残存の partial 状態からでも、正本 executor 経由で安全に cleanup を完了できる状態
Current Validated Scope
scripts/agent-ops/cleanup_exec.pyに branch-only resume lane を追加するscripts/agent-ops/cleanup_contract_v3.pyとscripts/agent-ops/guard_preflight.pyに branch-only 判定・reason code・verified field を追加するpost-merge-cleanupskill と hook / guard テストを branch-only lane に追従させるverify_cleanup_authorization()は通常 cleanup 専用のまま維持する(allow_branch_only=Falseがデフォルト)。branch-only verifier はcleanup_exec.run()のWORKTREE_NOT_IN_CATALOG分岐からのみ到達させ、materialize_cleanup_contract.pyからは branch-only verifier に到達させない
Remaining Parent Gaps
- hook failure transcript noise compaction は別 Issue で扱う
- resume capsule / SubAgent output contract v2 は別 Issue で扱う
Outcome
cleanup_exec が worktree 削除済み・branch のみ残存する partial cleanup 状態を判定し、必要条件を満たす場合に branch-only cleanup を status: ok で完了でき、対応テストと help/contract が更新されている状態。
In Scope
cleanup_execの branch-only candidate 判定と verified field 拡張- branch-only lane に限定した
git branch -D昇格条件の実装 actions_taken/reason_code/ report field の更新post-merge-cleanupskill と guard テストの更新
Out of Scope
- bare
git branch -Dを agent へ直接許可する変更 worktree_scope_guardの fail-closed 方針緩和- PR head OID mismatch の自動補正
- hook transcript noise compaction や resume capsule の実装
Acceptance Criteria
- AC1: worktree が存在する通常 cleanup は従来どおり
worktree_remove→branch_deleteの順で動作する - AC2: worktree が既に存在しないが branch tip と PR head OID が一致する場合、branch-only cleanup が
status: okで完了する。branch-only candidate 判定は以下 5 条件を全て満たす場合のみ:- (A) requested worktree realpath が
<repo>/.claude/worktrees/配下である - (B) requested worktree path が filesystem 上に存在しない
- (C)
git worktree list --porcelain -zに同じ path のエントリが残っていない - (D)
git worktree list --porcelain -zに同じ branch を使う別 worktree が存在しない - (E) local
refs/heads/<branch_name>が存在する
- (A) requested worktree realpath が
- AC3: branch tip と PR head OID が不一致の場合は
pr_head_oid_mismatchで拒否する - AC4: requested worktree path の realpath が
.claude/worktrees/配下でない場合は branch-only lane を拒否する - AC5: cross-repo PR / base branch mismatch / linked issue mismatch は branch-only lane でも拒否する
- AC6: cleanup report に
worktree_absent_after_removal: trueを記録できる - AC7: branch-only force delete は
cleanup_exec内部 subprocess のみが実行でき、以下を全て満たす場合のみgit branch -Dに昇格する: PR merged / same repo / base default / head branch match / head OID == local branch tip / linked issue match / branch not checked out anywhere。branch_only_force_delete_deniedreason code とactions_taken: ["branch_delete"]が定義される - AC8: agent-facing の bare
git branch -Dは引き続き hook で deny される(既存 AC のまま) - AC9:
cleanup_execの CLI 形状を変更しない(新 flag を追加しない)。既存--pr-number/--linked-issue-number/--worktree-path/--branch-name/--jsonのみで branch-only lane を自動判定する
Verification Commands
# AC1
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k normal_cleanup
# AC2
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k branch_only_candidate
# AC3
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k oid_mismatch
# AC4
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k path_constraint
# AC5
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k cross_repo
# AC6
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k absent_after_removal
# AC7
$ uv run pytest tests/codex/test_cleanup_exec_branch_only.py -k force_delete
# AC8
$ uv run pytest tests/codex/test_local_main_branch_guard.py -k cleanup
# AC9
# baseline-expect: pass
$ test -f scripts/agent-ops/cleanup_exec.pyBranch-Only Candidate Definition
branch-only cleanup は以下の条件を全て満たす場合のみ許可される:
- requested worktree realpath は
<repo>/.claude/worktrees/配下 - requested worktree path は filesystem 上に存在しない
git worktree list --porcelain -zに同 path のエントリが残っていないgit worktree list --porcelain -zに同 branch を使う別 worktree が存在しない- local
refs/heads/<branch_name>が存在する - root checkout がデフォルト branch にある
gh pr view --repo <trusted repo>でstate == MERGEDかつmergedAtが存在する- PR
headRefName == branch_name - PR
headRefOid == local refs/heads/<branch_name> - PR
baseRefName == default_branch - PR は cross-repository でなく head owner が trusted repo owner と一致する
linked_issue_number(指定時)がclosingIssuesReferencesに含まれる
Additional Reason Codes
worktree_still_in_catalogbranch_checked_out_in_worktreelocal_branch_missingpr_head_oid_mismatchbranch_only_force_delete_deniedbranch_only_materialize_denied
Verified Fields(cleanup report に含む)
branch_only_candidateworktree_path_under_worktrees_dirworktree_absent_on_diskworktree_absent_from_catalogbranch_absent_from_worktree_cataloglocal_branch_existslocal_branch_tip_oidpr_head_oidhead_oid_matchbranch_only_force_delete_used
Allowed Paths
scripts/agent-ops/cleanup_exec.pyscripts/agent-ops/cleanup_contract_v3.pyscripts/agent-ops/guard_preflight.py.claude/skills/post-merge-cleanup/SKILL.md.claude/hooks/tests/test_worktree_scope_guard.pytests/codex/test_cleanup_exec_branch_only.pytests/codex/test_local_main_branch_guard.pydocs/dev/hook-boundaries.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python 3
- Git / GitHub CLI
Scope Delta(任意)
N/A
Runtime Verification Applicability
- decision: not_applicable
- reason: cleanup executor・guard・skill・テスト更新で完結し、静的検証と pytest / CLI help で受け入れ可能
- if immediate: N/A
- if deferred: N/A
Delivery Rule
1 Issue = 1 PR。cleanup_exec を正本 executor とし、branch-only lane でも bare git cleanup を agent に直接実行させない。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jun 27, 2026
判定: REQUEST_CHANGES
Issue #1196 の方向性は正しいです。現行
cleanup_execは、git worktree remove成功後にgit branch -dが失敗するとactions_taken=["worktree_remove"]を保持したままerrorを返すため、「worktree は消えたが branch だけ残る」partial cleanup が実際に起きます。 ただし、現Issueのまま実装すると force delete 境界、V3 materialize 経路、preflight 表示、検証コマンド が曖昧で、#1139/#1143 で潰した認可境界の事故を再導入するリスクがあります。Issue #1196 自体にはコメントはありません。
前提として確認した関連経緯
#1147 では、
post-merge-cleanup-workerが root checkout 上で直接git checkout main/git pull/git branch -d/git worktree removeを実行しようとしてlocal_main_branch_guardに止められる問題が整理されています。根本原因は、cleanup 手順が root checkout からの直接 mutation を前提にしていた一方、guard はそれを意図どおり拒否していたことです。#1137 はこの反省から、cleanup の認可境界を単一
cleanup_execに集約し、PR merged / head branch / linked issue / worktree catalog / branch / root default / clean state を検証してから内部 subprocess で削除する設計に寄せています。 #1139 はその前身PRでしたが、実hook経路を通らないテスト、invalid V3→V2 downgrade、preflight の catalog 未使用、Codex route 不成立などで OWNERREQUEST_CHANGESを受けています。 その後 #1143 が、単一cleanup_exec、one-shot V3、三値ローダ、実hook統合、Codex guarded route を実装して merged されています。現行
cleanup_execは、まず root default、worktree catalog entry、branch match、.claude/worktrees/配下チェック、worktree clean を検証し、その後に PR merged / head branch / cross-repo / base branch / head OID / linked issue を検証します。 つまり worktree が既に消えて catalog に無い状態では、現状はWORKTREE_NOT_IN_CATALOGで止まり、PR head OID の照合まで到達しません。#1196 が解くべき穴はここです。P0 ブロッカー
1. 「worktree が存在しない」の定義が甘い
#1196 の AC2 は「worktree が既に存在しないが branch tip と PR head OID が一致する場合」としていますが、これは不足です。
Git 公式仕様では、作業ツリーを
git worktree removeではなく手動削除した場合、管理情報は残り、後で自動またはgit worktree pruneで除去されます。またgit worktree removeは clean な worktree だけを削除し、dirty/submodule 付きなら force が必要です。(Git)したがって branch-only lane は最低限、次を別々に判定すべきです。
path が無いだけでgit branch -Dに進むのは危険です。catalog に stale/prunable entry が残っているならworktree_still_in_catalogなどで拒否し、git worktree pruneをこのIssueに入れるなら別途 AC と guard テストが必要です。2.
git branch -D昇格条件が安全境界そのもの現行
_perform()はgit branch -dを使っています。 しかし Git 公式仕様上、-dは fully merged な branch の削除で、-Dは--delete --forceのショートカットです。--force付き delete は merged 判定や valid commit 判定を無視します。(Git)つまり #1196 が squash merge 後の branch 残存を解きたいなら、内部的に
git branch -Dへ昇格する可能性があります。これは妥当になり得ますが、agent に baregit branch -Dを許すこととは別物です。現行 hook はgit branch -D/--force/-f/ multi-target-dを force delete として検出し、cleanup block に倒す実装を持っています。 また_decide_bashでも force branch delete はbranch_force_delete_deniedで拒否されます。必要な仕様は次です。
branch_only_force_delete_deniedを AC に入れるなら、「どの入力が force を要求するのか」も定義してください。CLI に force flag を追加しないなら、この reason はcleanup_exec内部の defensive reason であり、hook 側は既存branch_force_delete_deniedのままでよいです。3.
verify_cleanup_authorization()を緩めるとmaterialize_cleanup_contract.pyまで広がるこれは最も見落としやすいです。
materialize_cleanup_contract.pyは V3 contract を発行する前に、cleanup_exec.verify_cleanup_authorization()と同じ検証を呼びます。 したがって #1196 でverify_cleanup_authorization()を「worktree absent でも branch-only OK」に緩めると、意図せずmaterialize --operation branch_deleteの V3 bare-git route まで branch-only を許可する可能性があります。#1196 の Allowed Paths には
materialize_cleanup_contract.pyが含まれていません。つまり今回の正本はcleanup_execの branch-only resume であり、V3 bare-git contract 発行まで広げるべきではありません。推奨修正:
または通常 cleanup と branch-only cleanup を別関数に分けるべきです。
materialize_cleanup_contract.pyはallow_branch_only=Falseのまま維持し、#1196 の branch-only はcleanup_exec.run()からだけ到達させるのが安全です。4. CLI flag を増やすなら hook allowlist が壊れる
現行
worktree_scope_guard.pyはcleanup_exec.pyの agent-facing argv を厳密に allowlist しています。許可される value flags は--pr-number/--linked-issue-number/--worktree-path/--branch-name、bool は--jsonです。 さらに unknown flag、重複、--flag=value、余剰 positional を拒否します。#1196 の Allowed Paths には
.claude/hooks/worktree_scope_guard.pyがありません。したがってcleanup_exec.py --branch-onlyや--resumeのような新flagを追加すると、実hook経路で deny されます。推奨は 既存CLI形状のまま自動判定 です。
この同じ呼び出しで、通常 lane と branch-only lane を
cleanup_exec内部が決定する形にしてください。新flagが必要なら、Allowed Paths に.claude/hooks/worktree_scope_guard.pyを追加し、実hook process test も必須です。5. Verification Commands が hollow
#1196 の AC2 / AC6 / AC7 が
cleanup_exec.py --helpで検証されるのは不十分です。help 出力は branch-only の安全性、status、reason、actions、verified field を何も保証しません。#1139 が失敗した主要因の一つは、実hook経路や実worktree catalog を通さないテストで「通ったように見えた」ことです。#1143 では実hook stdin JSON、実git worktree、one-shot replay、Codex route まで検証して修正されています。
#1196 も
ケース | 期待 -- | -- 通常 cleanup | actions_taken == ["worktree_remove", "branch_delete"] worktree remove 成功後 branch delete 失敗 | status: error, actions_taken == ["worktree_remove"] rerun: worktree absent + branch tip == PR head OID | status: ok, actions_taken == ["branch_delete"] branch tip != PR head OID | status: refused, reason_code: pr_head_oid_mismatch, branch remains requested path outside .claude/worktrees/ | GH call 前に拒否 cross-repo PR | pr_head_repo_mismatch base branch mismatch | pr_base_branch_mismatch linked issue mismatch | linked_issue_mismatch catalog に同branchの別worktreeあり | branch_checked_out_in_worktree などで拒否 bare git branch -D | Claude hook / Codex hook とも deny--helpではなく、最低限以下を pytest 化してください。P1 改善
guard_preflight.pyは現在、active worktree が実 catalog に存在することを前提にmatchesを返します。 branch-only resume は「worktree が無いが cleanup_exec で安全に branch だけ消せる」状態なので、active_worktree_state: mismatchに混ぜると誤誘導します。追加するなら、次のような別フィールドがよいです。
run_gated_cleanupは使わない方がよいです。現行の V3 bare-git route は contract が catalog entry に bind する前提なので、branch-only とは性質が違います。AC 追記案
Issue #1196 には以下を追記すると実装品質が上がります。
requested worktree realpath is under
<repo>/.claude/worktrees/requested worktree path is absent on disk
git worktree list --porcelain -zhas no entry for the requested worktree realpathgit worktree list --porcelain -zhas no entry whose branch isrefs/heads/<branch_name>local
refs/heads/<branch_name>existsroot checkout is on the default branch
gh pr view --repo <trusted repo>reportsstate == MERGEDandmergedAtis presentPR
headRefName == branch_namePR
headRefOid == local refs/heads/<branch_name>PR
baseRefName == default_branchPR is not cross-repository and head owner matches the trusted repo owner
supplied
linked_issue_number, if any, is included inclosingIssuesReferencesgh pr view --jsonはheadRefName、headRefOid、baseRefName、headRepositoryOwner、isCrossRepository、mergedAt、state、closingIssuesReferencesなどを取得できます。(GitHub CLI) 現行cleanup_execもこれらのフィールドを使っています。branch_only_materialize_deniedbranch_only_candidateworktree_path_under_worktrees_dirworktree_absent_on_diskworktree_absent_from_catalogbranch_absent_from_worktree_cataloglocal_branch_existslocal_branch_tip_oidpr_head_oidhead_oid_matchbranch_only_force_delete_used実装方針
最も安全な実装は次です。
cleanup_execの既存 CLI は変えない。verify_cleanup_authorization()は通常 cleanup 用のまま維持する。run()内で通常 verifier がWORKTREE_NOT_IN_CATALOGになった場合だけ、branch-only verifier に分岐する。branch-only verifier は PR/head/local branch/catalog/path を全検証する。
branch-only 実行は
git -C <root> branch -D <branch_name>を内部 subprocess 配列でのみ実行する。結果に
actions_taken: ["branch_delete"]と branch-only verified fields を出す。materialize_cleanup_contract.pyからは branch-only verifier に到達させない。結論として、#1196 は必要なIssueですが、現状のACでは「branchだけ残った partial cleanup を安全に終わらせる」よりも「force delete の抜け道を増やす」方向へ倒れやすいです。上記の state definition、materialize 分離、実hook/pytest 検証を入れてから実装に進めるべきです。
## 判定: REQUEST_CHANGESIssue #1196 の方向性は正しいです。現行
cleanup_execは、git worktree remove成功後にgit branch -dが失敗するとactions_taken=["worktree_remove"]を保持したままerrorを返すため、「worktree は消えたが branch だけ残る」partial cleanup が実際に起きます。 ただし、現Issueのまま実装すると force delete 境界、V3 materialize 経路、preflight 表示、検証コマンド が曖昧で、#1139/#1143 で潰した認可境界の事故を再導入するリスクがあります。Issue #1196 自体にはコメントはありません。
前提として確認した関連経緯
#1147 では、
post-merge-cleanup-workerが root checkout 上で直接git checkout main/git pull/git branch -d/git worktree removeを実行しようとしてlocal_main_branch_guardに止められる問題が整理されています。根本原因は、cleanup 手順が root checkout からの直接 mutation を前提にしていた一方、guard はそれを意図どおり拒否していたことです。#1137 はこの反省から、cleanup の認可境界を単一
cleanup_execに集約し、PR merged / head branch / linked issue / worktree catalog / branch / root default / clean state を検証してから内部 subprocess で削除する設計に寄せています。 #1139 はその前身PRでしたが、実hook経路を通らないテスト、invalid V3→V2 downgrade、preflight の catalog 未使用、Codex route 不成立などで OWNERREQUEST_CHANGESを受けています。 その後 #1143 が、単一cleanup_exec、one-shot V3、三値ローダ、実hook統合、Codex guarded route を実装して merged されています。現行
cleanup_execは、まず root default、worktree catalog entry、branch match、.claude/worktrees/配下チェック、worktree clean を検証し、その後に PR merged / head branch / cross-repo / base branch / head OID / linked issue を検証します。 つまり worktree が既に消えて catalog に無い状態では、現状はWORKTREE_NOT_IN_CATALOGで止まり、PR head OID の照合まで到達しません。#1196 が解くべき穴はここです。P0 ブロッカー
1. 「worktree が存在しない」の定義が甘い
#1196 の AC2 は「worktree が既に存在しないが branch tip と PR head OID が一致する場合」としていますが、これは不足です。
Git 公式仕様では、作業ツリーを
git worktree removeではなく手動削除した場合、管理情報は残り、後で自動またはgit worktree pruneで除去されます。またgit worktree removeは clean な worktree だけを削除し、dirty/submodule 付きなら force が必要です。([Git]1)したがって branch-only lane は最低限、次を別々に判定すべきです。
path が無いだけでgit branch -Dに進むのは危険です。catalog に stale/prunable entry が残っているならworktree_still_in_catalogなどで拒否し、git worktree pruneをこのIssueに入れるなら別途 AC と guard テストが必要です。2.
git branch -D昇格条件が安全境界そのもの現行
_perform()はgit branch -dを使っています。 しかし Git 公式仕様上、-dは fully merged な branch の削除で、-Dは--delete --forceのショートカットです。--force付き delete は merged 判定や valid commit 判定を無視します。([Git]2)つまり #1196 が squash merge 後の branch 残存を解きたいなら、内部的に
git branch -Dへ昇格する可能性があります。これは妥当になり得ますが、agent に baregit branch -Dを許すこととは別物です。現行 hook はgit branch -D/--force/-f/ multi-target-dを force delete として検出し、cleanup block に倒す実装を持っています。 また_decide_bashでも force branch delete はbranch_force_delete_deniedで拒否されます。必要な仕様は次です。
branch_only_force_delete_deniedを AC に入れるなら、「どの入力が force を要求するのか」も定義してください。CLI に force flag を追加しないなら、この reason はcleanup_exec内部の defensive reason であり、hook 側は既存branch_force_delete_deniedのままでよいです。3.
verify_cleanup_authorization()を緩めるとmaterialize_cleanup_contract.pyまで広がるこれは最も見落としやすいです。
materialize_cleanup_contract.pyは V3 contract を発行する前に、cleanup_exec.verify_cleanup_authorization()と同じ検証を呼びます。 したがって #1196 でverify_cleanup_authorization()を「worktree absent でも branch-only OK」に緩めると、意図せずmaterialize --operation branch_deleteの V3 bare-git route まで branch-only を許可する可能性があります。#1196 の Allowed Paths には
materialize_cleanup_contract.pyが含まれていません。つまり今回の正本はcleanup_execの branch-only resume であり、V3 bare-git contract 発行まで広げるべきではありません。推奨修正:
または通常 cleanup と branch-only cleanup を別関数に分けるべきです。
materialize_cleanup_contract.pyはallow_branch_only=Falseのまま維持し、#1196 の branch-only はcleanup_exec.run()からだけ到達させるのが安全です。4. CLI flag を増やすなら hook allowlist が壊れる
現行
worktree_scope_guard.pyはcleanup_exec.pyの agent-facing argv を厳密に allowlist しています。許可される value flags は--pr-number/--linked-issue-number/--worktree-path/--branch-name、bool は--jsonです。 さらに unknown flag、重複、--flag=value、余剰 positional を拒否します。#1196 の Allowed Paths には
.claude/hooks/worktree_scope_guard.pyがありません。したがってcleanup_exec.py --branch-onlyや--resumeのような新flagを追加すると、実hook経路で deny されます。推奨は 既存CLI形状のまま自動判定 です。
この同じ呼び出しで、通常 lane と branch-only lane を
cleanup_exec内部が決定する形にしてください。新flagが必要なら、Allowed Paths に.claude/hooks/worktree_scope_guard.pyを追加し、実hook process test も必須です。5. Verification Commands が hollow
#1196 の AC2 / AC6 / AC7 が
cleanup_exec.py --helpで検証されるのは不十分です。help 出力は branch-only の安全性、status、reason、actions、verified field を何も保証しません。#1139 が失敗した主要因の一つは、実hook経路や実worktree catalog を通さないテストで「通ったように見えた」ことです。#1143 では実hook stdin JSON、実git worktree、one-shot replay、Codex route まで検証して修正されています。
#1196 も
--helpではなく、最低限以下を pytest 化してください。actions_taken == ["worktree_remove", "branch_delete"]status: error,actions_taken == ["worktree_remove"]status: ok,actions_taken == ["branch_delete"]status: refused,reason_code: pr_head_oid_mismatch, branch remains.claude/worktrees/pr_head_repo_mismatchpr_base_branch_mismatchlinked_issue_mismatchbranch_checked_out_in_worktreeなどで拒否git branch -DP1 改善
guard_preflight.pyは現在、active worktree が実 catalog に存在することを前提にmatchesを返します。 branch-only resume は「worktree が無いが cleanup_exec で安全に branch だけ消せる」状態なので、active_worktree_state: mismatchに混ぜると誤誘導します。追加するなら、次のような別フィールドがよいです。
{ "cleanup_resume_state": "branch_only_candidate", "allowed_next_commands": [ { "action": "run_cleanup_exec", "detail": "worktree is absent but local branch can be verified against merged PR head" } ] }run_gated_cleanupは使わない方がよいです。現行の V3 bare-git route は contract が catalog entry に bind する前提なので、branch-only とは性質が違います。AC 追記案
Issue #1196 には以下を追記すると実装品質が上がります。
gh pr view --jsonはheadRefName、headRefOid、baseRefName、headRepositoryOwner、isCrossRepository、mergedAt、state、closingIssuesReferencesなどを取得できます。([GitHub CLI]3) 現行cleanup_execもこれらのフィールドを使っています。実装方針
最も安全な実装は次です。
cleanup_execの既存 CLI は変えない。verify_cleanup_authorization()は通常 cleanup 用のまま維持する。run()内で通常 verifier がWORKTREE_NOT_IN_CATALOGになった場合だけ、branch-only verifier に分岐する。git -C <root> branch -D <branch_name>を内部 subprocess 配列でのみ実行する。actions_taken: ["branch_delete"]と branch-only verified fields を出す。materialize_cleanup_contract.pyからは branch-only verifier に到達させない。結論として、#1196 は必要なIssueですが、現状のACでは「branchだけ残った partial cleanup を安全に終わらせる」よりも「force delete の抜け道を増やす」方向へ倒れやすいです。上記の state definition、materialize 分離、実hook/pytest 検証を入れてから実装に進めるべきです。
squne121 commentedon Jun 27, 2026
Refinement Loop: Human Escalation Required
The loop has terminated and requires human review. Cause: human judgment required
human_escalationhuman_judgment_requiredBlockers
squne121 commentedon Jun 27, 2026
squne121 commentedon Jun 27, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 27, 2026
Contract Review Result
squne121 commentedon Jun 27, 2026
実装完了
PR #1206 (Draft) を作成しました: #1206
VC 結果 (全 AC pass)
normal_cleanup: 4 passedbranch_only_candidate: 4 passedoid_mismatch: 2 passedpath_constraint: 2 passedcross_repo: 4 passedabsent_after_removal: 3 passedforce_delete: 5 passed合計 30 new tests + 6 existing regression tests = all pass
squne121 commentedon Jun 27, 2026
test review posted via issue comment
fix(#1196): update worktree_scope_guard test to expect branch_checked…
squne121 commentedon Jun 27, 2026
test
squne121 commentedon Jun 27, 2026
feat(#1196): register test_cleanup_exec_branch_only.py in python-test…
fix(#1196): B1 fail-closed catalog-None, B2 conditional absent flag, …
fix(#1196): re-add test_cleanup_exec_branch_only.py to python-test-pl…
feat(#1196): branch-only cleanup lane in cleanup_exec (#1206)