Add pass numbering to parallel branch names to prevent overwrites on retry

Parallel branches now include the node visit count (pass1, pass2, etc.)
in their ref names, preventing silent overwrite when a parallel node is
re-executed via retry or loop_restart.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-02 22:02:43 -05:00
parent e911a60220
commit ffac356c7b
2 changed files with 4 additions and 2 deletions

View file

@ -280,10 +280,12 @@ impl Handler for ParallelHandler {
let (branch_sandbox, worktree_path): (Arc<dyn Sandbox>, Option<PathBuf>) =
if let (Some(ref gs), Some(ref bsha)) = (&git_state, &base_sha) {
let branch_key = &target_id;
let visit = crate::engine::visit_from_context(&branch_context);
let branch_name = format!(
"arc/run/parallel/{}/{}/{}",
"arc/run/parallel/{}/{}/pass{}/{}",
gs.run_id,
crate::git::sanitize_ref_component(&node.id),
visit,
crate::git::sanitize_ref_component(branch_key),
);

View file

@ -9582,7 +9582,7 @@ async fn parallel_git_branching_host_e2e() {
);
// 10. Verify parallel branch refs still exist (for debugging)
let branch_ref_a = format!("arc/run/parallel/{run_id}/fan-out/branch-a");
let branch_ref_a = format!("arc/run/parallel/{run_id}/fan-out/pass1/branch-a");
let ref_check = std::process::Command::new("git")
.args(["rev-parse", "--verify", &branch_ref_a])
.current_dir(repo.path())