Views semantic fills yield cold-build slots while waiting on embeddings

Merged
AF
5d ago
+654-84

From the 21:03Z perf sweep: on views-on machines, semantic view fills held one of the two cold-build slots for the whole refresh, including every wait on the embedding backend. Other projects' call-graph and text builds queued a median of 4 min, and up to 24 min.

Change (views semantic runtime only):

  • A fill releases its cold slot during each embedding-backend call, and while it waits on a shared chunk gate or file claim. It re-acquires the slot before storing results.
  • A separate process-wide limit of two in-flight fills bounds the sources and chunks a fill keeps in memory across those waits, so the memory cap the cold slot used to provide still holds.
  • Small preparations keep their preparation permit until memory admission succeeds.
  • Readiness stays pending until storage and snapshot validation complete.

Measured on a fixed-delay fixture (6 semantic roots, 150 ms per backend call, 2 cold slots, 8 independent call-graph builds): non-semantic slot-wait p95 went from 3.6 s to 1.1 s (69% lower), while total fill time went from 5.6 s to 10.5 s, because fills now re-queue after each backend call. That trade favours text and call-graph responsiveness over semantic fill latency.

Tests. A call-graph build runs during an embedding wait, and the fill re-admits before storing; this fails without the fix. The in-flight memory bound holds across 5 roots. Chunk-gate and file-claim waiters yield the slot. The fixed-delay measurement is an ignored test you can run by hand. 142 semantic-runtime and limiter lib tests pass, plus the Windows target check.

Views are off by default (and currently off on the operator's Mac); this matters once views are on.


Summary by cubic

Semantic view fills now yield their cold-build slot while waiting on the embedding backend or shared work, so text and call-graph builds no longer queue behind embedding latency.

  • A fill releases its cold slot during each embedding-backend call and while waiting on a chunk gate or file claim, then re-acquires it before storing results.
  • A separate process-wide limit of two in-flight fills bounds the memory fills retain across those waits, preserving the cap the cold slot used to provide.
  • Small preparations keep their preparation permit until memory admission succeeds; readiness stays pending until storage and snapshot validation complete.
  • On a fixed-delay fixture, non-semantic slot-wait p95 drops from 3.6s to 1.1s, while total fill time rises from 5.6s to 10.5s as fills re-queue after each backend call. The trade favors text and call-graph responsiveness over semantic fill latency.