land: probe-thread-pool

Merged
AF
2d ago
+788-59

Accepted agent delivery; branch-keyed search descriptor included.


Summary by cubic

Replaces per-call thread spawning for bounded filesystem probes with a reusable pool of up to eight helpers, retiring timed-out helpers and replacing them on demand within the existing 64-thread cap.

  • Reused helpers reset helper-local directory, mutation-admission, read, canonicalization, and grep-audit state before each dispatch and restore it on unwind.
  • A dedicated factory thread keeps worker creation off timed admission paths.
  • Health is non-blocking: an unused pool reports not_started, and a contended pool reports unavailable rather than waiting for the state lock.
  • The health report includes filesystem_helpers with pool limits, abandonment, replacements, and admission counters.
  • A 900-call read/grep/edit workload drops helper spawns from 5400 to 1 and process CPU per dispatch from 315.6 to 270.0 µs.
  • Adds regression tests for reuse, timed-out replacement, cap recovery, context reset, unwind restoration, and non-blocking health.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no outstanding actionable findings.

Summary

Reuses filesystem helpers within an eight-worker pool and a 64-thread cap. Timed-out helpers leave the reusable pool and can be replaced.

  • Filesystem probes reuse helper threads and retire timed-out workers.
  • Filesystem health reports show the probe pool’s status and limits.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Request[Filesystem probe] --> Pool[Acquire helper before deadline]
    Pool --> Worker[Run job with clean local state]
    Worker --> Success[Return helper to pool]
    Worker --> Timeout[Retire timed-out helper]
    Timeout --> Replacement[Create replacement within thread cap]
    Health[Health read] --> Snapshot[Report ready, not_started, or unavailable]

Reviews (2) · Last reviewed commit: "Declare the probe pool's search_index.rs..." · Reviewed by Greptile