When Requirements Interact: Scaling Long-Horizon Coding via Interdependent Specifications

Yishuo Cai, Minzheng Wang, Liang Zhao, Linghao Zhang, Lei Li, Shicheng Li, Xu Sun, Fuli LuoarXiv 2026 · arXiv

In real-world software engineering, a single feature request rarely exists in a vacuum. Implementing a new API endpoint often requires simultaneous attention to error handling, state consistency, and backward compatibility. If a coding agent treats these as a simple checklist, it often breaks one requirement while trying to satisfy another.

A new paper from researchers at Xiaomi, Peking University, and the University of Hong Kong introduces CodeSpecWeave, a framework designed to move beyond "checklist coding" toward "joint reasoning" over interdependent specifications.

TL;DR

CodeSpecWeave is a framework that synthesizes complex coding tasks where multiple requirements are intentionally coupled, forcing AI agents to reason across constraints simultaneously. By training on 4,670 of these "interdependent" tasks, the authors achieved significant performance gains on long-horizon coding benchmarks like DeepSWE-v1.1, outperforming existing baselines.

What Problem Does This Paper Address?

Current coding agent benchmarks often suffer from "specification poverty." They typically focus on a primary goal (e.g., "fix this bug") while ignoring the subtle engineering constraints that make real-world development hard.

The authors identify two main gaps in existing datasets:

  1. Low Density and Diversity: Most tasks contain only 1–2 independent rules.
  2. Lack of Interdependency: In real repos, a choice made to satisfy one requirement (like performance) often restricts the options for another (like thread safety).

When agents are trained on simple, additive tasks, they fail to develop the "holistic exploration" needed for complex software architectures. Furthermore, verifying these complex interactions is notoriously difficult; tests often suffer from false positives (accepting buggy code) or false negatives (rejecting valid alternative implementations).

Comparison of task specifications across datasets. CodeSpecWeave features significantly higher density and more interdependent "coupled" requirements.

Methods

The CodeSpecWeave pipeline consists of two core stages: Task Synthesis and Validation & Repair.

  1. Synthesis: Instead of generating tasks from scratch, the system uses "specification seeds" mined from real-world commits, PRs, and issues. A Synthesis Agent explores a repository and anchors multiple complementary requirements to the same core components or state transitions. This ensures that satisfying one requirement inherently constrains the others.
  2. Validation & Repair: To ensure the generated tests are reliable, a Review Agent audits the solution trajectories of multiple models. If a model passes the tests but violates the requirements (False Positive), or if a valid solution is rejected (False Negative), the Review Agent identifies the misalignment, and a Repair Agent fixes the task or verifier.
Overview of the CodeSpecWeave framework, showing the iterative loop between synthesis, solver trials, and the review/repair process.

Datasets

The authors produced two major resources:

  • Training Set: 4,670 tasks across 2,865 repositories, used for Reinforcement Learning (RL).
  • CodeSpecWeave-Bench: A rigorous evaluation benchmark of 100 manually reviewed tasks containing 1,044 individual specifications.

Compared to existing datasets like SWE-bench or R2E-Gym, CodeSpecWeave-Bench has a much higher mean of 10.44 specifications per task, spanning categories like functional semantics, state effects, and error recovery.

Distribution of the 1,044 specifications in the benchmark across different behavioral categories.

Key Insights and Ideas

  • The "Checklist" Trap: The authors found that if specifications are merely additive, models can solve them greedily. True difficulty arises when specifications are interdependent, breaking the ability to decouple local edits.
  • Test Generation is Hard: In their pilot study, 73.9% of candidate tasks had alignment issues between the requirements and the tests. This highlights why simple "LLM-generated" benchmarks are often unreliable without a trajectory-based review loop.
  • Divergent Adaptation: When trained on these complex tasks, different models developed different "survival" strategies. MiMo-V2.5 scaled its single-turn effort (more "thinking" tokens), while MiMo-V2.6-Flash-SFT nearly doubled its number of agent turns to interact more with the environment.

Key Results

Training on CodeSpecWeave led to substantial improvements across the board:

  • DeepSWE-v1.1: Performance jumped from 12.39% to 25.30% for the MiMo-V2.5 model.
  • Benchmark Separation: CodeSpecWeave-Bench clearly separates frontier models. GPT-6 Astra achieved the highest pass rate (74.0%) with the lowest mean output length, suggesting that superior reasoning leads to more concise, correct solutions rather than "trial-and-error" bloat.
  • Behavioral Shift: RL-trained models became more diligent, showing a 3x to 4.8x increase in "thinking" tokens and a significant increase in the number of edit-test loops per trajectory.
Pass rates on CodeSpecWeave-Bench. Even the strongest models still have significant headroom, failing on roughly 26% of tasks.

Limitations and Future Work

The authors acknowledge three main hurdles:

  1. Computational Cost: Improving models via RL on these tasks requires massive compute resources.
  2. Infrastructure Complexity: Each task requires a specific containerized environment (Kubernetes pods), making the evaluation harness heavy.
  3. Model Dependency: The quality of the synthetic tasks depends on having strong "teacher" models for the synthesis and review agents.

Future work may involve expanding the variety of programming languages and exploring how these interdependent constraints can be used to improve the interpretability of agent reasoning chains.

Summary updated

Abstract

To succeed in real-world long-horizon software development, coding agents must satisfy multi-dimensional task specifications, such as interface compatibility and error handling, and do so without breaking existing dependencies. However, current works lack specification in both quantity and diversity, often emphasizing primary goals while ignoring complex constraints. Synthesizing tasks to bridge this gap presents two challenges: naively adding specifications risks reducing tasks to trivial checklists rather than compelling joint reasoning, and verifying these subtle interactions risks overlooking hidden flaws or rejecting valid alternatives. To address these challenges, we introduce CodeSpecWeave, a framework for synthesizing tasks with rich, interdependent specifications. Grounded in real developer seeds, a synthesis agent iteratively develops both coupled task requirements and executable tests, while a review agent audits solution trajectories from multiple models to guarantee test reliability. Using this pipeline, we construct 4,670 training tasks across 2,865 repositories. Applying Reinforcement learning on these tasks significantly improves performance over the base model on DeepSWE-v1.1, largely outperforming existing baselines. Furthermore, we curate CodeSpecWeave-Bench, a rigorous benchmark comprising 100 tasks and 1,044 specifications, which clearly separates frontier models and reveals significant headroom in handling interdependent engineering constraints.
BibTeX
@misc{cai2026when,
  author = {Yishuo Cai and Minzheng Wang and Liang Zhao and Linghao Zhang and Lei Li and Shicheng Li and Xu Sun and Fuli Luo},
  title = {{When Requirements Interact: Scaling Long-Horizon Coding via Interdependent Specifications}},
  year = {2026},
  eprint = {2610.40256},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.40256},
}
Figure