From 1cd1b0904171f55a3be4beac4e3b499a1a6f7491 Mon Sep 17 00:00:00 2001 From: openhands Date: Sat, 21 Mar 2026 16:35:00 +0000 Subject: [PATCH] fix: dev-agent.sh uses hardcoded bot usernames instead of dynamic resolution (#425) Replace hardcoded Disinto_bot/disinto-factory filter with dynamic /user API resolution + CODEBERG_BOT_USERNAMES env var fallback, matching the pattern established in action-agent.sh by PR #424. Co-Authored-By: Claude Opus 4.6 (1M context) --- dev/dev-agent.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dev/dev-agent.sh b/dev/dev-agent.sh index cbc44e6..3bfa07b 100755 --- a/dev/dev-agent.sh +++ b/dev/dev-agent.sh @@ -207,10 +207,23 @@ ISSUE_TITLE=$(echo "$ISSUE_JSON" | jq -r '.title') ISSUE_BODY=$(echo "$ISSUE_JSON" | jq -r '.body // ""') ISSUE_BODY_ORIGINAL="$ISSUE_BODY" +# --- Resolve bot username(s) for comment filtering --- +_bot_login=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ + "${API%%/repos*}/user" | jq -r '.login // empty' 2>/dev/null || true) + +# Build list: token owner + any extra names from CODEBERG_BOT_USERNAMES (comma-separated) +_bot_logins="${_bot_login}" +if [ -n "${CODEBERG_BOT_USERNAMES:-}" ]; then + _bot_logins="${_bot_logins:+${_bot_logins},}${CODEBERG_BOT_USERNAMES}" +fi + # Append human comments to issue body (filter out bot accounts) ISSUE_COMMENTS=$(curl -sf -H "Authorization: token ${CODEBERG_TOKEN}" \ "${API}/issues/${ISSUE}/comments" | \ - jq -r '.[] | select(.user.login != "Disinto_bot" and .user.login != "disinto-factory") | "### @\(.user.login) (\(.created_at[:10])):\n\(.body)\n"' 2>/dev/null || true) + jq -r --arg bots "$_bot_logins" \ + '($bots | split(",") | map(select(. != ""))) as $bl | + .[] | select(.user.login as $u | $bl | index($u) | not) | + "### @\(.user.login) (\(.created_at[:10])):\n\(.body)\n"' 2>/dev/null || true) if [ -n "$ISSUE_COMMENTS" ]; then ISSUE_BODY="${ISSUE_BODY}