CodeMidas: Scaling Agentic Coding RL Environments from Code Itself
Problem Statement
RL for coding agents is bottlenecked by the supply of diverse tasks with reliable verifiers. Prior pipelines (e.g., issue/commit-mined datasets in the SWE-Gym/R2E-Gym lineage) depend on development artifacts. That restricts them to repositories with rich history and to bug-fix-style tasks, which limits both scale and task diversity. A method that derives tasks from code itself could unlock far more repositories, languages, and task types, such as building functionality rather than only patching it.
Key Novelty
- Uses source code as the only task-specific input: implemented functionality is reverse-engineered into behavioral specifications plus executable tests, removing the dependence on issues, commits, or PRs.
- Allocates agentic compute to every pipeline stage: exploration-driven spec formulation, tests grounded in execution of the original code, and validation through execution checks and repeated solution rollouts that serve as a difficulty and solvability filter.
- Produces a broad, multilingual RL dataset: 5,545 tasks from 3,185 repos spanning 23 programming languages and 15 domains, with evidence that one source-code-derived training distribution transfers across heterogeneous agentic coding benchmarks.
Evaluation Highlights
- GRPO training of MiMo-V2.5 on CodeMidas tasks improves all five benchmarks. Reported gains include DeepSWE +11.7%, ProgramBench +17%, and Terminal-Bench v2.1 +8.5%. The abstract does not specify whether these are absolute points or relative changes, and it does not name the other two benchmarks.
- Ablations show performance increases with the number of high-quality training tasks. Trajectory analysis shows the RL-trained agent explores the codebase more and self-verifies in more diverse ways.
Signal Assessment
Methodology
- Select open-source repositories across many languages and domains, using only their source code as input.
- Have exploration agents navigate each codebase, identify implemented functionality, and write natural-language behavioral specifications describing it, typically paired with removing or masking the implementation to create the task.
- Have agents construct tests grounded in actually executing the original code, so the reference implementation defines correct behavior and the tests act as verifiers.
- Validate candidate tasks with execution checks (e.g., tests pass on the original code and fail on the stubbed version) and with repeated solution rollouts that filter out unsolvable, trivial, or ill-posed tasks.
- Train MiMo-V2.5 with GRPO in the resulting executable environments, using test outcomes as rewards.
- Evaluate on issue repair, whole-program construction, and terminal benchmarks, and run scaling ablations and trajectory behavior analysis.
System Components
Explores a repository to find self-contained implemented functionality and writes behavioral specifications that become task prompts.
Writes tests whose expected behavior comes from running the original implementation, yielding reliable reward signals.
Checks that environments build and run, and that tests discriminate between the reference and incomplete solutions.
Runs repeated agent solution attempts to estimate solvability and difficulty, discarding tasks that are broken, ambiguous, or uninformative for RL.
5,545 executable RL tasks from 3,185 repos covering 23 languages and 15 technical domains.
Group Relative Policy Optimization applied to MiMo-V2.5 with test-based rewards in the agentic environments.
Results
| Metric/Benchmark | Baseline | This Paper | Delta |
|---|---|---|---|
| DeepSWE (issue repair) | MiMo-V2.5 before RL (value not reported in abstract) | MiMo-V2.5 + CodeMidas GRPO | +11.7% |
| ProgramBench (whole-program construction) | MiMo-V2.5 before RL (value not reported in abstract) | MiMo-V2.5 + CodeMidas GRPO | +17% |
| Terminal-Bench v2.1 (terminal work) | MiMo-V2.5 before RL (value not reported in abstract) | MiMo-V2.5 + CodeMidas GRPO | +8.5% |
| Two other benchmarks (not named in abstract) | MiMo-V2.5 before RL | MiMo-V2.5 + CodeMidas GRPO | Improved (magnitude not reported in abstract) |
| Task-count scaling ablation | Fewer high-quality tasks | More high-quality tasks | Monotonic improvement (qualitative) |
Key Takeaways
- You do not need issue trackers or commit histories to build coding RL environments. Any repository with working functionality can be mined by masking implementations and deriving tests from the original code's execution, which greatly expands the pool of usable repos and languages.
- Investing agent compute in environment quality pays off: execution-grounded tests plus rollout-based solvability and difficulty filtering are key, and the ablations indicate that the number of high-quality tasks, not just raw volume, drives gains.
- Training on 'implement the existing functionality' tasks transfers beyond feature implementation to issue repair and terminal operation. It appears to instill general agent habits such as deeper codebase exploration and varied self-verification, so a single diverse environment mix can serve several downstream agentic coding targets.
Abstract
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.