Add stale label tagging and 30-day auto-close to stale-issues workflow#474
Add stale label tagging and 30-day auto-close to stale-issues workflow#474
Conversation
Update the stale-issues workflow to operate in two phases: 1. Close phase: auto-close issues labeled 'stale' for 30+ days 2. Tag phase: label newly identified stale candidates with 'stale' Add add-labels and close-issue safe outputs. Update permissions to issues: write. Update README and docs. Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
|
@copilot if someone has commented not stale then we should remove the stale label on our next check |
Phase 1 now checks for objection comments (e.g. "not stale", "still relevant") posted after the stale label was added. If found, the stale label is removed via gh CLI and the issue is skipped from automatic closure. Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Done in 2c83619. Phase 1 now checks for objection comments ("not stale", "still relevant", "still needed", "still an issue", "still a problem") posted after the |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis pull request splits the single "stale-issues" GitHub Actions workflow into two specialized workflows: stale-issues-investigator (labels likely-resolved issues as stale and files a report) and stale-issues-remediator (processes stale-labeled issues, removes labels for objections, and closes issues after a 30-day grace period). It adds an add_labels safe-outputs tool and a configurable stale-label input, updates triggers, lockfiles, docs, example workflows, and quick-setup/backwards-compat scripts to reflect the new investigator/remediator split and preserve compatibility. Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/ai we won't be using gh command line to do edits we'll need to use a real gh-aw safe output to modify labels |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
❌ Author of the following commits did not sign a Contributor Agreement: Please, read and sign the above mentioned agreement if you want to contribute to this project |
|
/ai can you check if we could use a workflow input for the name of the stale label? Does the order of events here cause any concerns? Is there any of this that we should script to help? Like for issues with the stale label, write all issue numbers and names to disk, for issues with the stale label and a comment more recent than the stale label put those in a separate file, etc. We can probably also modify our duplicate issues agent to also have a script run which dumps like the first thousand open issue numbers and titles to disk? Kinda line we do for the previous findings agent |
|
Yes—adding a workflow input for the stale label is reasonable, and you already use this pattern elsewhere ( Main concerns I see in this PR version:
On event/order: running close first, then tag is the right order and avoids same-run reprocessing of newly-tagged issues. On scripting: I agree it would help. I’d add a prep step (same idea as
That gives deterministic inputs to the agent prompt and makes debugging/replays much easier. What is this? | From workflow: Mention in PR Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not. |
@copilot I agree let's do it, for removing labels we should use |
…ep step
- Replace gh CLI label removal with remove-labels safe output
- Add configurable stale-label workflow input (default: "stale")
- Add prep step that dumps stale-labeled issues and recent comments to
/tmp/stale-labeled-issues.json and /tmp/stale-recent-comments.json
- Use ${{ inputs.stale-label }} throughout prompt and safe-outputs config
- Remove erroneous github/workflows/ duplicate file
- Update README with new input and prep step docs
Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
…o 500 chars Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Fixed in e15a6a4 — replaced
Implemented in e15a6a4:
Added in e15a6a4:
The duplicate-issues agent suggestion (dumping first 1000 open issues) makes sense but would be a separate PR since it touches a different workflow. |
|
@copilot can you check out the tool name and make sure we got it right |
The workflow runs on schedule/dispatch (no triggering issue), so add-labels, remove-labels, and close-issue all need target: "*" to operate on arbitrary issues (default "triggering" requires an issue event). Also fix required_labels → required-labels to match gh-aw reference docs kebab-case convention. Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
Verified against the gh-aw reference docs: Found two additional issues while checking — fixed in 6a5cbfb:
|
- Add prep step to fetch label timeline events to /tmp/stale-label-events.json for reliable 30-day expiry calculation - Fix close-issue → close_issue to match snake_case tool convention - Update prompt to reference label events file for 30-day check - Revert issues: write → read (safe outputs handle permissions) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Prevents incomplete label event history on issues with >30 events, which could cause premature 30-day closure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes review feedback: multi-word labels need quoting in GitHub search queries, and code fences should specify a language marker. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Keeps both the stale-labeled issues collection step (from this PR) and the prescan open issues step (from merged PR #481). Recompiled lock file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Separates the combined stale-issues workflow into two with a hard permission boundary: - **stale-issues-investigator**: finds resolved issues, labels them as stale, files a report (add-labels, create-issue, noop) - **stale-issues-remediator**: processes stale-labeled issues — handles objections and closes after 30-day grace (remove-labels, close-issue, noop) Renames stale-issues → stale-issues-investigator with a backwards-compat copy at the old lock.yml path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@github/workflows/gh-aw-stale-issues-remediator.md`:
- Around line 111-115: The gh api invocation is incorrectly passing jq's --arg
to gh (causing silent failure); change the pipeline so gh api outputs raw JSON
(use gh api --paginate "repos/$GITHUB_REPOSITORY/issues/$num/events" without
--jq/--arg) and then pipe that output into a standalone jq process that uses
--arg lbl "$STALE_LABEL" and the existing filter expression, e.g.: gh api ... |
jq --arg lbl "$STALE_LABEL" '[.[] | select((.event=="labeled" or
.event=="unlabeled") and .label.name==$lbl) | {number: '"$num"', event: .event,
created_at: .created_at}]' 2>/dev/null || echo "[]", ensuring the overall
pipeline still writes /tmp/stale-label-events.json or falls back to "[]".
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (18)
.github/workflows/agentics-maintenance.yml.github/workflows/gh-aw-stale-issues-investigator.lock.yml.github/workflows/gh-aw-stale-issues-investigator.md.github/workflows/gh-aw-stale-issues-remediator.lock.yml.github/workflows/gh-aw-stale-issues-remediator.md.github/workflows/gh-aw-stale-issues.lock.yml.github/workflows/trigger-stale-issues-investigator.yml.github/workflows/trigger-stale-issues-remediator.ymldocs/upgrading.mddocs/workflows/gh-agent-workflows.mdgh-agent-workflows/stale-issues-investigator/README.mdgh-agent-workflows/stale-issues-investigator/example.ymlgh-agent-workflows/stale-issues-remediator/README.mdgh-agent-workflows/stale-issues-remediator/example.ymlgithub/workflows/gh-aw-stale-issues-investigator.mdgithub/workflows/gh-aw-stale-issues-remediator.mdscripts/backwards-compat.shscripts/quick-setup.sh
✅ Files skipped from review due to trivial changes (1)
- gh-agent-workflows/stale-issues-remediator/README.md
- Create docs/workflows/gh-agent-workflows/stale-issues.md overview page covering both investigator and remediator (fixes nav/catalog consistency check) - Fix remediator prep step: gh api does not support --arg, pipe to standalone jq instead Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This PR splits stale-issue automation into a detector/fixer pair:
stale-issuesis nowstale-issues-investigator, and a newstale-issues-remediatorworkflow handles objections and 30-day auto-close.What changed
Split the previous single flow into two workflows
gh-aw-stale-issues-investigator) finds likely-resolved open issues, applies the configurable stale label, and files a report.gh-aw-stale-issues-remediator) processes already stale-labeled issues: removes the label when valid objections are posted, and closes issues after 30+ days with no objection.Added
stale-labelinputstale-label(defaultstale) and reference it throughout safe outputs and prompts.Added remediator prep/data collection
/tmp/stale-labeled-issues.json/tmp/stale-recent-comments.json/tmp/stale-label-events.jsonSafe outputs updated by role
add-labels+create-issueremove-labels+close-issue(with required stale label)Workflow migration and compatibility
.github/workflows/gh-aw-stale-issues.lock.ymlas a backward-compatibility copy with a deprecation header pointing togh-aw-stale-issues-investigator.lock.yml.Maintenance cadence update
.github/workflows/agentics-maintenance.ymlnow runs every 6 hours (from daily) to align with the 2-day expiration window used by stale-issues reporting.Docs/setup updates
gh-agent-workflows/.docs/workflows/gh-agent-workflows/stale-issues.md.