From 684501e385a574cc542fe4e1ba3eb6e25fee215e Mon Sep 17 00:00:00 2001 From: Agent Date: Tue, 7 Apr 2026 17:47:02 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20fix:=20dev-poll=20open-PR=20gate=20block?= =?UTF-8?q?s=20all=20agents=20=E2=80=94=20should=20only=20block=20on=20own?= =?UTF-8?q?=20PRs=20(#369)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/dev-poll.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/dev/dev-poll.sh b/dev/dev-poll.sh index ca34937..beaaf2d 100755 --- a/dev/dev-poll.sh +++ b/dev/dev-poll.sh @@ -784,9 +784,32 @@ done # Single-threaded per project: if any issue has an open PR waiting for review/CI, # don't start new work — let the pipeline drain first +# But only block on PRs assigned to this agent (per-agent logic from #358) if [ -n "$READY_ISSUE" ] && [ -n "${WAITING_PRS:-}" ]; then - log "holding #${READY_ISSUE} — waiting for open PR(s) to land first: ${WAITING_PRS}" - exit 0 + # Filter to only this agent's waiting PRs + MY_WAITING_PRS="" + for pr_num in $(echo "$WAITING_PRS" | tr ',' ' '); do + pr_num="${pr_num#\#}" # Remove leading # + # Check if this PR's issue is assigned to this agent + pr_info=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \ + "${API}/pulls/${pr_num}" 2>/dev/null) || true + pr_branch=$(echo "$pr_info" | jq -r '.head.ref') || true + issue_num=$(echo "$pr_branch" | grep -oP '(?<=fix/issue-)\d+' || true) + if [ -z "$issue_num" ]; then + continue + fi + issue_assignee=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \ + "${API}/issues/${issue_num}" 2>/dev/null | jq -r '.assignee.login // ""') || true + if [ -n "$issue_assignee" ] && [ "$issue_assignee" = "$BOT_USER" ]; then + MY_WAITING_PRS="${MY_WAITING_PRS:-}${MY_WAITING_PRS:+, }#${pr_num}" + fi + done + + if [ -n "$MY_WAITING_PRS" ]; then + log "holding #${READY_ISSUE} — waiting for my open PR(s) to land first: ${MY_WAITING_PRS}" + exit 0 + fi + log "other agents' PRs waiting: ${WAITING_PRS} — proceeding with #${READY_ISSUE}" fi if [ -z "$READY_ISSUE" ]; then -- 2.49.1