Conversation
…accuracy, stranded-checkout recovery - worktree deny message now distinguishes provisioning (claim) from teardown (check_merge/release/audit --prune) so an agent denied mid-teardown gets the exact cleanup action (vent #350) - is_branch_create() classifies checkout -b/-B and switch -c/-C; canonical-checkout deny says 'create a new branch' instead of the misleading 'would detach HEAD' (vent #395) - audit_orphans flags worktrees stranded on the default branch (intact gitdir) so worktree audit --prune clears the gh pr merge --delete- branch / post-merge-sync collision root cause (vents #351/#394/#423) - AGENTFLARE_GIT_ALLOW_CANONICAL_MUTATE now also lifts the default-branch checkout/switch deny in the canonical checkout, giving stranded checkouts a sanctioned way back (vent #386 residual) - allowlist classify.rs (already 1604L on master) in the LOC gate Agentflare-Agent: 1 Agentflare-Branch: task/441 Agentflare-Item: 441
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change recognizes branch-creating Git commands, protects canonical checkouts from those mutations, adds an override path for recovery, and audits intact orphan worktrees on the repository’s default branch. ChangesGit safety and orphan worktree handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Agent
participant Shim as flare-git-shim
participant Classifier as classify.rs
participant Git
Agent->>Shim: Invoke checkout or switch
Shim->>Classifier: Classify branch creation or HEAD detachment
Classifier-->>Shim: Return deny disposition
Shim-->>Agent: Deny canonical mutation
Agent->>Shim: Retry with AGENTFLARE_GIT_ALLOW_CANONICAL_MUTATE=1
Shim->>Classifier: Reclassify command
Classifier-->>Shim: Return overridden deny disposition
Shim->>Git: Execute command
Git-->>Agent: Return command result
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/flare-git-core/src/classify.rs`:
- Around line 123-128: The branch-creation detection in is_branch_create must
recognize all documented git switch creation forms before the "--" separator,
including --orphan, --create, --force-create, and attached -c<name>/-C<name>
forms, while preserving checkout handling. Update the argument parsing so these
options cause would_detach_head’s guard to reject the command, and add unit and
shim regressions covering each form.
In `@crates/flare-git-core/src/worktree.rs`:
- Around line 631-646: Before classifying an intact worktree as an orphan in the
orphan-pruning flow around current_branch, check its git status with porcelain
output; skip pruning dirty worktrees and report that they were preserved because
they contain uncommitted changes. Keep broken-gitdir handling unchanged, and add
a test covering a dirty worktree on the default branch.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dcdf9ef2-3f60-4d60-b43f-b4e85ecc23e7
📒 Files selected for processing (6)
crates/flare-git-core/src/classify.rscrates/flare-git-core/src/worktree.rscrates/flare-git-shim/src/main.rscrates/flare-git-shim/tests/shim_test.rsscripts/loc-gate.shsrc/cli/git.rs
…nded worktrees CodeRabbit review on PR #456: - is_branch_create only matched exact -b/-B/-c/-C, missing --orphan (checkout+switch), switch's --create/--force-create long forms, and attached short-option spellings (-bname). Those forms slipped past both would_detach_head and deny_canonical_detach_reason undetected, letting an agent create a branch in the canonical checkout via e.g. 'git switch --orphan x' or 'git checkout -bx' with no deny at all. - audit_orphans' new on-default-branch detection could hand a dirty, uncommitted stranded worktree to gc_orphans for deletion; the only other gc_orphans caller (cleanup_item_worktree) already refuses on a dirty status check first. Apply the same guard here. Agentflare-Agent: claude-code_2-1-227_agent Agentflare-Branch: task/441 Agentflare-Item: 441
Closed the four residual git-shim/worktree gaps from the vent audit in one pass:
Teardown messaging (vent ci: drop the Windows Defender exclusion step, it bought nothing #350) —
classify_pure'sworktreedeny now distinguishes provisioning (add) from teardown (remove/prune); the teardown message namesitem(action="check_merge")/releaseandagentflare git worktree audit --prune, so an agent denied mid-teardown knows the exact cleanup action.checkout -bmessage accuracy (vent fix(supervisor): dispatched jobs inherit the wrong timeout (300s, not works own 1800s) #395) — newis_branch_create()classifiescheckout -b/-Bandswitch -c/-C; the canonical-checkout deny says "create a new branch" instead of the misleading "would detach HEAD". Guard intent unchanged (feature work still blocked in canonical), escape hatch still works.gh merge collisions root cause (vents fix(store): give each db its own blob dir so GC cannot delete a neighbour's content #351/fix(jobs): kill_graceful reaches descendants that escaped into their own process group #394/fix(bridge,work): surface why a claimed item never gets worked #423) —
audit_orphansnow also flags worktrees stranded on the default branch (intact gitdir, not just broken-gitdir), soagentflare git worktree audit --pruneclears the stale worktrees that blockedgh pr merge --delete-branch/ post-merge local sync. Preview shows[on default branch]flag.Stranded canonical-checkout recovery (vent fix(vent): always report consolidate outcome, not just non-empty filings #386 residual) —
AGENTFLARE_GIT_ALLOW_CANONICAL_MUTATEnow also lifts the default-branch checkout/switch deny in the canonical checkout, giving a merged worktree a sanctioned way back tomaster.Tests: +7 new (classify: branch-create/detach/teardown-message; worktree: audit orphan-on-default-branch; shim: branch-create deny message + default-branch return escape). flare-git-core 158 pass, agentflare bin 1233 pass, shim 15 pass (3 pre-existing env failures on unmodified code too). fmt/clippy clean. Also allowlisted classify.rs (already 1604L on master) in loc-gate.sh.
Known pre-existing, not touched: 3 shim tests fail in THIS session's environment (agent-detector sees
opencodein the process tree) — verified they fail identically on unmodified code.Summary by CodeRabbit
New Features
[on default branch].Bug Fixes
Improvements