Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

The automated cleanup scripts for expired issues and discussions lacked visibility into their execution, making it difficult to debug failures or understand why items were or weren't closed.

Changes

Enhanced logging in close_expired_issues.cjs and close_expired_discussions.cjs:

  • Search phase: Log pagination progress (page count, cursor, items scanned), agentic item counts, and each item found with expiration markers
  • Expiration check: Log current timestamp, per-item creation/expiration dates, and time calculations (days/hours expired or remaining)
  • Closing phase: Log progress indicators [N/Total], operation status, detailed error objects, and rate limit delays

Enhanced GitHub Actions step summaries:

  • Scan summary: Total items scanned, pages processed, items with expiration markers, expired count, not-yet-expired count
  • Closing summary: Successfully closed, failed to close (with errors), remaining for next run
  • Successfully closed list: Links to all closed items
  • Failed list: Links to failed items with error messages
  • Not yet expired list: First 10 items with expiration countdown (days and hours)
  • Always shown: Summary displayed even when no items are found or no actions are taken

Example log output:

Starting GraphQL search for open issues in githubnext/gh-aw
Fetching page 1 of open issues (cursor: initial)
Page 1: Retrieved 100 open issues (total scanned: 100)
  Found issue #123 with expiration marker: "2024-01-15T00:00:00Z" - Issue Title
Page 1 summary: 15 agentic issues, 1 with expiration markers
Search complete: Scanned 100 issues across 1 pages, found 1 with expiration markers

Current date/time: 2026-01-15T13:27:30.957Z
Processing issue #123: Issue Title
  Creation date: 2024-01-10T10:00:00.000Z
  Expiration date: 2024-01-15T00:00:00.000Z
  ✓ Issue #123 is EXPIRED (expired 365 days, 13 hours ago)
  
[1/1] Processing issue #123: https://github.com/githubnext/gh-aw/issues/123
  Adding closing comment to issue #123
  ✓ Comment added successfully

Example step summary:

## Expired Issues Cleanup

**Scan Summary**
- Scanned: 150 issues across 2 page(s)
- With expiration markers: 3 issue(s)
- Expired: 1 issue(s)
- Not yet expired: 2 issue(s)

**Closing Summary**
- Successfully closed: 1 issue(s)

### Successfully Closed Issues
- Issue #123: [Title](url)

### Not Yet Expired
- Issue #456: [Title](url) - Expires in 31d 10h

Logic verified: pattern matching (agentic marker + expiration marker), date comparison (now >= expirationDate), and time calculations all confirmed correct.

Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21032083626/job/60470373007#step:4:1

Update the JavaScript that cleans expired issues and discussions:

  • add much more logging to core.info
  • double check the logic with current data

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ed_discussions.cjs

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update JavaScript for cleaning expired issues and discussions Add comprehensive logging to expired issues/discussions cleanup scripts Jan 15, 2026
Copilot AI requested a review from pelikhan January 15, 2026 13:37
@pelikhan
Copy link
Contributor

@copilot

  • also render to step summary

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot

  • also render to step summary

Done in bc41bb6. The scripts now render comprehensive step summaries showing:

  • Scan summary: items scanned, pages, expiration markers found
  • Closing summary: successfully closed, failed, remaining for next run
  • Detailed lists: closed items, failed items with errors, upcoming expirations (first 10)
  • Always visible: summary shown even when no items are found

Example summary output:

## Expired Issues Cleanup

**Scan Summary**
- Scanned: 150 issues across 2 page(s)
- With expiration markers: 3 issue(s)
- Expired: 1 issue(s)
- Not yet expired: 2 issue(s)

**Closing Summary**
- Successfully closed: 1 issue(s)

### Successfully Closed Issues
- Issue #123: [Title](url)

### Not Yet Expired
- Issue #456: [Title](url) - Expires in 31d 10h
- Issue #789: [Title](url) - Expires in 5d 3h

Copilot AI changed the title Add comprehensive logging to expired issues/discussions cleanup scripts Add comprehensive logging and step summaries to expired issues/discussions cleanup scripts Jan 15, 2026
@pelikhan pelikhan marked this pull request as ready for review January 15, 2026 13:59
@pelikhan pelikhan merged commit b149d67 into main Jan 15, 2026
@pelikhan pelikhan deleted the copilot/update-js-cleanup-logging branch January 15, 2026 13:59
mnkiefer pushed a commit that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants