Training capable coding agents via reinforcement learning (RL) requires diverse tasks with reliable verifiers. Open-source codebases offer a rich source of such tasks, while existing methods typically rely on development artifacts such as issues and commits, limiting the range of tasks that can be extracted. To better scale RL environments, we present CodeMidas, an agentic pipeline that turns implemented functionality in existing codebases into executable RL environments using source code as its only task-specific input. CodeMidas allocates agentic compute to every stage of environment construction: agents explore implemented functionality to formulate behavioral specifications, construct tests grounded in execution of the original code, and validate and filter candidate tasks through execution checks and repeated solution rollouts. The resulting dataset has 5,545 training tasks from 3,185 open-source codebases spanning 23 programming languages and 15 technical domains. Training MiMo-V2.5 on these tasks with GRPO improves performance on all five diverse benchmarks, covering issue repair (DeepSWE + 11.7%), whole-program construction (ProgramBench +17%), and terminal work (Terminal-Bench v2.1 +8.5%). Ablations show that increasing the number of high-quality training tasks improves performance. Trajectory analysis shows the RL-trained agent demonstrates better behaviors like increasing codebase exploration and more diverse self-verification. These results establish source code as a scalable foundation for constructing RL environments that improve coding agents across diverse software tasks.
Figures & tables
Method
w/o issue
w/o PR
w/o commit
w/o existing tests
w/o written description
Languages
SWE-rebench V2 ( Badertdinov et al., 2026 )
⧫
✗
✗
✗
✓
20
daVinci-Env ( Fu et al., 2026 )
✗
✗
✗
✗
✓
1
R2E-Gym ( Jain et al., 2025 )
✓
✓
✗
⧫
✓
1
SWE-smith ( Yang et al., 2025 )
✓
⧫
⧫
✗
✓
1
SWE-Flow ( Zhang et al., 2025 )
✓
✓
✓
✗
✓
1
SWE-Hub ( Zeng et al., 2026 )
✓
✓
✓
✗
⧫
11
Table 1: Task-specific input requirements and language coverage of representative pipelines for constructing coding environments. ✓ = not required; ⧫ = required by part of the pipeline; ✗ = required.
Figure 1: CodeMidas overview. Four modules cover task design, test construction, execution consistency, and post-rollout filtering. The pyramid shows retained task counts respectly.
Figure 3
Figure 4: Reference solution size. Bars show task percentages; the dashed line marks the median (142 lines). The piecewise log x-axis compresses the 1–10 interval to one fifth the width of subsequent decades.
Figure 5: Performance gains from RL on CodeMidas. Initial MiMo-V2.5 scores (gray) and CodeMidas RL scores (gold). ProgramBench reports Almost Solved; all other evaluations report pass rate. Labels on the right give absolute improvements over the initial policy in percentage points.
Figure 6: Learning curve on CodeMidas Val. Pass rate (green, left axis) and mean total length (gray-blue dashed, right axis) during RL on CodeMidas. Length is measured in thousands of tokens; the horizontal dotted line marks the pass rate achieved by the initial policy.
Figure 7: Learning curves on CodeMidas Val. Pass rates at five-step intervals from step 0 to 70, without smoothing. Solid lines with circles denote the high-quality 1k, 3k, and full (5k) pools; the dashed line with diamonds denotes the vanilla 8k sample drawn before filtering and cleaning.
Figure 8: Task scale and quality. Scores on SWE-bench Pro, DeepSWE, and CodeMidas Val. Connected circles denote high-quality 1k, 3k, and 5k pools; diamonds denote vanilla 8k. Panels use different y-axis ranges.
Figure 9: Codebase exploration, code drafting, and self-verification in one rollout. Columns pair reasoning with tool use from one CodeMidas training rollout: reading the caller, drafting hidden-file filtering and applying it via Edit , and testing both flag settings with .secret.csv . The diff marks additions; Passed indicates agreement with expected behavior.
Behavior
Measure
Early
Late
Change
Codebase exploration
Pre-edit read/search calls
27.2
40.1
+12.9
Code drafting
Drafting ratio
0.358
0.629
+0.271
Self-verification
Distinct post-edit commands
2.03
2.53
+0.50
Table 2: Changes during RL. Rollout means in early and late training, using defined measurements for each behavior. Changes are computed from unrounded means for each behavioral measure.
Evaluation
Codebase exploration (read/search calls)
Code drafting (drafting ratio)
Self-verification (distinct commands)
Interaction length (assistant turns)
SWE-bench Pro
23.1 → 35.5
0.304 → 0.653
0.80 → 0.96
37.3 → 50.1
ProgramBench
55.7 → 83.6
0.106 → 0.361
0.93 → 0.99
155.1 → 122.8
Terminal-Bench v2.1
11.9 → 16.8
N/A
2.01 → 2.61
59.2 → 69.5
Table 3: Behavior on held-out tasks. Means over the first → last three observed checkpoints for each benchmark. The three behavioral measures follow Table 2 and include rollouts with defined measurements; interaction length includes all scored rollouts. Measured subsets can vary across checkpoints.
Coding agents often fail in the last mile: they build most of a feature but drop a requirement, test only the cases their implementation already handles, break behavior that was supposed to stay intact, or validate against an unchecked assumption. We ask whether reinforcement learning (RL) on expert-built agentic coding tasks closes this gap, and whether what the agent learns transfers beyond the training distribution. We post-train Kimi K2.7 Code, a 1T-parameter (32B active) open-weight mixture-of-experts model, with RL alone on 1,700 tasks: 1,000 repository tasks graded by hidden fail-to-pass tests and by pass-to-pass tests of existing behavior, and 700 terminal tasks graded by expert-written hidden verifiers. The reward is the fraction of target checks passed and drops to zero if any pass-to-pass test fails. One epoch of GSPO on a rank-32 LoRA adapter improves pass@1 on each of the six external benchmarks we evaluated, across three agent harnesses: SWE-Bench Pro (60.1 to 64.8), DeepSWE (31.0 to 43.4), Terminal-Bench 2.1 (67.4 to 82.0), Terminal-Bench 3 (1.4 to 12.1), Terminal-Bench 4 (0.0 to 7.6), and SWE-Marathon (5.0 to 25.0). Pooled over the five independent task sets (Terminal-Bench 4 revises Terminal-Bench 3), the improvement is significant (p < 0.001), and it remains significant on the three sets released after the training data was collected (p = 0.004); the model also improves under both harnesses never used in training. Median trajectories on DeepSWE and Terminal-Bench 3 are 24-35% shorter in agent steps. The base model's failed DeepSWE runs are mostly near-misses, and on the tasks the trained model newly solves, paired trajectories show it avoiding each of the four failure modes above.
A prerequisite for coding agents to perform tasks on large repositories is code localization - the identification of relevant files, classes, and functions to work on. While repository-level code localization has been performed using embedding-based retrieval approaches such as vector search, recent work has focused on developing agents to localize relevant code either as a standalone precursor to or interleaved with performing actual work. Most prior methods on agentic code search equip the agent with complex, specialized tools, such as repository graphs derived from static analysis. In this paper, we demonstrate that, with an effective reinforcement learning recipe, a coding agent equipped with nothing more than a standard Unix terminal can be trained to achieve strong results. Our experiments on three benchmarks (SWE-Bench Verified, Pro, and Lite) reveal that our models consistently achieve superior or competitive performance over 2-18x larger base and post-trained LLMs and sometimes approach performance provided by closed models like Claude Sonnet, even when using specialized scaffolds. Our work particularly focuses on techniques for re-purposing existing coding agent environments for code search, reward design, and RL optimization. We release the resulting model family, CodeScout, along with all our code and data for the community to build upon.
Lintang Sutawika, Aditya Bharat Soni, Bharath Sriraam R R +8
Carnegie Mellon University · Independent · OpenHands
Scaling coding agents requires a continuing supply of executable data for training, benchmarking, and continuous evaluation. Each task must couple a realistic software state with a specification, development tools, and reliable verification. To expand this supply, we present Change2Task, a system grounded in repository history that converts merged pull requests (PRs) into verified tasks on healthy modern revisions of the same repository. It aligns historical evidence with evolved code, reconstructs task states through Patch Reversal, Code Mapping, or Agent Reconstruction, and validates the lifecycle from a healthy base to a task state and a restored state. By deriving multiple tasks grounded in developer evidence from maintained environments, Change2Task provides executable data for coding agent training and evaluation while reducing repeated environment setup, storage, and task construction effort. We evaluate five coding agent task families: Bug Fix, Feature Addition, Test Generation, Application Programming Interface (API) Migration, and Security Repair. Starting from 1,130 source changes eligible for construction, Change2Task achieves 79.6% verified task construction success across these task families. On a matched candidate set, it recovers 29.2% more verified tasks than a construction baseline based on PRs. Historical and reconstructed cases achieve 89.7% aggregate matched outcome agreement under agent evaluation, while reuse of modern bases reduces measured expenditure across the complete pipeline by 10.8%. Four matched studies examine construction stages, semantic review, branch consistency, and resource trade-offs. An industrial deployment further constructs 1,000 tasks from private PR histories and evaluates four models on a fixed 500-task cohort.
Haomin Qi, Xingliang Wang, Xuanqi Gao +9
Microsoft · University of California San Diego · Zhejiang University +2