|
| 1 | +--- |
| 2 | +name: fix-issue-batch |
| 3 | +description: Batch-fix [Model] or [Rule] issues from the GitHub Project board Backlog column — calls /fix-issue on each one sequentially |
| 4 | +--- |
| 5 | + |
| 6 | +# Fix Issue Batch |
| 7 | + |
| 8 | +Iterate through `[Model]` or `[Rule]` issues **from the Backlog column of the GitHub Project board** and call `/fix-issue` on each one sequentially. |
| 9 | + |
| 10 | +## Invocation |
| 11 | + |
| 12 | +``` |
| 13 | +/fix-issue-batch <model|rule> |
| 14 | +``` |
| 15 | + |
| 16 | +## Constants |
| 17 | + |
| 18 | +GitHub Project board IDs (same as fix-issue / project-pipeline): |
| 19 | + |
| 20 | +| Constant | Value | |
| 21 | +|----------|-------| |
| 22 | +| `PROJECT_NUMBER` | `8` | |
| 23 | +| `PROJECT_OWNER` | `CodingThrust` | |
| 24 | +| `PROJECT_ID` | `PVT_kwDOBrtarc4BRNVy` | |
| 25 | +| `STATUS_FIELD_ID` | `PVTSSF_lADOBrtarc4BRNVyzg_GmQc` | |
| 26 | +| `STATUS_READY` | `61e4505c` | |
| 27 | + |
| 28 | +## Process |
| 29 | + |
| 30 | +```dot |
| 31 | +digraph fix_batch { |
| 32 | + rankdir=TB; |
| 33 | + "Parse argument" [shape=box]; |
| 34 | + "Fetch project board Backlog" [shape=box]; |
| 35 | + "Filter & sort" [shape=box]; |
| 36 | + "Print queue" [shape=box]; |
| 37 | + "Pick next issue" [shape=diamond]; |
| 38 | + "Call /fix-issue N" [shape=box]; |
| 39 | + "Done" [shape=doublecircle]; |
| 40 | +
|
| 41 | + "Parse argument" -> "Fetch project board Backlog"; |
| 42 | + "Fetch project board Backlog" -> "Filter & sort"; |
| 43 | + "Filter & sort" -> "Print queue"; |
| 44 | + "Print queue" -> "Pick next issue"; |
| 45 | + "Pick next issue" -> "Call /fix-issue N" [label="remaining"]; |
| 46 | + "Pick next issue" -> "Done" [label="none left"]; |
| 47 | + "Call /fix-issue N" -> "Pick next issue"; |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Step 1: Parse Argument |
| 54 | + |
| 55 | +Accept one argument: `model` or `rule` (case-insensitive). |
| 56 | + |
| 57 | +- `model` → filter for issues with `[Model]` in the title |
| 58 | +- `rule` → filter for issues with `[Rule]` in the title |
| 59 | + |
| 60 | +If no argument or invalid argument → stop with: "Usage: `/fix-issue-batch <model|rule>`" |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Step 2: Fetch Issues from Project Board Backlog |
| 65 | + |
| 66 | +Fetch all items from the GitHub Project board and filter to the **Backlog** column: |
| 67 | + |
| 68 | +```bash |
| 69 | +gh project item-list 8 --owner CodingThrust --format json --limit 500 |
| 70 | +``` |
| 71 | + |
| 72 | +From the JSON result: |
| 73 | +1. Filter items where `status == "Backlog"` |
| 74 | +2. Keep only items whose `content.title` starts with `[Model]` or `[Rule]` (matching the argument) |
| 75 | +3. For each item, extract: issue number (`content.number`), title (`content.title`), and project item ID (`id`) |
| 76 | + |
| 77 | +Then fetch labels for each matching issue (needed for categorization): |
| 78 | + |
| 79 | +```bash |
| 80 | +gh issue view <NUMBER> --repo CodingThrust/problem-reductions --json labels |
| 81 | +``` |
| 82 | + |
| 83 | +Or batch-fetch with a single search query to avoid N+1: |
| 84 | + |
| 85 | +```bash |
| 86 | +gh issue list --repo CodingThrust/problem-reductions \ |
| 87 | + --state open --search "[Model] in:title" \ |
| 88 | + --json number,title,labels --limit 200 |
| 89 | +``` |
| 90 | + |
| 91 | +Cross-reference the board items with the label data to build the final list. |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## Step 3: Filter and Sort |
| 96 | + |
| 97 | +From the Backlog issues: |
| 98 | + |
| 99 | +1. **Categorize by current label status:** |
| 100 | + - `already-good` — has `Good` label |
| 101 | + - `has-failures` — has at least one failure label (`PoorWritten`, `Wrong`, `Trivial`, `Useless`) |
| 102 | + - `needs-check` — no check-issue comment yet (no `Good`/`PoorWritten`/`Wrong`/`Trivial`/`Useless` label) |
| 103 | +2. **Sort by priority then issue number:** `already-good` first, then `has-failures`, then `needs-check`. Within each group, sort by issue number ascending (oldest first). This prioritizes issues that already have a check report and are closest to being ready. |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## Step 4: Print Queue |
| 108 | + |
| 109 | +Show the user what will be processed: |
| 110 | + |
| 111 | +``` |
| 112 | +## Fix queue: [Model] issues (N total) |
| 113 | +
|
| 114 | +| # | Issue | Title | Status | |
| 115 | +|---|-------|-------|--------| |
| 116 | +| 1 | #235 | [Model] SteinerTree | already-good | |
| 117 | +| 2 | #233 | [Model] StrongConnectivityAugmentation | has-failures (PoorWritten) | |
| 118 | +| 3 | #234 | [Model] FeedbackVertexSet | needs-check | |
| 119 | +| ... | ... | ... | ... | |
| 120 | +
|
| 121 | +Priority: already-good → has-failures → needs-check. |
| 122 | +Processing N issues total. |
| 123 | +``` |
| 124 | + |
| 125 | +Then ask the user to confirm before starting: |
| 126 | + |
| 127 | +> Ready to start? I'll process each issue with `/fix-issue`, one at a time. |
| 128 | +> |
| 129 | +> 1. **Start** — begin processing from the first issue |
| 130 | +> 2. **Start from #N** — skip to a specific issue number |
| 131 | +> 3. **Cancel** |
| 132 | +
|
| 133 | +--- |
| 134 | + |
| 135 | +## Step 5: Process Each Issue |
| 136 | + |
| 137 | +**CRITICAL:** Each issue MUST be dispatched as a **subagent** for analysis, giving it a fresh context window to prevent cutting corners. The subagent does NOT interact with the human — it returns a structured report, then the main agent presents it for human decisions. |
| 138 | + |
| 139 | +For each issue in the queue (priority order: `already-good` → `has-failures` → `needs-check`): |
| 140 | + |
| 141 | +### 5a: Check prerequisite |
| 142 | + |
| 143 | +If no comment starting with `## Issue Quality Check` exists, run `/check-issue <NUMBER>` first. |
| 144 | + |
| 145 | +### 5b: Dispatch analysis subagent |
| 146 | + |
| 147 | +``` |
| 148 | +Agent tool: |
| 149 | + subagent_type: "general-purpose" |
| 150 | + description: "Analyze issue #<NUMBER>" |
| 151 | + prompt: | |
| 152 | + Analyze GitHub issue #<NUMBER> for fix-issue. |
| 153 | + 1. Fetch the issue: gh issue view <NUMBER> --json title,body,labels,comments |
| 154 | + 2. Find the most recent "## Issue Quality Check" comment |
| 155 | + 3. Parse all Fail and Warn results (warnings are NOT ignorable) |
| 156 | + 4. For each issue, classify as mechanical or substantive |
| 157 | + 5. For mechanical issues: apply the fix to a draft body |
| 158 | + 6. For substantive issues: prepare 2-3 concrete options with your recommendation |
| 159 | +
|
| 160 | + Return EXACTLY this format: |
| 161 | +
|
| 162 | + ## Analysis for #<NUMBER>: <title> |
| 163 | +
|
| 164 | + ### Auto-fixes applied |
| 165 | + | # | Section | Issue | Fix | |
| 166 | + |---|---------|-------|-----| |
| 167 | + | 1 | ... | ... | ... | |
| 168 | +
|
| 169 | + ### Questions for human |
| 170 | + **Q1: <topic>** |
| 171 | + <description of the problem> |
| 172 | + - (a) <option 1> ← recommended |
| 173 | + - (b) <option 2> |
| 174 | + - (c) <option 3> |
| 175 | +
|
| 176 | + **Q2: ...** |
| 177 | +
|
| 178 | + ### Draft body |
| 179 | + <full updated issue body with mechanical fixes applied, substantive issues marked as `[PENDING Q1]`> |
| 180 | +``` |
| 181 | + |
| 182 | +### 5c: Present to human |
| 183 | + |
| 184 | +Print the subagent's report and ask the human to answer all questions at once: |
| 185 | + |
| 186 | +``` |
| 187 | +## Issue #<NUMBER> (<current>/<total>): <title> |
| 188 | +
|
| 189 | +<auto-fixes table from subagent> |
| 190 | +
|
| 191 | +<questions from subagent> |
| 192 | +
|
| 193 | +Please answer the questions above (e.g. "Q1: a, Q2: b"), or type "skip" to skip this issue. |
| 194 | +``` |
| 195 | + |
| 196 | +### 5d: Apply answers and finalize |
| 197 | + |
| 198 | +After human responds: |
| 199 | +- If **"skip"**: move to next issue |
| 200 | +- Otherwise: apply the human's choices to the draft body, re-check (run 4 quality checks inline), then finalize on GitHub (edit body, post changelog comment, update labels, move to Ready — see fix-issue Steps 6–8) |
| 201 | + |
| 202 | +### 5e: Continue |
| 203 | + |
| 204 | +Print progress and ask whether to continue: |
| 205 | + |
| 206 | +``` |
| 207 | +Done #<NUMBER>. (<current>/<total> complete, <remaining> remaining) |
| 208 | +Next: #<NEXT_NUMBER> <next_title> |
| 209 | +``` |
| 210 | + |
| 211 | +> 1. **Continue** — process the next issue |
| 212 | +> 2. **Skip next** — skip the next issue and continue to the one after |
| 213 | +> 3. **Stop** — end the batch here and print summary |
| 214 | +
|
| 215 | +--- |
| 216 | + |
| 217 | +## Step 6: Summary |
| 218 | + |
| 219 | +After all issues are processed, print a summary: |
| 220 | + |
| 221 | +``` |
| 222 | +## Batch fix complete |
| 223 | +
|
| 224 | +| Result | Count | Issues | |
| 225 | +|--------|-------|--------| |
| 226 | +| Fixed & moved to Ready | 7 | #233, #234, #235, #236, #237, #238, #240 | |
| 227 | +| Skipped (by user) | 1 | #239 | |
| 228 | +| Total | 8 | | |
| 229 | +``` |
| 230 | + |
| 231 | +--- |
| 232 | + |
| 233 | +## Common Mistakes |
| 234 | + |
| 235 | +| Mistake | Fix | |
| 236 | +|---------|-----| |
| 237 | +| Fetching all open issues instead of board | Only process issues from the **Backlog** column of GitHub Project #8 | |
| 238 | +| Skipping already-good issues | Process ALL Backlog issues; `already-good` are processed first (highest priority) | |
| 239 | +| Not running check-issue first | If no check report exists, run `/check-issue` before `/fix-issue` | |
| 240 | +| Processing in random order | Always sort by issue number ascending within priority groups | |
| 241 | +| Continuing after user cancels | Respect cancel/skip requests immediately | |
| 242 | +| Missing project scopes | Run `gh auth refresh -s read:project,project` if board access fails | |
0 commit comments