Long-Horizon Coding Agent Evaluation: Understanding Terminal Benchmarks and Long-Run Code Tests

    As coding agents move from one-shot code generation to autonomous, multi-file work inside real repositories, evaluation must also shift. This article explains the transition from measuring code snippets to measuring whether tasks are actually completed, compares terminal-style benchmarks with long-run code tests, and highlights what their scores do and do not reveal. It also provides practical guidance for interpreting evaluation results, avoiding common pitfalls, and building a reproducible, regression-friendly evaluation loop for development teams.

    1. The focus of coding agent evaluation is shifting

    Evaluating code-generation ability has traditionally relied on single-turn accuracy over static datasets: a model generates a code snippet from a natural-language requirement or function signature, and the result is compared with a reference implementation or executed against predefined tests. These metrics are simple and reproducible at scale, but they only capture the probability of producing a correct snippet.

    Long-horizon coding agents, by contrast, must handle tasks that span multiple files and extended execution periods inside real code repositories. They need to read code autonomously, locate problems, modify files, execute commands, run tests, and iterate based on results until the task is completed or deemed failed. The evaluation unit therefore shifts from “a code snippet” to “whether the task is genuinely completed.”

    This shift introduces complexity across four dimensions:

    • State maintenance: Agents must preserve the task goal and intermediate state across multiple rounds of tool calls.
    • Error accumulation: If each step is correct with 99% probability, the probability that 100 consecutive steps are all correct is only about 37%.
    • Environment interaction: Real-world engineering issues such as dependency conflicts, path differences, and test failures must be handled correctly.
    • Execution safety: Granting an agent command execution permissions in a real terminal also means it may trigger destructive operations.

    For these reasons, terminal-style benchmarks and long-run code tests have become two important evaluation approaches for assessing the engineering capabilities of coding agents.

    2. Terminal-style benchmarks: Testing coding agents in real but constrained environments

    The core design of terminal-style benchmarks is to place agents in real, isolated, resource-constrained terminal environments, where they complete tasks through file reading/writing, command execution, and tool calls. Success or failure is then determined by independent verification. Taking a representative terminal-style coding benchmark as an example, its version has already reached 4.0 and continues to evolve. Its design highlights include four aspects:

    1. Realistic environments: Agents face real file systems, dependency management, and build tools rather than simplified code snippets. Only when code actually runs can issues such as environment configuration, dependency conflicts, and test-order dependencies be exposed.
    2. Resource constraints: Evaluations typically impose limits on CPU, memory, disk, and execution time for each task, and restrict network access. This helps ensure reproducibility and approximates real continuous-integration conditions, preventing agents from succeeding through brute-force repetition.
    3. Task-specific tests: Each task is equipped with independent verification tests to determine whether the final state meets expectations, rather than relying only on what the agent says. In most cases, the task is considered complete only when all tests pass.
    4. Comparability: Published comparative results should be interpreted together with task difficulty distribution, version differences, and evaluation conditions.

    Scores on terminal-style benchmarks are generally used to measure an agent’s overall ability to complete complex coding tasks. Around the same period, differences between models may be quite small: two mainstream models may differ by less than one percentage point and may win and lose against each other, indicating that a single score is insufficient to characterize a model’s full capabilities.

    3. Long-run code tests: Examining sustained planning and self-correction

    If terminal-style benchmarks focus on “getting the task right in a real environment,” long-run code tests extend the time dimension further, assessing whether agents can remain goal-aligned over large, multi-step tasks, continue making progress, and correct themselves.

    In one evaluation system, for example, the upgraded version of the long-run code test scored 61.2%, compared with 55.95% in the previous generation, an increase of 5.25 percentage points. This increase is larger than the less-than-one-percentage-point gap among leading models in terminal-style benchmarks during the same period, which suggests two implications:

    • Sustained capability has clear room for improvement: At similar single-point capability levels, long-run performance is an important dimension for differentiating models.
    • Long-run tests are more sensitive to version iterations: Improvements in single-step capability may be amplified or gradually offset when chained across multiple steps, so long-run scores can more sensitively reflect capability changes.

    Long-horizon capability degradation usually comes from four types of problems:

    • Context expansion: As rounds increase, context can be filled with tool outputs, error stack traces, and intermediate files, causing key constraints to be diluted.
    • Planning drift: Agents gradually deviate from the original goal or fail to judge current progress without external feedback.
    • Insufficient error recovery: A failed tool call may cause an agent to fall into ineffective retries instead of returning to the root cause.
    • Consistency breakdown: When making changes across files or sessions, agents may miss related modifications, leading to inconsistent coding style or interface contracts.

    Common industry approaches to improvement mainly focus on four areas: more structured task decomposition and plan management, rolling compression or summarization-based context management, explicit verification loops such as test-driven workflows and self-review, and iterative optimization based on result feedback.

    4. Differences and complementarity between terminal benchmarks and long-run tests

    The two approaches observe different dimensions and are complementary:

    Dimension Terminal-style benchmarks Long-run code tests
    Core focus Task completion ability in a real environment Planning, error correction, and consistency over long periods
    Typical task form Relatively clear single tasks whose final state can be verified by task-specific tests Large-scale, multi-step tasks spanning files or sessions
    Pressure on context management Relatively limited Significant and cumulative as rounds increase
    Sensitivity to recovery from a single error Moderate High, because errors can propagate along the step chain
    Main value Horizontal measurement of overall engineering capability Vertical observation of version iteration and capability degradation

    It should be noted that the above comparison is a general summary of the two evaluation types and does not represent the complete design of any specific benchmark.

    5. How to correctly interpret evaluation scores

    1. Understand the evaluation conditions: Benchmark version, task set, runtime environment, and prompt strategies can all affect results. Cross-source data without aligned conditions should only be treated as directional reference.
    2. Pay attention to the magnitude of differences: Leading models may differ by less than one percentage point on terminal-style benchmarks, which may be smaller than run-to-run variance. A single ranking is not enough to prove superiority.
    3. Watch out for data contamination: If evaluation tasks or their reference implementations have appeared in training corpora, scores may be inflated. It is advisable to keep evaluation sets private and rotate them regularly.
    4. Long-run trends are more informative than single-point scores: Changes in long-run scores often reflect real capability evolution more effectively.
    5. Scores do not equal production readiness: For vendor or model selection, enterprises should also conduct scenario-based validation using their own business codebases, coding standards, and domain knowledge.

    6. Building a sustainable coding agent evaluation system

    For teams preparing to introduce coding agents into development workflows, rather than chasing leaderboard rankings, it is better to build their own evaluation loop:

    1. Task stratification: Organize tasks by categories such as single-file fixes, cross-module refactoring, new feature development, defect localization, and operations troubleshooting, covering different complexity levels.
    2. Environment isolation: Prepare fixed-version repository snapshots and container images for each task, with unified resource quotas and timeout policies.
    3. Independent verification: Verification tests should be invisible to and unmodifiable by the agent, and the judgment criteria should be decoupled from the implementation code.
    4. Attributable failures: Record tool calls, command outputs, and elapsed time for each step, and establish failure categories such as “environment configuration failure,” “incorrect localization,” “ineffective fix,” and “verification failure.”
    5. Multiple sampling runs: Run the same task multiple times, report averages and variance ranges, and avoid drawing conclusions from a single run.
    6. Continuous regression: Automatically rerun tasks when task or model versions change, forming traceable version comparisons.

    The following pseudocode shows the basic structure of an evaluation execution framework:

    1. def evaluate(agent_factory, tasks, repeats=3, config=None):
    2. report = []
    3. for task in tasks:
    4. for _ in range(repeats):
    5. env = Sandbox(image=task.image,
    6. cpu=config.cpu, memory=config.memory,
    7. timeout=config.timeout, network="restricted")
    8. agent = agent_factory(tools=task.allowed_tools, max_steps=config.max_steps)
    9. agent.run(task.instruction, workspace=env.workspace)
    10. # Verification scripts are invisible to the agent and can only be invoked by the evaluation framework
    11. result = task.verifier.run(env)
    12. report.append({
    13. "task": task.id,
    14. "passed": result.all_passed,
    15. "steps": agent.step_count,
    16. "elapsed": env.elapsed_seconds,
    17. "failure_type": classify_failure(result, agent.trace),
    18. })
    19. env.destroy() # Destroy or roll back the snapshot immediately after the task to ensure isolation
    20. return aggregate(report)

    Several key design points are worth noting:

    • Isolation and resource constraints: Sandbox handles environment isolation and resource quotas, while destroy() ensures tasks do not affect one another.
    • Decoupling of verification and implementation: task.verifier is invisible to the agent, so judgment criteria cannot be tailored to or gamed by the agent.
    • Repeated sampling: The repeats parameter is used to quantify result variability.
    • Attributable metrics: In addition to pass/fail, the framework records steps, elapsed time, and failure types, making it easier to identify bottlenecks.

    At the platform level, teams can use general-purpose cloud capabilities to build evaluation infrastructure, including:

    • Container platforms: batch create and recycle isolated sandboxes;
    • Object storage: store repository snapshots and image artifacts;
    • Message queues: asynchronously distribute evaluation tasks and collect results;
    • Logging services: centrally search execution traces and error information;
    • Monitoring and alerting: build dashboards and threshold alerts for core metrics such as pass rate and average duration.

    Cloud providers such as Baidu AI Cloud offer these general-purpose cloud product categories, and teams can use them to build elastic and reproducible evaluation environments.

    7. Common pitfalls and how to avoid them

    • Score-only thinking: Focusing only on total scores while ignoring task difficulty distribution and runtime variance.
    • Ignoring evaluation conditions: Directly comparing results across different versions and tool configurations.
    • Over-reliance on a single evaluation set: Over-optimizing for a fixed evaluation set can lead to “leaderboard chasing” rather than real capability improvement.
    • Neglecting long-run performance: Good performance on short tasks does not imply reliability on long tasks.

    8. Conclusion

    Competition in coding agents has shifted from “whether they can write correct code” to “whether they can continuously complete tasks correctly in real environments.” Terminal-style benchmarks assess comprehensive engineering capabilities in real constrained environments, while long-run code tests examine cross-step planning and error-correction abilities. Together, they form important perspectives for understanding coding agent capabilities. For development teams, rather than obsessing over rankings that differ by fractions of a percentage point, it is more valuable to build a layered, reproducible, continuously regressed evaluation system based on their own business needs, so that evaluation results truly support technology selection and engineering adoption.