Code That Works, Environments That Don't: Measuring Environment Reproducibility in AI-Generated Software
cs.SE, cs.AI
Submitted: 2026-09-30
Updated: 2026-09-30
Comments: 17 pages, 8 figures. Manuscript prepared for AAAI Journal, AI Magazine Special Issue
License: http://creativecommons.org/licenses/by/4.0/
The gist: Code generation has emerged as a central capability of large language models, with coding agents now able to produce functionally correct software projects from natural language prompts.
Abstract
Code generation has emerged as a central capability of large language models, with coding agents now able to produce functionally correct software projects from natural language prompts. However, functional correctness alone does not capture a critical dimension of generation quality: environment specification, defined as the accurate identification of the dependencies required to execute generated code, is equally critical. We develop an agent protocol for environment specification and introduce a three-layer framework comprising declared, runtime-installed, and necessary-and-sufficient dependencies to systematically assess coding agents for environment specification. Using this protocol, we evaluate the extent to which coding agents systematically misspecify software environment dependencies and how this misspecification varies across three agents, four languages, and fifty programming tasks. Our results show that current coding agents exhibit systematic generalization failures along this dimension, producing dependency specifications that are inconsistent, redundant, or incomplete in ways that functional tests do not detect. Across agents, dependency set agreement is as low as 7% for identical tasks, and newer agents show no meaningful improvement, suggesting the failure is not resolved by scale or recency. The largest divergence occurs between the declared and runtime dependency layers, implicating environment priors learned from the models' training distributions as the primary driver. Our findings establish environment specification as a distinct, measurable axis of code generation quality that current benchmarks do not capture, and motivate training objectives and evaluation protocols that jointly optimize for functional correctness and environmental portability.
Sources
- Gemini: A Family of Highly Capable Multimodal Models
- Evaluating Large Language Models Trained on Code
- A Survey on Large Language Models for Code Generation
- Large Language Models for Software Engineering: Survey and Open Problems
- Program Synthesis with Large Language Models
- StarCoder: may the source be with you!
- Code Llama: Open Foundation Models for Code
- Bugs in Large Language Models Generated Code: An Empirical Study
- An Empirical Study of the Non-determinism of ChatGPT in Code Generation
- Holistic Evaluation of Language Models
Related papers
- Falsification-Based Verification of LLM-Generated Optimization Models: Sound Test Batteries and Their Detection Limits
- GitSkills: A Dataset of Agent Skills on GitHub
- SABER: Benchmarking Operational Safety of LLM Coding Agents in Stateful Project Workspaces
- PackMonitor: Enabling Zero Package Hallucinations Through Decoding-Time Monitoring
- IntentCoding: Amplifying User Intent in Code Generation
- Incentives and Outcomes in Bug Bounties