Resolve all unresolved PR review comments and CI failures
Resolves all unresolved PR review comments and CI failures, then updates the PR.
/plugin marketplace add settlemint/agent-marketplace/plugin install crew@settlemint[PR number, defaults to current branch PR]git/pr/<butler_context>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gitbutler-context.sh
</butler_context>
<stack_context>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/machete-context.sh 2>&1
</stack_context>
<pr_info>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-info.sh 2>&1
</pr_info>
<unresolved_threads>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-threads.sh 2>&1
</unresolved_threads>
<ci_status>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-checks.sh 2>&1
</ci_status>
Sync stack, fix PR comments and CI failures, resolve threads, update PR. Max 3 CI iterations.
</objective> <workflow>if git machete is-managed "$(git branch --show-current)" 2>/dev/null; then
git fetch origin
git machete update
fi
If no PR found → ask user to create or specify PR number.
CRITICAL: Include a "Resolve thread" task for EACH thread. Do NOT skip thread resolution.
TodoWrite({
todos: [
// For EACH comment from <unresolved_threads>, create TWO todos:
// 1. A "Fix" todo for making the code change
{
content: "Fix: src/file.ts:42 - description (THREAD_ID=PRRT_xxx)",
status: "pending",
activeForm: "Fixing...",
},
// 2. A "Resolve thread" todo - ONE PER THREAD, must be completed after pushing
{
content: "Resolve thread PRRT_xxx on GitHub",
status: "pending",
activeForm: "Resolving thread",
},
// Repeat for each thread...
// For each CI failure:
{
content: "Fix CI: lint errors",
status: "pending",
activeForm: "Fixing lint",
},
// Final tasks:
{ content: "Commit and push", status: "pending", activeForm: "Committing" },
{
content: "Resolve ALL threads on GitHub",
status: "pending",
activeForm: "Resolving threads",
},
{
content: "Verify all threads resolved",
status: "pending",
activeForm: "Verifying",
},
{ content: "Update PR", status: "pending", activeForm: "Updating PR" },
],
});
AskUserQuestion({
questions: [
{
question: `Found ${comments} comments, ${failures} CI failures. Proceed?`,
header: "Fix",
options: [
{ label: "Fix all (Recommended)", description: "Comments + CI" },
{ label: "Comments only", description: "Skip CI" },
{ label: "CI only", description: "Skip comments" },
],
multiSelect: false,
},
],
});
Mark todos as in_progress → make fix → completed.
For complex multi-file fixes:
Task({
subagent_type: "crew:workflow:pr-comment-resolver",
prompt: "Fix: [details]",
run_in_background: true,
});
bun run ci
If fails after 3 iterations → escalate to user.
Task({
subagent_type: "crew:review:smells-reviewer",
prompt:
"Review code modified while fixing PR comments for: duplication, complexity, dead code, YAGNI violations. Report issues to fix.",
description: "code-quality-review",
});
Extract PR branch name from <pr_info>:
// PR branch is the head branch of the PR (from HEAD_BRANCH in pr_info context)
const prBranch = HEAD_BRANCH; // e.g., "feature/add-auth"
If GitButler active (from <butler_context>):
// Assign all modified files to PR branch and commit
// The --branch flag ensures files go to correct virtual branch
Skill({ skill: "crew:git:butler:commit", args: `--branch ${prBranch}` });
// Then push that branch
Skill({ skill: "crew:git:butler:push", args: prBranch });
If traditional:
git add -A
git commit -m "fix: address PR review comments"
git push --force-with-lease
DO NOT SKIP THIS STEP. Unresolved threads leave PR in incomplete state.
For EACH thread that was fixed, resolve it on GitHub:
# Run this for EVERY thread ID from <unresolved_threads>
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "PRRT_xxx" "Fixed: brief description of fix"
Example for multiple threads:
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "PRRT_abc123" "Fixed: Added null check"
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "PRRT_def456" "Fixed: Updated variable name"
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "PRRT_ghi789" "Fixed: Removed deprecated call"
Confirm zero unresolved threads remain:
gh api graphql -f query='
query {
repository(owner: "OWNER", name: "REPO") {
pullRequest(number: PR_NUMBER) {
reviewThreads(first: 50) {
nodes { isResolved }
}
}
}
}' --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)] | length'
# Should output: 0
If any threads remain unresolved, go back to Step 9 and resolve them.
Skill({ skill: "crew:git:pr:update" });
</workflow>
<success_criteria>
bun run ci passes locallyINCOMPLETE if any threads remain unresolved. Always verify with Step 10 query.
</success_criteria>