Long-Horizon Coding with Large Models: Capability Boundaries and Delivery Acceptance
This article examines why long-horizon coding tasks have become a key benchmark for evaluating large language models, covering three core capabilities—understanding existing context, sustaining cross-module changes, and delivering runnable, testable results. It also explains why passing tests does not guarantee safe delivery, with practical guidance on permission isolation acceptance and secure file import practices in legacy system modernization.
1. Why Long-Horizon Coding Tasks Have Become the Benchmark
In the past, code generation was typically evaluated by asking a model to produce a single function or script and judging correctness with unit tests. These problems have short inputs and clear boundaries, which makes them useful for measuring basic syntax and algorithm skills, but they poorly reflect the real burden of engineering work.
Real development is long-horizon work. A single requirement may span data models, APIs, asynchronous tasks, frontend pages, and deployment configuration. Developers must first understand the conventions of an existing codebase, keep multiple modules consistent, and finally make the whole result compile, run, and pass tests. The longer the task chain, the more easily an early misjudgment propagates downstream. The evaluation focus should therefore shift from “can the model write a piece of code” to “can it complete a deliverable change.”
2. Three Capabilities That Matter in Long-Horizon Tasks
2.1 Understanding Existing Context
The difficulty of a legacy project usually lies not in syntax but in implicit conventions: naming habits, the meaning of error codes, state transition order, which fields may be null, and which directories are maintained by other teams. A model that only sees the current file tends to produce changes that are locally correct but globally conflicting.
Three observations help judge this capability: whether the model searches the relevant call chains before modifying code; whether it reuses existing utility functions and type definitions; and when a historical design conflicts with the requirement, whether it raises the issue explicitly instead of silently overwriting it.
2.2 Sustaining Cross-Module Changes
A typical sequence for cross-module changes is: agree on the data structure first, then persist it, implement the service and API layers, and finally wire up asynchronous processing and frontend display. Each step depends on the result of the previous one. The model’s value here lies in keeping the plan coherent and locating root causes when compilation errors or test failures occur, rather than repeatedly trying the same patch.
The following checklist can measure the quality of execution:
- Does each change have a clear scope, avoiding unrelated refactoring?
- After a failure, does the model record the cause and provide verification results?
- Are documentation and configuration updated in sync at the end?
2.3 Delivering to a Runnable, Testable State
There is still a gap between “code is written” and “ready to deliver.” Deliverable standards usually include: dependencies install successfully, the build passes, unit and integration tests pass, key paths can be exercised in a browser or command line, and logs can explain abnormal situations.
In long-horizon tasks, this step is the most easily underestimated. Passing all tests only shows that covered scenarios did not fail; it says nothing about whether uncovered scenarios are safe.
3. Passing Tests Does Not Mean Safe to Deliver
3.1 Blind Spots in Test Coverage
Automated tests are good at verifying functional paths, but poor at finding permission and boundary problems. For example, an API may function correctly and return the right structure, yet fail to verify resource ownership, allowing unauthorized access. Such problems typically do not cause functional tests to fail; they require dedicated security test cases and manual review.
Here is a common example of an unauthorized access risk:
# Risky: only checks login state, not resource ownershipdef get_asset(user_id, asset_id, db):return db.assets.find_one({"id": asset_id})# Fixed: ownership check added to the query conditiondef get_asset(user_id, asset_id, db):asset = db.assets.find_one({"id": asset_id, "owner_id": user_id})if asset is None:raise PermissionError("Resource does not exist or access is denied")return asset
Both implementations behave identically for normal users. The difference only appears when one user requests another user’s resource. This is exactly where manual acceptance review should focus.
3.2 Permission Isolation Needs Separate Acceptance
Permission isolation should be an independent acceptance item, not an accessory to functionality. During acceptance, prepare three types of users: the resource owner, a user in the same group without permission, and a completely unrelated user. For each type, verify all four operations: read, write, delete, and list.
4. Modernization Practice on a Legacy System
Take “secure user asset import with page animation references” as an example. This kind of requirement involves both file processing and content rendering, so security risks are concentrated.
4.1 Security Constraints for Asset Import
The import pipeline typically requires the following controls:
- Type validation: check both the file extension and the file header, rather than trusting only the client-declared type;
- Size limits: set upper limits at both the gateway and the server to prevent resource exhaustion;
- Storage isolation: partition paths by user or tenant, with filenames generated by the server instead of reusing user input;
- Path safety: reject inputs containing path separators or parent-directory markers;
- Access control: asset reads must also go through ownership checks; access should not be opened just because a URL is guessable.
Example code:
import osimport uuidALLOWED_TYPES = {"png": b"\x89PNG", "jpg": b"\xff\xd8\xff"}MAX_SIZE = 5 * 1024 * 1024 # 5 MBdef store_upload(data: bytes, declared_ext: str, user_id: str, base_dir: str) -> str:ext = declared_ext.lower()if ext not in ALLOWED_TYPES:raise ValueError("Unsupported file type")if len(data) > MAX_SIZE:raise ValueError("File too large")if not data.startswith(ALLOWED_TYPES[ext]):raise ValueError("File content does not match its declared type")user_dir = os.path.join(base_dir, user_id)os.makedirs(user_dir, exist_ok=True)filename = f"{uuid.uuid4().hex}.{ext}"path = os.path.join(user_dir, filename)with open(path, "wb") as f:f.write(data)return filename
The user_id in the example should come from the authenticated server-side context rather than from client-supplied input.
