@@ -15,6 +15,21 @@ If Gate is not passed, go back to `.github/agents/pr.md` and complete phases 1-3
1515
1616---
1717
18+ ## Phase Completion Protocol (CRITICAL)
19+
20+ ** Before changing ANY phase status to ✅ COMPLETE:**
21+
22+ 1 . ** Read the state file section** for the phase you're completing
23+ 2 . ** Find ALL ⏳ PENDING and [ PENDING] fields** in that section
24+ 3 . ** Fill in every field** with actual content
25+ 4 . ** Verify no pending markers remain** in your section
26+ 5 . ** Commit the state file** with complete content
27+ 6 . ** Then change status** to ✅ COMPLETE
28+
29+ ** Rule:** Status ✅ means "documentation complete", not "I finished thinking about it"
30+
31+ ---
32+
1833## 🔧 FIX: Explore and Select Fix (Phase 4)
1934
2035> ** SCOPE** : Explore independent fix alternatives using ` try-fix ` skill, compare with PR's fix, select the best approach.
@@ -37,25 +52,38 @@ The purpose of Phase 4 is NOT to re-test the PR's fix, but to:
3752
3853Invoke the ` try-fix ` skill repeatedly. The skill handles one fix attempt per invocation.
3954
55+ ** IMPORTANT:** Always pass the ` state_file ` parameter so try-fix can record its results:
56+ ```
57+ state_file: .github/agent-pr-session/pr-XXXXX.md
58+ ```
59+
60+ try-fix will automatically append rows to the Fix Candidates table. You remain responsible for:
61+ - Setting "Exhausted" field when done
62+ - Setting "Selected Fix" field with reasoning
63+ - Updating phase status to ✅ COMPLETE
64+
4065```
4166┌─────────────────────────────────────────────────────────────┐
4267│ Agent orchestration loop │
4368├─────────────────────────────────────────────────────────────┤
4469│ │
4570│ attempts = 0 │
4671│ max_attempts = 5 │
72+ │ state_file = ".github/agent-pr-session/pr-XXXXX.md" │
4773│ │
4874│ while (attempts < max_attempts): │
49- │ result = invoke try-fix skill │
75+ │ result = invoke try-fix skill (with state_file) │
5076│ attempts++ │
5177│ │
5278│ if result.exhausted: │
5379│ break # try-fix has no more ideas │
5480│ │
5581│ # result.passed indicates if this attempt worked │
82+ │ # try-fix already recorded to state file │
5683│ # Continue loop to explore more alternatives │
5784│ │
5885│ # After loop: compare all try-fix results vs PR's fix │
86+ │ # Update "Exhausted" and "Selected Fix" fields │
5987│ │
6088└─────────────────────────────────────────────────────────────┘
6189```
@@ -73,8 +101,9 @@ Each `try-fix` invocation:
731013 . Proposes ONE new independent fix idea
741024 . Implements and tests it
751035 . Records result (with failure analysis if it failed)
76- 6 . Reverts all changes (restores PR's fix)
77- 7 . Returns ` {passed: bool, exhausted: bool} `
104+ 6 . ** Updates state file** (appends row to Fix Candidates table if state_file provided)
105+ 7 . Reverts all changes (restores PR's fix)
106+ 8 . Returns ` {passed: bool, exhausted: bool} `
78107
79108See ` .github/skills/try-fix/SKILL.md ` for full details.
80109
@@ -127,13 +156,31 @@ Update the state file:
127156
128157### Complete 🔧 Fix
129158
159+ ** 🚨 MANDATORY: Update state file AND post comment**
160+
130161** Update state file** :
1311621 . Verify Fix Candidates table is complete with all attempts
1321632 . Verify failure analyses are documented for failed attempts
1331643 . Verify Selected Fix is documented with reasoning
1341654 . Change 🔧 Fix status to ` ✅ COMPLETE `
1351665 . Change 📋 Report status to ` ▶️ IN PROGRESS `
136167
168+ ** Before marking ✅ COMPLETE, verify state file contains:**
169+ - [ ] Root Cause Analysis filled in (if applicable)
170+ - [ ] Fix Candidates table has numbered rows for each try-fix attempt
171+ - [ ] Each row has: approach, test result, files changed, notes
172+ - [ ] "Exhausted" field set (Yes/No)
173+ - [ ] "Selected Fix" populated with reasoning
174+ - [ ] No ⏳ PENDING markers remain in Fix section
175+ - [ ] State file committed
176+
177+ ** Post completion comment (if PR exists) - MANDATORY, DO NOT SKIP:**
178+ ``` bash
179+ cat .github/agent-pr-session/pr-XXXXX.md | pwsh .github/skills/pr-comment/scripts/post-pr-comment.ps1 -PRNumber XXXXX
180+ ```
181+
182+ ** ⚠️ The script ALWAYS updates the ONE aggregated review comment with all phases. If the comment doesn't exist yet, it creates it.**
183+
137184---
138185
139186## 📋 REPORT: Final Report (Phase 5)
@@ -228,11 +275,27 @@ Update all phase statuses to complete.
228275
229276### Complete 📋 Report
230277
278+ ** 🚨 MANDATORY: Update state file AND post comment**
279+
231280** Update state file** :
2322811 . Change header status to final recommendation
2332822 . Update all phases to ` ✅ COMPLETE ` or ` ✅ PASSED `
2342833 . Present final result to user
235284
285+ ** Before marking ✅ COMPLETE, verify state file contains:**
286+ - [ ] Final recommendation (APPROVE/REQUEST_CHANGES/COMMENT)
287+ - [ ] Summary of findings
288+ - [ ] Key technical insights documented
289+ - [ ] Overall status changed to final recommendation
290+ - [ ] State file committed
291+
292+ ** Post completion comment (if PR exists) - MANDATORY, DO NOT SKIP:**
293+ ``` bash
294+ cat .github/agent-pr-session/pr-XXXXX.md | pwsh .github/skills/pr-comment/scripts/post-pr-comment.ps1 -PRNumber XXXXX
295+ ```
296+
297+ ** ⚠️ The script ALWAYS updates the ONE aggregated review comment with all phases. If the comment doesn't exist yet, it creates it.**
298+
236299---
237300
238301## Common Mistakes in Post-Gate Phases
0 commit comments