Repository navigation
The embed phase copies vectors from embed_reuse_from - #1710
Conversation
Only the inline ingest looked up reusable vectors, so a branch namespace indexed with --phase index and embedded with --phase embed (or by code_embed_recovery) embedded every chunk. _embed_rows now copies the vector of every code chunk stub whose path, content hash and stored context text match a live, embedded chunk in the namespace's embed_reuse_from, and embeds only the rest. A switched-off org still gets its copied vectors; its other stubs stay as they are. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
No blocking findings. The backfill and worker share the reuse path. It reads vectors by organization, source namespace, path, and model, and checks the stored context text before copying. Unmatched chunks still use the existing embed path.
zlareb1
left a comment
There was a problem hiding this comment.
The format job fails on the adoption page with the same formatter output on clean main. The pinned Biome check passes with the tracked repair. Failed job · Repair #1706
zlareb1
left a comment
There was a problem hiding this comment.
The hosted worker suite found four failures in the existing polling tests. Update the shared configuration fixture before merging. Failed unit job
The embed phase reads embed_reuse_from from the namespace's repo config, and the cer fixture's stand-in config had only org and namespace, so four polling tests raised AttributeError. Signed-off-by: Vanshaj Poonia <vanshajtheunique@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The polling fixture now supplies the reuse setting. That keeps the existing scan, watermark, and poison tests on their intended paths when the worker looks up the namespace configuration. No blocking findings on this head.
zlareb1
left a comment
There was a problem hiding this comment.
The rename report integration test fails at the same assertion on this head and on clean main. The tagged fixture describes a naming claim, so the planner returns about_naming. The same test passes with the fixture repair. PR job · Main job · Repair #1719
Closes: #1681
Changelog category (leave one):
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):
loom code backfill --phase embedand thecode_embed_recoveryworker now copy vectors from a namespace'sembed_reuse_fromfor chunks whose path, content hash and context text match, as an inline--embedindex already did, and embed only the rest.Why
embed_reuse.reusable_vectorshad one caller,_embed_new_chunks, which runs only when the index embeds inline. A branch namespace indexed with--phase indexand then embedded with--phase embedsent every chunk to the embedder, although the guide recommends both the split andembed_reuse_fromfor a branch.Scope and risk
_embed_rowsinserver/code/workers/embed_recovery.py, which both the backfill embed phase andcode_embed_recoveryuse, resolvesembed_reuse_fromonce per(org, namespace)group (code chunks only, never the summaries table). Before each embed call it looks up reusable vectors per path with the existingreusable_vectorsand its key: the same path, content hash and storedcontext_textunder the sameembedding_model. Matched stubs get the copied vector and the rest go to the embedder as before.reusable_vectorsalready returns{}on any error. A stub without a path, hash, context text or model is embedded as before.CodeEmbedRecoveryResult.reusedcounts copied vectors. The backfill embed phase prints it and records it asembed_reused, the name the inline index uses.test_code_embed_recovery_republishes.pygainsembed_reuse_from = "", which every realRepoConfighas.Compatibility, rollout and rollback
embed_reuse_fromnow reuses vectors in the embed phase with no flag.Tests
pytest tests/unit/test_code_embed_recovery_reuse.py: 3 new cases. Two stubs that match the source copy its vectors and a third with the same content but a different context text is embedded, with one lookup for the path. A namespace withoutembed_reuse_fromembeds everything and looks nothing up. A switched-off org still writes the copied vector and leaves the other stub untouched. All 3 fail without the change.test_code_embed_recovery_republishes.pyandtest_code_embed_recovery_empty_text.pypass (19 with the new file).tests/unit/test_code_*.pyfile was run with and without the change on this machine. The failure sets are the same (local gaps such as numpy and clickhouse-local), apart from two timing-based parser cases that flip between runs.test_public_copy.pyandtest_doc_links.pypass. No run against a live ClickHouse and embedder.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code wrote the diff and ran the checks above.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s), as CONTRIBUTING.md asks.Note
Medium Risk
Touches shared embed recovery used by backfill and background workers; behavior change is limited to namespaces with embed_reuse_from and falls back to full embed when lookup fails.
Overview
Fixes a gap where branch namespaces indexed with
--phase indexand then--phase embed(or healed bycode_embed_recovery) sent every chunk to the embedder even whenembed_reuse_frompointed at a main namespace with identical chunks. Those paths now match inline--embedingest: before each embed batch, stubs whose path, content hash, and storedcontext_textmatch a live embedded chunk in the source namespace copy that vector; only unmatched stubs call the embedder.CodeEmbedRecoveryResultgains areusedcounter; backfill’s embed phase prints it and recordsembed_reusedin pass counters. When model calls are switched off mid-pass, copied vectors still land and stubs that still need embedding are left untouched.Docs under
docs/operations/code-index-operations.mddescribe reuse for--phase embedand branch indexing. Unit tests cover match vs mismatch, namespaces without reuse, and switched-off orgs.Reviewed by Cursor Bugbot for commit dff2452. Bugbot is set up for automated code reviews on this repo. Configure here.