Testing and Evaluation Strategies for AI-Powered Code Editor with Agentic Editing

zed · Tech · 2025 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: AI-powered code editor reliability

Zed needed reliable agentic editing in a Rust code editor while preserving its empirical engineering culture despite non-deterministic LLM outputs, streaming edits, parsing edge cases, and model-specific behavior.

Constraints:

Architecture

Zed combined data-driven high-level evaluations with deterministic and stochastic unit tests around specific editing mechanisms. For streaming edits, it moved from single tool calls to a two-stage model loop: a small tool call describes intended edits, then the model streams old-text/new-text blocks that are parsed and applied incrementally.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  agentic_editing_model["Agentic editing model"] --> streaming_edit_parser["Streaming edit parser"]
  streaming_edit_parser --> code_buffer["Code buffer"]
  agentic_editing_model --> evaluation_harness["Evaluation harness"]
  evaluation_harness --> stochastic_unit_tests["Stochastic unit tests"]
  stochastic_unit_tests --> streaming_edit_parser
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Agentic editing model Generates intended edit descriptions and old/new text blocks. Streaming edit parser, Evaluation harness
Streaming edit parser Parses structured streamed old/new blocks and handles malformed output. Agentic editing model, Code buffer
Code buffer Editor state that receives incremental edits. Streaming edit parser
Evaluation harness Runs headless editor tasks and high-level coding-agent evaluations. Agentic editing model, Stochastic unit tests
Stochastic unit tests Runs repeated focused tests for nondeterministic LLM behaviors and parser edge cases. Evaluation harness, Streaming edit parser

Data flow

A code-editing task runs through high-level agent evaluations and targeted stochastic tests. For actual editing, the model first describes the intended change, then emits structured old/new text blocks; Zed parses, validates, and applies those blocks incrementally while tests probe parser and formatting edge cases.

3 supporting quotes
“They developed a multi-layered approach combining stochastic testing with deterministic unit tests, addressing issues like streaming edits, XML tag parsing, indentation handling, and escaping behaviors.”summary, stated
“first, a small tool call describes the intended edits, then they loop back to the same model (leveraging its loaded cache) to emit "old text/new text" blocks”summary, stated
“This streaming approach required sophisticated parsing and handling of the LLM's output format”summary, stated

Why this architecture

Zed layered tests because broad agent evaluations reveal failures but are too coarse to debug; focused stochastic tests catch nondeterministic parser and edit behavior where deterministic unit tests alone are insufficient.

3 supporting quotes
“when these high-level evaluations failed, diagnosing the root cause among potentially millions of failure modes became extremely difficult.”summary, stated
“The second layer involves more programmatic, stochastic unit tests that focus on specific aspect”summary, stated
“Tool calls don't stream well, providing all results at once rather than showing progressive updates.”summary, stated

Models used: Claude 4 · Frontier LLMs

Scale

Alternatives considered (roads not taken)

Traditional tool calls for edits

Rejected because: They did not stream well and produced poor progressive user experience.

“The team initially implemented editing through traditional tool calls, but discovered significant user experience issues with this approach.”summary, stated

Rely only on high-level SWE-bench-like evaluations

Rejected because: Failures were too hard to diagnose among many possible causes.

“These evaluations compile a headless version of Zed, check out repositories, run agents, and attempt to make them perform coding tasks.”summary, stated

Patterns

eval-driven-development (quality)

Zed used high-level evaluations plus focused stochastic unit tests to validate agentic editing.

“implemented comprehensive testing and evaluation strategies to ensure reliable agentic editing capabilities.”summary, stated

tool-use-orchestration (editing workflow)

The model first uses a small edit-description tool call, then emits streamed old/new blocks for application.

“To address this, they developed a two-stage approach: first, a small tool call describes the intended edits, then they loop back to the same model (leveraging its loaded cache) to emit "old text/new text" blocks that can be streamed to users in real-time.”summary, stated

Tradeoffs

Use a two-stage streaming edit protocol.

Chose Tool description plus streamed old/new text blocks over Single non-streaming tool call.

Rationale: The two-stage design improves user experience by showing progressive edits while reusing model cache.

“To address this, they developed a two-stage approach: first, a small tool call describes the intended edits, then they loop back to the same model (leveraging its loaded cache) to emit "old text/new text" blocks that can be streamed to users in real-time.”summary, stated

Gotchas (what bit them)

Streaming LLM edits require robust parsers, not just prompts.

Root cause: The model can emit malformed, incomplete, or incorrectly structured output while streaming.

Resolution: Build parsing, validation, and focused tests around the output format.

“The challenge was ensuring robust handling of malformed, incomplete, or incorrectly structured output from the LLM.”summary, stated

High-level agent tests are poor debugging tools by themselves.

Root cause: A failed end-to-end coding task can involve millions of possible failure modes.

Resolution: Pair them with programmatic stochastic unit tests for specific mechanisms.

“However, the team quickly discovered that when these high-level evaluations failed, diagnosing the root cause among potentially millions of failure modes became extremely difficult.”summary, stated

Evaluation

Zed evaluated agentic editing with headless repository tasks, stochastic unit tests, deterministic unit tests, repeated runs, and pass/fail thresholds.

Metrics: Hundreds of stochastic iterations. · Pass/fail thresholds. · Parser and formatting unit tests. · Headless coding-agent task outcomes.

“Through statistical testing methods running hundreds of iterations and setting pass/fail thresholds, they successfully deployed reliable AI-powered code editing features that work effectively with frontier models like Claude 4.”summary, stated

Outcomes

The summary mentions hundreds of stochastic iterations and a native editor target of 120 FPS, but not production user volume.

“successfully deployed reliable AI-powered code editing features that work effectively with frontier models like Claude 4.”summary, stated