Manuscript Offprint

arXiv:2610.13395

ProgramGym: Scaling Training Environments for Long-Horizon Program Reproduction Agents

Chengyi Yang, Renxu Bao, Jue Hou, Zongpei Teng, Ziheng Wang, Yujie Lin, Chengsong Huang, Junnan Zhu, Delai Qiu, Yining Wang, Shengping Liu, Fei Long, Jinsong Su

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Coding agents are increasingly used to build programs from scratch as software engineers do rather than to resolve issues within a repository or to generate a repository from a given requirements document. However, scalable verifiable training environments that force agents to discover what is required and to decide how the system should be designed remain scarce. Moreover, existing agent workflows also cannot sustain long-horizon development in which the agent explores the reference program before implementation. To address these challenges, we introduce ProgramGym, a framework consisting of Program-Env and Program-Agent for scalable training environments of long-horizon program reproduction agents. Specifically, Program-Env constructs verifiable training environments from repositories through a feedback-driven loop that repairs runtime sandbox builds and the quality of black-box tests. Using this novel pipeline, we obtain 1,648 training environments spanning C, C++, Go, and Rust. Program-Agent combines a role-isolated workflow of analysis, implementation, and review with revision management for compilation checks and failure recovery. Experiments on ProgramBench show that both Program-Env and Program-Agent improve performance on program reproduction. Fine-tuning on trajectories with these constructed environments raises the performance of Qwen3.8-27B from 34.87% to 42.84%. Program-Agent further raises the base and SFT models to 55.71% and 56.25%, both exceeding some flagship models. We will release the ProgramGym to support further research on coding agents that build programs from scratch.

huggingface.co/ProgramGym

programgym.github.io/

Figure

Figure 1: Overview of ProgramGym.

∗^{*}Equal Contributions.

†^{\dagger}Corresponding authors.

1 INTRODUCTION

Current coding agents (Qwen Team, 2026; Team et al., 2026; Zeng et al., 2026a) typically handle issue-resolution tasks and repository generation tasks. Issue-resolution tasks such as SWE-bench give a repository and an issue for the agent to patch (Jimenez et al., 2024; Rashid et al., 2025; Zeng et al., 2026b; Shi et al., 2026). Repository generation tasks such as NL2Repo-Bench give a requirements document for the agent to implement (Ding et al., 2025). In both settings, the agent starts from a given codebase or a specified feature. A software engineer building a program from scratch instead keeps asking what is required and how the system should be designed.

To explore this from-scratch setting, program reproduction tasks such as ProgramBench ask an agent to rebuild a program's observable behavior from its usage documentation and a reference program without access to the source code or network (Yang et al., 2026b; Adamczewski et al., 2026). The agent needs to still discover remaining behavior by exploration and design the implementation from scratch. None of the models in the original ProgramBench evaluation fully solved a task (Yang et al., 2026b) 1^{1}. Training therefore requires interactive environments with reliable behavioral supervision, which issue-resolution resources such as SWE-Gym and SWE-smith do not provide (Pan et al., 2024; Yang et al., 2026a; Song et al., 2026; Chen et al., 2026a). MindForge (Chen et al., 2026b) is restricted to command-line programs and still leaves this supervision unverifiable. Building verifiable environments and using them over long horizons raises two challenges. (i) Scaling verifiable training environments. Building the reference executable and runtime sandbox requires accommodating repository-specific toolchains and dependencies. The black-box tests need to cover diverse functionality while rejecting incorrect reproductions, yet a single test-generation attempt may miss important behaviors or produce weak assertions. (ii) Sustaining long-horizon development. General-purpose agent harnesses support tool use but do not by themselves keep exploration and implementation coordinated. An agent can begin implementing before sufficiently exploring the reference program and forget previously observed requirements as its context grows. Addressing these risks requires an explicit development workflow that preserves behavioral evidence and coordinates implementation, review, and revision.

To overcome these challenges, we introduce ProgramGym consisting of Program-Env and Program-Agent for scalable training environments of long-horizon program reproduction agents. Specifically, Program-Env addresses environment construction by augmenting an existing agent harness with feedback-driven loops for runtime sandbox and black-box test construction. To produce the reference executable and its runtime sandbox, it separates online dependency preparation from offline compilation and returns build diagnostics to guide repairs. Test construction proceeds across functional modules in parallel, using program analysis to target unexplored behavior and validation feedback. The resulting environments provide reference executables, runtime sandboxes, documentation, and black-box behavioral test suites for training supervision. Program-Agent addresses long-horizon development through a role-isolated iterative workflow of analysis, implementation, and review. It first records evidence from reference-program exploration and then alternates implementation with behavioral review in separate sessions. Persistent records carry requirements across rounds, while offline build checks and validated checkpoints support revision and failure recovery.

Building on these designs, Program-Env scales 1,648 training environments covering C, C++, Go, and Rust. Each environment provides a reference executable, a runtime sandbox, usage documentation, and black-box tests, which are essential for training agents on program reproduction from scratch. We conduct extensive experiments on ProgramBench. With Program-Agent, Qwen3.8-27B reaches 55.71% Tests Passed and Qwen3.8-27B-SFT reaches 56.25%, both exceeding flagship Claude Opus 4.7. We further evaluate DeepSeek-V4-Flash-0731 under the same protocol. These results suggest that ProgramGym can scale training environments for coding agents that reproduce programs from scratch as software engineers do. We will release ProgramGym as a scalable gym for the community to develop coding agents that discover requirements and design systems from scratch. In summary, our main contributions are threefold:

• We propose Program-Env, a feedback-driven pipeline that builds the reference executable and runtime sandbox and constructs black-box tests from repositories (Section 4).

1^{1}Release-time results; later performance of the flagship models are at https://programbench.com.

• We propose Program-Agent, which combines a role-isolated workflow of analysis, implementation, and review with revision management for compilation checks and failure recovery (Section 5).

• We conduct extensive experiments on ProgramBench and show that Program-Env training and Program-Agent both improve program reproduction. We further analyze environment construction as well as iteration budget and agent behavior (Section 6).

References (33)