Backtestshugorun-20261007-020926#15261
github: Fix workflow for stale issues
Worse
The merged fix was judged better than our patch.
In this judgment, Patch B = our agent, Patch A = the merged fix.
The failure comes from input validation inside dessant/lock-threads v6.0.0, which rejects the new GitHub token length of more than 100 characters. Patch A bumps the pinned action to a newer release (v6.0.2) by commit SHA. That fixes the root cause where it lives, in the action's validation, and keeps the existing config and the repo's SHA-pinning convention. It is a one-line, low-risk change. Its correctness depends on the newer release relaxing the token validation, which this diff alone cannot confirm, but that is the obvious upstream fix and matches the scope of the issue. Patch B abandons the action and reimplements its behaviour in an ad-hoc bash script calling gh api. That is a broad redesign with real regression risk: it handles only 50 search results per type per run with no pagination. It posts a comment and adds labels before locking, so a mid-loop failure under set -e leaves threads half-processed. It relies on search-API `updated:` semantics, which only approximate lock-threads' inactivity logic. It drops the action's built-in handling of discussions, rate limits and dry-run/log output. It also hard-codes defaults such as PR_INACTIVE_DAYS=365 that were previously implicit. None of this is needed to resolve the token-length error, and it makes the workflow harder to maintain. Neither patch adds tests, which is expected for a workflow file. On correctness, scope and craft, Patch A is the better fix.
The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.
Solve
31m 42s
Wall-clock time in the container
Full test suite
No new failures
3,749 passed · 99 skipped · 3,850 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
53vs 2 merged
Changed lines, ours vs merged
The issue
View on GitHubThe workflow began failing on 26 May 2026:
<https://github.com/gohugoio/hugo/actions/runs/26486945788>
"github-token" length must be less than or equal to 100 characters long
The two patches
Our patch+47 −6
.github/workflows/stale.ymlindex 89dbdde7d..4db02e12c 100644@@ -12,18 +12,59 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps:- - uses: dessant/lock-threads@f5f995c727ac99a91dec92781a8e34e7c839a65e # v6.0.0- with:- issue-inactive-days: 21- add-issue-labels: 'Outdated'- issue-comment: >+ # Lock closed issues and PRs using the gh CLI.+ # dessant/lock-threads rejects GitHub tokens longer than 100 characters,+ # which the GITHUB_TOKEN exceeds since May 2026.+ - name: Lock closed issues and PRs+ env:+ GH_TOKEN: ${{ github.token }}+ REPO: ${{ github.repository }}+ ISSUE_INACTIVE_DAYS: 21+ PR_INACTIVE_DAYS: 365+ ISSUE_LABELS: 'Outdated'+ ISSUE_COMMENT: > This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.- pr-comment: >+ PR_COMMENT: > This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.+ run: |+ set -euo pipefail++ # Pause after each write to stay under GitHub's secondary rate limits.+ write() {+ gh api "$@" > /dev/null+ sleep 1+ }++ lock_threads() {+ local type="$1" days="$2" comment="$3" labels="$4"+ local since+ since="$(date -u -d "${days} days ago" +%Y-%m-%dT%H:%M:%SZ)"+ local numbers+ numbers="$(gh api -X GET search/issues \+ -f q="repo:${REPO} is:${type} is:closed is:unlocked updated:<${since} archived:false" \+ -f sort=updated -f order=desc -F per_page=50 \+ --jq '.items[].number')"+ for number in ${numbers}; do+ echo "Locking ${type} #${number}"+ write -X POST "repos/${REPO}/issues/${number}/comments" -f body="${comment}"+ if [ -n "${labels}" ]; then+ local label_args=()+ IFS=',' read -ra label_list <<< "${labels}"+ for label in "${label_list[@]}"; do+ label_args+=(-f "labels[]=${label}")+ done+ write -X POST "repos/${REPO}/issues/${number}/labels" "${label_args[@]}"+ fi+ write -X PUT "repos/${REPO}/issues/${number}/lock" -f lock_reason=resolved+ done+ }++ lock_threads issue "${ISSUE_INACTIVE_DAYS}" "${ISSUE_COMMENT}" "${ISSUE_LABELS}"+ lock_threads pr "${PR_INACTIVE_DAYS}" "${PR_COMMENT}" "" - uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0 with: operations-per-run: 999
Merged fix · PR #15262+1 −1
.github/workflows/stale.ymlindex 89dbdde7d..73e31f024 100644@@ -12,7 +12,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps:- - uses: dessant/lock-threads@f5f995c727ac99a91dec92781a8e34e7c839a65e # v6.0.0+ - uses: dessant/lock-threads@89ae32b08ed1a541efecbab17912962a5e38981c # v6.0.2 with: issue-inactive-days: 21 add-issue-labels: 'Outdated'