A Practical Guide to Evaluating Open-Source Coding Agents: Long-Horizon Task Testing and Selection Methodology
This guide presents a four-dimension framework for evaluating coding agents beyond single-turn benchmark scores: code generation quality, long-horizon self-iteration, quota and cost efficiency, and engineering integration stress tests. It includes concrete sample tasks, scoring rubrics, logging fields, an A/B experiment procedure, compliance checks for self-hosting open-source models, and decision rules for migration—designed for individual developers and small teams who want selection conclusions grounded in their own task sets rather than public leaderboards.
1. Background and Evaluation Scope
In agentic scenarios, single-turn benchmark scores no longer tell you much about real productivity. A coding agent must stay aligned with the goal across multi-turn interactions, adjust its next action based on execution results, and complete the entire task within a quota budget. When two models have similar benchmark scores but one consumes significantly more quota per task, the team may actually finish less work with it. Selection should therefore prioritize pass rates and unit cost on real tasks.
The methodology in this article suits individual developers and small teams. Evaluating a frontend page does not predict performance on complex backends, permission systems, or high-concurrency scenarios—those require a separate task set.
Every evaluation run must record the environment: model name and version, model provider, client tool and version, operating system, hardware specs for local deployments, and the test date. Results without this information cannot be reproduced or compared against other people’s results.
2. The Four-Dimension Evaluation Matrix
| Dimension | Core Question | Sample Task | Key Metrics | Suggested Pass Line |
|---|---|---|---|---|
| Code generation quality | Can a single generation meet the requirements and run directly? | A frontend dashboard page | Mean of four-ish scores; build success | Build passes; mean score ≥ 3.5 |
| Long-horizon iteration | Can it complete an “execute–inspect–fix” loop autonomously? | 3–5 historical bug fixes | Task pass rate; human interventions | Pass rate ≥ 60%; ≤ 2 interventions per task |
| Quota and cost | How much useful work per unit of quota? | Same task set | Quota per task; output per unit cost | On par with or below the current solution |
| Engineering integration | Is it stable once wired into automation? | Stress-test script | Failure rate, timeout rate, retry success rate | Failure rate ≤ 5% |
These pass lines are starting points; teams should adjust them based on task difficulty and risk tolerance.
2.1 Code Generation Quality
Sample evaluation task:
- Requirements: Build an order dashboard page with filtering by date and status, sorting by amount, and a line chart of daily order volume. The style should be a clean, light admin theme—no default component-library styling.
- Sample data:
orders.jsonwith 200 records, including order ID, date, status, amount, and customer ID. - Acceptance commands: In a clean environment, run
npm install && npm run build—the build must complete without errors; then runnpm test—all unit tests must pass.
Score each generation on the following rubric, 0–5 points per item:
| Score | Requirements Fidelity | Style Consistency | Feature Completeness |
|---|---|---|---|
| 5 | All details match the description | Matches the specified style, no template residue | All features generated in one pass |
| 3 | Core features correct, minor detail deviations | Mostly consistent, some generic styling in places | One minor feature missing |
| 1 | Many features simplified or omitted | Clearly a stock template | Requires multiple patch rounds to be usable |
| 0 | Won’t run or irrelevant to the request | Cannot be judged | No usable functionality |
Average the three scores, then combine with the build result. A failed build is an automatic fail regardless of scores.
2.2 Long-Horizon Self-Iteration
Pick 3–5 closed bug tickets from your team’s last three months. Each must meet two conditions: the problem is reproducible, and there is a clear test case as the acceptance criterion. Record the following:
- The initial repository commit hash, so every run starts from the same state;
- The acceptance command, e.g.,
pytest -qornpm test; - The exact task description text—both models must receive identical wording.
Record these fields for every run:
| Field | Description |
|---|---|
| Turns | Number of model calls from start to finish |
| Human interventions | Times a human had to supply information or edit manually |
| Failure type | One of: environment error, logic error, tool-call error, missed requirement |
| Duration | Time from start to passing acceptance |
| Final result | Whether the acceptance command passed |
Failure types must follow unified definitions. For example, a dependency version mismatch is an environment error; a failing test assertion is a logic error. Write down the classification rules before the experiment starts and do not change them mid-way.
2.3 Quota and Cost
Using the task set from Section 2.2, record resource consumption per task:
- Call count: number of model calls from client logs or platform request records;
- Token count: input and output counted separately, from platform billing or local inference logs;
- Quota consumption: read the quota panel before and after the run and take the difference.
If panel accounting is inconsistent, run both solutions under the same account within the same time window, and save screenshots with timestamps. Quota refresh rules may differ across periods, making direct comparison unreliable.
Output per unit cost is calculated as:
Output per unit cost = number of passed tasks ÷ total consumption of the task set
If one solution has both a higher pass rate and a higher cost, comparing pass rates alone cannot determine which is better—you need this metric.
Example (hypothetical data, only to illustrate the calculation): a task set of 10 tasks. Solution A passes 7 tasks at an average of 0.8 quota units each: 0.7 ÷ 0.8 = 0.875. Solution B passes 8 tasks at an average of 1.5 quota units each: 0.8 ÷ 1.5 ≈ 0.533. Under this assumption, Solution A delivers more output per unit cost despite passing fewer tasks.
2.4 Engineering Integration Stress Test
Before wiring the agent into an automation framework, run each of the following stress tests:
| Metric | Definition | Sampling Method | Concurrency | Timeout | Retry Policy | Pass Standard |
|---|---|---|---|---|---|---|
| Stability | Failure and timeout rate across consecutive calls | 200 identical consecutive requests | 1 and 4, one round each | 120 s | Up to 2 retries, 5 s apart | Failure rate ≤ 5% |
| Instruction following | Output format consistency under a complex system prompt | 20 fixed instructions with constraints | 1 | None | No retries | Format correctness ≥ 90% |
| Burst/error handling | Recovery after a tool error | Inject tool errors, e.g., file not found | 1 | 60 s | Decided by the model | Recovery rate ≥ 80% |
| Environment awareness | Correctly identifying working directory and dependency versions | Provide 5 dependency manifests of different versions | 1 | None | None | Recognition accuracy ≥ 90% |
| Context management | Whether key constraints survive long sessions | Check initial constraints after 50 dialogue turns | 1 | None | None | Constraint retention ≥ 90% |
Every request must log the following fields: request ID, task ID, model name, tool name, latency (ms), response status, retry count, error type, and timestamp. Missing logs make failure rates unverifiable, so confirm logging works before the stress test begins.
3. A/B Experiment Procedure
- Lock the configuration: Both solutions use the same system prompt, the same tool list, and identical sampling parameters such as temperature. Record the model version for each solution.
- Prepare the task set: Select at least 10 tasks from the team’s high-frequency scenarios, covering all four dimensions. Freeze the task set before the experiment—no adding or removing tasks mid-run.
- Execute and record: Run both solutions in the same time window to reduce variance from service load fluctuations. Save the full process and results of every task.
- Dual scoring: Two team members score each generation independently; if scores differ by more than 1 point, discuss and settle on a final score.
- Aggregate and compute: Calculate pass rates, output per unit cost, and stress-test metrics for each dimension, and build a comparison table.
- Small-scale canary: Have the winning solution run for one to two weeks in non-core projects of 1–2 team members before deciding on a full migration.
Compliance and Risk Checklist
Before self-hosting an open-source model, confirm the following:
- Hardware: Verify VRAM and memory requirements against the model’s specs, and actually load the model on the target machine—do not substitute estimates for real testing.
- License: Check the model’s open-source license terms and confirm whether your team’s use cases are permitted, including commercial use and redistribution.
- Data compliance: Confirm whether code and business data will be sent to third-party APIs. Projects involving customer data or regulated data should use only local deployments or vetted services.
- Credential management: Use a separate read-only or least-privilege account for testing; inject secrets via environment variables, never into prompts or logs.
- Rollback plan: Run the agent on a separate branch—never let it modify the main branch directly. Keep the original tool’s configuration so switching back requires flipping a single toggle.
4. Selection Conclusions
Based on experiment results, use the following rules to decide whether to migrate:
- If the new solution’s pass rate on high-frequency tasks is no worse than the incumbent and its output per unit cost is clearly higher (a gap of 10% or more is recommended), it can enter the canary stage.
- If pass rates are comparable but the new solution is cheaper, adopt it as the default or as a fallback.
- If the engineering stress test’s failure rate exceeds the threshold, keep the solution out of automated pipelines and use it only for human-assisted scenarios.
- If the team already runs a stable toolchain and the experiment shows only a small gap, keeping the incumbent saves migration cost. An open-source option can serve as a supplement for cost-sensitive batch tasks.
Final conclusions should come from your team’s own task set, not public leaderboard rankings. Leaderboards indicate a model’s general level, but they cannot reflect your codebase, how your requirements are written, or your acceptance criteria. Preserve the task set and experiment records—when the next new model ships, you can rerun the same process for a direct comparison.
