Skip to content

Commit db6d70f

Browse files
CopilotTravisEz13
andcommitted
Add guidance on finding default branch for instruction files
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
1 parent a33e0d0 commit db6d70f

File tree

1 file changed

+80
-1
lines changed

1 file changed

+80
-1
lines changed

AGENT_FEEDBACK.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,91 @@ If this verification fails, the PR will target the wrong release branch.
9999
}
100100
```
101101

102+
## 4. Clarify How to Find Default Branch for Reading Instructions
103+
104+
**Issue**: The agent instructions assume the default branch is "master" when reading instruction files, but this may not always be correct. The agent should determine the default branch dynamically.
105+
106+
**Current state** (in "Required Reading" section):
107+
```powershell
108+
# Read instruction files from default branch
109+
git show upstream/master:.github/instructions/backports/pr-template.instructions.md
110+
```
111+
112+
**Problem**:
113+
- Assumes default branch is named "master"
114+
- Assumes upstream remote exists and is named "upstream"
115+
- Instructions may not exist on master if they're in a different branch
116+
117+
**Suggested improvement**: Add a section that explains how to find the correct branch for reading instructions:
118+
119+
```markdown
120+
## Reading Instruction Files
121+
122+
**IMPORTANT**: Instruction files must be read from the branch where they exist, which may not be the default branch (master/main).
123+
124+
### Step 1: Determine where instruction files exist
125+
126+
First, check if the instruction files exist in various branches:
127+
128+
```bash
129+
# Check if instructions exist in upstream master
130+
git ls-tree -r --name-only upstream/master .github/instructions/backports/ 2>/dev/null
131+
132+
# Check if instructions exist in upstream main
133+
git ls-tree -r --name-only upstream/main .github/instructions/backports/ 2>/dev/null
134+
135+
# Check in origin branches if upstream doesn't have them
136+
git ls-tree -r --name-only origin/travisez13-main .github/instructions/backports/ 2>/dev/null
137+
git ls-tree -r --name-only origin/master .github/instructions/backports/ 2>/dev/null
138+
git ls-tree -r --name-only origin/main .github/instructions/backports/ 2>/dev/null
139+
```
140+
141+
### Step 2: Read from the branch that has them
142+
143+
Once you've identified which branch contains the instruction files, use that branch:
144+
145+
```bash
146+
# Example: If instructions are in origin/travisez13-main
147+
git show origin/travisez13-main:.github/instructions/backports/pr-template.instructions.md
148+
149+
# Example: If instructions are in upstream/main
150+
git show upstream/main:.github/instructions/backports/pr-template.instructions.md
151+
```
152+
153+
### Step 3: Similarly for agent instructions
154+
155+
```bash
156+
# Check where agent file exists
157+
git ls-tree -r --name-only origin/travisez13-main .github/agents/ 2>/dev/null
158+
git ls-tree -r --name-only upstream/master .github/agents/ 2>/dev/null
159+
160+
# Read from the correct location
161+
git show origin/travisez13-main:.github/agents/backport-agent.md
162+
```
163+
164+
### Why this matters
165+
166+
Instruction files and agent prompts may be:
167+
- In a feature/development branch before being merged to default branch
168+
- In a fork's main branch (like `origin/travisez13-main`)
169+
- Have different content between default branch and development branches
170+
- Not exist at all in older release branches
171+
172+
**Don't assume**:
173+
- Default branch is named "master" (could be "main")
174+
- Instructions exist in the default branch
175+
- Remote is named "upstream" (might be "origin")
176+
177+
**Always verify** where the files exist before trying to read them.
178+
```
179+
102180
## Summary
103181
104182
These improvements focus on:
105183
106184
1. **Explicit PR description handling**: Making it clear that the PR body must be passed to `report_progress`, not just saved to a file
107185
2. **Template validation**: Adding a checklist to ensure all required sections are included
108186
3. **Better error messages**: Providing clearer guidance when branch name verification fails
187+
4. **Dynamic branch discovery**: Teaching the agent to find instruction files rather than assuming they're in "upstream/master"
109188
110-
These changes would help ensure backport PRs follow the correct template on the first attempt and reduce confusion about how to properly format and submit the PR description.
189+
These changes would help ensure backport PRs follow the correct template on the first attempt and reduce confusion about how to properly format and submit the PR description, while also making the agent more robust when instruction files are in non-standard locations.

0 commit comments

Comments
 (0)