Files
zed/script
Jacob Wolf 065d7ae597 agent_ui: Improve model and configuration option search (#64147)
# Objective
Fixes #64144. 

Improve search in agent model and configuration option pickers.

Previously, searches could fail when punctuation differed between the
query and model name, such as `GPT 5.6` versus `GPT-5.6`. Configuration
options also could not be found by provider/group, description, or value
identifier, and results were limited to 100 entries.

## Solution

Use the existing `fuzzy_nucleo` matcher for agent model and
configuration option searches.

Include relevant metadata in each search candidate:

- Model name and provider/group
- Configuration option name, group, description, and value identifier

Return all matching configuration options while preserving their
existing ordering when scores are equal.

Rank matches against option/model names independently of their metadata,
then append metadata-only matches without duplicates. This keeps
descriptions and identifiers searchable without letting their lengths
demote exact name matches or reorder equally relevant names.

Run the shared pure-data search pipeline on the background executor,
including candidate construction, ranking, and result cloning. This
prevents large catalogs and descriptions from monopolizing foreground
task polls without changing the ranking rule.

## Testing

- Added and ran automated tests with the following:
	- Searches with punctuation differences, such as `GPT 5.6`
	- Searches by provider/group
- Searches across configuration option names, descriptions, groups, and
identifiers
	- Searches returning more than 100 configuration options
	- Existing fuzzy-match ordering behavior
- Exact option-name matches ahead of partial-name and metadata-only
matches
	- Stable name ordering despite different metadata lengths
	- Combined queries spanning names and metadata

Follow-up validation on the ranking fix:

- `cargo test -p agent_ui --lib`: all 521 tests passed. Both new
configuration-option ranking regression tests failed before the fix and
passed afterward.
- `./script/clippy -p agent_ui`: passed, including the available
cargo-shear and typo checks.
- `rustfmt --check --edition 2024 crates/agent_ui/src/config_options.rs
crates/agent_ui/src/model_selector.rs`: passed.
- `git diff --check`: passed.

Additionally compiled the app with `cargo run`, launched OpenCode agent
in ACP mode, and searched `GPT 5.6`, which produces `OpenAI/GPT-5.6 Sol`
and `OpenRouter/GPT-5.6 Sol`. See video below.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Background-search validation

- `cargo test -p agent_ui --lib`: all 522 tests passed. The new
background-preparation test failed on the foreground implementation and
now passes across 20 scheduler seeds.
- `./script/clippy -p agent_ui -p agent_ui_benchmarks`: passed,
including cargo-shear and typo checks.
- `cargo fmt -p agent_ui -p agent_ui_benchmarks --check`, `git diff
--check`, and `./script/check-licenses`: passed.
- `./script/bench-agent-model-search --test`: all 20 workloads passed
before and after the change. The runner rejects any `test-support`
feature in the benchmark package graph.
- Ran quick mode before measured runs. Recorded `--save-baseline
foreground-preparation` on `b6157587dbfe96`, then ran the identical
benchmark with `--baseline foreground-preparation` on `4617d47567401e`.

Apple Silicon, Rust 1.98.1, `release-fast`, 15 Criterion samples, 200 ms
warm-up, 500 ms measurement. Representative broad-query results:

| Synthetic catalog | Total completion before → after | Foreground
task-poll p95 before → after |
| --- | --- | --- |
| 10,000 options, 128-byte descriptions | 10.35 → 12.49 ms | 7.36 → 0.46
ms |
| 10,000 options, 1,024-byte descriptions | 42.16 → 43.95 ms | 30.26 →
0.66 ms |

For the larger-description workload, foreground p99/max fell from
33.10/33.10 ms to 1.35/1.35 ms. Median foreground instructions fell from
879.9 million to 11.8 million, while total instructions stayed
approximately 2.14 billion. Observed synthetic 120 FPS budget overruns
fell from 66 to zero for this workload.

This improves foreground responsiveness rather than reducing total work.
Other Rust builds were active on the machine, so completion-time
estimates are noisy and no throughput speedup is claimed. The benchmark
measures the production search module with synthetic ACP-like options,
not provider requests, picker rendering, or live keystrokes. Its
foreground report includes warm-up/calibration, and budget overruns are
not literal display-dropped frames.

## Showcase


https://github.com/user-attachments/assets/04c1a59e-8454-49f8-af6c-47e1107f9416

---

Release Notes:

- Improved fuzzy searching for agent model and configuration option
pickers across Zed Agent and third-party ACP-compatible agents,
preserving name relevance and keeping search preparation off the UI
thread.

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-10-20 13:06:38 +00:00
..
…
2026-02-24 05:13:04 +00:00
…
…
…
…
…
…
…
…
…
…