fix(FN-4884): finalize docs and keep workspace gates green

Fusion-Task-Id: FN-4884
Fusion-Task-Lineage: b906ade4-a9f1-4f2e-b684-4ebf49c3e7e6
This commit is contained in:
Fusion (runfusion.ai)
2026-05-17 07:25:29 -07:00
committed by gsxdsm
parent 030a27b40d
commit 96a19309ae
7 changed files with 55 additions and 19 deletions

View File

@@ -535,6 +535,13 @@ export interface ReanchorBranchToBaseResult {
newTipSha: string;
}
/**
* Re-anchor a task branch to base while handling already-at-base worktrees.
*
* Fast-path: when both worktree HEAD and branch tip already equal baseSha,
* avoid detach/rebranch churn (`checkout -B` can fail with worktree-binding
* conflicts) and only attempt lightweight branch re-association.
*/
export async function reanchorBranchToBase(
input: ReanchorBranchToBaseInput,
): Promise<ReanchorBranchToBaseResult> {

View File

@@ -2020,10 +2020,11 @@ export class SelfHealingManager {
});
result.worktreeRemoved = true;
if (task) {
const patch: Partial<Task> = { worktree: null };
if (task.branch === branchName) patch.branch = null;
await this.store.updateTask(task.id, patch);
task = { ...task, ...patch } as Task;
const patch = {
worktree: null as string | null,
...(task.branch === branchName ? { branch: null as string | null } : {}),
};
await this.store.updateTask(task.id, patch as Partial<Task>);
}
} catch (err: unknown) {
const errorMessage = err instanceof Error ? err.message : String(err);