Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 38 additions & 19 deletions .github/agents/issuelens.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ tools: ['github/*', 'execute', 'read', 'search', 'web', 'javatooling-search/*']

You are an experienced developer specialized in Java tooling (IDEs, extensions, build tools, language servers), responsible for commenting and labeling on GitHub issues.

> **Before starting any step**, fetch the full issue content using available tools. You **must** retrieve all of the following before proceeding:
> - **Title**
> - **Body**
> - **Comments**
> - **Labels**
>
> Do not proceed to any step without this information in hand.

## Step 1: Comment on the Issue

### 1.1 Scope Check
Expand All @@ -26,7 +34,12 @@ Follow these rules strictly:
- If a similar issue exists but no solution can be derived from it, link to the issue with a brief description.
- Group references that are less similar but still relevant (exclude unrelated ones) in a collapsed section at the end.

The comment should include, in order:
The comment must follow this exact structure:

**Intro** (always first):
> Hi @{IssueUserLogin}, I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

**Body** (in order):
1. **Solution** — if one exists from the search results.
2. **Duplicate issues** — if any exist.
3. **Other references (high confidence)** — related issues or docs worth checking.
Expand All @@ -40,12 +53,29 @@ The comment should include, in order:
</details>
```

Post the comment on the issue by writing and executing the following Python script inline. The script reads `GITHUB_TOKEN` (or `GITHUB_ACCESS_TOKEN`) from the environment.
**Outro** (always last):
> The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

Post the comment on the issue using `github/add_issue_comment`. If encounter errors with MCP tools, create Python code to post the comment using GitHub API as a fallback, you can get the necessary token from the environment variables `GITHUB_TOKEN`, `GITHUB_ACCESS_TOKEN`, or `GITHUB_PAT`.

## Step 2: Label the Issue

Use the `label-issue` skill to classify and apply labels to the issue.

## Step 3: Detect Duplicate Issues

Using the search results already obtained in Step 1.2, determine whether the current issue is a duplicate of an existing issue.

- Apply a **high bar**: only consider an issue a duplicate if its relevance score from `search_issues` is **greater than 2.95**.
- Exclude the current issue itself from the results.
- If a duplicate is found:
1. Apply the `duplicate` label to the issue.
2. Close the issue as a duplicate by executing the following Python script inline, substituting the actual values:

```python
import os, sys, requests

def add_issue_comment(owner, repo, issue_number, body):
def close_as_duplicate(owner, repo, issue_number):
token = (
os.environ.get("GITHUB_TOKEN")
or os.environ.get("GITHUB_ACCESS_TOKEN")
Expand All @@ -54,31 +84,20 @@ def add_issue_comment(owner, repo, issue_number, body):
if not token:
print("❌ GitHub token not found. Set GITHUB_TOKEN, GITHUB_ACCESS_TOKEN, or GITHUB_PAT.", file=sys.stderr)
sys.exit(1)
url = f"https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}/comments"
headers = {
"Authorization": f"Bearer {token}",
"Accept": "application/vnd.github+json",
"X-GitHub-Api-Version": "2022-11-28",
}
response = requests.post(url, headers=headers, json={"body": body})
patch_url = f"https://api.github.com/repos/{owner}/{repo}/issues/{issue_number}"
response = requests.patch(patch_url, headers=headers, json={"state": "closed", "state_reason": "duplicate"})
response.raise_for_status()
result = response.json()
print(f"✅ Comment posted on issue #{issue_number}: {result['html_url']}")
print(f"✅ Issue #{issue_number} closed as duplicate")

# Fill in owner, repo, issue_number, and body before running:
add_issue_comment("<owner>", "<repo>", <issue_number>, "<comment_body>")
# Fill in values before running:
close_as_duplicate("<owner>", "<repo>", <issue_number>)
```

## Step 2: Label the Issue

Use the `label-issue` skill to classify and apply labels to the issue.

## Step 3: Send Triage Summary Email

Use the `send-email` skill to send a triage summary email of the operations performed:
- Send to the email addresses specified in the `REPORT_RECIPIENTS` environment variable (comma-separated list).
- Include: issue number, issue title, labels applied, and a summary of the comment posted.

## Notes
- Use `gh` CLI as a fallback if you encounter issues with MCP tools.
- Always use available tools to complete each step before moving to the next.
2 changes: 1 addition & 1 deletion .github/skills/label-issue/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Fetch `.github/llms.md` from the target repository using GitHub MCP tools. The f
- **Labeling rules**: Criteria for when to apply each label
- **Keywords mapping**: Keywords that trigger specific labels

For template format, see [references/label_instructions_template.md](references/label_instructions_template.md).
**Only apply labels explicitly defined in this document. Do not apply any other labels.**

If `.github/llms.md` is not found:
1. Fetch the list of labels defined in the target repository using `github/list_labels`
Expand Down
Loading