Skip to content

Bound concurrent jobs in memory read producers - #811

Merged
zlareb1 merged 13 commits into
mainfrom
feat/memory-fanout-windows
Nov 18, 2026
Merged

zlareb1 merged 13 commits into
mainfrom
feat/memory-fanout-windows

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #808

Changelog category (leave one):

  • Improvement

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

Main vector reads, entity boosts, summaries, observations, anchors, key matches and digest descent create at most four read jobs per producer window. Each producer preserves input order and joins its owned children before a failure or cancellation escapes.

Why

Namespace and entity lists can create a task for every input at once. The existing private-first helper can schedule an ordered window and serve the affected memory producers without changing their store arguments or result assembly.

Scope and risk

Changes local scheduling and cleanup in the shared ordered-input helper and the listed memory producers. Private-first visibility, identity parameters, SQL, row order and ranking code remain unchanged. Supplemental phrases retain their existing namespace scheduling and completion-based duplicate selection. This is a per-producer bound; request-wide admission and process-wide cost isolation remain separate work. No performance improvement is claimed.

Compatibility, rollout and rollback

  • Wire: no operation, field or error-code changes.
  • Operator steps: none. The fixed read window applies to this build.
  • Rollback: restores scheduling without a schema migration or stored-state change.

Tests

  • Original focused regressions demonstrate excess fanout and children surviving the first failure. The retained feature, lifecycle, private-first and caller controls pass together: 18 cases, including repeated cancellation and the original supplemental duplicate-score control.
  • Four type-check errors were corrected with explicitly typed closures. Scoped mypy over six source files, Ruff lint and formatting, function-length ratchets and diff checks pass. The same 18 cases pass after that correction.
  • A successful window awaited inside a handled caller exception must propagate cleanup cancellation. That regression fails before the correction; the same regression and previous controls pass together: 19 targeted cases. Cleanup records only the window's own failure.
  • Supplemental windowing changed duplicate selection in a targeted control, so its original implementation and score expectations are preserved. This PR does not bound that producer.
  • Full GitHub CI passes on the final head: 46 successful checks and two documentation publication checks skipped for the pull request. A fresh independent review of all eight changed files has no findings or nits. These checks do not establish a performance or request-wide admission result.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (Codex): source and caller inspection, assertion and store-argument comparisons, focused regressions and scoped static checks.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • Required full GitHub CI passes on the final head.
  • Small related checks and scoped static checks pass.
  • Documentation describes the per-producer bound and remaining scope.
  • Commits are signed off.

The in-process server lifespan loads a timestamped keyring snapshot. Restore the original client snapshot at fixture teardown so later tests do not inherit a stale server view. Production freshness checks remain unchanged.

Signed-off-by: zlareb1 <[email protected]>
Create awaitables for the current window and join owned children before an error escapes. Preserve namespace and result order, row parameters and private-first passes. Supplemental phrase scheduling retains its existing duplicate selection.

Signed-off-by: zlareb1 <[email protected]>
Type each namespace and digest target at the factory boundary so the generic window preserves the store-call contract.

Signed-off-by: zlareb1 <[email protected]>
Pass the search body exception through the owned async context rather than reading ambient exception state. A successful search awaited from an exception handler still propagates cancellation after joining its children.

Signed-off-by: zlareb1 <[email protected]>
A handled exception in an awaiting caller must not suppress cancellation after a successful window. Keep the actual window failure explicitly while retaining shielded child cleanup.

Signed-off-by: zlareb1 <[email protected]>
@zlareb1
zlareb1 changed the base branch from feat/summary-seed-capacity to main November 18, 2026 02:51
@zlareb1
zlareb1 marked this pull request as ready for review November 18, 2026 02:51
@zlareb1 zlareb1 closed this Nov 18, 2026
@zlareb1 zlareb1 reopened this Nov 18, 2026
@zlareb1
zlareb1 merged commit dc636b1 into main Nov 18, 2026
48 checks passed
@zlareb1 zlareb1 mentioned this pull request Nov 18, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant