Rust in Everything
← Papers

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

Yishuo Cai, Minzheng Wang, Liang Zhao, Linghao Zhang, Lei Li, Shicheng Li et al.

2026-11-02▲ 8arXiv 2610.40256v1Hugging Face

AI-generated from the full paper (deepseek-flash). It may contain mistakes; check the original.

TL;DR

CodeSpecWeave synthesizes coding tasks with interdependent specifications and reliable executable tests, producing 4,670 training tasks and a 100-task benchmark.

Problem

Coding agents must satisfy multi-dimensional specifications such as interface compatibility, state consistency, and error handling without breaking existing dependencies. Existing task data lack specification density and structural diversity, often emphasizing a primary goal while leaving other constraints unaddressed. Naively adding specifications can reduce tasks to checklists of independent edits, and verifying subtle interactions can miss hidden flaws or reject valid solutions.

Method

CodeSpecWeave mines specification seeds from open-source commit histories, issue discussions, and pull requests; normalized deduplication yields 104,182 candidate specification units across six natural languages. A synthesis agent explores the repository and jointly drafts the task request, fine-grained specifications, and executable tests, anchoring requirements to shared state transitions or core components to create interdependence. The agent executes generated tests in the repository and refines them based on runtime feedback, with tests mapping flexibly to specifications. A review agent inspects patches and execution trajectories from multiple coding models to identify tests that accept incomplete implementations or reject valid alternatives. A repair agent then revises the task request or verifier, and repaired task-verifier pairs undergo execution checks, fresh solver trials, and alignment review before acceptance.

Results

  • The full pipeline produces a training set and a manually reviewed benchmark with many specifications per task. §2.4
  • Automated reviews found alignment flaws in a large majority of candidate tasks, with false positives more common than false negatives. §2.4
  • In one generation batch, difficulty filtering and review retained a small fraction of initial tasks. §2.4
  • CodeSpecWeave yields the highest average scores across two backbones and is especially strong on CodeSpecWeave-Bench and DeepSWE. §3.2.2
  • CodeSpecWeave improves Flash-SFT across specification-count groups and across the seven specification categories. §3.2.3
  • Training increases reasoning output, code changes, and edit-test loops on CodeSpecWeave-Bench. §3.2.2

Limitations

  • Using synthesized tasks to improve model performance through RL requires substantial computational resources for training experiments.
  • Each task has an associated container image and runs in a Kubernetes pod, so training and evaluation require infrastructure to manage many containers concurrently.
  • Producing high-quality tasks relies on strong models and multiple rounds of filtering, which discard a large fraction of generated candidates.

Key points

  • Interdependent specifications break additive factorization, so a choice made to satisfy one requirement constrains feasible options for another and forces joint reasoning. §2.2
  • A task is formulated as repository, natural-language request, specification set, and execution environment with a verifier; valid patches must satisfy all specifications. §2.1
  • Specification seeds are extracted from commit histories, issue discussions, and pull requests, then filtered and deduplicated into 104,182 candidate units across six natural languages. §2.3
  • The synthesis agent combines complementary requirements tied to the same state transitions or core components so that satisfying one requirement in isolation still violates the broader contract. §2.3
  • The review agent compares execution trajectories with test results to expose missing checks and tests that enforce unintended restrictions, using mixed solver success to keep challenging yet solvable tasks. §2.4
  • Failure analysis identifies patches that target a specification but still violate it, and patches that satisfy one requirement while violating another constraining the same state. §3.1.1
  • CodeSpecWeave-Bench contains 1,044 specifications organized into five primary categories and seven total categories, with functional semantics split into three subcategories. §C.1
  • Manual review examined task realism, requirement clarity and consistency, test coverage of stated requirements, verifier restrictions, implementation defects, environment issues, and flaky tests. §A.2

Mind map

CodeSpecWeave
Problem
Specs lack density and diversity
Naive specs become checklists
Verification misses flaws or rejects valid solutions
Synthesis
Mine developer specification seeds
Couple requirements to shared state
Draft query specs and tests together
Execute tests and refine
Validation
Multi-model solver trials
Review patches and trajectories
Repair false positives and negatives
Outputs
4,670 training tasks
2,865 repositories
CodeSpecWeave-Bench 100 tasks
1,044 specifications
Experiments
RL with GRPO
Average scores 50.15 and 67.60
CodeSpecWeave-Bench 52.00 and 70.67
DeepSWE 25.30 and 62.98
Limitations
RL needs substantial compute
Container infrastructure required
Filtering discards many candidates