From e4d7ca42ac18cf6b82b82de21172e392b690ffff Mon Sep 17 00:00:00 2001 From: m3taversal Date: Wed, 25 Mar 2026 11:09:24 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20Gate=202=20PR=20lookup=20=E2=80=94=20For?= =?UTF-8?q?gejo=20head=3D=20filter=20returns=20wrong=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Forgejo API head=teleo:$BRANCH filter is unreliable — returns unrelated PRs. All 13 queued sources were matching PR #1838 (Leo's research) instead of their own PRs. Fixed: fetch all open PRs and filter locally by head.ref match. Pentagon-Agent: Epimetheus <3D35839A-7722-4740-B93D-51157F7D5E70> --- batch-extract-50.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/batch-extract-50.sh b/batch-extract-50.sh index 5592a42..88ce9b8 100755 --- a/batch-extract-50.sh +++ b/batch-extract-50.sh @@ -118,8 +118,15 @@ for SOURCE in $SOURCES; do if [ "$AGE_HOURS" -ge 2 ]; then # Branch is stale — check if PR is mergeable - PR_NUM=$(curl -sf "$FORGEJO_URL/api/v1/repos/teleo/teleo-codex/pulls?state=open&head=teleo:$BRANCH&limit=1" \ - -H "Authorization: token $TOKEN" | python3 -c 'import sys,json; prs=json.load(sys.stdin); print(prs[0]["number"] if prs else "")' 2>/dev/null) + # Note: Forgejo head= filter is unreliable. Fetch all open PRs and filter locally. + PR_NUM=$(curl -sf "$FORGEJO_URL/api/v1/repos/teleo/teleo-codex/pulls?state=open&limit=50" \ + -H "Authorization: token $TOKEN" | python3 -c " +import sys,json +prs=json.load(sys.stdin) +branch='$BRANCH' +matches=[p for p in prs if p['head']['ref']==branch] +print(matches[0]['number'] if matches else '') +" 2>/dev/null) if [ -n "$PR_NUM" ]; then PR_MERGEABLE=$(curl -sf "$FORGEJO_URL/api/v1/repos/teleo/teleo-codex/pulls/$PR_NUM" \ -H "Authorization: token $TOKEN" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("mergeable","true"))' 2>/dev/null)