mirror of
https://github.com/anthropics/claude-code.git
synced 2026-02-19 04:27:33 -08:00
The sweep script was closing issues based solely on when a lifecycle label was applied, ignoring any human comments posted after the label. This caused active issues (like #11792) to be closed even when users responded to the stale warning. Three changes: 1. Teach the triage bot about `stale` and `autoclose` labels so it removes them when a human comments on the issue. 2. Add a safety net in `closeExpired()` that checks for non-bot comments posted after the lifecycle label was applied — if any exist, skip closing. 3. Extend the 10-upvote protection (which previously only applied to enhancements) to all issue types, in both `markStale()` and `closeExpired()`. Fixes #16497 ## Test plan Trace through scenarios manually: - Issue with stale label + human comment after → triage removes label; sweep skips even if triage hasn't run yet (safety net) - Issue with stale label + no human comment → closes as before - Issue with 10+ upvotes of any type → never marked stale or closed Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
107 lines
6.0 KiB
YAML
107 lines
6.0 KiB
YAML
name: Claude Issue Triage
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
jobs:
|
|
triage-issue:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
if: >-
|
|
github.event_name == 'issues' ||
|
|
(github.event_name == 'issue_comment' && !github.event.issue.pull_request && github.event.comment.user.type != 'Bot')
|
|
concurrency:
|
|
group: issue-triage-${{ github.event.issue.number }}
|
|
cancel-in-progress: true
|
|
permissions:
|
|
contents: read
|
|
issues: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run Claude Code for Issue Triage
|
|
timeout-minutes: 5
|
|
uses: anthropics/claude-code-action@v1
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
allowed_non_write_users: "*"
|
|
prompt: |
|
|
You're an issue triage assistant. Analyze the issue and manage labels.
|
|
|
|
IMPORTANT: Don't post any comments or messages to the issue. Your only actions are adding or removing labels.
|
|
|
|
Context:
|
|
- REPO: ${{ github.repository }}
|
|
- ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
- EVENT: ${{ github.event_name }}
|
|
|
|
ALLOWED LABELS — you may ONLY use labels from this list. Never invent new labels.
|
|
|
|
Type: bug, enhancement, question, documentation, duplicate, invalid
|
|
Lifecycle: needs-repro, needs-info, stale, autoclose
|
|
Platform: platform:linux, platform:macos, platform:windows, platform:wsl, platform:ios, platform:android, platform:vscode, platform:intellij, platform:web, platform:aws-bedrock
|
|
API: api:bedrock, api:vertex
|
|
|
|
TOOLS:
|
|
- `gh issue view NUMBER`: Read the issue title, body, and labels
|
|
- `gh issue view NUMBER --comments`: Read the conversation
|
|
- `gh search issues QUERY`: Find similar or duplicate issues
|
|
- `gh issue edit NUMBER --add-label` / `--remove-label`: Add or remove labels
|
|
|
|
TASK:
|
|
|
|
1. Run `gh issue view ${{ github.event.issue.number }}` to read the issue details.
|
|
2. Run `gh issue view ${{ github.event.issue.number }} --comments` to read the conversation.
|
|
|
|
**If EVENT is "issues" (new issue):**
|
|
|
|
3. First, check if this issue is actually about Claude Code (the CLI/IDE tool). Issues about the Claude API, claude.ai, the Claude app, Anthropic billing, or other Anthropic products should be labeled `invalid`. If invalid, apply only that label and stop.
|
|
|
|
4. Analyze and apply category labels:
|
|
- Type (bug, enhancement, question, etc.)
|
|
- Technical areas and platform
|
|
- Check for duplicates with `gh search issues`. Only mark as duplicate of OPEN issues.
|
|
|
|
5. Evaluate lifecycle labels:
|
|
- `needs-repro` (bugs only, 7 days): Bug reports without clear steps to reproduce. A good repro has specific, followable steps that someone else could use to see the same issue.
|
|
Do NOT apply if the user already provided error messages, logs, file paths, or a description of what they did. Don't require a specific format — narrative descriptions count.
|
|
For model behavior issues (e.g. "Claude does X when it should do Y"), don't require traditional repro steps — examples and patterns are sufficient.
|
|
- `needs-info` (bugs only, 7 days): The issue needs something from the community before it can progress — e.g. error messages, versions, environment details, or answers to follow-up questions. Don't apply to questions or enhancements.
|
|
Do NOT apply if the user already provided version, environment, and error details. If the issue just needs engineering investigation, that's not `needs-info`.
|
|
|
|
Issues with these labels are automatically closed after the timeout if there's no response.
|
|
The goal is to avoid issues lingering without a clear next step.
|
|
|
|
6. Apply all selected labels:
|
|
`gh issue edit ${{ github.event.issue.number }} --add-label "label1" --add-label "label2"`
|
|
|
|
**If EVENT is "issue_comment" (comment on existing issue):**
|
|
|
|
3. Evaluate lifecycle labels based on the full conversation:
|
|
- If the issue has `stale` or `autoclose`, remove the label — a new human comment means the issue is still active:
|
|
`gh issue edit ${{ github.event.issue.number }} --remove-label "stale" --remove-label "autoclose"`
|
|
- If the issue has `needs-repro` or `needs-info` and the missing information has now been provided, remove the label:
|
|
`gh issue edit ${{ github.event.issue.number }} --remove-label "needs-repro"`
|
|
- If the issue doesn't have lifecycle labels but clearly needs them (e.g., a maintainer asked for repro steps or more details), add the appropriate label.
|
|
- Comments like "+1", "me too", "same here", or emoji reactions are NOT the missing information. Only remove `needs-repro` or `needs-info` when substantive details are actually provided.
|
|
- Do NOT add or remove category labels (bug, enhancement, etc.) on comment events.
|
|
|
|
GUIDELINES:
|
|
- ONLY use labels from the ALLOWED LABELS list above — never create or guess label names
|
|
- DO NOT post any comments to the issue
|
|
- Be conservative with lifecycle labels — only apply when clearly warranted
|
|
- Only apply lifecycle labels (`needs-repro`, `needs-info`) to bugs — never to questions or enhancements
|
|
- When in doubt, don't apply a lifecycle label — false positives are worse than missing labels
|
|
- It's okay to not add any labels if none are clearly applicable
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
claude_args: |
|
|
--model claude-opus-4-6
|
|
--allowedTools "Bash(gh issue view:*),Bash(gh issue edit:*),Bash(gh search issues:*)"
|