SWE-Review: Agentic Code Review로 이슈 해결 루프 완성하기
SWE-Review: Closing the Loop on Issue Resolution with Agentic Code Review
TL;DR Highlight
AI가 생성한 PR을 자동으로 리뷰하고 수정 피드백까지 주는 에이전트 프레임워크로, resolve rate를 최대 2배 가까이 끌어올렸다.
Who Should Read
AI 코딩 에이전트(Devin, Claude Code 등)를 프로덕션에 붙이거나, LLM으로 코드 리뷰 자동화를 구축하려는 백엔드/DevOps 개발자. 테스트 없이 one-shot으로 PR 머지하는 파이프라인의 품질을 높이고 싶은 팀에 특히 유용하다.
Core Mechanics
- 기존 AI 코딩 에이전트는 PR을 생성하고 끝나는 'open-loop' 구조 — 리뷰도, 진단도, 수정도 없다. SWE-Review는 여기에 리뷰어 에이전트를 끼워 넣어 generate → review → revise 루프를 만든다.
- 리뷰어 에이전트는 저장소를 직접 탐색하며 증거를 수집한 뒤 approve/request-changes 결정을 내리고, 거절 시에는 어느 파일 몇 번째 줄이 문제인지 구체적인 진단(diagnosis)을 함께 제공한다.
- 단순히 diff만 보는 single-turn 리뷰와 달리, 에이전트 리뷰는 콜 체인을 따라가며 버그의 근본 원인(root cause)을 찾아낸다 — sympy 사례에서 single-turn은 증상 수정 PR을 approve했지만 에이전트는 upstream 버그를 잡아냈다.
- SWE-Review-Bench(1,384개 PR)와 SWE-Review-Traj(8,914개 리뷰 궤적 데이터셋)을 공개해서 오픈 리뷰어 학습과 평가를 지원한다.
- 리뷰 궤적 데이터로 Qwen3-8B를 SFT(지도학습 파인튜닝)하면 completion rate가 ~4%에서 71~84%로, decision accuracy가 랜덤 수준에서 67~72%로 올라간다.
- 리뷰 궤적을 이슈 해결 데이터와 혼합 학습하면 단순 코드 생성 능력까지 올라간다 — 같은 모델이 PR 생성 + 리뷰 + 수정을 모두 수행하는 단일 에이전트가 된다.
- Test-time scaling 전략으로 review-guided iterative revision이 가장 효율적 — 최대 5샘플 예산에서 평균 2.44샘플만 써서 resolve rate를 22.9% → 38.4%로 올린다.
Evidence
- generate-review-revise 루프 적용 시 SWE-bench Verified resolve rate: Qwen3-30B-A3B 27.5% → 56.9% (+29.4pp), Qwen3-Coder-30B-A3B 50.9% → 68.8% (+17.9pp), GLM-5 72.2% → 75.4% (+3.2pp).
- 에이전트 리뷰 vs single-turn 리뷰(diff+context), Qwen3-30B-A3B 기준 RRR(수정 후 resolve rate): 52.6% vs 44.1% — no-review 베이스라인 27.5% 대비 에이전트 리뷰가 거의 2배.
- Qwen3-8B SFT 후 completion rate 4% → 71~84%, decision accuracy +18~21pp 향상 (Table 2).
- 혼합 학습(이슈 해결 2k + 리뷰 2k) 시 직접 resolve rate 31.2% → 36.8%, review-then-revise 최종 resolve rate 31.2% → 41.8% (Table 3).
- Test-time scaling 토큰 효율: review-guided iterative revision 2.28pp/Mtok vs reviewer-gated resampling 0.35pp/Mtok — 6.5배 차이 (Table 14).
How to Apply
- 기존 AI 코딩 에이전트(Claude Code, Aider 등) 뒤에 리뷰어 에이전트를 붙이면 된다. 리뷰어는 저장소 접근 권한과 코드 실행 환경만 있으면 되고, approve가 나올 때까지 PR을 거부-수정 루프로 돌린다. 논문의 프롬프트(Appendix E.2)를 그대로 가져다 쓸 수 있다.
- 오픈소스 소형 리뷰어가 필요하다면 SWE-Review-Traj 데이터셋으로 Qwen3-8B를 파인튜닝하면 된다. 리뷰 데이터만 써도 되고, 이슈 해결 데이터와 1:1로 섞으면 코드 생성 능력까지 같이 올라간다.
- Test-time scaling 비용을 줄이고 싶다면 best-of-N 방식 대신 review-guided iterative revision을 쓰면 된다. 리뷰어가 reject하면 피드백을 붙여서 재생성하는 구조라 평균 2~3샘플로 best-of-16과 비슷하거나 더 나은 성능을 낸다.
Code Example
# Appendix E.2에서 가져온 아gentic 리뷰 프롬프트 핵심 구조
# 리뷰어 에이전트에게 넘길 system prompt 골격
REVIEW_SYSTEM_PROMPT = """
You are reviewing an AI-generated patch. Your job: determine if the patch
correctly fixes the root cause of the bug.
## Process
### Step 1: Read the Problem (NOT the patch yet)
Read the problem statement. Answer:
1. What does the user expect? (exact output/return value)
2. What actually happens? (error type + message, wrong output)
### Step 2: Find the Root Cause
Trace from the entry point down through the call stack.
Root cause = where the wrong value is created or wrong logic runs.
### Step 3: Write YOUR Proposed Fix (BEFORE reading the patch)
Commit to what you would change and why.
### Step 4: Read and Apply the Patch
Compare the patch to your Step 3 proposal.
HARD RULE - Symptom fix detection -> request_changes if:
- The patch is at a shallower location than your root cause
- The patch adds a guard at the point of USE instead of fixing point of CREATION
### Step 5: Verify Complete Behavior
Write and run tests:
1. Bug reproduction test
2. Full output/behavior check (not just 'no exception')
3. Regression test
### Step 6: Write Report
"""
REVIEW_OUTPUT_SCHEMA = {
"decision": {
"recommendation": "approve | request_changes",
"confidence": "0.0 to 1.0"
},
"summary": {
"problem": "1 sentence: root cause (file + function + what's wrong)",
"solution": "2-4 sentences: what the patch changes and whether it matches root cause",
"overall_assessment": "1-2 sentences: verdict with reason"
},
"defects": [
{
"severity": "high | medium | low",
"category": "correctness | compatibility | security | performance | maintainability",
"location": {"path": "exact/file/path.py", "start_line": "N", "end_line": "N"},
"description": "What is wrong: specific code, condition, failure",
"suggestion": "In file.py function foo(), change X to Y"
}
]
}
# 리뷰 피드백을 받아서 revision 에이전트에 넘기는 예시
def run_review_revision_loop(issue, pr, repo_path, max_rounds=5):
for round in range(max_rounds):
review = reviewer_agent(issue, pr, repo_path) # 에이전트 리뷰 실행
if review["decision"]["recommendation"] == "approve":
return pr # 승인되면 종료
# 거절 시 진단 내용을 revision 에이전트에게 전달
feedback = format_feedback(review["defects"])
pr = revision_agent(issue, pr, feedback, repo_path) # 수정
return prTerminology
관련 논문
Microsoft, AI 에이전트를 위한 시각화 언어 Flint 공개
Microsoft가 LLM/AI 에이전트가 차트를 쉽게 생성할 수 있도록 설계된 고수준 시각화 DSL(도메인 특화 언어) Flint를 오픈소스로 공개했다. 에이전트가 복잡한 시각적 세부사항 대신 의미론적 명세만 다루면 되도록 추상화 계층을 제공하는 게 핵심이다.
GeoSQL: Claude/Codex를 지리공간 데이터 분석 에이전트로 만들어주는 Skill
PostGIS, BigQuery, Snowflake 등에서 지리공간 데이터를 다룰 때 Claude/Codex/GitHub Copilot에 설치해서 SQL 생성과 지도 렌더링까지 자동화해주는 오픈소스 Skill이다.
GitLost: GitHub AI 에이전트를 속여 비공개 저장소 내용을 유출시킨 방법
Noma Security 연구팀이 GitHub의 새 AI 에이전트 워크플로우에서 Prompt Injection 취약점을 발견했고, 인증 없이 공개 이슈 하나만으로 조직 내 private 저장소 내용을 외부에 노출시키는 데 성공했다.
AI가 Cloudflare의 암호화 라이브러리 CIRCL에서 실제 버그 7개를 찾아낸 이야기
zkSecurity 팀이 AI 감사 파이프라인을 Cloudflare의 오픈소스 암호화 라이브러리 CIRCL에 돌려서 실제로 존재하는 버그 7개를 발견했고, 그 중에는 속성 기반 암호화의 접근 제어를 완전히 우회할 수 있는 Critical 버그도 포함되어 있다. AI가 암호화 코드 감사에서 실질적인 성과를 낼 수 있음을 보여준 사례라 주목할 만하다.
Docx-CLI: AI 에이전트가 Word 문서를 절반의 토큰으로 읽고 편집하는 CLI 도구
AI 에이전트(Claude, Codex)가 .docx 파일을 직접 XML로 다루는 대신 CLI 명령어로 편집할 수 있게 해주는 도구로, 토큰 사용량을 최대 2.6배 줄이고 문서 파손 없이 작업 성공률을 크게 높인다.
Rowboat – 오픈소스 로컬 우선 AI 코워커 (Claude Desktop 대안)
이메일, 미팅, Slack, 코드 등 업무 데이터를 로컬 지식 그래프로 인덱싱하고 백그라운드 에이전트로 자동화해주는 오픈소스 데스크톱 AI 비서 앱이다. Claude Desktop처럼 쓰되 훨씬 더 풍부한 업무 컨텍스트와 자체 작업 화면을 제공한다는 점에서 주목할 만하다.
Related Resources
Original Abstract (Expand)
Coding agents increasingly generate pull requests (PRs) for real-world software issues, yet one-shot PR generation remains open-loop: the PR is proposed without systematic review, diagnosis, or revision. We introduce SWE-Review, a framework for closing this loop with agentic code review. Given an issue and an AI-generated PR, a reviewer agent explores the repository, decides whether the PR should be accepted, and provides structured feedback for revision. We evaluate this setting with our proposed SWE-Review-Bench to measure both review correctness and downstream revision usefulness. We further curate SWE-Review-Traj dataset to study broader applications of agentic review and fill the data-scarcity gap for open reviewer training. Experiments show that agentic review continuously improves PRs through a generate-review-revise loop, outperforms single-turn fixed-context review in both decision accuracy and resolve rate after revision, transfers beyond review to improve issue-resolution models, and enables effective and efficient test-time scaling. These results position agentic code review as a practical mechanism for moving AI coding agents from one-shot PR generation toward closed-loop issue resolution.