Backtestshugorun-20261013-011256#15261

Issue #15261 Merged fix PR #15262 Run 13 Oct 2026 · run-20261013-011256 gohugoio/hugo

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.

Both patches target the root cause: dessant/lock-threads v6.0.0 validates github-token length at ≤100 characters, and GitHub began issuing longer tokens. Patch A bumps to v6.0.2, presumably the upstream release that relaxes that validation, with a pinned SHA. It is a minimal one-line change that keeps the existing configuration (inactive days, labels, comments) intact. I can't verify from the diff alone that v6.0.2 contains the fix, which limits confidence somewhat, but a patch-level bump right after this breakage is the conventional fix. Patch B replaces the action with a hand-written gh CLI shell script. That removes the dependency on the bug, but it adds real risk and behavioral drift. The search returns at most 50 items per type, with no pagination. It invents a PR_INACTIVE_DAYS of 365, which the original config didn't specify; lock-threads' default is 365, so this happens to match, but it is guessed. It does label, comment and lock as separate non-atomic steps, so a mid-loop failure under set -e leaves threads half-processed. It relies on search API semantics ('updated:<'), which differ from lock-threads' logic. And it introduces about 40 lines of custom code to maintain. Neither patch adds tests, which is appropriate for a workflow file. On correctness-with-least-risk, 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

2m 45s

Wall-clock time in the container

Full test suite

Not run

The harness did not reach the test stage

Contamination audit

Clean

No sign the agent saw the real fix

Patch size

48vs 2 merged

Changed lines, ours vs merged

The 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+42 −6
.github/workflows/stale.ymlindex 89dbdde7d..748fbc7ca 100644@@ -12,18 +12,54 @@ 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 v6.0.0 rejects GitHub tokens longer than 100 characters,+      # which broke this workflow when GitHub started issuing longer tokens.+      - name: Lock closed issues and PRs+        env:+          GH_TOKEN: ${{ github.token }}+          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++          find_threads() {+            local kind="$1" days="$2" before+            before="$(date -u -d "${days} days ago" +%Y-%m-%d)"+            gh api -X GET search/issues \+              -f q="repo:${GITHUB_REPOSITORY} is:${kind} is:closed is:unlocked updated:<${before}" \+              -f sort=updated -f order=asc -f per_page=50 \+              --jq '.items[].number'+          }++          # Assign before looping so a failed search fails the step (set -e ignores+          # failures inside a for loop's word list). Sleep between threads to stay+          # under GitHub's secondary rate limit for content-creating requests.+          issues="$(find_threads issue "$ISSUE_INACTIVE_DAYS")"+          for n in $issues; do+            echo "Locking issue #$n"+            gh issue edit "$n" --repo "$GITHUB_REPOSITORY" --add-label "$ISSUE_LABELS"+            gh issue comment "$n" --repo "$GITHUB_REPOSITORY" --body "$ISSUE_COMMENT"+            gh issue lock "$n" --repo "$GITHUB_REPOSITORY" --reason resolved+            sleep 2+          done++          prs="$(find_threads pr "$PR_INACTIVE_DAYS")"+          for n in $prs; do+            echo "Locking PR #$n"+            gh pr comment "$n" --repo "$GITHUB_REPOSITORY" --body "$PR_COMMENT"+            gh pr lock "$n" --repo "$GITHUB_REPOSITORY" --reason resolved+            sleep 2+          done       - 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'