| ... | @@ -233,18 +233,10 @@ function readFileAsDataUrl(file: File): Promise<string> { | ... | @@ -233,18 +233,10 @@ function readFileAsDataUrl(file: File): Promise<string> { |
| 233 | }); | 233 | }); |
| 234 | } | 234 | } |
| 235 | | 235 | |
| 236 | function hashBranchSeed(value: string): string { | 236 | function buildTemporaryWorktreeBranchName(): string { |
| 237 | let hash = 2166136261; | 237 | // Keep the 8-hex suffix shape for backend temporary-branch detection. |
| 238 | for (let index = 0; index < value.length; index++) { | 238 | const token = crypto.randomUUID().slice(0, 8).toLowerCase(); |
| 239 | hash ^= value.charCodeAt(index); | 239 | return `${WORKTREE_BRANCH_PREFIX}/${token}`; |
| 240 | hash = Math.imul(hash, 16777619); | | |
| 241 | } | | |
| 242 | return (hash >>> 0).toString(16).padStart(8, "0"); | | |
| 243 | } | | |
| 244 | | | |
| 245 | function buildTemporaryWorktreeBranchName(message: string): string { | | |
| 246 | const seed = `${Date.now()}:${message.trim().toLowerCase()}:${crypto.randomUUID()}`; | | |
| 247 | return `${WORKTREE_BRANCH_PREFIX}/${hashBranchSeed(seed)}`; | | |
| 248 | } | 240 | } |
| 249 | | 241 | |
| 250 | const VscodeEntryIcon = memo(function VscodeEntryIcon(props: { | 242 | const VscodeEntryIcon = memo(function VscodeEntryIcon(props: { |
| ... | @@ -1544,7 +1536,7 @@ export default function ChatView({ threadId }: ChatViewProps) { | ... | @@ -1544,7 +1536,7 @@ export default function ChatView({ threadId }: ChatViewProps) { |
| 1544 | // On first message: lock in branch + create worktree if needed. | 1536 | // On first message: lock in branch + create worktree if needed. |
| 1545 | if (baseBranchForWorktree) { | 1537 | if (baseBranchForWorktree) { |
| 1546 | setSendPhase("preparing-worktree"); | 1538 | setSendPhase("preparing-worktree"); |
| 1547 | const newBranch = buildTemporaryWorktreeBranchName(trimmed); | 1539 | const newBranch = buildTemporaryWorktreeBranchName(); |
| 1548 | const result = await createWorktreeMutation.mutateAsync({ | 1540 | const result = await createWorktreeMutation.mutateAsync({ |
| 1549 | cwd: activeProject.cwd, | 1541 | cwd: activeProject.cwd, |
| 1550 | branch: baseBranchForWorktree, | 1542 | branch: baseBranchForWorktree, |