@@ -151,3 +151,33 @@ jobs: |
151 | 151 | - **One PR per coherent set**: batch every instance of the same problem — and all related dependency updates — into a single PR, or a few PRs split by coherent group. Never one PR per item or per dependency. |
152 | 152 | - **Prefer tracked, higher-impact work**: before inventing a new micro-fix, check the open issues and implement the highest-impact one you can complete and verify, even when it spans several files. |
153 | 153 | - **Merging is permitted, never required**: merge your PR only when checks pass and you are reasonably certain it is correct and low-risk. Otherwise leave it open and state your confidence and what a human should check in the description. |
| 154 | +
|
| 155 | + - name: Close superseded daily session-prompt issues (#15723) |
| 156 | + # Runs in the same job as the dispatch above, once the new tracking |
| 157 | + # issue exists, so each close comment can name it as the successor. |
| 158 | + # A prior copy is stale when it is open, carries the exact |
| 159 | + # session-prompt title, is older than 24h, and is not claimed (no |
| 160 | + # queue/claimed label): a claimed/in-flight copy is never auto-closed. |
| 161 | + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && steps.dispatch.outputs.issue_number != '' |
| 162 | + env: |
| 163 | + GH_TOKEN: ${{ github.token }} |
| 164 | + NEW_ISSUE: ${{ steps.dispatch.outputs.issue_number }} |
| 165 | + run: | |
| 166 | + set -euo pipefail |
| 167 | + cutoff="$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" |
| 168 | + gh issue list --repo "$GITHUB_REPOSITORY" --state open --limit 100 \ |
| 169 | + --search '"Daily codebase innovation & maintenance" in:title' \ |
| 170 | + --json number,title,createdAt,labels > stale-copies.json |
| 171 | + jq -r --arg cutoff "$cutoff" --argjson new_issue "$NEW_ISSUE" ' |
| 172 | + .[] |
| 173 | + | select(.title == "Daily codebase innovation & maintenance") |
| 174 | + | select(.number != $new_issue) |
| 175 | + | select(.createdAt < $cutoff) |
| 176 | + | select([.labels[].name] | index("queue/claimed") == null) |
| 177 | + | .number' stale-copies.json > stale-copies.txt |
| 178 | + while read -r n; do |
| 179 | + [ -n "$n" ] || continue |
| 180 | + echo "closing superseded session-prompt issue #$n" |
| 181 | + gh issue close "$n" --repo "$GITHUB_REPOSITORY" \ |
| 182 | + --comment "closed as moot — session prompt superseded by #$NEW_ISSUE" |
| 183 | + done < stale-copies.txt |