|
1 | 1 | description = "Analyzes and cleans up older issues by checking code validity, duplicates, and providing a triage summary." |
2 | 2 | prompt = """ |
3 | | -Execute the following triage process for Issue #!{echo $ISSUE_NUMBER} in the `!{echo $REPOSITORY}` repository. |
4 | | -You are a script executor. You MUST execute these steps in exact sequential order. Do not skip steps. Do not parallelize steps. Do not investigate your own configuration. |
| 3 | +Execute the following triage process for `!{echo $ISSUE_LINK}`. |
| 4 | +You are a script executor. You MUST execute these steps in exact sequential order. Do not skip steps. Do not parallelize steps. Do not investigate your own configuration. DO NOT clone the repository until you reach Step 5. |
5 | 5 |
|
6 | | -### STEP 1: FETCH DATA (MANDATORY FIRST TURN) |
7 | | -You MUST execute ONLY these two commands in your very first turn. Do NOT execute any other tools. |
8 | | -1. `git clone https://github.com/!{echo $REPOSITORY}.git target-repo` |
9 | | -2. `gh issue view !{echo $ISSUE_NUMBER} --repo !{echo $REPOSITORY} --json title,body,author,comments,labels,assignees` |
10 | | -
|
11 | | -WAIT for the output of Step 1 before proceeding to Step 2. |
12 | | -
|
13 | | -### STEP 2: RESOLUTION CHECK |
14 | | -Read the comments from the `gh issue view` output. |
15 | | -Does the latest comment indicate that the issue has been fixed, resolved, or is functioning properly? |
16 | | -- If YES: Execute `gh issue close !{echo $ISSUE_NUMBER} --comment "Closing because the latest comments indicate this issue has been resolved. Feel free to reopen if the problem persists." --reason "completed" --repo !{echo $REPOSITORY}` and **STOP EXECUTION IMMEDIATELY**. |
17 | | -- If NO: Proceed to Step 3. |
| 6 | +<custom_instructions> |
| 7 | +!{echo $CUSTOM_INSTRUCTIONS} |
| 8 | +</custom_instructions> |
18 | 9 |
|
19 | | -### STEP 3: INACTIVITY CHECK |
20 | | -Check the environment variable `!{echo $INACTIVE_OVER_30_DAYS}`. Is it exactly equal to the string `true`? |
21 | | -- If YES: Execute the following bash script exactly as written. |
22 | | -```bash |
23 | | -ISSUE_JSON=$(gh issue view !{echo $ISSUE_NUMBER} --repo !{echo $REPOSITORY} --json author,labels,assignees) |
24 | | -REPORTER=$(echo "$ISSUE_JSON" | jq -r '.author.login') |
25 | | -HAS_ASSIGNEES=$(echo "$ISSUE_JSON" | jq '.assignees | length > 0') |
26 | | -ASSIGNEE_MENTIONS=$(echo "$ISSUE_JSON" | jq -r '.assignees | map("@" + .login) | join(" ")') |
27 | | -IS_HIGH_PRIORITY=$(echo "$ISSUE_JSON" | jq '.labels | map(.name | ascii_downcase) | any(. == "priority/p0" or . == "priority/p1" or . == "p0" or . == "p1")') |
28 | | -IS_FEATURE=$(echo "$ISSUE_JSON" | jq '.labels | map(.name | ascii_downcase) | any(contains("feature") or contains("enhancement"))') |
| 10 | +### STEP 1: FETCH DATA (MANDATORY FIRST TURN) |
| 11 | +You MUST execute ONLY these commands in your very first turn. Do NOT execute any other tools. |
| 12 | +1. `gh issue view !{echo $ISSUE_LINK} --json title,body,author,comments,labels,assignees` |
| 13 | +2. `gh api repos/!{echo $REPOSITORY}/issues/$(echo !{echo $ISSUE_LINK} | awk -F/ '{print $NF}')/timeline --jq '[.[] | select(.event == "cross-referenced" and .source.issue)] | map({issue: .source.issue.number, state: .source.issue.state, state_reason: .source.issue.state_reason, is_pr: (.source.issue.pull_request != null)})'` |
| 14 | +3. `gh api graphql -F owner=$(echo !{echo $REPOSITORY} | cut -d/ -f1) -F repo=$(echo !{echo $REPOSITORY} | cut -d/ -f2) -F number=$(echo !{echo $ISSUE_LINK} | awk -F/ '{print $NF}') -f query='query($owner: String!, $repo: String!, $number: Int!) { repository(owner: $owner, name: $repo) { issue(number: $number) { parent { number } } } }' --jq '.data.repository.issue.parent'` |
| 15 | +4. `gh api repos/!{echo $REPOSITORY}/issues/$(echo !{echo $ISSUE_LINK} | awk -F/ '{print $NF}') --jq '{is_epic: (.sub_issues_summary.total > 0)}'` |
29 | 16 |
|
30 | | -gh issue edit !{echo $ISSUE_NUMBER} --remove-label "status/need-triage" --repo !{echo $REPOSITORY} 2>/dev/null || true |
31 | | -gh issue edit !{echo $ISSUE_NUMBER} --add-label "status/needs-info" --repo !{echo $REPOSITORY} 2>/dev/null || true |
| 17 | +WAIT for the outputs of Step 1 before proceeding to Step 2. |
32 | 18 |
|
33 | | -COMMENT="" |
34 | | -if [ "$IS_FEATURE" = "true" ]; then |
35 | | - COMMENT="@${REPORTER}, this feature request hasn't been updated in over a month. Please reopen if this is still needed." |
36 | | -else |
37 | | - COMMENT="@${REPORTER}, this issue hasn't been updated in over a month. Could you please try reproducing it with the latest build? If it still occurs, please provide detailed reproduction steps." |
38 | | -fi |
| 19 | +### STEP 2: PRE-TRIAGE OVERRIDES |
| 20 | +Review the <custom_instructions> provided at the beginning of this prompt. Do they contain any conditions that dictate stopping execution early based on the data fetched in Step 1 (e.g., specific labels)? |
| 21 | +- If YES and the condition is met: Execute the actions specified in the custom instructions and **STOP EXECUTION IMMEDIATELY**. Do not proceed to Step 3. |
| 22 | +- If NO or the condition is not met: Proceed to Step 3. |
39 | 23 |
|
40 | | -if [ "$IS_HIGH_PRIORITY" = "false" ]; then |
41 | | - if [ "$HAS_ASSIGNEES" = "true" ]; then |
42 | | - COMMENT="${COMMENT}\n\n${ASSIGNEE_MENTIONS}, please reopen if you are actively working on this." |
43 | | - elif [ "$IS_FEATURE" = "false" ]; then |
44 | | - COMMENT="${COMMENT} Feel free to reopen this issue." |
45 | | - fi |
46 | | -else |
47 | | - if [ "$HAS_ASSIGNEES" = "true" ]; then |
48 | | - COMMENT="${COMMENT}\n\n${ASSIGNEE_MENTIONS}, checking in on this high priority issue." |
49 | | - fi |
50 | | -fi |
| 24 | +### STEP 3: RESOLUTION CHECK |
| 25 | +Read ALL the comments from the `gh issue view` output carefully. |
| 26 | +Check if ANY of the following conditions are met in the comments (especially the latest ones): |
| 27 | +1. Is it fixed, resolved, no longer reproducible, or functioning properly? (e.g., someone mentions it `might be fixed`, `should be fixed`, or `no longer an issue`) AND the reporter has not replied afterward to contradict this? |
| 28 | +2. Is there a workaround provided? |
| 29 | +3. Does someone state the issue is actually unrelated to this repository/project, or is an external problem (like a terminal emulator bug)? |
51 | 30 |
|
52 | | -gh issue comment !{echo $ISSUE_NUMBER} --body "$COMMENT" --repo !{echo $REPOSITORY} |
| 31 | +- If condition 1 or 2 is met: Execute `gh issue close !{echo $ISSUE_LINK} --comment "Closing because the comments indicate this issue might be fixed, has a workaround, is no longer an issue, or is resolved. Feel free to reopen if the problem persists." --reason "completed"` and **STOP EXECUTION IMMEDIATELY**. |
| 32 | +- If condition 3 is met: Execute `gh issue close !{echo $ISSUE_LINK} --comment "Closing because the comments indicate this issue is unrelated to the Gemini CLI or is an external problem." --reason "not planned"` and **STOP EXECUTION IMMEDIATELY**. |
| 33 | +- If NONE of these conditions are met: Proceed to Step 4. |
53 | 34 |
|
54 | | -if [ "$IS_HIGH_PRIORITY" = "false" ]; then |
55 | | - gh issue close !{echo $ISSUE_NUMBER} --reason "not planned" --repo !{echo $REPOSITORY} |
56 | | -fi |
57 | | -``` |
58 | | - - After executing this script, **STOP EXECUTION IMMEDIATELY**. Do not proceed to Step 4. |
59 | | -- If NO: Proceed to Step 4. |
| 35 | +### STEP 4: ASSIGNEE AND INACTIVITY CHECK |
| 36 | +1. ASSIGNEE CHECK: Look at the assignees and comments from Step 1. If an assignee is a contributor and hasn't made any updates on the issue for over 2 weeks, you MUST execute `gh issue edit !{echo $ISSUE_LINK} --remove-assignee <username>` to remove them. (Do this before proceeding further). |
| 37 | +2. INACTIVITY CHECK: Check the environment variable `!{echo $INACTIVE_OVER_60_DAYS}`. Is it exactly equal to the string `true`? |
| 38 | +- If YES: |
| 39 | + a. Formulate a comment to the reporter (@<reporter_username>). Evaluate the issue description and whether it is an Epic (from Step 1.4): |
| 40 | + - Always mention that the issue is being closed or pinged because it has been inactive for over 60 days. |
| 41 | + - IF IT IS AN EPIC (has sub-issues): Ask the reporter if it is still in progress or complete, and if it is complete, ask them to close it. |
| 42 | + - IF IT IS NOT AN EPIC: |
| 43 | + - If it's a feature/enhancement request and the description is relatively vague, ask: 1) if it is still needed and 2) if they can provide more details on the feature request. |
| 44 | + - If the issue was mentioned by another issue that is closed as completed or by a pull request that is merged/closed (based on the cross-referenced timeline events), mention this cross-reference (e.g., "I see this issue was mentioned by #123 which is closed as completed...") and ask if this means it is resolved. Do NOT mention cross-references that are still open or closed as "not planned". |
| 45 | + - If it's a feature/enhancement request but well-described, just ask if it's still needed. |
| 46 | + - If it's a bug, ask if they can reproduce it with the latest build and provide detailed reproduction steps. |
| 47 | + - If the issue has assignees, append a ping to the assignees to check in. |
| 48 | + - If it is NOT an Epic AND the issue is NOT high priority (`priority/p0` or `priority/p1`) AND does NOT have a parent issue (from Step 1.3), append "Feel free to reopen this issue." to the comment. |
| 49 | + b. Execute `gh issue edit !{echo $ISSUE_LINK} --remove-label "status/need-triage"` (ignore errors if the label doesn't exist). If it is NOT an Epic, also append `--add-label "status/needs-info"`. |
| 50 | + c. Execute `gh issue comment !{echo $ISSUE_LINK} --body "<your formulated comment>"` |
| 51 | + d. If it is NOT an Epic AND the issue is NOT high priority AND does NOT have a parent issue (from Step 1.3), execute `gh issue close !{echo $ISSUE_LINK} --reason "not planned"`. |
| 52 | + - After executing these actions, **STOP EXECUTION IMMEDIATELY**. Do not proceed to Step 5. |
| 53 | +- If NO: Check the environment variable `!{echo $INACTIVE_OVER_30_DAYS}`. Is it exactly equal to the string `true`? |
| 54 | + - If YES AND the issue is a bug report (not a feature/enhancement request) AND it is NOT an Epic: |
| 55 | + a. Execute `gh issue edit !{echo $ISSUE_LINK} --remove-label "status/need-triage" --add-label "status/needs-info"` (ignore errors if labels don't exist). |
| 56 | + b. Execute `gh issue comment !{echo $ISSUE_LINK} --body "@<reporter_username>, this issue has been inactive for over a month. Could you please try reproducing it with the latest nightly build and let us know if it still occurs?"` |
| 57 | + - After executing these actions, **STOP EXECUTION IMMEDIATELY**. Do not proceed to Step 5. |
| 58 | + - If NO (or it is not a bug, or it is an Epic): Proceed to Step 5. |
60 | 59 |
|
61 | | -### STEP 4: VAGUENESS CHECK |
62 | | -Is the issue description fundamentally missing context (no logs, no repro steps, just "it's broken") AND no one has asked for more information yet? |
63 | | -- If YES: Ask the reporter: `gh issue comment !{echo $ISSUE_NUMBER} --body "@<reporter_username>, thank you for the report! Could you please provide more specific details (e.g., reproduction steps, expected behavior, and environment)? Closing this as vague if no response is received in a week." --repo !{echo $REPOSITORY}` and **STOP EXECUTION IMMEDIATELY**. |
64 | | -- If NO: Proceed to Step 5. |
| 60 | +### STEP 5: VAGUENESS CHECK |
| 61 | +Is the issue fundamentally missing context AND no one has asked for more information yet? |
| 62 | +- For bugs: Explicit reproduction steps are **REQUIRED**. Even if the user provides logs, error traces, or screenshots, if they do not provide clear, step-by-step instructions on how to reproduce the bug, it MUST be considered vague. |
| 63 | +- For feature requests: If it is just a vague statement without clear use cases or details, it is considered vague. |
| 64 | +- If YES (it is vague): Execute `gh issue edit !{echo $ISSUE_LINK} --remove-label "status/need-triage" --add-label "status/needs-info"` (ignore errors if labels don't exist). Ask the reporter: `gh issue comment !{echo $ISSUE_LINK} --body "@<reporter_username>, thank you for the report! Could you please provide more specific details (e.g., detailed reproduction steps, expected behavior, logs, and environment details)? Closing this as vague if no response is received in a week."` and **STOP EXECUTION IMMEDIATELY**. |
| 65 | +- If NO: Proceed to Step 6. |
65 | 66 |
|
66 | | -### STEP 5: REPRODUCTION & CODE VALIDITY |
67 | | -Search the `target-repo/` codebase to see if the bug still occurs or if the feature is already implemented. |
68 | | -- If definitively NO LONGER VALID: Close it: `gh issue close !{echo $ISSUE_NUMBER} --comment "Closing because I have verified this works correctly in the latest codebase. <brief explanation>" --repo !{echo $REPOSITORY}` and **STOP EXECUTION IMMEDIATELY**. |
69 | | -- If still valid: Proceed to Step 6. |
| 67 | +### STEP 6: REPRODUCTION & CODE VALIDITY |
| 68 | +1. Review the issue comments. If a community member has already clearly identified the root cause of the bug, DO NOT clone the repo, DO NOT write tests, and DO NOT execute any code. You may only perform a quick `grep_search` or `read_file` if the repo is already cloned to determine if the fix is simple. |
| 69 | +- If your quick code check reveals that the problematic code has already been significantly changed or appears fixed in the current `target-repo`, DO NOT investigate git history or releases. Simply execute `gh issue edit !{echo $ISSUE_LINK} --remove-label "status/need-triage" --add-label "status/needs-info"` and `gh issue comment !{echo $ISSUE_LINK} --body "@<reporter_username>, the code related to this issue appears to have been updated recently. Could you please try reproducing it with the latest nightly build and let us know if it still occurs?"` and **STOP EXECUTION IMMEDIATELY**. |
| 70 | +- Otherwise, immediately proceed to Step 7. |
| 71 | +2. If no root cause is identified, run `git clone https://github.com/!{echo $REPOSITORY}.git target-repo` and search the `target-repo/` codebase using `grep_search` and `read_file` ONLY. You are explicitly FORBIDDEN from writing new files, running `npm test`, attempting to fix the code, OR attempting to reproduce the bug by executing code or shell commands (e.g., creating named pipes, running scripts, etc.). Your ONLY goal is to perform STATIC code analysis to determine if the logic for the bug still exists, if the feature is already implemented, or if the reported behavior is actually intentional by design. |
| 72 | +- If definitively NO LONGER VALID: Close it: `gh issue close !{echo $ISSUE_LINK} --comment "Closing because I have verified this works correctly in the latest codebase. <brief explanation>"` and **STOP EXECUTION IMMEDIATELY**. |
| 73 | +- If INTENTIONAL BY DESIGN: Close it: `gh issue close !{echo $ISSUE_LINK} --reason "not planned" --comment "Closing this issue as the reported behavior is intentional by design. <brief explanation of the design logic>"` and **STOP EXECUTION IMMEDIATELY**. |
| 74 | +- If still valid: Proceed to Step 7. |
70 | 75 |
|
71 | | -### STEP 6: DUPLICATES |
| 76 | +### STEP 7: DUPLICATES |
72 | 77 | Search for duplicates using `gh issue list --search "<keywords>" --repo !{echo $REPOSITORY} --state all`. |
73 | | -- If found: `gh issue close !{echo $ISSUE_NUMBER} --reason "not planned" --comment "Closing as duplicate of #<duplicate_number>." --repo !{echo $REPOSITORY}` and **STOP EXECUTION IMMEDIATELY**. |
74 | | -- If no duplicates: Proceed to Step 7. |
| 78 | +- If found: `gh issue close !{echo $ISSUE_LINK} --reason "not planned" --comment "Closing as duplicate of #<duplicate_number>."` and **STOP EXECUTION IMMEDIATELY**. |
| 79 | +- If no duplicates: Proceed to Step 8. |
75 | 80 |
|
76 | | -### STEP 7: TRIAGE SUMMARY |
77 | | -Provide a summary comment using these instructions: |
78 | | -``` |
79 | | -!{echo $CUSTOM_INSTRUCTIONS} |
80 | | -``` |
81 | | -- Action: `gh issue comment !{echo $ISSUE_NUMBER} --body "### Triage Summary\n\n<your summary>" --repo !{echo $REPOSITORY}` |
| 81 | +### STEP 8: TRIAGE SUMMARY |
| 82 | +Provide a summary comment using the <custom_instructions> provided at the beginning of this prompt. |
| 83 | +- Action: `gh issue comment !{echo $ISSUE_LINK} --body "### Triage Summary\\n\\n<your summary>"` |
82 | 84 | - **STOP EXECUTION**. |
83 | 85 | """ |
0 commit comments