Repository navigation
Index embed-excluded paths without a description or a vector - #1564
KaloyanNaumov wants to merge 11 commits into
Conversation
A repository entry's `embed_exclude` globs (`LOOM_CODE_EMBED_EXCLUDE` for the scalar entry, the `exclude` glob semantics) keep a path in the index: it is chunked, its symbols, edges and test map are derived, and code.search reaches its chunks through the lexical leg. Its new chunks are neither described nor embedded, in the file ingest and in the round's prefetch, and `loom code describe` leaves them alone. The rows carry `unembedded by design: embed_exclude`. Embed recovery and the coverage counts now match the shared prefix `unembedded by design`, so reference fixtures and embed-excluded chunks are neither stubs to fill nor counted in the embeddable denominator. Rows already stored under the reference marker match it unchanged. Test files are often a large share of a repository's chunks; this lets an operator spend the embedder on source and reach tests from the source hit through the test map. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
`loom code reembed` copies a row that carries the `unembedded by design` marker under the second label with its marker and no vector, so an embed-excluded path or a reference fixture is not embedded there and that label's recovery leaves it alone. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The provider rebuild embedded every live `code_chunks` row and cleared `embed_last_error`, so a staged embedder switch gave embed-excluded chunks and reference fixtures a vector and erased their marker. It now stages a row marked unembedded by design without a vector and keeps the marker. The `code_summary` pass wrote an LLM card and a card vector for an embed-excluded file, and could carry a twin's card across models. It now takes the entry's `embed_exclude` globs (`denylist_for`), writes and carries no card for a matching file, and clears a card written before the glob: the row keeps its rank and carries the marker, so recovery and the card leg of code.search skip it. Removing the glob lets the next pass write the card. `unembedded_by_design` is the one predicate the Python writers read the marker with. A test discovers every code-plane module that calls an embedder or an LLM and fails until a new one is declared as a writer gated on the marker or the globs, or as a query-side reader; the round prefetch filter, the describe skip and the marker precedence get their own tests. `ReembedStats.rows_unembedded` had no reader and is dropped. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
`ingest_file` resolved `default_denylist()` in `_refused` and again for the embed rule; it now resolves it once and passes it down. The chunk stage's `embed_excluded` has its one caller pass it, and the marker choice reads as one expression. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
… entries The operations guide states what a changed glob does: adding one leaves existing vectors until a chunk changes, and removing one leaves the chunks unembedded and outside the coverage denominator, embedded again when their content changes or when the repository is indexed into a new namespace. `embed_exclude` applies to configured entries only. A rolling-upgrades entry records how an older build reads the marker as a stub. The coverage comments name both kinds of rows unembedded by design, and the setting's comment is cut to two lines; the generated references are regenerated. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The exclusion needs to survive mixed-version recovery and model migration. loom code reembed selects all live source chunks, then embeds each missing target row. Preserve the marker and the vectorless row when copying to another model label. Existing reembed thread
The embed_exclude marker now extends the reference fixtures' marker (`unembedded by design: reference (embed_exclude)`), so the previous build's recovery, backfill embed phase and coverage counts, which match `unembedded by design: reference` as a prefix, skip it as this build's do. The recovery and coverage reads keep main's parameter. A test pins the reference literal, and a cross-version test checks that the row ingest stores is skipped by the previous build's recovery predicate and by this build's. The code_summary pass no longer clears a card written before its file's glob: a card, like a chunk, keeps the state it had when the glob was set. The candidate and carry filters stay. The model-caller enumeration test is gone: it was a closed list that every new caller had to edit, and it passed with the ingest gate removed. The reembed, provider rebuild and card tests move beside their existing fakes, and the recovery parameter check already in test_code_reference_files.py stays the only one. reembed partitions its rows in one loop and reads the column it always selects. Rule 63 and the operations guide say what is true now. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
The operations guide's CA-bundle paragraph and the embed_exclude paragraph both follow the same paragraph; both are kept, CA bundle first. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
Agreed, a marker the previous build reads as a stub was the wrong representation. An embed-excluded row is now stored as On the Bugbot reembed thread: Fixed: |
The code_summary pass leaves embed-excluded paths out of its candidates, so a card written before the path's glob was never rewritten or removed after the file changed: code.map and the cards leg kept serving a description of the old content. The pass now tombstones the live card of an excluded path whose inputs_hash no longer matches the file's content hash, a deleted file included. A card that still matches the file stays, as before, and a rank row without a card is left alone. The next code_graph_stats pass writes the file's rank row back. The operations guide says the card stays until the file changes. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
P2 — An existing file card stays live when an embed-excluded file changes. I verified that the worker skips the card, while both the map and card search still read it without checking the file's current hash. Retire the stale card when the source changes and cover the case with an existing card. The stored marker and the model-copy paths address the previous findings. Existing stale-card finding
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 6b38f60. Configure here.
zlareb1
left a comment
There was a problem hiding this comment.
Excluded files keep their index entries, and stale cards are retired after the file changes. Both builds' recovery reads skip the stored marker. All 109 focused tests passed, including card retirement, model migration, and settings defaults.
code_ready_embed_coverage named embed_exclude by its suffix; it now names code_embed_exclude, and the example file and schema follow. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
scripts/codegen/settings_reference.py after 59fc101's catalog wording change. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
zlareb1
left a comment
There was a problem hiding this comment.
The graph-stats race in the existing thread still applies. graph_stats.py:590–618 can read the old card before its retirement and write it afterward with a higher version and no tombstone. Keep rank updates from restoring stale summaries and cover that ordering in the regression test.
|
Thanks for the review. Converting to draft while I address it; a new head and the replies will follow, so no need to look at this head again. |
The ranks leg reads a live file card, then inserts a mirror of it with the new rank at the clock version. A tombstone or a new summary written in between carries an earlier version than that copy, so the copy won under FINAL and brought back a card retired meanwhile. The copy now takes the read card's version plus one. Every other writer takes its version from the clock, so a later tombstone or summary is higher and wins; with no write in between the copy is still the newest row. The test reads a card, lets the tombstone land during the read and checks that FINAL keeps the tombstone. It fails without the change. Signed-off-by: Kaloyan Naumov <knaumov@gmail.com>
|
Fixed in 7c4f87c. The rank copy |
zlareb1
left a comment
There was a problem hiding this comment.
The rank writer now advances the version it read by one. The real query returns that version, and the regression verifies that a tombstone written after the read wins over the delayed rank copy.

Closes: #1559
TL;DR: Adds
embed_excludeglobs (LOOM_CODE_EMBED_EXCLUDEfor the scalar entry): matching files stay in the index with their symbols, edges and test map, but nothing describes or embeds their chunks or writes them a summary card. Their rows carry a marker that extends the reference fixtures' one, so the previous build's recovery and coverage reads skip them too, andloom code reembedand the provider rebuild keep them without a vector. Empty by default, so nothing changes unless set.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):
A repository entry's
embed_excludeglobs (LOOM_CODE_EMBED_EXCLUDEfor the scalar entry) keep matching files in the code index, with their symbols, edges and test map, while their chunks are neither described nor embedded and they get no summary card; code.search finds them through its lexical leg.Why
The only way to keep a path out of the embedder was
exclude, which drops the file from the index with its symbols, call edges, impact and test map. Test files are often a large share of a repository's chunks: on our deployment, 45% of the live chunks of OpenClaw (343,578 of about 762,000, a ClickHouseGROUP BYoverloom.code_chunks FINAL) come from*.test.*and*.spec.*files. An agent reaches a test from the source it covers through the test map, so the vectors buy little for their embedder time and storage.The index already holds rows that are indexed and unembedded on purpose, the reference fixtures, marked
embed_last_error = "unembedded by design: reference", which every read matches as a prefix. An embed-excluded chunk is stored as"unembedded by design: reference (embed_exclude)". Recovery, the backfill embed phase and the coverage counts keep their parameter, so this build and the one before it skip the row alike.ingest_file→_chunk_stage)embed_attempts = 0, no stub count. Symbols, edges, guards, lexemes and the file row as for any file. A reference fixture keeps its own marker;excludewins overembed_exclude.pass_commit._ingest_commit_files)loom code describeloom code reembedprovider_rebuild_batch.py)code_chunksorcode_summariesrow with no vector and keeps the marker.code_summarycards (workers/summary.py)unembedded_by_design()inlang_reference.pyis the one Python predicate. The lexical leg has noembedding_dimfilter, so the rows are found by code.search's lexical leg, grep,code.files,code.outlineand the test map; the vector legs skip them.Scope and risk
server/code/app/index/denylist.py,ingest.py,pass_commit.py,reembed_model.py,server/code/domain/extract/lang_reference.py,server/code/domain/index/repos.py,server/code/workers/summary.py,server/code/workers/graph_stats.py,server/insights/app/provider_rebuild_batch.py,server/cli/code_maintenance.py, the setting inserver/settings/catalog.py, and the docs. With no glob configured nothing changes: the denylist'sembed_patternsis empty and every path is embedded as before.The globs apply to chunks written after they change. This answers the two open questions in #1559, and the operations guide documents it:
code_graph_statsmirrors from a card is written at the version it read plus one, so a tombstone landing meanwhile is not undone), and the nextcode_graph_statspass writes the file's rank row back without one. Until that pass the file is missing fromcode.mapand the hub query, a gap that closes by itself and only on paths the operator chose to exclude.code.reposstill reports them covered. No writer re-embeds an unchanged chunk: a chunk is embedded when its content changes, and embedding all of them means indexing the repository into a new namespace. The card comes back at the nextcode_summarypass. Should recovery instead treat a marked row whose path no longer matches as a stub (the issue's proposal)? I left that mechanism for your call.embed_excludeapplies to configured entries only. The registry table (loom.code_repos) has no column for the list, so a self-service entry is embedded in full until a migration adds one.Compatibility, rollout and rollback
LOOM_CODE_EMBED_EXCLUDE(default empty), and one new optional repository-entry key,embed_exclude.How this was found
Found and reproduced on our deployment with AI assistance. Fixed on a fork, PR submitted.
Tests
tests/unit/test_code_embed_exclude.py(new):test_an_embed_excluded_file_is_chunked_but_never_described_or_embedded: symbols and lexemes kept, no embedder or LLM call, the marker with no attempt and no stub; a path outside the globs is embedded as before.test_the_scalar_setting_and_a_repo_entry_carry_the_globs: the glob semantics,LOOM_CODE_EMBED_EXCLUDEand aLOOM_CODE_REPOS_JSONentry'sembed_exclude.test_the_reference_marker_is_the_previous_builds_literalpinsunembedded by design: reference, written out.test_the_recovery_of_either_build_skips_a_stored_embed_excluded_row: the row ingest stores passes the previous build's recovery predicate (its literal,NOT startsWith(embed_last_error, …)) and this build's (the parameter its pending read binds). It fails with the earlierunembedded by design: embed_excludemarker.test_a_reference_fixture_keeps_its_marker_and_exclude_wins.test_the_round_prefetch_is_not_given_an_embed_excluded_file.test_loom_code_describe_leaves_a_marked_chunk_alone.test_reembed_model_wide_path.py::test_a_row_unembedded_by_design_is_copied_with_its_marker_and_no_vector,test_provider_rebuild_batch.py::test_a_code_row_unembedded_by_design_is_staged_without_a_vector(chunks and cards)test_code_card_selection.py::test_worker_writes_and_carries_no_card_for_an_embed_excluded_file, andtest_code_card_selection.py::test_an_embed_excluded_files_card_goes_once_the_file_changes(a changed and a deleted file's cards are tombstoned, a matching card and a rank row without a card stay; without the tombstone step it fails, nothing written).test_code_graph_stats_light_ranks.py::test_rank_write_does_not_restore_a_card_retired_after_the_read: the ranks leg reads a live card, a tombstone lands, and FINAL still keeps the tombstone; it fails without the change.test_code_card_selection.py,test_code_summary_cancel.py,test_model_calls_held_mid_pass.py,test_model_calls_switch_workers.pyandtest_model_call_customer.pygive the card pass real entry configs (repo_config), since it now reads their globs.test_code_reference_files.pypass;ruff check,ruff format --check, the mypy gate and the function-length gate are clean. The full suite is left to CI.docs/reference/tables were regenerated withscripts.codegen.settings_reference,settings_schema,settings_exampleanddocs_reference.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 the tests. Checked: I reviewed the whole diff and its tests; the gate runs listed under Tests are the agent's, against
mainat the same commit.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/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.Note
Medium Risk
Touches core ingest, embed recovery, reembed, and summary paths; misconfigured globs change what is embedded and what counts toward readiness, though defaults preserve current behavior.
Overview
Adds
embed_excludeglobs (per-repo andLOOM_CODE_EMBED_EXCLUDEon the scalar entry) so matching files stay fully indexed—chunks, symbols, edges, lexemes—while no LLM descriptions, no embeddings, and nocode_summarycards are written. Those chunks getunembedded by design: reference (embed_exclude), extending the existing reference-fixture marker so recovery, coverage,loom code describe,loom code reembed, and provider rebuild all treat them like intentionally unembedded rows.Ingest and round prefetch skip describe/embed for excluded paths; summary skips candidates and tombstones cards when content changes; graph_stats bumps rank-copy version so a retired card is not revived by a concurrent rank refresh.
Docs, settings schema, and rolling-upgrade notes document mixed-version behavior (older builds may still embed paths that this build marks).
Reviewed by Cursor Bugbot for commit 7c4f87c. Bugbot is set up for automated code reviews on this repo. Configure here.