Skip to content

Commit 664f898

Browse files
committed
update fix-issue
1 parent 4e05e98 commit 664f898

2 files changed

Lines changed: 78 additions & 57 deletions

File tree

.claude/skills/fix-issue/SKILL.md

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ GitHub Project board IDs:
2525
| `PROJECT_ID` | `PVT_kwDOBrtarc4BRNVy` |
2626
| `STATUS_FIELD_ID` | `PVTSSF_lADOBrtarc4BRNVyzg_GmQc` |
2727
| `STATUS_BACKLOG` | `ab337660` |
28+
| `STATUS_ON_HOLD` | `48dfe446` |
2829
| `STATUS_READY` | `f37d0d80` |
2930

3031
## Process
@@ -33,6 +34,7 @@ GitHub Project board IDs:
3334
digraph fix_issue {
3435
rankdir=TB;
3536
"Pick issue from Backlog" [shape=box];
37+
"Move card to OnHold (claim lock)" [shape=box];
3638
"Fetch issue + check comment" [shape=box];
3739
"Parse failures & warnings" [shape=box];
3840
"Auto-fix mechanical issues" [shape=box];
@@ -44,7 +46,8 @@ digraph fix_issue {
4446
"Ask what to change (free-form)" [shape=box];
4547
"Apply changes + re-check locally" [shape=box];
4648
47-
"Pick issue from Backlog" -> "Fetch issue + check comment";
49+
"Pick issue from Backlog" -> "Move card to OnHold (claim lock)";
50+
"Move card to OnHold (claim lock)" -> "Fetch issue + check comment";
4851
"Fetch issue + check comment" -> "Parse failures & warnings";
4952
"Parse failures & warnings" -> "Auto-fix mechanical issues";
5053
"Auto-fix mechanical issues" -> "Present auto-fixes to human";
@@ -60,7 +63,7 @@ digraph fix_issue {
6063

6164
---
6265

63-
## Step 1: Pick Next Issue from Backlog
66+
## Step 1: Pick and Claim the Issue
6467

6568
The argument is `model`, `rule`, or a specific issue number.
6669

@@ -79,19 +82,48 @@ Returns all Backlog issues of the requested type, sorted by `Good` label first t
7982
{
8083
"issue_type": "rule",
8184
"items": [
82-
{"number": 246, "title": "[Rule] A → B", "has_good": true, "labels": ["Good", "rule"]},
83-
{"number": 91, "title": "[Rule] C to D", "has_good": false, "labels": ["rule"]}
85+
{"number": 246, "title": "[Rule] A → B", "item_id": "PVTI_xxx", "has_good": true, "labels": ["Good", "rule"]},
86+
{"number": 91, "title": "[Rule] C to D", "item_id": "PVTI_yyy", "has_good": false, "labels": ["rule"]}
8487
]
8588
}
8689
```
8790

8891
### 1b: Pick the top issue
8992

90-
Pick the first item from the list. If the list is empty, STOP with message: "No `[Model]`/`[Rule]` issues in Backlog."
93+
Pick the first item from the list and retain both `<NUMBER>` and `<ITEM_ID>`. If the list is empty, STOP with message: "No `[Model]`/`[Rule]` issues in Backlog."
9194

9295
If the top issue already has the `Good` label and its check report has **0 failures and 0 warnings**, skip to Step 8 (just move it to Ready — no edits needed). If it has warnings, proceed normally.
9396

94-
### 1c: Fetch the chosen issue
97+
### 1c: For a specific issue number, locate the board item and validate status
98+
99+
When `/fix-issue <NUMBER>` is used, do **not** start editing immediately. First look up the card:
100+
101+
```bash
102+
uv run --project scripts scripts/pipeline_board.py find <NUMBER>
103+
```
104+
105+
Returns JSON: `{"item_id": "PVTI_xxx", "status": "Backlog", "number": 207, "title": "..."}` or an error if not found.
106+
107+
- If the status is `Backlog`, continue and claim it in Step 1d.
108+
- If the status is `OnHold`, continue only as a **resume** of in-progress `fix-issue` work.
109+
- If the status is anything else (`Ready`, `In progress`, `Review pool`, etc.), STOP with message: "Issue #<NUMBER> is not available for `/fix-issue` because its board status is <STATUS>."
110+
- If an error is returned, STOP with message: "Issue #<NUMBER> is not on the project board."
111+
112+
### 1d: Move the card to OnHold immediately
113+
114+
Claim the work item **before any further action** (before `gh issue view`, before parsing comments, before drafting edits):
115+
116+
```bash
117+
uv run --project scripts scripts/pipeline_board.py move <ITEM_ID> OnHold
118+
```
119+
120+
This is a temporary lock to avoid two agents or humans editing the same issue concurrently. Do not leave the card in Backlog while you inspect or modify it.
121+
122+
Use `OnHold` as the in-progress state for `/fix-issue`. Once claimed, do not move the issue back to `Backlog` automatically; keep it in `OnHold` until Step 8 or explicit human re-triage.
123+
124+
If the issue is already in `OnHold` because you are resuming previously started `fix-issue` work, do not move it again; just continue.
125+
126+
### 1e: Fetch the chosen issue
95127

96128
```bash
97129
gh issue view <NUMBER> --json title,body,labels,comments
@@ -169,54 +201,14 @@ Use `cargo run -p problemreductions-cli --bin pred -- show <problem>` (or `./tar
169201

170202
## Step 4: Present Full Context and Auto-Fixes to Human
171203

172-
**IMPORTANT: Show all context BEFORE asking for any decisions.** The human needs full visibility into the check report findings, research results, and classification before being asked to choose.
173-
174-
### 4a: Show the check report summary
204+
**IMPORTANT: Show all context BEFORE asking for any decisions.**
175205

176-
Print the parsed check report summary table (from Step 2) so the human can see the starting state:
206+
Present everything in one block so the human has full visibility:
177207

178-
```
179-
## Check Report Summary (Issue #<NUMBER>)
180-
181-
| Check | Result | Details |
182-
|-------|--------|---------|
183-
| Usefulness | ✅ Pass | ... |
184-
| Non-trivial | ✅ Pass | ... |
185-
| Correctness | ⚠️ Warn | ... |
186-
| Well-written | ⚠️ Warn | ... |
187-
```
188-
189-
For each `Fail` or `Warn` result, include the key details from the check report's detailed section (not just the one-liner — include the specific sub-issues identified).
190-
191-
### 4b: Show research results
192-
193-
If web searches, `pred show` lookups, or other research was performed during classification (Step 2–3), present those findings now. For example:
194-
- Web search results that confirm or contradict references
195-
- `pred show` output for source/target problems
196-
- Companion issue status (exists / missing)
197-
198-
This ensures the human has all the evidence before any decisions.
199-
200-
### 4c: Show auto-fixes and substantive issues
201-
202-
Print a summary of all mechanical fixes applied:
203-
204-
```
205-
## Auto-fixes applied
206-
207-
| # | Section | Issue | Fix |
208-
|---|---------|-------|-----|
209-
| 1 | Size Overhead | Symbol `m` undefined | Added ... |
210-
```
211-
212-
Then list the substantive issues that need discussion:
213-
214-
```
215-
## Issues requiring your input
216-
217-
1. **Decision vs optimization:** ...
218-
2. **Reference accuracy:** ...
219-
```
208+
1. **Check report summary** — the parsed table from Step 2 (Check / Result / Details). For `Fail` or `Warn` results, include the specific sub-issues from the detailed section, not just the one-liner.
209+
2. **Research results** — any web searches, `pred show` lookups, or companion issue status gathered during Steps 2–3.
210+
3. **Auto-fixes applied** — table of mechanical fixes (Section / Issue / Fix).
211+
4. **Substantive issues requiring input** — numbered list of issues that need human judgment, with enough context for the human to evaluate each one.
220212

221213
---
222214

@@ -245,6 +237,8 @@ Re-run the 4 quality checks (Usefulness, Non-trivial, Correctness, Well-written)
245237

246238
Print results to the human as a summary table (Check / Result / Details).
247239

240+
If the issue cannot be completed in this session because the check report is missing, the issue body is malformed, required context is unavailable, or the proposed fix turns out to be wrong, STOP and tell the human exactly what blocked completion. Leave the card in `OnHold`.
241+
248242
---
249243

250244
## Step 7: Ask Human for Decision
@@ -255,7 +249,7 @@ Use `AskUserQuestion` to present the options:
255249

256250
> The issue has been re-checked locally. What would you like to do?
257251
>
258-
> 1. **Looks good** — I'll push the edits to GitHub, update labels, and move it to Ready
252+
> 1. **Looks good** — I'll push the edits to GitHub, update labels, and move it from OnHold to Ready
259253
> 2. **Modify again** — tell me what else you'd like to change
260254
261255
### If human picks 2: Modify Again
@@ -266,6 +260,8 @@ Ask the human (free-form) what they want to change:
266260
267261
Apply the requested changes to the draft issue body, re-check locally (Step 6), then ask again (Step 7). Repeat until the human picks "Looks good".
268262

263+
If the session pauses without approval, leave the card in `OnHold`. Do **not** move it back to Backlog automatically; `OnHold` is the conflict-avoidance state for partially completed `fix-issue` work.
264+
269265
---
270266

271267
## Step 8: Finalize (If human picks 1 "Looks good")
@@ -317,9 +313,9 @@ gh issue edit <NUMBER> --remove-label "Useless,Trivial,Wrong,PoorWritten" 2>/dev
317313
gh issue edit <NUMBER> --add-label "Good"
318314
```
319315

320-
### 8d: Move to Ready on project board
316+
### 8d: Move from OnHold to Ready on project board
321317

322-
Use the `item_id` obtained from Step 1a:
318+
Use the `item_id` obtained from Step 1b/1c:
323319

324320
```bash
325321
uv run --project scripts scripts/pipeline_board.py move <ITEM_ID> Ready
@@ -331,7 +327,7 @@ uv run --project scripts scripts/pipeline_board.py move <ITEM_ID> Ready
331327
Done! Issue #<NUMBER>:
332328
- Body updated on GitHub
333329
- Labels: removed failure labels, added "Good"
334-
- Board: moved to Ready
330+
- Board: moved OnHold -> Ready
335331
```
336332

337333
---
@@ -346,7 +342,8 @@ Done! Issue #<NUMBER>:
346342
| Overwriting human's original content | Preserve original text; only modify the specific sections flagged |
347343
| Not preserving `<!-- Unverified -->` markers | Keep existing provenance markers; add new ones for AI-filled content |
348344
| Running check-issue more than once per iteration | Re-check exactly once after edits, then ask human |
345+
| Leaving the card in Backlog while you inspect/edit | Move it to OnHold before `gh issue view` or any drafting, and keep blocked work there |
349346
| Closing the issue | Never close. Labels and board status only |
350347
| Force-pushing or modifying git | This skill only edits GitHub issues via `gh`. No git operations |
351-
| Inventing `pipeline_board.py` subcommands | Only `next`, `claim-next`, `ack`, `list`, `move`, `backlog` exist |
348+
| Inventing `pipeline_board.py` subcommands | Only `next`, `claim-next`, `ack`, `list`, `move`, `backlog`, `find` exist |
352349
| Forgetting to update the issue title | If the problem name changed, update the title with `gh issue edit <N> --title "..."` and find all related issues referencing the old name |

scripts/pipeline_board.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,12 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
14991499
fix_parser.add_argument("--limit", type=int, default=500)
15001500
fix_parser.add_argument("--format", choices=["text", "json"], default="json")
15011501

1502+
find_parser = subparsers.add_parser("find")
1503+
find_parser.add_argument("number", type=int, help="Issue or PR number to look up")
1504+
find_parser.add_argument("--owner", default="CodingThrust")
1505+
find_parser.add_argument("--project-number", type=int, default=8)
1506+
find_parser.add_argument("--limit", type=int, default=500)
1507+
15021508
return parser.parse_args(argv)
15031509

15041510

@@ -1529,6 +1535,24 @@ def main(argv: list[str] | None = None) -> int:
15291535
print(f"#{r['number']:<5} {good:5s} {r['title']}")
15301536
return 0 if results else 1
15311537

1538+
if args.command == "find":
1539+
board_data = fetch_board_items(
1540+
args.owner, args.project_number, args.limit, lite=True,
1541+
)
1542+
for item in board_data.get("items", []):
1543+
content = item.get("content") or {}
1544+
if content.get("number") == args.number:
1545+
result = {
1546+
"item_id": item["id"],
1547+
"status": item.get("status"),
1548+
"number": content["number"],
1549+
"title": content.get("title"),
1550+
}
1551+
print(json.dumps(result))
1552+
return 0
1553+
print(json.dumps({"error": f"Issue #{args.number} not found on project board"}))
1554+
return 1
1555+
15321556
if args.command == "claim-next":
15331557
if args.mode == "review" and not args.repo:
15341558
raise SystemExit("--repo is required in claim-next review mode")

0 commit comments

Comments
 (0)