Skip to content

Commit faa5db6

Browse files
committed
ci: Dynamically resolve bot fork repo to prevent push failures
- Fixes repository not found errors when pushing the fix branch in the issue-fix workflow by query-inspecting the authenticated bot's username and ensuring the fork exists via gh repo fork. - Also updates the adk-issue-analyze skill output template to use a details tag for collapsible section and restructure questions. Change-Id: If87b4ddbe897b9338aa6ee78221709e8777b0045
1 parent 04924bf commit faa5db6

2 files changed

Lines changed: 38 additions & 48 deletions

File tree

.agents/skills/adk-issue-analyze/SKILL.md

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,24 @@ This skill provides a structured workflow for analyzing, verifying, and triaging
2525
---
2626

2727
## Step 2: Deep Investigation & Analysis
28-
Address the following four critical questions and present your findings in a structured, premium report.
28+
Address the following three critical questions and present your findings in a structured, premium report.
2929

3030
### 1. What is broken?
3131
Explain the root cause of the issue or failure:
32-
- **Trace the execution flow**: Identify which components, classes, or functions are malfunctioning.
33-
- **Pinpoint the bug**: Detail why the system is behaving incorrectly and where the failure originates (e.g. incorrect logic, missing configuration, unhandled states).
34-
35-
### 2. Is the issue legitimate?
36-
Inspect the codebase to confirm if the issue represents a real problem:
37-
- **Examine the description**: Identify the component, class, function, or file referenced.
38-
- **Search the codebase**: Use `grep_search` to locate the relevant files/functions in the local workspace.
39-
- **Inspect the code**: Open the files using `view_file` to analyze the code's current logic.
40-
- **Verify the bug**:
41-
- Is the reported problem actually present in the code?
42-
- Does it produce the reported error or behavior under the current version (ADK 2.0)?
43-
- Is it a documentation typo, setup discrepancy, or a genuine code/logic bug?
44-
- **Document your code evidence**: Reference specific file paths and line ranges (using clickable markdown file links, e.g., `[skill_toolset.py](file:///path/to/file#L123)`) in your report.
45-
46-
### 3. Should we fix it?
32+
- **Trace the execution flow**: Use `grep_search` and `view_file` to locate and analyze the malfunctioning components, classes, or functions in the local workspace.
33+
- **Pinpoint the bug**: Detail why the system is behaving incorrectly and where the failure originates (e.g., incorrect logic, missing configuration, unhandled states).
34+
- **Document code evidence**: Reference specific file paths and line ranges using clickable markdown file links, e.g., `[filename.py](file:///absolute/path/to/file#L100-L120)`.
35+
36+
### 2. Is there a linked PR that fixes this issue?
37+
Search for any existing pull requests that attempt to resolve the issue:
38+
- **Search PRs**: Run `gh pr list --repo google/adk-python --search "<issue_number>"` to list pull requests mentioning the issue number in the branch name, title, or body.
39+
- **Verify the PR details**: If PRs are found, fetch their details:
40+
```bash
41+
gh pr view <pr_number> --repo google/adk-python --json number,title,state,url,body,author
42+
```
43+
- **Analyze progress**: Check if the PR is open, merged, or closed, and if it successfully fixes the issue according to the repository's testing patterns.
44+
45+
### 3. Recommendation
4746
Formulate a recommendation on whether the issue should be addressed:
4847
- **Assess the impact**:
4948
- Does it break core functionality?
@@ -55,16 +54,6 @@ Formulate a recommendation on whether the issue should be addressed:
5554
- **Evaluate workarounds**: Is there a clean workaround, or is a core fix necessary?
5655
- **Final Recommendation**: Clearly declare whether we should fix it, along with the reasoning and estimated complexity/scope of the fix.
5756

58-
### 4. Is there a linked PR that fixes this issue?
59-
Search for any existing pull requests that attempt to resolve the issue:
60-
- **Search PRs**: Run `gh pr list --repo google/adk-python --search "<issue_number>"` to list pull requests mentioning the issue number in the branch name, title, or body.
61-
- **Verify the PR details**: If PRs are found, fetch their details:
62-
```bash
63-
gh pr view <pr_number> --repo google/adk-python --json number,title,state,url,body,author
64-
```
65-
- **Analyze progress**: Check if the PR is open, merged, or closed, and if it successfully fixes the issue according to the repository's testing patterns.
66-
- **Present the structured report**: Format and present your findings structured as a premium report following the **Report Template** below.
67-
6857
---
6958

7059
## Report Template
@@ -74,36 +63,30 @@ Present your final analysis as a high-quality markdown response using the follow
7463
```markdown
7564
# GitHub Issue #<issue_number> Analysis: <Issue Title>
7665

77-
## Detailed Analysis
66+
## Executive Summary
67+
1. **What is broken?** [Brief explanation of the root cause or error]
68+
2. **Is there a linked PR that fixes this issue?** [None / Yes, PR #<pr_number> - <state>]
69+
3. **Recommendation**: [Should Fix (High Priority) / Should Fix (Medium/Low Priority) / Won't Fix / Needs Discussion - priority & brief reasoning]
70+
71+
<details>
72+
<summary><b>Detailed Analysis</b></summary>
7873

7974
### 1. Root Cause Analysis ("What is broken?")
8075
- Explanation of the failure or bug (what is failing and why).
8176
- Pinpoint the exact file, function, or design component that is malfunctioning.
77+
- Code references: [filename.py](file:///absolute/path/to/file#L100-L120)
8278

83-
### 2. Legitimacy Analysis
84-
- **Status**: [Legitimate Bug / Feature Request / Duplicate / Invalid / Not Reproducible]
85-
- **Evidence**:
86-
- Code references: [filename.py](file:///absolute/path/to/file#L100-L120)
87-
- Analysis of code behavior and why the issue occurs.
79+
### 2. Existing Pull Requests ("Is there a linked PR that fixes this issue?")
80+
- **Linked PR**: [None / Pull Request #<pr_number> - <PR Title> (<state>)]
81+
- **PR URL**: <PR URL>
82+
- **Analysis**: Brief summary of the PR's approach and status (e.g., "Fixes the bug by implementing X in Y, currently awaiting review").
8883

89-
### 3. Fix Recommendation
84+
### 3. Recommendation
9085
- **Recommendation**: [Should Fix (High Priority) / Should Fix (Medium/Low Priority) / Won't Fix / Needs Discussion]
9186
- **Rationale**:
9287
- Impact on user experience, workflows, or architecture.
9388
- Implementation complexity and risk of side effects.
94-
95-
### 4. Existing Pull Requests
96-
- **Linked PR**: [None / Pull Request #<pr_number> - <PR Title> (<state>)]
97-
- **PR URL**: <PR URL>
98-
- **Analysis**: Brief summary of the PR's approach and status (e.g., "Fixes the bug by implementing X in Y, currently awaiting review").
99-
100-
---
101-
102-
## Executive Summary
103-
1. **What is broken?** [Brief explanation of the root cause or error]
104-
2. **Is the issue legitimate?** [Yes / No - brief explanation]
105-
3. **Should we fix it?** [Yes / No / Needs Discussion - priority & brief reasoning]
106-
4. **Is there a linked PR that fixes this issue?** [None / Yes, PR #<pr_number> - <state>]
89+
</details>
10790
```
10891

10992
---

.github/workflows/issue-fix.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,15 @@ jobs:
103103
# Append the closes tag using Python to avoid relying on LLM formatting
104104
python -c "import os, subprocess; msg = subprocess.check_output(['git', 'log', '-1', '--pretty=%B'], text=True); tag = 'closes https://github.com/google/adk-python/issues/' + os.environ['ISSUE_NUMBER']; subprocess.run(['git', 'commit', '--amend', '-m', msg.strip() + '\n\n' + tag], check=True) if tag not in msg else None"
105105
106+
# Retrieve the username of the authenticated user
107+
BOT_USER=$(gh api user --jq .login)
108+
echo "Authenticated bot user is $BOT_USER"
109+
110+
# Ensure the fork exists
111+
gh repo fork google/adk-python --clone=false --remote=false || true
112+
106113
# Push the branch to the bot fork
107-
git remote add fork https://x-access-token:${{ secrets.ADK_TRIAGE_AGENT }}@github.com/adk-bot/adk-python.git
114+
git remote add fork "https://x-access-token:${{ secrets.ADK_TRIAGE_AGENT }}@github.com/${BOT_USER}/adk-python.git"
108115
git push fork "$BRANCH_NAME" --force
109116
110117
# Retrieve the commit message of the last commit
@@ -115,7 +122,7 @@ jobs:
115122
--repo google/adk-python \
116123
--title "fix(issue): fix issue #${ISSUE_NUMBER}" \
117124
--body "$COMMIT_MSG" \
118-
--head "adk-bot:$BRANCH_NAME" \
125+
--head "${BOT_USER}:$BRANCH_NAME" \
119126
--base "main"
120127
else
121128
echo "No changes made by the agent. Skipping PR creation."

0 commit comments

Comments
 (0)