Skip to content

Commit 852589a

Browse files
Copilotchagong
andauthored
Add AI triage agent workflow and LLM documentation from vscode-gradle (#902)
* Initial plan * Add AI triage agent workflow and LLM documentation from vscode-gradle Co-authored-by: chagong <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: chagong <[email protected]>
1 parent 124b733 commit 852589a

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-0
lines changed

.github/llms.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Extension Pack for Java
2+
Extension Pack for Java is a collection of popular extensions that can help write, test and debug Java applications in Visual Studio Code. By installing Extension Pack for Java, the following extensions are installed:
3+
4+
- [📦 Language Support for Java™ by Red Hat ](https://marketplace.visualstudio.com/items?itemName=redhat.java)
5+
- Code Navigation
6+
- Auto Completion
7+
- Refactoring
8+
- Code Snippets
9+
- [📦 Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug)
10+
- Debugging
11+
- [📦 Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test)
12+
- Run & Debug JUnit/TestNG Test Cases
13+
- [📦 Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven)
14+
- Project Scaffolding
15+
- Custom Goals
16+
- [📦 Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle)
17+
- View Gradle tasks and project dependencies
18+
- Gradle file authoring
19+
- Import Gradle projects via [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle)
20+
- [📦 Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency)
21+
- Manage Java projects, referenced libraries, resource files, packages, classes, and class members
22+
- [📦 Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode)
23+
- AI-assisted development
24+
- Completion list ranked by AI
25+
26+
## Label
27+
When labeling an issue, follow the rules below per label category:
28+
### General Rules
29+
- Analyze if the issue is related with the scope of using extensions for Java development. If not, STOP labelling IMMEDIATELY.
30+
- Assign label per category.
31+
- If a category is not applicable or you're unsure, you may skip it.
32+
- Do not assign multiple labels within the same category, unless explicitly allowed as an exception.
33+
34+
### Issue Type Labels
35+
- [bug]: Primary label for real bug issues
36+
- [enhancement]: Primary label for enhancement issues
37+
- [documentation]: Primary label for documentation issues
38+
- [question]: Primary label for question issues

.github/workflows/triage-agent.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: AI Triage - Label and Comment on New Issues
2+
on:
3+
issues:
4+
types: [opened]
5+
workflow_dispatch:
6+
inputs:
7+
issue_number:
8+
description: 'Issue number to triage (manual run). e.g. 123'
9+
required: true
10+
11+
permissions:
12+
issues: write
13+
contents: read
14+
15+
jobs:
16+
label_and_comment:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
23+
- name: Get issue data
24+
id: get_issue
25+
uses: actions/github-script@v6
26+
with:
27+
script: |
28+
const eventName = context.eventName;
29+
let issue;
30+
if (eventName === 'workflow_dispatch') {
31+
const inputs = context.payload.inputs || {};
32+
const issueNumber = inputs.issue_number || inputs.issueNumber;
33+
if (!issueNumber) core.setFailed('Input issue_number is required for manual run.');
34+
const { data } = await github.rest.issues.get({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
issue_number: parseInt(issueNumber, 10),
38+
});
39+
issue = data;
40+
} else if (context.payload.issue) {
41+
issue = context.payload.issue;
42+
} else {
43+
core.setFailed('No issue information found in the event payload.');
44+
}
45+
core.setOutput('id', String(issue.number));
46+
core.setOutput('user', String((issue.user && issue.user.login) || ''));
47+
core.setOutput('title', String(issue.title || ''));
48+
core.setOutput('body', String(issue.body || ''));
49+
const labelNames = (issue.labels || []).map(label => label.name);
50+
core.setOutput('labels', JSON.stringify(labelNames));
51+
52+
- name: Call Azure Function
53+
id: call_azure_function
54+
env:
55+
PAYLOAD: >-
56+
{
57+
"authToken": "${{ secrets.GITHUB_TOKEN }}",
58+
"repoId": "microsoft/vscode-java-dependency",
59+
"issueData": {
60+
"id": ${{ steps.get_issue.outputs.id }},
61+
"user": ${{ toJson(steps.get_issue.outputs.user) }},
62+
"title": ${{ toJson(steps.get_issue.outputs.title) }},
63+
"body": ${{ toJson(steps.get_issue.outputs.body) }},
64+
"labels": ${{ steps.get_issue.outputs.labels }}
65+
},
66+
"mode": "DirectUpdate"
67+
}
68+
69+
run: |
70+
# Make the HTTP request with improved error handling and timeouts
71+
echo "Making request to triage agent..."
72+
73+
# Add timeout handling and better error detection
74+
set +e # Don't exit on curl failure
75+
response=$(timeout ${{ vars.TRIAGE_AGENT_TIMEOUT }} curl \
76+
--max-time 0 \
77+
--connect-timeout 30 \
78+
--fail-with-body \
79+
--silent \
80+
--show-error \
81+
--write-out "HTTPSTATUS:%{http_code}" \
82+
--header "Content-Type: application/json" \
83+
--request POST \
84+
--data "$PAYLOAD" \
85+
${{ secrets.TRIAGE_FUNCTION_LINK }} 2>&1)
86+
87+
curl_exit_code=$?
88+
set -e # Re-enable exit on error
89+
90+
echo "Curl exit code: $curl_exit_code"
91+
92+
# Check if curl command timed out or failed
93+
if [ $curl_exit_code -eq 124 ]; then
94+
echo "❌ Request timed out after 650 seconds"
95+
exit 1
96+
elif [ $curl_exit_code -ne 0 ]; then
97+
echo "❌ Curl command failed with exit code: $curl_exit_code"
98+
echo "Response: $response"
99+
exit 1
100+
fi
101+
102+
# Extract HTTP status code and response body
103+
http_code=$(echo "$response" | grep -o "HTTPSTATUS:[0-9]*" | cut -d: -f2)
104+
response_body=$(echo "$response" | sed 's/HTTPSTATUS:[0-9]*$//')
105+
106+
echo "HTTP Status Code: $http_code"
107+
108+
# Validate HTTP status code
109+
if [ -z "$http_code" ]; then
110+
echo "❌ Failed to extract HTTP status code from response"
111+
echo "Raw response: $response"
112+
exit 1
113+
fi
114+
115+
# Check if the request was successful
116+
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
117+
echo "✅ Azure Function call succeeded"
118+
else
119+
echo "❌ Azure Function call failed with status code: $http_code"
120+
echo "Response: $response_body"
121+
exit 1
122+
fi

0 commit comments

Comments
 (0)