feat(FN-5329): remove orphan rescue and branch-recovery primitives from eng

Removes the branch-recovery CLI surface, orphan-rescue engine primitives, and their associated tests (over 1,500 lines deleted), while restoring a minimal prune-only orphan branch sweep with proper git audit mutation types. Documentation across `cli-reference.md`, `task-management.md`, and `AGENTS.m

Fusion-Task-Id: FN-5329
This commit is contained in:
Fusion (runfusion.ai)
2026-05-20 16:42:50 -07:00
committed by gsxdsm
parent 0e5cb4d292
commit fd202e9356
33 changed files with 131 additions and 1644 deletions

View File

@@ -530,43 +530,9 @@ fn task unarchive FN-001
fn task delete FN-001 --force
```
### Branch conflict recovery
### Branch conflict handling
Use `fn task branch-recovery` when executor branch allocation fails because the canonical task branch is already checked out elsewhere. By default, the command lists every recovery candidate for the task, including the branch tip SHA, attached worktree path (if any), and patch-id-aware stranded commit subjects unique versus `main` (`git cherry`). Fully-subsumed branches show `stranded commits: none`.
```bash
fn task branch-recovery FN-001
fn task branch-recovery FN-001 --reclaim fusion/fn-001-2
fn task branch-recovery FN-001 --discard fusion/fn-001-2 --yes
```
| Option | Description |
|---|---|
| `--reclaim <branch>` | Point the task at an existing canonical or sibling branch so the next executor run resumes from that branch without rewriting commits. |
| `--discard <branch>` | Delete a stranded sibling branch and its worktree. Fusion refuses to run this destructive action unless `--yes` is also supplied. |
| `--yes` | Confirm destructive discard when `--discard` is used. |
Example inspect output:
```bash
fn task branch-recovery FN-001
Branch recovery candidates for FN-001
Canonical branch: fusion/fn-001
Current task branch: fusion/fn-001
Current task worktree: /repo/.worktrees/fn-001
• fusion/fn-001 (canonical)
tip: 0123456789abcdef0123456789abcdef01234567
worktree: /repo/.worktrees/fn-001
stranded commits:
- 0123456789ab fix: preserve stranded commits
• fusion/fn-001-2
tip: fedcba9876543210fedcba9876543210fedcba98
worktree: (not attached to a worktree)
stranded commits: none
```
See [Task Management → Branch conflict recovery](./task-management.md#branch-conflict-recovery) for the operator workflow and [Settings Reference → executorAllowSiblingBranchRename](./settings-reference.md#executorallowsiblingbranchrename) for the legacy opt-out setting.
When executor branch allocation fails because `fusion/<task-id>` is already checked out, Fusion marks the task failed/investigable and logs conflict details (existing worktree path, tip SHA, stranded commits). Operators should inspect and resolve conflicting local branches/worktrees with standard git tooling, then retry the task.
### GitHub integration