From 254d8e9279ff265ec54b074763413e395fa85e35 Mon Sep 17 00:00:00 2001 From: Peter Braden Date: Tue, 2 Jun 2026 13:50:12 +0200 Subject: [PATCH] fix: add unique suffix to foxops branch names to prevent stale branch collisions Branch names for MR changes are deterministic: foxops/update-to-{hash}-{version}. When an MR is closed without merging, GitLab does not delete the source branch. A subsequent update to the same version generates the same branch name, causing a push failure because the remote already has that branch with diverging history. Adding a short uuid suffix to the branch name prevents collisions entirely, without requiring branch deletion API calls. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/foxops/services/change.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/foxops/services/change.py b/src/foxops/services/change.py index dfecb73e..eccdb651 100644 --- a/src/foxops/services/change.py +++ b/src/foxops/services/change.py @@ -823,4 +823,5 @@ def delete_all_files_in_local_git_repository(directory: Path) -> None: def generate_foxops_branch_name(prefix: str, target_directory: str, template_repository_version: str) -> str: target_directory_hash = hashlib.sha1(target_directory.encode("utf-8")).hexdigest()[:7] - return f"foxops/{prefix}-{target_directory_hash}-{template_repository_version}" + unique_suffix = uuid.uuid4().hex[:8] + return f"foxops/{prefix}-{target_directory_hash}-{template_repository_version}-{unique_suffix}"