Evaluating Long-Horizon Code Agents: Capability Boundaries and Acceptance Practices
Long-horizon code agents are increasingly capable of handling real-world engineering tasks, but benchmark scores alone do not tell the full story. This article examines how to evaluate such agents through dual-task testing that covers both legacy system security hardening and greenfield product development. It discusses why long-horizon post-training matters more than base model size, where permission isolation gaps tend to appear, why "all tests green" does not equal "safe to ship," and how human reviewers should define security boundaries and acceptance criteria. The key takeaway: agents can accelerate feature delivery, but humans must retain responsibility for security review and final release decisions.
Why Benchmark Scores Are Not Enough for Long-Horizon Code Agents
Discussions about code agent capabilities often devolve into benchmark comparisons—terminal operation scores, software engineering benchmark rankings, tool-calling evaluation results. These metrics have value, but they answer a narrow question: “Can the agent solve a well-defined problem under controlled conditions?” They do not answer the more important question: “Can the agent safely deliver work in a real project?”
Real engineering tasks have three characteristics that benchmarks typically fail to capture. First, the context is long and messy—legacy code, implicit conventions, and temporary compatibility logic all coexist. Second, constraints are numerous and strict—permissions, tenant isolation, security auditing, and rollback strategies often matter more than feature functionality itself. Third, the acceptance criteria are not “the code runs” but “the code is runnable, testable, auditable, and rollback-capable.”
Evaluating a long-horizon code agent therefore requires shifting attention from single-point generation ability to long-task performance: Can it read and understand complex context? Can it drive multi-module changes to completion? Can it bring a task to a runnable, testable state? Can it stay within security boundaries?
A representative dual-task evaluation produced a revealing outcome. One class of long-horizon code agents successfully worked continuously within a single-repository, multi-package codebase, completing cross-frontend and cross-backend changes involving data and task state. The same agent also built a complete knowledge-learning game from scratch, covering the full chain from information analysis to product delivery. However, when working on a legacy project with historical code and security constraints, the agent did get the feature working—yet manual review exposed a high-priority permission isolation flaw. The capability ceiling is rising, but “all tests green” still does not justify shipping without human review.
Why Long-Horizon Post-Training Matters More Than Base Model Upgrades
There are generally two upgrade paths for agent systems: switching to a larger base model, or extending post-training while keeping the base model unchanged. The latter is often underestimated. For code agents, what determines real-project performance is frequently not parameter count, but whether the training environment covers long-horizon tasks, cross-module changes, tool-call failure recovery, test feedback loops, and security constraints.
When the post-training phase expands the long-horizon task environment—say, by several times—and increases environment diversity and training duration, the model is more likely to learn how to maintain state across long tasks. It learns a practical sequence: locate the entry point, trace the call chain, modify data contracts, fill in interfaces, run tests, and fix regressions. This capability is hard to observe in single-file tasks, but it becomes critical when modifying an aging system. The hard part is not “writing a function.” It is knowing who calls this function, which tenants are affected by a change, and which layer performs permission checks.
Three directions summarize the engineering-level improvement:
- Code capability advances from snippet generation to production-grade software engineering, emphasizing long-task progression and testable delivery.
- Security capability extends from generating code to white-box review and vulnerability reasoning. The agent can identify certain permission and input-validation issues, but complete exploit chains still require human judgment.
- Deployment and verification capability means the full model weights are made available after security evaluation and hardening, allowing developers to self-host, verify, and continue improving.
For adopters, this implies the agent can be placed into real projects for controlled evaluation—but it cannot be treated as the final security authority.
Dual-Task Design: Security Hardening of a Legacy System Plus Greenfield Product Delivery
To assess long-horizon coding capability, task design must create meaningful differentiation. A single task allows the model to pass through pattern matching. Dual tasks more effectively expose boundary conditions.
Task 1: Secure media import in a legacy system. The agent must add a “secure user image material import with HTML animation scene referencing” capability to a project with substantial historical code. This tests three things: understanding legacy system boundaries, handling security constraints, and ensuring the new feature does not break the existing permission model.
Task 2: Greenfield product with PRD only. The agent receives learning materials and a PRD, and must build a playable Agent knowledge-learning game from scratch. This tests information analysis, product decomposition, state machine design, level progression closure, and testability.
One task is about modification; the other is about creation. One centers on security constraints; the other centers on product completeness. Together, they reveal whether the agent merely patches code or can bring a task to delivery status.
Legacy System Hardening: Permission Isolation Is the Easiest Hard Constraint to Miss
Adding a material import capability to a legacy system sounds like three steps—upload a file, return a URL, reference it on a page. In reality, it involves tenants, users, roles, resource visibility, object storage keys, presigned URL expiration, content validation, and audit logs. A common failure pattern: the agent gets the feature pipeline working but encodes the permission boundary as “trust the frontend.”
Security Boundaries for Material Import
A secure material import flow must satisfy at minimum:
- Identity and tenant must be derived from the server-side session, never from request body fields.
- Write permissions are checked against the least-privilege role.
- Object keys include a tenant prefix and are unpredictable.
- File size, type, content sniffing, and malware scanning are all enforced.
- Presigned URLs expire quickly and are bound to the specific operation.
- Metadata records the owner, tenant, source, and audit information.
If the implementation only checks file extensions, an attacker can bypass it via forged MIME types or double extensions.
Pseudo-code example:
function authorizeMaterialImport(ctx, file):require ctx.tenantId and ctx.userIdrequire ctx.roles contains "material:write"require file.size <= MAX_SIZErequire isAllowedDeclaredMime(file.mime)require sniffedMime(file.bytes) == file.mimescanMalware(file.bytes)key = tenantPrefix(ctx.tenantId) + hash(file.bytes)return {key: key,ownerTenant: ctx.tenantId,visibility: "private",audit: record(ctx.userId, "material.import", key)}
The point of this logic is not the code itself—it is that every check happens server-side. If the agent delegates tenant isolation to frontend parameters, it embeds a high-priority permission vulnerability.
Isolation Strategy for HTML Animation Scene Referencing
HTML animation scene references are riskier than ordinary images because HTML can carry scripts, external resources, and message communication. A security policy should include:
- Rendering in a sandboxed container to restrict script capabilities.
- Content Security Policy (CSP) restricting resource origins.
- Only allowing controlled resource URLs.
- Validating postMessage origin and message structure.
- Prohibiting top-level navigation and sensitive API access.
- Providing a static fallback cover for degraded scenarios.
If user-supplied HTML is injected directly into the main document, the attacker effectively receives the main site’s privileges.
Pseudo-code example:
policy = {sandbox: "allow-scripts",csp: "default-src 'none'; img-src 'self'; style-src 'unsafe-inline'",trustedMessageOrigin: TRUSTED_ORIGIN,allowTopNavigation: false}
In a Baidu AI Cloud environment, object storage, log services, and monitoring/alerting can serve as the underlying infrastructure for assets, audit records, and anomaly metrics. Regardless of infrastructure choices, permission decisions must be made in the business service layer.
Greenfield Product Delivery: Material Analysis, PRD Decomposition, and a Passable Game Loop
Building a learning game from scratch is hard not because of the frontend, but because the game must actually be completable. The agent needs to extract a knowledge graph from source materials, decompose the PRD into level state machines, question generation logic, correctness rules, progress persistence, and completion conditions. A runnable version requires at minimum: a level data model, answer or interaction judgment, failure retry, progress persistence, completion verification, and basic tests. A static page does not count as product delivery.
The strength of a long-horizon agent is visible here: it maintains task state across a long span—building the data model first, then interaction, then tests, then fixing failures based on feedback. But a human must still verify whether the product loop is real: Is the completion condition achievable? Is error feedback understandable? Can state be recovered? Do tests cover edge cases?
Why “All Tests Green” Does Not Equal “Safe to Ship”
All tests passing only means the written tests pass. It does not mean the permission matrix is complete, tenant isolation is correct, exception paths are secure, or audit trails are traceable. Permission issues often surface not in the happy-path tests but in cross-cutting paths: “Can user A reference user B’s material?” “Can an expired presigned URL be replayed?” “Can the sandbox forge a message origin?”
Agents excel at writing feature tests and fixing regressions. They do not naturally take responsibility for security acceptance. The correct division of labor is:
- The agent handles: long-horizon task progression, cross-module changes, test generation, and regression fixes.
- The human handles: defining security boundaries, reviewing permission models, designing acceptance test cases, and making the final release decision.
Specifically for permissions, security, and final acceptance, human review remains mandatory.
Human-in-the-Loop Acceptance Checklist
At minimum, verify the following:
- Tenant and user identity are derived server-side.
- Role permissions follow least privilege.
- Object keys include tenant prefixes and are unpredictable.
- Upload types are validated with dual checks (declared MIME and content sniffing).
- Malicious content is scanned.
- Presigned URLs are short-lived and bound to specific operations.
- HTML is rendered in a sandbox.
- CSP restricts resource origins.
- Message origins are validated.
- Audit logs are complete.
- Failures degrade gracefully.
- The permission matrix includes negative test cases.
- Rollback is executable.
Conclusion
Long-horizon code agents have reached a point where they deserve evaluation in real projects. They can read complex context, sustain cross-module changes, and bring tasks to a runnable, testable state. But they have not yet reached the level where “all tests green” justifies shipping without review.
The more reliable evaluation method is dual-track: use a legacy system security hardening task to probe boundary handling, use a greenfield product task to probe completeness, and use manual acceptance to guard the bottom line of permissions and security. Features can be accelerated by agents; the responsibility for delivery remains with the human.
