RefactorPlatform: An Open-Source Harness for Controlled Evaluation of Repository-Scale Refactoring Agents
Organizations: Pi School · Translated
Abstract
Repository-scale refactoring requires coding agents to propagate a single change across many interdependent files without altering program behavior, yet to our knowledge no existing harness isolates the design choices that determine agent success on this task. We present RefactorPlatform, an open-source evaluation harness that holds the environment fixed and varies each design axis explicitly: model backbone (via OpenRouter and GitHub Copilot CLI), execution regime (baseline, retrieval-augmented, and multi-agent), and prompt specificity. Each run executes in an isolated workspace with live terminal streaming, per-task logging of tokens, diffs, and transcripts, AST-based verification, and exportable telemetry for audit and reproduction. Demonstrating the platform on 100 multi-file RefactorBench tasks across four model families, we illustrate the analyses it supports: AST-aware chunking outperforms naive token-window chunking by 25-30 percentage points (pp) across prompt modes, whereas naive retrieval falls below the retrieval-free baseline; a lean retrieval-augmented single agent (86%) beats the sub-agent configuration we evaluated (66%) on matched tasks with no task passing under delegation that fails under retrieval; and retrieval's accuracy gains absorb its token overhead, leaving cost per successful refactoring unchanged. RefactorPlatform is open-sourced to make refactoring-agent evaluation reproducible and auditable.
Figures & tables
| Model | Regime | Prompt Mode | Augmentation | Pass Rate |
|---|---|---|---|---|
| qwen3.6-flash | Baseline | Descriptive | +LSP Enforcement | 73% |
| qwen3.6-flash | Baseline | Descriptive | -LSP Enforcement | 71% |
| qwen3.6-flash | Baseline | Base | +LSP Enforcement | 64% |
| qwen3.6-flash | Baseline | Base | -LSP Enforcement | 59% |
| qwen3.6-flash | Baseline | Lazy | +LSP Enforcement | 48% |
| qwen3.6-flash | Baseline | Lazy | -LSP Enforcement | 44% |
| Model | Regime | Prompt Mode | Augmentation | Pass Rate |
|---|---|---|---|---|
| qwen3.6-flash | Baseline | Descriptive | - | 73% |
| qwen3.6-flash | Retrieval | Descriptive | AST Chunking | 86% |
| minimax-m3 | Baseline | Descriptive | - | 75% |
| minimax-m3 | Retrieval | Descriptive | AST Chunking | 81% |
| kimi-k2.6 | Baseline | Descriptive | - | 71% |
| kimi-k2.6 | Retrieval | Descriptive | AST Chunking | 78% |
| Configuration | Pass | $/Task | $/Pass |
|---|---|---|---|
| qwen3.6-flash ( ) | 73% | $0.096 | $0.13 |
| qwen3.6-flash ( ) | 86% | $0.113 | $0.13 |
| minimax-m3 ( ) | 75% | $0.490 | $0.65 |
| minimax-m3 ( ) | 81% | $0.538 | $0.66 |
| kimi-k2.6 ( ) | 71% | $0.444 | $0.63 |
| kimi-k2.6 ( ) | 78% | $0.489 | $0.63 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Task Target | Project | Primary Failure Mode |
|---|---|---|
| debug helpers to helpers | flask | Diff heuristic fails to match changes |
| new path traversal | django | Import propagation to test module fails |
| new utils from basic | ansible | Incorrect log sanitization relocation |
| option parser print | tornado | Outright failure across all 6 variants |
| parameterize gunzip | scrapy | Incomplete spider parameterization |
| Model Family Configuration | Setup Regime | Code Extracted | Compiled | AST Verified | Pass Rate |
|---|---|---|---|---|---|
| qwen3.6-flash | Baseline Default | 90% | 28% | 59% | 24% (43/177) |
| minimax-m3 | Baseline Default | 97% | 34% | 55% | 29% (51/177) |
| gpt-5-mini | Baseline Default | 82% | 12% | 44% | 20% (15/75) |
| gpt-5-mini | -eval (Feedback Loop) | 94% | 88% | 85% | 85% (28/33) |
| GPT-4o-mini Xu et al. (2026) | Simple Prompting Reference | - | - | - | 19% (34/177) |
| GPT-4o-mini Xu et al. (2026) | + RAG Few-Shot Baseline | - | - | - | 20% (36/177) |
| Failure Category / Pipeline Stage | Observed Failures | % of Total Failures |
| Panel A: RefactorBench (Python Dataset, 300 exploratory agent runs) | ||
| Partial completion (some subtests pass, missed 1–2 trailing files) | 31 | 27.7% |
| Assertion / functional logic error (incorrect refactored behavior) | 30 | 26.8% |
| Missing import statement / broken variable reference post-move | 26 | 23.2% |
| All subtests fail (complete task miss) | 13 | 11.6% |
| Harness execution timeout (agent caught in tool-invocation loops) | 10 | 8.9% |
| Repository | Objective & Success | Blind Spot & Breaking Point | Architectural Diagnosis |
|---|---|---|---|
| Ansible | Obj: Extract core utility functions to a new utils.py . Succ: Successfully refactored 9 production import sites. | Treated production and test suites as isolated; failed to audit test files for stale assignments. Fail: 2/12 tests failed ( AssertionError in test suite). | Partial Completion. Handles immediate local edits successfully, but lacks the repo-wide scope to synchronize downstream testing environments. |
| Django | Obj: Add optional log=True flag to get_resolver() and propagate. Succ: Core definition block modified accurately. | Assumed strictly localized scope; skipped repo-wide search, missing 2 critical caller nodes. Fail: 2/3 tests failed ( AssertionError : flag unexpectedly None ). | Reference Blindness. Local technical edits succeed, but failure to perform codebase-wide discovery leaves external dependencies broken. |
Software Engineering Agents
Software Engineering Agents are AI systems that use code, tools, and feedback to perform software development tasks.
See all 337 papers