From a58aef90d3913eef769f4162377123a158311046 Mon Sep 17 00:00:00 2001 From: openhands Date: Fri, 20 Mar 2026 09:50:20 +0000 Subject: [PATCH] fix: too_large branch still uses string label '"underspecified"' (#213) Look up UNDERSPECIFIED_LABEL_ID via the Gitea labels API (with fallback) and use the numeric ID in both phase-handler.sh (PHASE:failed/too_large) and dev-poll.sh (preflight too_large), matching the pattern already used for BACKLOG_LABEL_ID. Co-Authored-By: Claude Opus 4.6 (1M context) --- dev/dev-poll.sh | 7 ++++++- dev/phase-handler.sh | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dev/dev-poll.sh b/dev/dev-poll.sh index 5cfa004..bb44ee3 100755 --- a/dev/dev-poll.sh +++ b/dev/dev-poll.sh @@ -20,6 +20,11 @@ export PROJECT_TOML="${1:-}" source "$(dirname "$0")/../lib/env.sh" source "$(dirname "$0")/../lib/ci-helpers.sh" +# Gitea labels API requires []int64 — look up the "underspecified" label ID once +UNDERSPECIFIED_LABEL_ID=$(codeberg_api GET "/labels" 2>/dev/null \ + | jq -r '.[] | select(.name == "underspecified") | .id' 2>/dev/null || true) +UNDERSPECIFIED_LABEL_ID="${UNDERSPECIFIED_LABEL_ID:-1300816}" + # Track CI fix attempts per PR to avoid infinite respawn loops CI_FIX_TRACKER="${FACTORY_ROOT}/dev/ci-fixes-${PROJECT_NAME:-harb}.json" CI_FIX_LOCK="${CI_FIX_TRACKER}.lock" @@ -606,7 +611,7 @@ if [ -f "$PREFLIGHT_RESULT" ]; then curl -sf -X POST -H "Authorization: token ${CODEBERG_TOKEN}" \ -H "Content-Type: application/json" \ "${API}/issues/${READY_ISSUE}/labels" \ - -d '{"labels":["underspecified"]}' >/dev/null 2>&1 || true + -d "{\"labels\":[${UNDERSPECIFIED_LABEL_ID}]}" >/dev/null 2>&1 || true ;; already_done) log "#${READY_ISSUE} already done" diff --git a/dev/phase-handler.sh b/dev/phase-handler.sh index 5c329d5..6f05527 100644 --- a/dev/phase-handler.sh +++ b/dev/phase-handler.sh @@ -512,6 +512,9 @@ Instructions: BACKLOG_LABEL_ID=$(codeberg_api GET "/labels" 2>/dev/null \ | jq -r '.[] | select(.name == "backlog") | .id' 2>/dev/null || true) BACKLOG_LABEL_ID="${BACKLOG_LABEL_ID:-1300815}" + UNDERSPECIFIED_LABEL_ID=$(codeberg_api GET "/labels" 2>/dev/null \ + | jq -r '.[] | select(.name == "underspecified") | .id' 2>/dev/null || true) + UNDERSPECIFIED_LABEL_ID="${UNDERSPECIFIED_LABEL_ID:-1300816}" # Check if this is a refusal (Claude wrote refusal JSON to IMPL_SUMMARY_FILE) REFUSAL_JSON="" @@ -561,7 +564,7 @@ A maintainer should split this issue or add more detail to the spec." -H "Authorization: token ${CODEBERG_TOKEN}" \ -H "Content-Type: application/json" \ "${API}/issues/${ISSUE}/labels" \ - -d '{"labels":["underspecified"]}' >/dev/null 2>&1 || true + -d "{\"labels\":[${UNDERSPECIFIED_LABEL_ID}]}" >/dev/null 2>&1 || true curl -sf -X DELETE \ -H "Authorization: token ${CODEBERG_TOKEN}" \ "${API}/issues/${ISSUE}/labels/backlog" >/dev/null 2>&1 || true