fix: dep check — trust closed state, drop merged-PR search

The merged-PR search was over-engineered and caused false negatives
(couldn't match PR to issue when title/body didn't contain #NNN).
Issue closed = dep satisfied. Factory only closes after merging.
This commit is contained in:
openhands 2026-03-13 11:25:35 +00:00
parent d61dead3f1
commit 98210cc302

View file

@ -60,24 +60,10 @@ dep_is_merged() {
return 1
fi
# Check there's a merged PR for this issue.
# Strategy: search closed PRs for title/body containing "#NNN",
# OR check if a PR with the same number exists and is merged.
local has_merged
has_merged=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
"${API}/pulls?state=closed&limit=30" | \
jq -r --arg num "#${dep_num}" \
'[.[] | select(.merged == true) | select((.title | contains($num)) or (.body // "" | test("ixes " + $num + "\\b"; "i")))] | length')
if [ "${has_merged:-0}" -gt 0 ]; then
return 0
fi
# Fallback: check if PR with same number is merged (Codeberg uses shared numbering)
local same_pr_merged
same_pr_merged=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \
"${API}/pulls/${dep_num}" 2>/dev/null | jq -r '.merged // false')
[ "$same_pr_merged" = "true" ]
# Issue closed = dep satisfied. The factory only closes issues after
# merging, so closed state is trustworthy. No need to hunt for the
# specific PR — that was over-engineering that caused false negatives.
return 0
}
# =============================================================================