You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vector sync re-prepares the whole oversized entity on every pass #1786
Vector sync re-prepares an entire oversized entity on every pass, even though a pass embeds at most OVERSIZED_ENTITY_VECTOR_SHARD_SIZE (256) chunks (repository/semantic_vector_sync.py:29). Every pass rebuilds and hashes all of the entity's chunks first, so the cost of a pass grows with the note's size, not with what changed.
For a large note that keeps being edited, this repeats on every edit. The cost is note size times edit rate.
Evidence (Basic Memory Cloud production, 2026-10-11 to 10-18)
One 2.6 MB note with about 8,700 chunks and 3,400 observations was edited by an agent up to about 1,400 times a day.
Typical successful passes: 200 to 230 s of prepare, then 77 to 118 s of embedding. About 7,500 of 8,400 chunks were skipped as unchanged, and the pass ended with entities_deferred=1.
Over the week, vector sync on that one workspace used 115 worker-hours: 67 h of prepare, 15 h of embedding.
About 3,000 more attempts timed out about 32 s into the batch.
The "oversized entity" log fired about 700 times for that one note in 4 days.
Other workspaces have the same shape at smaller scale: a 25.5 MB note with 32.7k chunks, and an entity with 18k chunks.
Fix
Make a pass's cost scale with the chunks that changed, not with the whole entity. For example:
reuse the stored per-chunk source hashes, so unchanged chunks are not rebuilt and re-hashed every pass;
and/or debounce or coalesce embedding for very large entities that are edited constantly, so a burst of edits produces one pass instead of hundreds.
Acceptance
A test with an oversized entity, where one small edit triggers a pass, shows the prepare work bounded by the changed chunks, not by the entity's total chunk count.
Repeated edits to one oversized entity within the debounce window cause one embedding pass, not one per edit.
Priority: High. The production evidence shows one note using 115 worker-hours in a week, and other workspaces show the same pattern at smaller scale.
Component: Database/sync (vector sync in repository/semantic_vector_sync.py). It was observed in Cloud production, so I labeled it cloud.
Complexity: Medium to Complex. Reusing the stored per-chunk source hashes means changing how the prepare phase decides which chunks to rebuild. A debounce or coalesce for edits to the same large entity also needs a defined lifecycle.
Duplicates and related issues
I found no exact duplicate. These closed issues cover nearby ground and may help:
Both cover embedding and shard resumption. This issue is about the prepare and hash cost that remains on every pass.
Notes
The issue has an evidence section, a proposed fix, and acceptance criteria, so I don't need reproduction steps.
The two acceptance criteria are testable separately: prepare work bounded by changed chunks, and one embedding pass per burst of edits.
Any change here touches derived state (vector rows and chunk hashes). Per the repo's consistency model, the fix should stay lock-free and rely on later passes to converge.
Activity
claude commentedon Oct 20, 2026
Claude finished @phernandez's task in 14s —— View job
Triage
repository/semantic_vector_sync.py). It was observed in Cloud production, so I labeled itcloud.Duplicates and related issues
I found no exact duplicate. These closed issues cover nearby ground and may help:
Both cover embedding and shard resumption. This issue is about the prepare and hash cost that remains on every pass.
Notes
I stopped after triage and made no code changes.
fix(sync): move reused vector chunk metadata in set-based batches (ba…