Skip to content

Commit 6cd885a

Browse files
authored
fix: add push failure recovery instructions to sweep skill (#787)
* fix: add push failure recovery instructions to sweep skill Subagents in worktrees were failing silently when hooks (guard-git.sh) denied commits or pushes — the agent couldn't distinguish a hook denial from a user denial and would abort. Added explicit recovery instructions for commitlint failures, edit-log hook denials, and other push errors so subagents diagnose and recover instead of dying. * fix: remove duplicate function definitions in leiden optimiser collectRefinementCandidates and boltzmannSelectCandidate were defined twice, causing TS2393 compilation errors in CI. * fix: use --force-with-lease and add missing branch validation case (#787)
1 parent 19c7baa commit 6cd885a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.claude/skills/sweep/SKILL.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ After addressing all comments for a PR:
206206
2. Group changes by concern — each logically distinct fix gets its own commit (e.g., one commit for a missing validation, another for a naming change). Do not lump all feedback into a single commit.
207207
3. Use descriptive messages per commit: `fix: <what this specific change does> (#<number>)`
208208
4. Push to the PR branch.
209+
5. **If the push is rejected** (e.g., by a hook or commitlint), diagnose the error before retrying:
210+
- **Commitlint failure** (bad commit message format): This is the ONE case where amend + force-push is allowed. Fix the message with `git commit --amend -m "correct message"` then `git push --force-with-lease`.
211+
- **Hook denial** (guard-git.sh blocking staged files not in session edit log): The worktree has no edit log — commit with explicit file paths (`git commit <file1> <file2> -m "msg"`) instead of staging first.
212+
- **Branch name validation failure**: You are on the wrong branch — check out the correct PR branch before retrying.
213+
- **Any other failure**: Fix with a new commit. Never amend + force-push for code changes.
209214

210215
### 2g. Re-trigger reviewers
211216

@@ -309,7 +314,7 @@ If any subagent failed or returned an error, note it in the Status column as `ag
309314
## Rules
310315

311316
- **Never rebase.** Always `git merge <base>` to resolve conflicts.
312-
- **Never force-push** unless fixing a commit message that fails commitlint. Amend + force-push is the only way to fix a pushed commit title (messages are part of the SHA). This is safe on feature branches. For all other problems, fix with a new commit.
317+
- **Never force-push** unless fixing a commit message that fails commitlint. Amend + force-push is the only way to fix a pushed commit title (messages are part of the SHA). This is safe on feature branches. For all other problems, fix with a new commit. **If a push or commit is denied by a hook**, read the denial reason — don't blindly retry or escalate to force-push. Common causes: (1) commitlint rejects the message format → amend + force-push (`git push --force-with-lease`), (2) guard-git blocks staged files not in session edit log → use `git commit <file1> <file2> -m "msg"` with explicit paths, (3) branch name validation fails → you're on the wrong branch.
313318
- **Address ALL comments from ALL reviewers** (Claude, Greptile, and humans), even minor/nit/optional ones. Leave zero unaddressed. Do not only respond to one reviewer and skip another.
314319
- **Always reply to comments** explaining what was done. Don't just fix silently. Every reviewer must see a reply on their feedback.
315320
- **Never trigger `@greptileai` without replying to every Greptile comment first.** Before posting the re-trigger, run the Step 2g verification script to confirm zero unanswered Greptile comments. Triggering a new review while old comments are unanswered is a blocking violation — it creates review noise and signals that feedback was ignored. Reply first, verify, then trigger.

0 commit comments

Comments
 (0)