Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
triage-requiredNeeds owner triage for priority decision
Description
概要
post-merge-cleanup-worker SubAgent が root checkout(default branch main)から実行されると、local_main_branch_guard により必要な bash 操作がブロックされ、skill が機能しない。PR #1140 のマージ後 cleanup 実行時に再現した。git/gh mutation を isolation worktree agent 経由に切り替えることで人手回避できたが、canonical な worker 経路が成立していないため改善する。
観測された挙動(#1140 cleanup 時)
post-merge-cleanup-worker(非 isolation の SubAgent)は root checkout 上で動作する。skill の Procedure は root から直接git checkout main/git pull origin main/git branch -d/git worktree remove/classify-git-state.pyを実行する設計。local_main_branch_guard.sh(PreToolUse Bash hook)が root checkout(current_is_default: true)からの mutation を設計どおり拒否するため、これらの操作およびuv run python3 .../classify-git-state.pyがブロックされた。- 結果として worker は git 状態分類すらできず
execution_status: FAILEDを返した。さらに worker はこのブロックを 「hook の誤設定(contradictory hook)」と誤診断した(実際は root mutation を意図どおり阻止しているだけで誤設定ではない)。
根本原因
- post-merge-cleanup skill の cleanup ステップ(main 整合・branch/worktree 削除・git 状態分類)が root checkout からの直接 mutation を前提にしているが、
local_main_branch_guardは root checkout の mutation を全面ブロックする。両者の前提が矛盾している。 - 過去の fix(guard): gh issue/pr GitHub ops を allowlist-closed から除外し
post-merge-cleanup 操作を復元する #1108(gh issue/pr ops の復元)・実装: local_main_branch_guard の Claude/Codex read-only parity と script allowlist を整備する #1089(read-only parity + script allowlist)では gh ops と一部 read-only は復元されたが、cleanup の git mutation(checkout/pull/branch -d/worktree remove)と
classify-git-state.pyの実行経路は未解消のまま。
改善の方向性(要 refinement)
いずれか、または組合せ:
- guard に cleanup command-class の exact allow を追加:
classify-git-state.pyの read-only 実行、baregit worktree remove <project_root>/.claude/worktrees/...、baregit branch -d <merged-branch>、git pull --ff-only origin main(default branch 上)を、cleanup contract(POST_MERGE_CLEANUP_REQUEST_V2等)に基づいて narrow に許可する。permission allowlist だけでは回避できないため guard 本体に command-class allow を入れ、実 PreToolUse hook chain(stdin JSON・実 git 状態)で検証する。 - worker を isolation/cleanup 経路へ移行: post-merge-cleanup-worker を root 直接 mutation でなく、guard が許可する cleanup grammar / isolation worktree 経由で動作させる。
- worker の誤診断修正: guard による正当なブロックを「hook 誤設定」と分類しないよう、worker の失敗分類を修正し、
human_review_requiredでなく適切な routing(isolation 経路への委譲提案等)を返す。
非ゴール
local_main_branch_guardの root mutation 防止方針そのものの撤廃(main 保護は維持する)。- agent-ops の cleanup_exec 機械化(実装: guard arbitration preflight と cleanup contract delivery を機械化する (agent-ops) #1137 の責務)。本 Issue は post-merge-cleanup skill の cleanup 経路に限定する。
関連
- fix(guard): gh issue/pr GitHub ops を allowlist-closed から除外し post-merge-cleanup 操作を復元する #1108(CLOSED, gh ops 復元)/ 実装: local_main_branch_guard の Claude/Codex read-only parity と script allowlist を整備する #1089(CLOSED, read-only parity + script allowlist)/ 実装: guard arbitration preflight と cleanup contract delivery を機械化する (agent-ops) #1137(OPEN, agent-ops guard arbitration・cleanup contract)。実装: guard arbitration preflight と cleanup contract delivery を機械化する (agent-ops) #1137 と責務が一部重なる可能性があるため triage で統合判断を仰ぐ。
Source
source:
kind: post_merge_cleanup
observed_in_pr: 1140
url: https://github.com/squne121/loop-protocol/pull/1140
dedupe_key: "improvement:squne121/loop-protocol:post-merge-cleanup-worker-blocked-by-local-main-branch-guard"
origin_skill: post-merge-cleanup
related_issues: [1108, 1089, 1137]Metadata
Metadata
Assignees
Labels
triage-requiredNeeds owner triage for priority decision
Activity
squne121 commentedon Aug 12, 2026
Disposition: CLOSED / not_planned(obsolete)
#1782 の敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1782#issuecomment-5266277591)に基づき close する。
根拠: