authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-28 22:39:56-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-03-01 20:06:21-08:00
log343c0a94729b7d8040dd4a0fe54a8c6fdee6eeef
tree3352bef65d4893aeec2e4bf25a8025d1b09fbd86
parent82681606d0a4c0fecf5487751812487abb489c4c

Generate temporary worktree branch names from UUID tokens

- Remove message/time hashing for temporary branch names in `ChatView` - Use an 8-char UUID token while preserving backend-detected suffix format

1 files changed, 5 insertions(+), 13 deletions(-)

apps/web/src/components/ChatView.tsx+5-13
......@@ -233,18 +233,10 @@ function readFileAsDataUrl(file: File): Promise<string> {
233233 });
234234}
235235
236function 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
245function buildTemporaryWorktreeBranchName(message: string): string {
246 const seed = `${Date.now()}:${message.trim().toLowerCase()}:${crypto.randomUUID()}`;
247 return `${WORKTREE_BRANCH_PREFIX}/${hashBranchSeed(seed)}`;
236function 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}`;
248240}
249241
250242const VscodeEntryIcon = memo(function VscodeEntryIcon(props: {
......@@ -1544,7 +1536,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
15441536 // On first message: lock in branch + create worktree if needed.
15451537 if (baseBranchForWorktree) {
15461538 setSendPhase("preparing-worktree");
1547 const newBranch = buildTemporaryWorktreeBranchName(trimmed);
1539 const newBranch = buildTemporaryWorktreeBranchName();
15481540 const result = await createWorktreeMutation.mutateAsync({
15491541 cwd: activeProject.cwd,
15501542 branch: baseBranchForWorktree,