Repository navigation
Conversation
… of failing
create_worktree only handled two states: already inside a worktree on
this branch (no-op), or a brand new branch (git worktree add -b).
Missing: the branch exists as a plain ref with no worktree owning it --
e.g. a second-session item claim on a task/N branch that survived from
before. -b unconditionally failed there ("a branch named 'task/N'
already exists"), with the raw git stderr as the only remediation.
Hit this exact case on item #29 today.
Now checks refs/heads/<branch> first, falling back to a targeted fetch
+ refs/remotes/origin/<branch> check when it's only been pushed from
elsewhere with no local ref yet (validated against git-parsec's
worktree_add_existing, which does the same two-step). Either way,
checks out the existing ref directly instead of trying to recreate it.
Brand-new-branch behavior is unchanged.
Agentflare-Agent: claude-code_2-1-219_agent
Agentflare-Branch: task/339
Agentflare-Item: 339
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesWorktree branch reuse
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Agentflare-Agent: claude-code_2-1-219_agent Agentflare-Branch: task/339 Agentflare-Item: 339
getappz
enabled auto-merge (squash)
July 25, 2026 03:00
Agentflare-Agent: claude-code_2-1-219_agent Agentflare-Branch: task/339 Agentflare-Item: 339
3 tasks done
getappz
added a commit
that referenced
this pull request
Jul 29, 2026
…mmand (#367) * feat(git-shim): CI paths in trust-root baseline + /flare:git slash command Item #403, from the 2026-07-29 git-shim competitor audit: - Added .github/workflows/, .gitlab-ci.yml, .circleci/ to TRUST_ROOT_PATHS in classify.rs (CI-wipe was named as an attack agentflare didn't yet cover). Documented a known limitation: resolve_trust_root_touch self-diffs when the pushed branch equals the default branch by name, so this doesn't change behavior for the ordinary direct-push case yet -- tracked as an addendum on item #321. - New /flare:git prompt (mcp_prompts.rs), same mechanism as the existing /flare:artifact and /flare:handoff prompts, surfacing the agentflare git-shim's own admin subcommands: install-hooks, install-shim, uninstall-shim, snapshot list/restore/prune, audit preview/prune, doctor. Deliberately scoped to just these -- ordinary git commands and other CLI/MCP surfaces (pr_check, etc.) already have their own entrypoint (the ! shell-escape, or their own MCP tool) and don't need duplicating here. * fix(git-shim): fmt + sync trust-root deny message + reject hidden git-shim subcommands in /flare:git - cargo fmt fix for the new test in mcp_prompts.rs - TrustRootTouch::Unknown deny message now lists policy.trust_root_paths instead of a hardcoded subset, so it stays accurate as the list grows - get_git_command rejects trailer-inject/ref-transaction-log/scope-check instead of echoing a run instruction for internal-only subcommands
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_worktree(crates/flare-git-core/src/worktree.rs) only handled two states: already inside a worktree on this branch (no-op), or a brand new branch (git worktree add -b). Missing state: the branch exists as a plain ref with no worktree owning it — e.g. a second-sessionitem claimon atask/Nbranch that survived from a prior session.-bunconditionally failed there ("a branch named 'task/N' already exists"), with raw git stderr as the only remediation.refs/heads/<branch>first; if absent, fetch that specific branch and checkrefs/remotes/origin/<branch>(covers a branch pushed from another machine/session with no local ref yet). Either way, check out the existing ref directly instead of trying to recreate it. Brand-new-branch behavior is unchanged.worktree_add_existing, an established worktree-lifecycle tool that does the same local-then-remote two-step check.Fixes the core bug in agentflare item #339, under epic #337.
Test plan
cargo build --workspace --all-features— cleancargo fmt --check -p flare-git-core— cleancargo test -p flare-git-core --all-features— 106 passed, 0 failedcargo clippy -p flare-git-core --all-features -- -D warnings— cleancreate_worktree_reuses_a_branch_that_exists_with_no_owning_worktreereproduces the item feat: add npm distribution packaging (#28) #29 collision and asserts it now succeedsSummary by CodeRabbit