Evaluating Long-Horizon Coding Agents: Benchmarks vs. Real-World Deployment Boundaries
Benchmark scores alone are a poor proxy for the delivery capability of code-focused AI agents. This article introduces a product-agnostic, dual-track evaluation method for long-horizon coding: extending an existing codebase under security constraints, and building a complete application from scratch using only learning material and a requirements brief. It explains why post-training scaling—rather than swapping the base model—drives recent gains, and shares findings from two hands-on tests covering permission isolation, state management, and convergence. Readers will find a reusable four-layer evaluation framework and a practical human-AI division of labor for production use.
1. Why Benchmark Scores Don’t Reflect Real Coding Agent Capability
When evaluating a new generation of code-focused large models, the easiest mistake is treating public benchmark scores as equivalent to delivery capability. Benchmark problems are typically closed-ended tasks with clear boundaries, controlled dependencies, and a single acceptance criterion. Real engineering environments are the opposite: requirements carry implicit assumptions, codebases carry historical baggage, and permission and security constraints are often scattered across documentation, comments, and existing implementations as implicit rules.
A more meaningful evaluation is therefore long-horizon task testing. “Long-horizon” means the task requires the model to stay aligned with the goal across dozens of interaction turns, spanning multiple directory layers and technical roles (API contracts, data layer, task state, server endpoints, background task executors, frontend UI, and rendering), and ultimately advancing the output to a “runnable and testable” state. This bar is far stricter than “can write a correct function,” and much closer to enterprise requirements.
This article abstracts a product-agnostic, dual-track evaluation method. One track measures incremental capability expansion in an existing project with legacy code and security constraints. The other provides only a piece of learning material and a requirements document, requiring the agent to build an application from scratch that can be fully completed end to end. The former tests understanding of legacy systems and constraint adherence; the latter tests the full path from material analysis to product delivery.
2. Where the Capability Upgrade Comes From: Post-Training Scaling, Not a Base Model Swap
One common upgrade path keeps the base model size unchanged and concentrates resources in the post-training stage. The approach scales the agent training environment by one to two orders of magnitude, covers more diverse environment types, and extends training duration, so the model receives denser feedback in the loop of “read code → modify code → run commands → inspect errors → correct.”
This path improves capability in three directions:
- Code and engineering: emphasis on long-horizon tasks and production-grade software engineering rather than isolated algorithm puzzles;
- Security: extending from functional code generation to white-box code review and vulnerability reasoning, approaching frontier closed-source levels on basic security tasks, while still lagging in complete exploit-chain scenarios;
- Open strategy: full weights are typically released after security evaluation and model hardening, making self-deployment, verification, and further improvement easier.
This distinction matters: post-training scaling mainly improves the ability to “keep working without drifting off course,” not the filling of domain knowledge gaps. Knowledge such as permission models, audit compliance, and business semantics still requires external constraints as a safety net.
3. Test Design: Two Very Different Tasks
Task 1 (incremental development in an existing system): In a project with substantial legacy code, add the capability for “secure import of user image assets that can be referenced in animation scenarios.” The difficulty is not writing the feature, but identifying the existing authentication chain, storage abstractions, and validation conventions, and embedding a new security boundary without breaking old behavior.
Task 2 (build from scratch): Given only a piece of agent learning material and a requirements document, implement a knowledge-learning game that can genuinely be completed. The difficulty lies in structuring the material, splitting knowledge points into verifiable levels, designing the state machine and save system, and ensuring the “completion” acceptance condition is truly reachable.
The two tasks are complementary: one tests restraint under constraints, the other tests planning and convergence under open conditions.
4. Existing-Project Test: Passing Functionality Is Not Passing Acceptance
In Task 1, the model met the “long-horizon usable” expectation: it located relevant modules, filled in contracts, data structures, and endpoints according to the existing layering, made consistent changes across multiple layers, and ultimately produced a service that starts, a page that works, and assets that upload and can be referenced in scenarios.
Manual acceptance, however, exposed a high-priority issue: permission isolation did not hold. Asset objects lacked ownership checks on the read path, allowing other users within the same tenant to access someone else’s assets by constructing identifiers. The typical signature of this defect is that functional tests are all green, because tests only verify “my user can access my resources,” while the attack surface is “another identity accessing my resources.”
A minimal ownership-check example below shows the defense belongs on the server, not the frontend:
// Bad: only checks login state, not resource ownershippublic AssetView get(Long assetId, User caller) {requireLogin(caller);return assetRepo.findById(assetId); // broken access control risk}// Good: enforce ownership and visibility on the serverpublic AssetView get(Long assetId, User caller) {Asset a = assetRepo.findById(assetId);if (a == null) throw new NotFound();if (!a.ownerId().equals(caller.id()) && !a.isSharedWith(caller.id())) {throw new Forbidden(); // uniform error semantics to prevent enumeration probing}return AssetView.of(a);}
The conclusion is clear: the model can complete the implementation, but security invariants must be explicitly declared and verified one by one by humans. A practical approach is to write invariants as a checklist, for example: “any endpoint that reads by identifier must perform an ownership check,” “uploaded content requires both type and content validation,” and “error responses must not reveal whether a resource exists.”
5. Build-from-Scratch Test: Long-Horizon Planning and Convergence Quality
In Task 2, the model first performed structured extraction of the material, organizing knowledge points into decidable level objectives, then designed the level state machine, progress saving, and judgment logic, and finally completed the UI and the completion flow. Throughout the process, there was no goal drift; the model self-corrected based on runtime feedback, and the “completion” path was genuinely traversable rather than merely having a complete UI.
Key evaluation dimensions for such tasks include: whether requirement ambiguity is proactively clarified, whether task decomposition granularity is reasonable, whether irrelevant complexity is introduced too early, and whether the model can converge to a verifiable state within a limited number of turns. Testing shows the strength of long-horizon coding is precisely “continuously advancing cross-module changes and converging,” while product trade-offs still require human judgment.
6. A Reusable Evaluation Framework
Break the evaluation into four layers, with a gate at each layer:
- Environment layer: can it understand the directory structure, existing conventions, and dependencies;
- Change layer: are cross-module changes self-consistent, with interfaces and data structures evolving in sync;
- Verification layer: can it run, test, and iterate based on errors on its own;
- Delivery layer: do security, permissions, auditing, and final acceptance meet the bar.
For supporting engineering practices, a container platform can provide a consistent runtime environment, object storage can hold uploaded assets with content validation, and logging services with monitoring alerts can accumulate runtime evidence, turning “testable” from a verbal promise into an observable fact.
7. Conclusion and Division-of-Labor Recommendation
Overall, this kind of long-horizon coding capability is worth trialing in real projects, especially for cross-module, long-chain engineering tasks; but at the permission isolation, security audit, and final acceptance stages, humans cannot step back. The recommended division of labor is: the model handles implementation and iteration, while humans define invariants, review attack surfaces, and sign off on delivery. To further reduce risk, the capability can be integrated into general engineering pipelines related to Baidu AI Cloud, using standardized storage, logging, and monitoring components to solidify acceptance evidence.
