Skip to content

perf: selective recall filters re-run up to five times; the capture worker repeats housekeeping #1671

Closed

Description

@ajianaz

What

Two performance findings:

  1. A selective recall filter re-runs the recall up to five times (recall_filter.rs:85). With strict or min_trust active, the window starts at 3x the limit and grows fourfold (15, 60, 240, 960, 1000 for limit 5), re-running the strategy and hydrating candidates on each pass. A query few hits satisfy always pays the worst case.
  2. The capture worker repeats housekeeping per session and ignores shutdown mid-cycle (capture_worker.rs:38). run_cycle calls run_capture_extraction(facts, 1, ...) once per session, so the retention DELETE, lease reclaim and pending counts run budget_per_run times per cycle; and the loop never checks the shutdown flag, so stopping the server waits for up to budget_per_run provider calls.

Why

Off-topic strict queries are the common case for strict, and a stop signal should not wait minutes. Found by a Cora scan run as agent on the files added since v0.22.1 (2026-11-04). Line numbers are for develop @ 7e53cec.

Proposal

Stop widening when a pass added no kept row, or fetch the maximum window once when the first pass keeps nothing. Run the housekeeping once per cycle and check shutdown between sessions.

Testing

A strict query with no qualifying hit makes at most two passes; a shutdown during a cycle stops after the current session.

Activity

  1. added
    enhancement
    scope:core
    priority:low
    cora-scan
    scope:server
    on Nov 4, 2026
  2. ajianaz commented on Nov 4, 2026

    @ajianaz
    CollaboratorAuthor

    Fixed by #1681 (merged into develop). The recall filter part is done there; the worker housekeeping and shutdown check were already in place from #1674.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cora-scanenhancementpriority:lowscope:corescope:server

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions