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