Duolingo's agent pipeline merges 700+ human-approved iOS test PRs (~225,000 lines of tests) in eight months; MVVM coverage 9% → 59%
Kush Agrawal, a staff engineer on Duolingo's platform team, describes a pipeline that has coding agents write unit tests for Duolingo's iOS app (nearly 2 million lines, weekly releases, 600+ live A/B tests). Overall unit test coverage was 11% in March 2026. The team first ran Claude Code locally: two batches of 17 and 40 PRs had 8 and 19 merged. Failures led to explicit XCTest vs Swift Testing rules, a codebase-wide migration of a hard-to-mock user client to a protocol plus a lint rule, and Swift 6 Sendable and timing guidance in the repository's testing skill. In production, Python workflows on Temporal share state in S3: a scheduled backfill scores Swift files by type (MVVM view models, repositories and data sources boosted 2.5x), coverage gap, module priority and size, and launches one parallel agent session per file (Claude Code or Codex on Duolingo's cloud coding platform) that opens a labelled PR. A lifecycle workflow visits every open generated-test PR every couple of hours: closes stale or conflicting PRs, runs a pre-commit fix or a repair agent from CI logs (up to five attempts), and on green CI assigns the top git-blame contributor and enables auto-merge; a rejection puts the file on a 30-day cooldown. Engineers can also request tests on their own PR with a label. A deterministic rule closes any test PR that touches files outside tests, mocks, fakes and stubs, and a reviewer agent checks for production edits, deleted or disabled tests and long waits. Moving agents from Linux to Mac runners let them build and lint before opening PRs (lint failures had hit 13.6% of PRs). After eight months the pipeline had merged more than 700 test PRs, each approved by a human.
The numbers (as reported)
| Test PRs merged | More than 700, each approved by a human |
|---|---|
| Test code added | About 225,000 lines |
| Overall iOS unit test coverage | 11% (March) → 24% (November 2026) |
| Targeted MVVM layers coverage | 9% → 59% (repositories 11% → 72%, view models 9% → 58%, data sources 5% → 41%) |
| Share of new iOS test work since March | 34% of new test files, 44% of new test cases, 10% of all Swift lines added |
| First local batches | 8 of 17 and 19 of 40 PRs merged |
| Lint failures before Mac runners | 13.6% of PRs; two rules caused 62% of them |
| Earlier checkpoint (blog, June 2026) | 250 PRs, ~85,000 lines, 4,460 test functions in ~17 weeks; 76% passed CI first time |
Facts
- Company / subject
- Duolingo
- Tools
- Claude Code, OpenAI Codex
- Codebase
- brownfield
- Work type
- Refactor / maintenance
- Stack
- Swift, iOS, XCTest, Swift Testing, Xcode, Python, Temporal, Amazon S3, GitHub Actions, Datadog, MCP
- Published
- 2026-11-11
- Last checked
- 2026-11-27
What the source claims Practitioner (own blog/paper)
Claimed by the builder, writing about their own work. Not checked independently.
- Merged more than 700 human-approved test PRs, adding about 225,000 lines of test code 700+ PRs, ~225,000 lines
“The pipeline merged more than 700 test PRs, adding about 225,000 lines of test code.”
- Overall iOS unit test coverage rose from 11% to 24%, and the targeted MVVM layers from 9% to 59% 11% → 24%; MVVM 9% → 59%
- The pipeline wrote 34% of all new iOS test files and 44% of new test cases since March 34% of new test files
- Fixing agent failures (protocol for the user client, lint rule) made files easier for engineers to test too
“That made the affected files easier for engineers to test, too.”
Caveats
Talk by the Duolingo engineer who built the pipeline; the source page is AI Engineer's write-up of the talk with transcript. The coverage figures are Duolingo's own measurements, and the conference write-up notes the talk does not establish that every change was caused by the agent. The secondary June 2026 blog post gives an earlier checkpoint (250 PRs, ~85K lines) and names only Claude Code; the talk shows Claude Code or Codex as the agent. The agent share of new tests dipped in the final weeks as engineers wrote more tests themselves. Applying the same loop to SwiftUI and Android coroutine migrations is described as just starting, not as a result.
More stories by tool: Claude CodeOpenAI Codex
Related topics: Refactoring and maintenanceBrownfield codebases
Source
AI Engineer CODE 2026 talk (Kush Agrawal, Duolingo)
Also: https://blog.duolingo.com/ai-ios-unit-test-generation-pipeline/