Agentic Long-Horizon Coding in Mobile App Development: Benchmark Metrics and Cost Trade-offs

    This article examines why mobile app development has become a key testbed for long-horizon coding agents. It explains four core evaluation metrics—pass rate, average completion, average wall-clock time, and cost per benchmark run—and analyzes why high completion often comes with high latency and cost. It also outlines practical selection strategies, internal benchmarking methods, and engineering safeguards such as sandboxing, observability, and tiered routing.

    Why mobile app development has become a testbed for long-horizon tasks

    In the past, code generation was often evaluated with short tasks: single-file completion, function-level algorithm problems, and localized bug fixes. These tasks have clear inputs and outputs, can be judged automatically, and are easy to reproduce. Real engineering delivery is different. Requirements often arrive as a sentence of natural language, validation requires building, testing, and installing the app on a device to interact with it, and the code baseline is usually a repository that has accumulated years of history, including legacy code, implicit conventions, and cross-module coupling.

    Mobile app development amplifies these difficulties:

    • Long environment chains. From writing code to producing a verifiable result, the agent must pass through building, packaging, signing, installation, launch, and interaction verification. If any step fails, the feedback signal becomes noisy.
    • High constraint density. Screen-size adaptation, OS-version compatibility, background lifecycle behavior, permission declarations, and resource/dependency version alignment are often implicit constraints: if you do not handle them, the result breaks.
    • Migration and conversion are heavy work. Moving a UI implementation from an old stack to a new framework, or converting a cross-platform approach into a native implementation, can involve coordinated changes across hundreds or thousands of files. There is no single optimal point.

    That is why the four typical benchmark categories—app creation, feature development, code migration, and app conversion—ultimately test whether an agent can maintain goal consistency across a long chain and self-correct after failures. This is also why differences among agent frameworks show up directly in scores: with the same model, changing the tool-calling and context-management strategy can produce a noticeable change in pass rate.

    Four metrics: translating “intelligence” into engineering language

    Public cross-model evaluations usually center on four metrics. Their combination is more informative than any single number.

    Metric Definition Engineering meaning Typical use
    Pass rate Share of tasks meeting all acceptance criteria Direct measure of deliverable usability Decide whether the output can enter a production workflow
    Average completion Partial achievement of acceptance items across tasks How far off the task is, rather than where it fails Estimate remaining work and rework cost
    Average elapsed time Wall-clock time from task start to termination How long a developer waits Latency-sensitive interactive scenarios
    Cost per benchmark run Total model-call cost for all tasks Unit economics of delivery Budget planning and scale estimation

    A notable empirical pattern is that, in recent public comparisons, leading agents typically pass about 20% to 30% of long-horizon tasks. In other words, more than 70% of tasks cannot be completed successfully in one pass. At the same time, the model cost of a single full benchmark run can range from tens of dollars to hundreds of dollars, a difference close to two orders of magnitude. Total elapsed time can extend from just over ten hours to nearly a full day.

    These numbers lead to two conclusions. First, long-horizon coding agents cannot yet fully replace the end-to-end delivery of senior engineers. Their value is mainly in compressing the time from an idea to a runnable skeleton. Second, completion level is positively correlated with cost and elapsed time. The real selection problem is not finding the “strongest model,” but choosing a point on this curve.

    “High completion, long runtime” is both a capability signal and a cost structure

    Why do results such as “the task reaches 80% completion, takes more than 20 hours, and costs hundreds of dollars” appear? Four factors combine.

    1. The solution space is search-based, not generation-based. An app-creation task can have an effectively unlimited number of acceptable implementations. The agent must read files, probe dependencies, write code, run builds, inspect errors, and revise. Each step prunes possibilities, and pruning has a cost. The more an agent verifies before moving forward, the more turns and wall-clock time it consumes, but the higher its pass rate tends to be. In contrast, generating a large amount of code first and verifying it later is cheaper and faster, but if the result deviates from expectations, rework costs can grow exponentially.

    2. The feedback loop itself is a bottleneck. Unlike backend services, mobile validation often requires a full build plus execution on a device or emulator. One round of “change → build → verify” can take minutes. In a 20-hour run, much of the time is not spent by the model thinking; it is spent waiting for build queues and device startup. This is why, when optimizing such pipelines, the largest engineering gains often come not from switching models, but from parallelizing verification steps and making incremental builds reliable.

    3. Context compression causes information loss. Context grows quickly in long-horizon tasks, and once it exceeds the window, it must be summarized. What gets discarded is often exactly the critical constraint: a specific version number, an implicit naming convention, or a previously deleted discussion. Failures are frequently not capability failures, but memory failures.

    4. Sunk cost cannot be recovered. If a task fails at step 18, the tokens produced in the first 17 steps are still billed. Since “high completion” usually means the agent reached a deep point before failing, the cost per task can be significantly higher than for tasks that fail early.

    The practical implication is that evaluating an agent cannot rely on pass rate alone; average cost per successful pass must be considered at the same time. A 28% pass rate with hundreds of dollars per run and a 17% pass rate with tens of dollars per run correspond to very different use cases.

    Calculating cost properly: using benchmark data correctly

    Many teams use public leaderboards for technical selection while ignoring the fact that “cost per benchmark run” covers model-call cost for all tasks and may not be comparable to the task-difficulty distribution in their own repositories. A more robust approach is to define an internal measurement standard first.

    1. # bench_metrics.py: Calculate four core metrics from a benchmark output directory
    2. import json, statistics
    3. from pathlib import Path
    4. def evaluate(result_dir: Path) -> dict:
    5. records = [json.loads(p.read_text(encoding="utf-8"))
    6. for p in sorted(result_dir.glob("*.json"))]
    7. passed = [r for r in records if r["accepted"]]
    8. durations = [r["wall_clock_hours"] for r in records]
    9. completions = [r["completion_ratio"] for r in records]
    10. costs = [r["cost_usd"] for r in records]
    11. pass_rate = len(passed) / len(records)
    12. # Key: passed-task cost and failed-task cost should be analyzed separately
    13. cost_passed = [r["cost_usd"] for r in passed] or [0.0]
    14. return {
    15. "tasks": len(records),
    16. "pass_rate": round(pass_rate, 4),
    17. "avg_completion": round(statistics.mean(completions), 4),
    18. "avg_hours": round(statistics.mean(durations), 2),
    19. "cost_per_run_usd": round(sum(costs), 2), # same definition as public leaderboards
    20. "cost_per_pass_usd":round(sum(costs) / max(len(passed), 1), 2),
    21. "p90_hours": round(sorted(durations)[int(len(durations)*0.9) - 1], 2),
    22. }

    The real value of this script is cost_per_pass_usd. It converts “how much did one leaderboard run cost” into “how much does it cost to deliver one passing task,” which is the number that can actually be put into a budget table.

    Task descriptions should also be stored in a structured format so that evaluations are repeatable and diffable:

    1. task_id: feature-offline-cache
    2. category: feature_development # app_creation | feature | migration | conversion
    3. repo_snapshot: refs/heads/base@a1b2c3d
    4. instruction: |
    5. Add offline caching to an existing list page. During cold start, render cached data first when available.
    6. verify: # Acceptance checks must be machine-decidable; otherwise, pass rate is meaningless
    7. build: ./ci/build.sh
    8. tests: ./ci/test.sh --filter cache
    9. smoke: ./ci/smoke.sh --scenario cold_start_with_cache
    10. limits:
    11. max_steps: 200
    12. budget_usd: 40.0
    13. wall_clock_hours: 12.0

    Three design points are essential: acceptance conditions must be machine-decidable (otherwise the pass rate becomes subjective scoring); the repository snapshot must be fixed (otherwise results cannot be reproduced); and budget and step limits must be set (otherwise non-convergent tasks can consume unlimited resources).

    Selection: three paths and one combined strategy

    When the above metrics are combined, selection needs usually fall into three categories.

    Path 1: Prioritize budget and latency. This applies to internal tools, prototype validation, batch small changes, and automated minor fixes in CI. In this case, it is reasonable to choose a “fast and cheap” approach. A lower pass rate is acceptable because the cost of human intervention may be much lower than the model cost. One possible criterion is the “human takeover ratio,” for example allowing 60% of tasks to require manual completion in exchange for a one-order-of-magnitude reduction in unit cost.

    Path 2: Prioritize quality. This applies to core-module migration, cross-platform conversion, and projects delivered to external parties. In this case, “slow and expensive” can be justified: if a migration task fails, the cost of manual investigation may be dozens of times the model cost. The selection criterion shifts from pass rate to “first-pass success rate × rework hours.”

    Path 3: Tiered routing (recommended). Most teams need both. A lightweight routing layer can address this:

    1. # Route by task characteristics instead of applying one global profile
    2. def route(task) -> str:
    3. if task.category in ("migration", "conversion") or task.risk == "high":
    4. return "thorough" # long feedback loop + strict verification + higher budget cap
    5. if task.category == "app_creation" and task.estimated_files > 50:
    6. return "thorough"
    7. return "fast" # small changes use the low-cost path
    8. def run(task):
    9. plan = route(task)
    10. result = execute(task, profile=plan)
    11. if not result.accepted and plan == "fast":
    12. # Cascade escalation: if the fast path fails, the thorough path takes over
    13. result = execute(task, profile="thorough")
    14. return result

    The economics of a cascade strategy are straightforward: if the fast path can solve 60% of tasks, the thorough path only handles the remaining 40%. Total cost is significantly lower than using the thorough path for every task, while tail quality is preserved. The prerequisite is that both paths share the same acceptance scripts; otherwise, it is impossible to judge whether the handoff truly succeeded.

    Moving benchmark capability into the R&D pipeline

    Benchmark scores do not directly translate into productivity. Several engineering supports are required.

    1. Prioritize making tasks verifiable over making them generatable. If a team turns 80% of repetitive requirements into machine-decidable acceptance conditions, the agent’s actual pass rate will often be much higher than the leaderboard score, because it faces its own repository and clear acceptance criteria. Conversely, if acceptance depends on human subjective judgment, no model score can be reproduced internally.

    2. Sandboxing and least privilege are hard requirements. An agent needs to execute build scripts, install dependencies, and run tests, which effectively means giving it a writable and executable environment. In practice, each task should run in a disposable container that is destroyed after the task completes; only a read/write copy of the repository snapshot should be mounted; dependency installation should use an internal mirror; and no credentials, signing material, or production access should enter the sandbox. If network access is required, it should go through an allowlisted egress proxy. Ignoring this exposes production credentials to an uncertain executor.

    3. Context engineering is often more cost-effective than switching models. Reusable techniques include: maintaining a structured document of repository modules and conventions and injecting it as fixed context; writing build, test, and code-style rules as machine-readable configuration rather than relying on human memory; and building a regression set from historical failures so that similar problems do not recur.

    4. Observability must be designed for long-running tasks. For short tasks, inspecting the result in logs may be enough. Long tasks must expose the process: each tool call, duration, token consumption, and failure reason should be persisted and aggregated by task ID. In practice, teams can reuse common cloud capabilities: object storage can archive execution traces and build artifacts, logging services can provide search, and monitoring/alerting can set thresholds for three signals: “elapsed time exceeds threshold,” “cost exceeds budget,” and “consecutive failures.” General-purpose capabilities offered by platforms such as Baidu AI Cloud—including container platforms, object storage, logging, and monitoring/alerting—can cover much of this pipeline. With trace data, teams can answer questions such as “which step is actually slow?”

    5. Benchmark sets must be versioned. Comparability of leaderboard scores comes from fixed snapshots; internal benchmarks should follow the same principle. The benchmark set itself should be placed under version control and tagged together with model configurations, routing policies, and acceptance scripts, forming a traceable “configuration → result” comparison. Otherwise, after three months, no one can say whether a score change came from a model upgrade or from a benchmark-set change.

    Common pitfalls

    • Focusing only on pass rate and ignoring cost per pass. A 5-percentage-point improvement in pass rate with a 10× cost increase is a negative return for most teams.
    • Using public leaderboard scores to infer performance on your own repository. Leaderboard tasks are filtered and normalized; your repository has legacy baggage, and the actual pass rate is usually lower.
    • Treating long runtime as a model-capability problem. A large portion of long runtime is serialized waiting for builds and verification. Optimizing the pipeline often yields more value than optimizing the model.
    • Going live without budget caps. Long-horizon tasks without both step and monetary limits become cost black holes for non-convergent tasks.
    • Ignoring whether acceptance conditions are machine-decidable. Acceptance criteria that cannot be automated make all metrics meaningless.

    Conclusion

    The real value of long-horizon coding benchmarks such as mobile app development is not producing a ranking. It is breaking down the vague question of “what coding agents can actually do” into four measurable dimensions: pass rate, completion, elapsed time, and cost. The data repeatedly point to the same conclusion: high completion often comes with high elapsed time and high cost; fast/cheap and slow/accurate each have their place.

    For engineering teams, the rational approach is not to chase the top of a leaderboard. It is to first turn acceptance conditions in your own repositories into an engineering artifact, build an internal benchmark set and cost model, and then use tiered routing to send tasks of different difficulty to execution paths with different costs. When the “cost per delivered passing task” becomes a metric that can be monitored, alerted on, and optimized, coding agents have truly moved from demos into the development workflow.