Harness engineering is not enough: why the software factory model fails

Two years of engineering data from 22,000 developers: Output rose 66%, but production incidents per PR surged 242.7%.
By Dex Horthy(HumanLayer)07-27 · 12 min read⚑ Expert view · personal take
🎧 Listen to the podcast0:00 / --:--
0:00 / --:--
Deep Dive · Xiaohu Breakdown
At a glance
  • The trending "lights-out factory" approach has AI write and review code while humans read nothing. HumanLayer founder Dex Horthy argues in a two-part post why this model fails—not due to poor workflow, but because of how models are trained.
  • Faros data tracking 22,000 developers over two years shows a 66% rise in completed epics per developer, but production incidents per PR spiked 242.7%, and unreviewed PRs merged directly into main grew 31.3%.
  • The root cause lies in training rewards: the grading harness only checks whether the target test passes and existing tests don't break. How the fix is implemented doesn't affect the score, so swallowing exceptions in try-catch blocks gets full credit.
  • Bad architecture goes unpunished because it lacks a fast feedback loop: tests execute in seconds, whereas the bill for poor architecture arrives months later—far too late to backpropagate.
  • The solution isn't using less AI, but shifting effort upfront: product review, system architecture, program design, and vertical slicing. He estimates an hour of planning cuts review time from six hours to 20 minutes, eliminating 80% of expected pain in the first ten minutes.
⚑ Disclosure: Dex Horthy's company HumanLayer builds collaboration tools for keeping humans in the loop with AI, aligning his commercial incentives with these conclusions—a declaration he discloses upfront. The Faros data compares the same set of companies across low-AI and high-AI usage periods rather than a controlled experiment. Faros highlights these trends as statistically significant, while Dex frames them as a correlation signal rather than conclusive proof.

In July 2026, HumanLayer founder Dex Horthy delivered a keynote titled "Why Software Factories Fail" at the AI Engineer World's Fair. He expanded his talk into a long-form essay, split across two posts on July 24 and 25 due to X's media limits per post.

Part 1 is subtitled "Harness is Not Enough." The industry calls the environment surrounding AI coding models a harness—the tools provided, context fed, retry attempts, and automated review checks. Over the past year, engineering effort has focused heavily on refining this harness to achieve fully autonomous pipelines. His thesis: this approach cannot fix code quality because the issue lies in how models are trained, not in their harness.

Part 2, "Turning the Lights Back On," details the workflow his team adopted after learning these hard lessons. This breakdown synthesizes both parts.

Original keynote, 19:17, published by AI Engineer on July 23, 2026. The article expands on this talk. Subtitles translated and burned by this site (Chinese top, English bottom). Watch original on YouTube.
Part 1 · Harnessing is Not EnoughCurrent State

The state of software factories and blind automation

Faros AI aggregated two years of engineering data across 22,000 developers and 4,000 teams. None of these numbers come from surveys; all were extracted directly from code repositories, CI pipelines, incident systems, issue trackers, and IDEs. They compared the same companies across periods of low vs. high AI usage.

While output metrics look impressive, downstream metrics show rising incidents and bugs.

Output: Measurable Gains
+66%
Epics completed
per developer
+33.7%
Task throughput
per developer
+16.2%
Merged PRs
per developer
Cost: Downstream Impact
+242.7%
Production incidents
per PR
+54%
Bugs per developer
(up from +9% prior year)
+441.5%
Median code review
turnaround time

The fourth metric, "incidents per PR," normalizes for higher submission volume. Higher submission frequency alone cannot explain this rise—individual changes have become inherently riskier. Faros attributes this to reviewers failing to keep pace with AI code generation rather than intentional reviewer bypasses. Meanwhile, unreviewed PRs merged directly into main (without human or machine review) rose 31.3%.

Faros Report: Pre-merge code quality declining
Pre-merge: Review comments per PR rose 25%, with comment length up 22.7%.
Faros Report: Production quality declining
Post-deployment: Monthly incidents grew 57.9%, and bugs per PR increased 28.7%. Source: Faros AI "AI Engineering Report 2026".

Dex highlights these figures to underscore a core point: code output has increased, but the technical debt is being paid downstream.

What a software factory is—and what "lights-out" removes

A "software factory" is an assembly line where ideas enter a queue, get built, reviewed, deployed, and recycled back when incidents occur. This workflow predates AI.

The 2022 software factory model: features queue up from product and engineering, get built and reviewed, deploy to production, and recycle user complaints and incidents back into the queue. Source: Dex Horthy.

With AI, only one stage shifted: "Human builds" became "Agent builds." Companies like Ramp, Stripe, WorkOS, and Brex have reported that 75% of their code is written by agents. However, while building dropped from days to minutes, code review stayed at hours or days. The review stage quickly became the primary bottleneck.

Teams tried layering on more automation: AI code reviews, browser regression tests, and auto-routing production incidents back to agents. Yet review remained slow. Eventually, some teams eliminated human review altogether.

Click the tabs below to view the three factory generations
Feature Queue Human Builds Agent Builds Human Reviews Deploy User feedback & incidents recycle to queue Bottleneck Removed Feature Queue Human Builds Agent Builds Human Reviews Deploy Feedback & incidents recycle to queue

2022 Model: Both building and reviewing are done by humans, taking hours to days.

Agent Factory: Building drops to minutes, but reviewing remains hours to days, making review the main bottleneck.

Lights-out Factory: Human review is eliminated entirely, redirecting effort to automated testing, sandboxes, auto-reviews, and canary deployments.

The term "lights-out" was coined by Dan Shapiro, drawing from fully automated manufacturing where no humans are needed on the floor. StrongDM is frequently cited as an example, operating pipelines where humans neither write nor read code. At this stage, the only remaining constraint is how many tasks can be queued.

Diagram of a lights-out software factory with human testing and human review crossed out
Author's diagram of a lights-out factory. The "human tests the change" and "human reviews the change" steps are crossed out in red with "NO THANKS" written alongside. Source: Dex Horthy.
Related Article
AI Engineer World's Fair Debate: Has coding loop hype outpaced engineering discipline?

Going lights-out: A two-week manual rewrite four months later

The concept sounded promising, so Dex implemented it. In July 2025, his team went fully lights-out—reading only specs and tickets, delegating tasks entirely to background agents.

Then they hit bugs that agents simply could not fix. He notes that anyone running this model for months encounters the same outcome: feeding all relevant code and documentation, or asking the agent to reproduce the bug ten different ways, yields no fix. Engineers had to dive back into a codebase unread for three months to locate the failure line by line—all while production was down and users complained.

After tolerating initial incidents for the sake of speed, repeated failures forced a reckoning. By November, after the third major incident, the co-founder opened standard VS Code (bypassing AI editors like Cursor) and spent two weeks manually rewriting the codebase.

While this reflects a single startup's experience, the pattern is familiar across teams: rapid initial output eventually degenerates into an unmaintainable legacy codebase.

Core Question

Why do agents excel at fixing isolated bugs or building standalone pages, yet make long-term codebases progressively harder to maintain? The answer lies neither in prompt engineering nor workflows, but in how models are trained.

Part 1 · Harnessing is Not EnoughProcess of Elimination

Why harness engineering won't save AI coding

Common critiques blame flawed usage: weak prompts, poor workflows, or insufficient reviewer agents. This line of reasoning misses the fundamental issue.

While external harnesses can be modified indefinitely, the model's underlying weights remain fixed. These internal weights ultimately constrain harness effectiveness, as demonstrated by Claude Code.

Before Claude Code, CLI tools like Aider, Cline, and Codebuff offered similar toolsets and context management: reading, editing, searching files, and running shell commands. Yet they frequently failed on simple edits, forcing developers to intervene manually.

The 2024 SWE-Agent paper demonstrated that subtle tool design changes significantly impact performance—such as adding line numbers to file outputs or switching file editing from search-replace to line-range editing.

Comparison of three file editing tools from the SWE-Agent paper
Comparison of tool designs. Left: No dedicated edit tool; the agent dumps the file and edits via shell. Center: Dedicated edit tool, but recovery from errors is difficult. Right: Edits pass syntax checks first; invalid edits are rejected with feedback to retry. Source: SWE-Agent paper (2024).

When Claude Code launched, its performance stood out. Rather than relying solely on harness tuning, Anthropic trained the model directly on the exact tool signatures it would use in production. Optimizing harnesses without model weight access cannot compete with co-designing models and harnesses together, a point echoed by OpenAI's team in late 2024.

Related Article
Twelve Rules of Harness Engineering: Concrete templates from a year of Google lead engineer practices
Part 1 · Harnessing is Not EnoughTraining Flaws

Flaws in model training: No penalty for unmaintainable code

If harness engineering cannot bridge the gap, where does the issue lie? In RL training objectives, which contain zero penalties for unmaintainable code.

Grading harnesses check only two outcomes: Did it fix the bug, and did it break anything else?

The fundamental problem traces back to how models are trained under reinforcement learning.

Reinforcement learning loop for coding models, adapted from Calvin French-Owen's (Codex team) talk at AI Council. Source: Dex Horthy.

The RL loop follows three steps: sample multiple execution trajectories for a prompt, grade each attempt using an automated test harness, and update model weights to favor successful paths. This loop repeats millions of times across weeks of training.

Harness: The execution environment surrounding a model—tool declarations, context formatting, retry logic, and evaluation loops. Changing the harness alone can dramatically shift performance.

Analogy

It resembles teaching a student solely through multiple-choice answer keys: correct selections yield full points regardless of whether the reasoning was sound or guessed. Over millions of iterations, the student learns answer-matching rather than problem-solving.

Key Takeaway

A model optimizes strictly for what the grading harness evaluates. What, then, does the coding harness actually grade?

Examining a benchmark task: "Code quality" is nowhere in the reward function

Consider SWE-bench Multilingual, an industry-standard benchmark derived from real bugs in repositories like Redis, jq, and Django. The grading harness checks only two binary criteria: whether failing target tests now pass (FAIL_TO_PASS), and whether previously passing tests remain unbroken (PASS_TO_PASS). Meeting both yields 1 point; otherwise 0.

In one fastlane (Ruby) benchmark issue, the program attempted to invoke `.empty?` on a `nil` object when optional parameters were omitted, causing a runtime crash.

Benchmark Prompt · Error Stack Trace
'zip_command': undefined method 'empty?' for nil:NilClass
Attempted to call `empty?` on `nil` because optional parameters were not provided.
Human Fix · fastlane/lib/fastlane/actions/zip.rb
-      @include = params[:include]
-      @exclude = params[:exclude]
+      @include = params[:include] || []
+      @exclude = params[:exclude] || []
Two lines: Fall back to empty arrays when parameters are nil.

During evaluation, the model receives the error trace and codebase snapshot. It cannot see the reference solution or test suite patch. Upon submitting a patch, the evaluation pipeline strips any model edits to test files (preventing models from commenting out failing tests), applies the benchmark test patch, and executes the suite.

Full evaluation pipeline of a coding benchmark task from bug report to binary score
Complete evaluation flow: Bug report and pre-fix snapshot on the left, agent patch in the center, hidden grading step on the right (stripping test edits, applying official tests, running rspec). 1 point for passing target tests without regressions; 0 otherwise. Source: Dex Horthy.

Implementation quality has zero influence on the score.

After millions of training steps, models converge on antipatterns like wrapping code in try-catch blocks to suppress exceptions, or using double type-casts to bypass static type checking. Both pass the automated test harness despite degrading codebase integrity.

Code swallowing JSON parse errors via try catch
Swallows errors and returns null. Callers receive null with no context on failure.
Code using double type casts to bypass type safety
Double type-casting to bypass type checking before attaching arbitrary properties. Source: Dex Horthy.
Core Problem

Because RL training contains no penalties for architectural decay, models naturally converge on quick-fix hacks.

Why code quality cannot be easily rewarded: The bill arrives weeks later

Why not add code quality metrics to the reward function? The challenge lies in evaluation latency.

Test Pass / Fail
Seconds

Immediate execution allows RL loops to iterate millions of times.

Architectural Quality
Weeks, months, or years

The penalty surfaces only when developers attempt to modify the code later—long after training has completed.

Architectural debt manifests as "shotgun surgery" (a concept formalized by Martin Fowler), where changing a single requirement forces scattershot edits across a dozen files while risking silent side effects.

By the time production outages occur, credit assignment cannot be backpropagated through time to the original design decision. The causal link between early shortcut edits and later outages is broken.

Broken backprop link diagram showing missing path between early bad decisions and later incidents
Broken credit assignment: Early shortcut decisions (pink) lead to brittle code (red), causing outages months later (right). The backward arrow is crossed out, showing backpropagation cannot assign credit across this gap. Source: Dex Horthy.

"It stands to reason that if the model were capable of reliably evaluating code quality, it would have generated clean code in the first place."

Dex Horthy, "Why Software Factories Fail"
Part 1 · Harnessing is Not EnoughFrontier Research

Frontier research and industry efforts

Research teams are actively exploring alternate reward structures, a direction Dex considers promising:

OrganizationNovel Evaluation Approach
SWE-Marathon
Abundant AI
Evaluates long-horizon tasks (up to 400 hours, such as cloning Excel features) using multi-dimensional partial scoring rather than binary outcomes.
DeepSWE
Datacurve
Constructs benchmarks from unmerged open-source epics to ensure solutions are absent from pre-training data (addressing memorization, though not code quality).
Frontier Code
Cognition
Spans multi-PR benchmarks and penalizes trivial tests (e.g., tests that pass even before applying the fix), supplemented by linter-based review models.

While these benchmarks represent progress toward evaluating maintainability, Dex notes that automated reviewer agents and extra token compute raise performance floors without moving model ceilings. RL requires fast, reliable grading harnesses—which long-term code maintainability currently lacks.

Part 2 · Turning Lights Back OnTurning Lights Back On

Turning the lights back on: Restoring human code review

Because model capabilities remain bounded by RL reward limits, human code review must be restored. AI effort should shift upstream into pre-implementation planning, reducing downstream errors. In his team's experience, spending one hour on upfront planning reduces code review turnaround from six hours to 20 minutes.

Traditional software engineering reached a similar conclusion decades ago: because building and reviewing both demand substantial effort, upfront design aligns architectural expectations before code is written. This reduces rework and accelerates code reviews.

Leverage of upfront planning highlighted on the software factory diagram
Software factory diagram with high-leverage points highlighted: 1 hour spent on upfront planning (bottom left) reduces review time from 6 hours to 20 minutes (right) while lowering rework rates. Source: Dex Horthy.

He structures upfront planning into four sequential stages:

Product Review
Define target user pain point and success metrics
→
System Architecture
Define contracts across services, APIs, and schemas
→
Program Design
Specify types, signatures, file trees, and call stacks
→
Vertical Slicing
Build end-to-end thin slices incrementally
Part 2 · Turning Lights Back OnFour-Stage Planning

Upfront four-stage AI planning before code generation

Treat current AI agents as fast, obedient junior engineers who lack global architectural perspective. Prompting them directly for complex features yields thousands of lines of passing yet unmaintainable code.

The highest-leverage point occurs before code generation. Every stage is drafted by AI and finalized by human engineers.

Stage 1: Product Review

A concise specification defining two elements: the specific user pain point (framed in user terms rather than technical jargon) and explicit success criteria (e.g., reduced flow completion time, onboarding milestone metrics, or lower ticket volume).

For UI-facing features, generate interactive HTML prototypes directly rather than relying on textual descriptions. A mock interface resolves ambiguities faster than lengthy discussions.

Embedded UI prototype in a product review document
Product review document with an embedded UI prototype for creating a task (workflow selection on the left, step preview on the right). Source: Dex Horthy.

Minor fixes, copy edits, or one-off scripts bypass this step. Formal product review is reserved for high-rework-risk features. Additionally, the assigned PR reviewer reviews the spec before implementation begins.

Stage 2: System Architecture

This stage establishes integration boundaries—defining communication across services, API contracts, database schemas, and message queues prior to internal module design.

API Contract · Request & Response Schema
PUT /api/resources/:slug
  request:  { destination: string }
  response: { resource: Resource }
Keep it concise: endpoint, request payload, response schema.

Dex notes that while diagrams like Mermaid are useful, text-based contracts and schema definitions often prevent model hallucinations more effectively.

Stage 3: Program Design

Relying solely on architecture leaves internal module structure to model discretion, often yielding suboptimal code organization.

Before code generation, developers define concrete program shapes: core types, function signatures, file tree diffs, and call stack trees. Dex emphasizes that program design is heavily underrated in AI coding workflows.

Their team utilizes three lightweight pseudo-code artifacts:

Artifact 1 · Call Stack Tree (+/- marking added or removed layers)
 entrypoint
   runCommand
+    handleCreateResource
+      ResourceClient.create(input)
+        POST /resources
+      renderResult
-    legacyCreateFlow
Used when changing invocation order or callers. Clarifies where new call chains hook in and where legacy paths disconnect.
Artifact 2 · File Tree Diff (New vs Modified files with brief rationales)
 src
 └── resource
+    ├── resource-client.ts      # NEW - wraps API contract calls
+    ├── resource-client.test.ts # NEW - covers request/response mapping
~    └── resource-route.ts       # MODIFIED - wires create action into UI
Maintains explicit control over file structure and module boundaries.
Artifact 3 · Core Function Types & Signatures
interface Item {
  id: ItemId
  parentId: ItemId | null
  // ...
}

interface Cursor {
  position: ItemId
  direction: 'up' | 'down'
  // ...
}

resolveTarget(items: Item[], cursor: Cursor) -> ItemId | null
Captures structural type definitions that models frequently infer incorrectly.

These artifacts allow rapid iteration between developer and model. Unresolved structural details during planning inevitably trigger costly refactoring during code review.

Stage 4: Vertical Slicing

Rather than generating entire features end-to-end across database, API, and UI in a single pass, vertical slicing breaks work into thin, testable end-to-end increments.

AI models naturally favor horizontal layer-by-layer plans (database → service → API → UI).

Horizontal planning: Executing migrations, service layers, APIs, and UI sequentially. Source: Dex Horthy.

Horizontal execution prevents intermediate end-to-end testing. Manual verification in the browser or terminal becomes impossible until the final layer is completed.

Vertical slicing (tracer bullets): Building a thin, fully integrated end-to-end path first, then expanding functionality. Source: Dex Horthy.

Vertical slicing establishes working endpoints with mock data first, builds UI views against mock responses, connects real service layers, and finishes with data migrations and edge-case handling.

Frontier models rarely slice work vertically without human intervention. Releasing 1–3 thin slices per iteration allows reviewing 100–200 lines at a time rather than debugging 2,000 lines at once.

Part 2 · Turning Lights Back OnReview Load

Managing code review overhead in the AI era

Even with upfront planning, code review queues remain active. His key insight: "You don't have too many PRs; you have too many low-quality PRs."

Well-structured PRs that conform to team architecture conventions are straightforward to review.

Conversely, PRs requiring 20%+ rework impose significant cognitive load. Unguided AI-generated PRs often require near 50% rework.

Core Quote

"You don't have too many PRs; you have too many low-quality PRs."

Upfront planning reduces code review friction. To determine when full four-stage planning is warranted, he proposes a decision framework based on expected risk.

His team tailors planning depth by task scale: roughly 40% of small tasks use direct single-prompt agents, medium tasks combine product and architecture into a single plan, and full four-stage planning is reserved for major features.

He defines "Expected Pain" as:
Expected Pain = Probability of Rework × Severity of Rework

Evaluating three points along this curve: a 2-minute quick prompt carries a ~50% rework probability; 5 hours of detailed spec writing by a senior engineer drops rework probability to ~10%; spending 20 hours writing all code manually eliminates AI leverage entirely.

Curve of expected pain declining with upfront planning investment
Expected Pain vs. Upfront Planning Investment. X-axis: time spent planning; Y-axis: expected pain. Conceptual estimates by Dex Horthy. Source: Dex Horthy.

He notes that minor UI tweaks carry low rework severity, keeping total expected pain minimal even if rework probability is high.

Decision Rule

If 10 minutes of initial planning eliminates 80% of expected pain, avoid spending six hours over-specifying it.

Part 2 · Turning Lights Back OnTradeoffs

Accepting constraints to find true leverage

While fully autonomous software generation remains an attractive vision, current model limitations require structuring workflows around realistic capabilities.

Rather than chasing hypothetical 10x–100x efficiency claims at the expense of code quality, teams can achieve a sustainable 2x–3x throughput increase by adopting structured upfront planning.

He concludes with four key principles:

1
Understand Model Constraints: Build intuition through direct usage to learn where models excel and where human oversight is required.
2
Optimize Within Constraints: Design engineering workflows tailored to current model capabilities rather than waiting for next-generation breakthroughs.
3
Identify High Leverage Points: Focus human effort where small inputs yield maximum returns—specifically upfront architectural and program design.
4
Read the Dang Code: Maintain rigorous human code reviews prior to merging.

StrongDM responds to the article

Following Dex's comment regarding sporadic updates on StrongDM's public progress page, StrongDM AI Labs responded on Hacker News.

StrongDM engineer jaytaylor clarified on July 23 that updates occur monthly as milestones are met. They remain optimistic that software engineering challenges will succumb to automated factory pipelines as base models improve. Dex replied requesting a retrospective detailing successes and lessons learned.

Actionable Execution Checklist
The three program design artifacts (call stack tree, file tree diff, types & signatures) included in the text can be copied directly into your planning documents as templates.
Sources
Why Software Factories FailDex Horthy (HumanLayer)·Part 1·Part 2·2026-07-24
Site Notes
Due to X media posting limits, the author split his essay into two parts; this article synthesizes the full text from GitHub along with the side-quest essay "Where Does the Time Go" (which contains the Expected Pain curve). All images and videos are original assets hosted locally. Metrics such as +441.5% median review time and +33.7% task throughput originate from the cited Faros AI report. The StrongDM response is sourced from Hacker News and linked in the original post. The three-generation factory diagram in Section 2 is an adapted visualization based on the author's original diagrams.
↑ End of article
✓ This article is free to read in full

Members can copy or download the full Markdown, and let their AI subscribe and ask.

Read the original ↗
📮 New explainers, straight to your inbox

Found this useful? Leave your email — every new explainer, the moment it's out. Unsubscribe anytime.