fix(server): suffix-fallback auto-named branches and rotate opencode waterfall

Auto-namer now probes refs/heads/<name> and appends -2, -3, … (up to 50)
when the desired slug is taken, instead of failing with "branch already
exists" and leaving the worktree on its placeholder name.

Structured-generation waterfall replaces opencode/gpt-5-nano with
opencode/minimax-m2.5-free and opencode/nemotron-3-super-free so users
without nano configured fall through to free models they actually have.
This commit is contained in:
Mohamed Boudra
2026-05-09 20:44:03 +07:00
parent 73f35537f9
commit d88af28e93
4 changed files with 83 additions and 4 deletions
@@ -870,6 +870,10 @@ async function getWorktreePathForBranch(cwd: string, branchName: string): Promis
}
}
export async function localBranchExists(cwd: string, branchName: string): Promise<boolean> {
return doesGitRefExist(cwd, `refs/heads/${branchName}`);
}
export async function renameCurrentBranch(
cwd: string,
newName: string,