fix: Normalize 'main' branch to __main__ in auto-loop key generation

This commit is contained in:
gsxdsm
2026-02-16 12:07:05 -08:00
parent 462dbf1522
commit 434792a2ef

View File

@@ -35,12 +35,12 @@ export interface ProjectAutoLoopState {
* Generate a unique key for a worktree auto-loop instance. * Generate a unique key for a worktree auto-loop instance.
* *
* When branchName is null, this represents the main worktree (uses '__main__' sentinel). * When branchName is null, this represents the main worktree (uses '__main__' sentinel).
* Named branches always use their exact name — the caller is responsible for passing * The string 'main' is also normalized to '__main__' for consistency.
* null for the primary branch (main/master/etc.) so key matching stays consistent * Named branches always use their exact name.
* with ConcurrencyManager's dynamic primary branch resolution.
*/ */
export function getWorktreeAutoLoopKey(projectPath: string, branchName: string | null): string { export function getWorktreeAutoLoopKey(projectPath: string, branchName: string | null): string {
return `${projectPath}::${branchName ?? '__main__'}`; const normalizedBranch = branchName === 'main' ? null : branchName;
return `${projectPath}::${normalizedBranch ?? '__main__'}`;
} }
export type ExecuteFeatureFn = ( export type ExecuteFeatureFn = (