Fix review feedback, update PR, and trigger re-review automatically
Automates the complete review iteration cycle: gathers PR feedback, fixes issues, updates the PR, and triggers re-review. Use this after receiving review comments to automatically address feedback and verify fixes without manual intervention.
/plugin marketplace add Lobbi-Docs/claude/plugin install jira-orchestrator@claude-orchestrationIssue: ${issue_key} PR: ${pr} Auto Review: ${auto_review} Max Iterations: ${max_iterations}
After receiving review feedback (from council or human reviewers), this command:
detection_order:
1. Use explicit --pr argument if provided
2. Parse from current git branch: feature/PROJ-123-* → find open PR
3. Query Jira issue for linked PRs
4. Fail with helpful message if not found
From Harness:
actions:
- tool: harness_get_pull_request_activities
params:
repo_id: ${repo}
pr_number: ${pr}
- tool: harness_api_get_comments # REST API for inline comments
endpoint: /v1/repos/${repo}/pullreq/${pr}/comments
From GitHub (fallback):
actions:
- tool: mcp__github__list_pull_request_reviews
- tool: mcp__github__list_review_comments
categories:
critical:
keywords: ["must fix", "blocking", "security", "vulnerability", "bug"]
action: fix_immediately
priority: 1
warning:
keywords: ["should fix", "code smell", "missing", "consider"]
action: fix
priority: 2
suggestion:
keywords: ["nit", "suggestion", "nice to have", "optional"]
action: fix_if_easy
priority: 3
question:
keywords: ["?", "why", "clarify", "explain"]
action: respond_with_explanation
priority: 2
resolved:
keywords: ["fixed", "addressed", "resolved", "done"]
action: skip
priority: 0
praise:
keywords: ["great", "lgtm", "nice", "good"]
action: acknowledge
priority: 0
output:
unresolved_comments: [...]
fix_plan:
- id: FIX-001
comment_id: "c123"
file: "src/auth/login.ts"
line: 42
issue: "Missing null check"
category: warning
fix_strategy: "Add null check before access"
- id: FIX-002
comment_id: "c456"
file: "src/api/users.ts"
line: 78
issue: "SQL injection vulnerability"
category: critical
fix_strategy: "Use parameterized query"
grouping:
by_file:
"src/auth/login.ts": [FIX-001, FIX-003]
"src/api/users.ts": [FIX-002]
by_domain:
security: [FIX-002]
quality: [FIX-001, FIX-003]
execution_order:
1. Critical security fixes first
2. Structural changes
3. Quality improvements
4. Coding standards violations
5. Suggestions (if time permits)
All fixes MUST follow config/coding-standards.yaml:
standards_check:
before_fix:
- Verify fix follows naming conventions
- Check language-specific rules apply
quick_reference:
terraform:
variables: snake_case
resources: "this (iterated) or main (primary)"
tag_keys: PascalCase
python:
classes: PascalCase
functions: "snake_case verbs"
api_routes: "/api/v{n}/{plural}"
typescript:
functions: camelCase
components: PascalCase
hooks: "use prefix"
database:
tables: "snake_case plural"
columns: snake_case
agent_selection:
FIX-002 (security):
agent: security-specialist
model: sonnet
FIX-001 (quality):
agent: code-reviewer # Can also fix
model: haiku
For each fix in order:
fix_workflow:
- Read current file content
- Understand the specific issue
- Apply fix using appropriate agent
- Run affected tests
- Verify fix doesn't break anything
After each fix, reply to the original comment:
reply_template:
fixed: |
✅ **Fixed** in commit `${sha}`:
${description_of_fix}
wont_fix: |
ℹ️ **Won't fix**: ${reason}
${alternative_approach_if_any}
need_clarification: |
❓ **Need clarification**:
${question}
Via Harness API:
client.create_comment(
repo=repo,
pr_number=pr,
text=reply_text,
parent_id=original_comment_id # Creates thread reply
)
failure_handling:
test_failure:
action: Debug and retry (max 2 attempts)
escalate_after: 2 failures
syntax_error:
action: Auto-correct and retry
escalate_after: 1 failure
complex_refactor:
action: Flag for human review
escalate_immediately: true
git add -A
commit_message:
format: "fix(${issue_key}): address review feedback"
body: |
Fixes applied:
${list_of_fixes}
Resolved comments: ${resolved_count}
Pending: ${pending_count}
git push origin ${branch}
Add iteration note to PR:
pr_update:
append_to_description: |
---
## Iteration ${iteration_number} - ${timestamp}
**Fixes applied:** ${fix_count}
**Comments resolved:** ${resolved_count}
### Changes
${fix_summary}
Only review affected areas:
focused_council:
scope: ${changed_files_in_iteration}
members:
- code-reviewer # Always
- security-auditor # If security fixes
- test-strategist # If test changes
verification:
for_each_fix:
- Original issue resolved?
- No new issues introduced?
- Tests still passing?
review_decision:
all_fixed_and_verified: "approved"
some_remaining: "reviewed" # Progress noted
new_issues_found: "changereq"
jira_update:
- tool: mcp__atlassian__jira_add_comment
params:
body: |
## Iteration ${iteration_number} Complete
**Fixes Applied:** ${fix_count}
**Comments Resolved:** ${resolved_count}
${fix_details}
**Re-Review Result:** ${review_decision}
# Mark fixed comments as resolved (if API supports)
for_each_resolved_comment:
- Update comment status to "resolved"
╔═══════════════════════════════════════════════════════════════════════════╗
║ ITERATION COMPLETE: ${issue_key} (Iteration #${n}) ║
╠═══════════════════════════════════════════════════════════════════════════╣
║ ║
║ PR: ${pr_url} ║
║ ║
║ Feedback Processed: ║
║ ├─ Critical: ${critical_count} → ${critical_fixed} fixed ║
║ ├─ Warnings: ${warning_count} → ${warning_fixed} fixed ║
║ └─ Suggestions: ${suggestion_count} → ${suggestion_fixed} fixed ║
║ ║
║ Re-Review: ${review_decision} ║
║ ${review_summary} ║
║ ║
║ Next: ${next_action} ║
║ ║
╚═══════════════════════════════════════════════════════════════════════════╝
limits:
max_iterations: ${max_iterations} # Default: 3
escalation_triggers:
- Same comment unfixed after 2 attempts
- Critical issue count not decreasing
- Test failures persisting
- Iteration time exceeds 30 minutes
⚠️ ITERATION LIMIT REACHED
After ${max_iterations} iterations, the following issues remain unresolved:
${list_of_unresolved_issues}
Recommended Actions:
1. Review persistent issues manually
2. Clarify ambiguous requirements
3. Consider scope reduction
4. Pair with human developer
To force continue: /jira:iterate ${issue_key} --force
To get help: /jira:status ${issue_key} --verbose
| Error | Recovery |
|---|---|
| PR not found | Clear message with detection help |
| No unresolved comments | Success - nothing to fix |
| API rate limit | Wait and retry with backoff |
| Merge conflict | Abort, ask user to resolve |
| Fix introduces new failures | Rollback fix, try alternative |
Override in .jira/iterate-config.yaml:
iterate:
max_iterations: 3
auto_review: true
fix_priorities:
critical: always
warning: always
suggestion: if_time_permits
reply_to_comments: true
resolve_threads: true
escalation:
notify_slack: true
channel: "#dev-alerts"
/jira:ship - Initial shipping with council review/jira:council - Standalone council review/jira:review - Manual AI code review