Coding Agents With Long Context: Can They Do the Dirty Work?

    Hand a coding agent a bug ticket and it can often return a plausible-looking patch within minutes. That demo sets the wrong expectation: the tedious part comes after the patch, when the test suite fails. This article examines what million-token context windows and open weights actually change for coding agents, argues that the real dividing line is not patch speed but whether an agent can close the loop of diagnose, patch, verify, and converge without step-by-step guidance, walks through a typical agent solve loop, and offers four practical recommendations: build an evaluation set first, scope tasks tightly, keep a human in the loop, and break large work into atomic, independently verified tasks.

    From “Here Is a Ticket”: The Gap Between the Demo and the Job

    Hand a coding agent a bug ticket and it will often return a patch within a few minutes. Demos like this are striking, and they make it easy to conclude that the most tedious part of development has already been automated.

    The tedious part comes later. Once the patch is generated and the tests fail, the real work begins. Is a dependency missing from the environment? Is it an intermittent failure caused by concurrency or timing? Is an edge-case input simply not covered? Fix this spot or that one? Will the change introduce a regression? That cycle of run, fail, locate, and fix again is where most engineering time goes and where experience matters most.

    So the test of whether an agent can genuinely “do the dirty work” is not how fast it writes code, but whether it can complete the loop of find, change, verify, and converge without step-by-step human guidance. Two underlying capabilities make that more likely: million-token context windows and open weights.

    What Long Context Actually Changes

    Traditional code assistants are limited by their context window. They see the current file or a few snippets, and everything else, cross-file semantics, the call contracts between modules, the evolution of past commits, gets cut off. The longer the context, the less of that information is lost. When a model can take in the full directory tree, several related files, dependency declarations, and the test code in one pass, it can begin to understand relationships like “changing A affects B, and B is called by C.”

    Worth stressing: long context is not about stuffing in as much as possible. It delivers three concrete benefits:

    • Fewer semantic splits caused by retrieval chunking, so cross-file understanding stays consistent;
    • The agent can hold implementation and constraints in the same view, including interface contracts, coding standards, and existing tests;
    • It provides a state carrier for long-horizon tasks, so multi-turn iteration does not “forget” what it was doing.

    The value of open weights lies elsewhere: private deployment, data that never leaves your environment, fine-tuning on internal code style, and controllable inference cost. For enterprise R&D, code is a core asset, and whether the model can run in your own environment and follow internal conventions often matters more than a benchmark score.

    Why the Failing Test Is the Real Dividing Line

    Whether a patch passes on the first try depends on luck and on task difficulty. The more useful engineering question is: when the tests fail, can the agent diagnose itself and converge? Four capabilities have to work together.

    1. Real environment interaction. It must actually run the code, execute the tests, and read the logs rather than imagine what the result would be.
    2. Failure attribution. It has to separate symptom from root cause across a pile of errors and stack traces, instead of treating the headache.
    3. Long-horizon reasoning. The task goal must not drift; after several rounds of edits it still has to remember the original problem.
    4. Regression awareness. After every change it should re-run the full validation so that fixing one thing does not break three others.

    A typical agent solve loop can be sketched as follows:

    1. def agent_solve(issue, repo, max_iter=20):
    2. # 1. Build context: relevant files, dependencies, existing tests
    3. context = build_context(issue, repo)
    4. for step in range(max_iter):
    5. patch = model.generate_patch(context) # generate the change
    6. result = run_tests(patch) # real execution, not assumption
    7. if result.all_passed():
    8. return patch # converged, task done
    9. # 2. Feed the real failure information back into the context
    10. context = append_failure(context, result.logs)
    11. # 3. If there is no progress for a while, fall back: narrow the scope or hand it to a human
    12. return escalate_to_human(issue, context) # fallback

    The point of this snippet is not the implementation details but the loop of generate, execute, and feed back, plus an explicit fallback path. A “closed loop” without real execution is an illusion, and autonomy without a fallback will run off the rails on long tasks.

    Four Practices That Make Agents Actually Stick

    Build the evaluation set before talking about automation. Rather than agonizing over benchmark scores, turn past tickets into a batch of tasks with known answers. Each task should carry a problem description, the scope it touches, and an acceptance script that can be judged automatically. Wire it into continuous integration and every agent change gets scored objectively while regressions get blocked automatically. The evaluation set is the foundation for everything that follows.

    Give the task clear boundaries. “Help me optimize this module” is a vague instruction. “Fix the bug where this interface returns an error code for a specific input, without changing the public signature, and add the corresponding test case” is actionable. The clearer the boundary, the less the agent drifts, and the cheaper human review becomes.

    Keep a human in the loop. Let the agent take the repetitive dirty work, locating, trying fixes, and adding tests, but reserve architecture decisions, breaking changes, and security-sensitive changes for human confirmation. The right collaboration model: the agent proposes with evidence, and the human decides and signs off.

    Break work into atomic tasks. For a large request, first have the agent decompose it and order the dependencies, then solve and verify each atomic task independently, and finally merge and run the regression suite. Compared with asking it to “solve everything in one pass,” this orchestration is more stable and easier to control.

    Conclusion: Capability Is Growing, but Humans Still Guard the Boundary

    Long context and open weights really do move coding agents from “code completion tool” toward “can carry part of the engineering workload,” giving them a chance at the genuinely hard parts, tests and iteration. But the distance between “a patch in minutes” and “doing the dirty work independently” is not measured in model size. It is measured in a verifiable loop, clear task boundaries, and a reliable human-AI collaboration mechanism.

    The pragmatic view: position the agent as a tireless executor and hand it the repetitive, tedious, automatically verifiable work, while the responsibility for deciding what should be done and what must not be done stays with developers. Validate capability with an evaluation set first, constrain behavior with clear boundaries, and backstop the risk with human-AI collaboration. That is how you wire intelligent coding into a real production workflow.