From 4ea5ff4ea8d4268ebbd784575d30772a4da1fd85 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Tue, 10 Feb 2026 18:24:19 +0000 Subject: [PATCH] fix: add missing local declarations in cmd_transition to prevent cross-contamination The session_id, worktree, branch, log_file, and pr_url variables in cmd_transition() were not declared as local. When the pulse cycle calls cmd_transition() in a loop for multiple tasks, these variables leaked between calls via the shell's global scope. A call with --branch or --pr-url would set the global, and subsequent calls without those flags would still see the stale value via ${branch:-} / ${pr_url:-} checks, overwriting unrelated tasks' DB rows. This was the root cause of all PR cross-contamination (6 historical duplicates, plus ongoing backlog-19 contamination where PR #962 was linked to 5 unrelated tasks). --- .agents/scripts/supervisor-helper.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.agents/scripts/supervisor-helper.sh b/.agents/scripts/supervisor-helper.sh index 1b6ba0a0..59ad37a7 100755 --- a/.agents/scripts/supervisor-helper.sh +++ b/.agents/scripts/supervisor-helper.sh @@ -1693,6 +1693,7 @@ cmd_batch() { ####################################### cmd_transition() { local task_id="" new_state="" error_msg="" + local session_id="" worktree="" branch="" log_file="" pr_url="" # Positional args if [[ $# -gt 0 && ! "$1" =~ ^-- ]]; then