Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
import { describe, expect, it } from 'vitest'
import {
getClientWorktreeCreateCandidate,
getGeneratedWorktreeCreateRetryCandidate,
isRetryableWorktreeCreateConflict
} from './worktree-create-retry-policy'
describe('client worktree create retry policy', () => {
it('uses the same suffix sequence for every client', () => {
expect(getClientWorktreeCreateCandidate('feature', 0)).toBe('feature')
expect(getClientWorktreeCreateCandidate('feature', 1)).toBe('feature-2')
})
it('keeps generated retries on canonical tiers', () => {
expect(getGeneratedWorktreeCreateRetryCandidate('nautilus-2', 0)).toBe('nautilus-2')
expect(getGeneratedWorktreeCreateRetryCandidate('nautilus-2', 1)).toBe('nautilus-3')
expect(getGeneratedWorktreeCreateRetryCandidate('nautilus-2-3', 0)).toBe('nautilus-4')
})
it('retries only known branch and review conflicts', () => {
expect(isRetryableWorktreeCreateConflict('Branch already exists locally')).toBe(true)
expect(isRetryableWorktreeCreateConflict('Branch "x" already exists.')).toBe(true)
expect(isRetryableWorktreeCreateConflict('Branch already has PR #42')).toBe(true)
expect(isRetryableWorktreeCreateConflict('Permission denied')).toBe(false)
})
})