Problem
When a branch's PR was merged into a non-main parent branch (e.g., a phase1 branch), il cleanup blocks with:
❌ Cannot cleanup:
Branch 'feat/issue-ai-44__preserve-chat-session' has not been pushed to remote and is not merged into 'develop'.
Deleting this branch would result in data loss.
Root Cause
The safety check flow in ResourceCleanup.ts (line ~950):
getMergeTargetBranch() checks for parentLoom.branchName in metadata. If none, falls back to configured mainBranch (e.g., develop).
- GitHub deleted the remote branch after merge →
remoteStatus.exists is false.
- Falls to
isBranchMergedIntoMain(branch, mainBranch) which checks git merge-base --is-ancestor against develop.
- Branch was merged into a parent branch (not
develop), so the check fails → blocked.
Workaround
il cleanup <identifier> --force bypasses the safety check.
Suggested Fix
When the remote branch doesn't exist and the branch isn't merged into the configured main branch, check via the VCS provider if a merged PR exists for this branch. If a merged PR exists, the work is safe — no data loss risk.
Relevant code:
src/lib/ResourceCleanup.ts:914-969 — safety check logic
src/utils/git.ts:1076-1100 — getMergeTargetBranch()
src/utils/git.ts:858-870 — isBranchMergedIntoMain()
Problem
When a branch's PR was merged into a non-main parent branch (e.g., a phase1 branch),
il cleanupblocks with:Root Cause
The safety check flow in
ResourceCleanup.ts(line ~950):getMergeTargetBranch()checks forparentLoom.branchNamein metadata. If none, falls back to configuredmainBranch(e.g.,develop).remoteStatus.existsisfalse.isBranchMergedIntoMain(branch, mainBranch)which checksgit merge-base --is-ancestoragainstdevelop.develop), so the check fails → blocked.Workaround
il cleanup <identifier> --forcebypasses the safety check.Suggested Fix
When the remote branch doesn't exist and the branch isn't merged into the configured main branch, check via the VCS provider if a merged PR exists for this branch. If a merged PR exists, the work is safe — no data loss risk.
Relevant code:
src/lib/ResourceCleanup.ts:914-969— safety check logicsrc/utils/git.ts:1076-1100—getMergeTargetBranch()src/utils/git.ts:858-870—isBranchMergedIntoMain()