Repository navigation
Conversation
Embeds have the lowest queue priority, so they run only when no change, scan or dir_index is waiting. While files keep being edited that never happens: one live server held 918 files unembedded for over two hours, so semantic search silently missed them while regex search found them. Once a pending embed has waited _EMBED_MAX_WAIT_SECONDS (60 s), the loop runs one embed pass ahead of the next non-embed job. generate_missing_embeddings covers every chunk missing a vector, so the pass settles all waiting embeds; their queue entries are released and skipped as unowned when dequeued. A failed pass (compaction busy, provider error) leaves them pending and is not retried until the interval passes again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A chunk whose embedding was never written stays invisible to semantic search while
regex search still finds it, and nothing reported or repaired it:
- daemon_status had no coverage figure, so a live server showed healthy while ~531
chunks lacked vectors.
- The realtime server embeds only in response to file events, so missing vectors
from before a restart (or a starved/failed pass) were never filled.
- `chunkhound index` skipped the missing-embeddings pass after a clean Rust run,
and the Rust pipeline embeds only files it (re)processes, so unchanged files'
missing vectors were never repaired by a rebuild either.
Changes:
- IndexingCoordinator.count_chunks_missing_embeddings(): the same anti-join
generate_missing_embeddings works from, so count and repair cannot disagree.
- Realtime: when the queue goes idle after any work (and once at start-up), measure
the count, publish it as realtime.embedding_coverage {missing_chunks, checked_at},
and queue an embed pass if any are missing. A check the database cannot answer
yet (Rust pipeline/compaction owns it) is retried after 30 s idle. The check can
never raise: an escaping error would spin the loop without yielding.
- DirectoryIndexingService: always run the missing-embeddings pass; when nothing
is missing it is one query.
Tests: the idle server fills missing vectors with no file event and reports 0; a
clean Rust run still calls the repair pass. Each goes red when its change is
removed. Unit suite: the 7 failures / 9 errors are identical without this change
(environmental: config and API-key tests).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…not embed When an embed pass left chunks without a vector (provider down, a chunk the model rejects), the idle coverage check queued another embed pass, whose completion re-ran the check, and so on: CI logged the check ~400 times a second, and test_stale_delete_retry_is_dropped_after_newer_change never settled on any OS. An embed pass covers every chunk missing a vector, so a second pass with no change in between can only repeat it. Queue a repair pass only when no embed pass has run since the last non-embed mutation (or start-up). Chunks still missing are reported in embedding_coverage; the next change or a restart retries them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A note on the red CI before anyone reviews this. The cause was the idle coverage check. When an embed pass left chunks without a vector, the check queued another embed pass, and when that pass finished the check ran again, so the cycle never ended. The test's no-op embed hit this every time, and the CI log shows the check running about 400 times a second. In production, the same thing would happen whenever chunks can't be embedded (provider down, a chunk the model rejects). The fix relies on the fact that an embed pass already covers every chunk missing a vector, so a second pass with nothing changed in between can only repeat it. A repair pass is now queued only if no embed pass has run since the last non-embed mutation, or since start-up. Chunks still missing are reported in
🤖 Generated with Claude Code |
|
CI on d3c4fab: the One job failed:
I can't re-run upstream jobs from a fork. Could a maintainer re-run that job? 🤖 Generated with Claude Code |
…llow-up is never stranded The promoted embed pass this PR adds awaits after a change's path is made active and before the "file no longer exists" check. While the path is active, add_file turns a newer write into a reserved follow-up, and only the end of the active span queues it. That end lived in a finally around process_file alone; the missing-file branch released the path and continued without draining the reservation, so a write whose event arrived during the promoted pass (for example a re-create) was not indexed until the file changed again. Before the promoted pass nothing awaited between activation and the check, so no reservation could be made there. The change/scan handling moves into _process_change_mutation, which activates the path and runs the whole active span (promoted embed pass, existence check, process_file) in one try/finally. That finally calls _end_active_change, now the only place an active path is released, which pops it and drains the reserved follow-up. process_file errors are still re-raised to the loop's handlers (compaction retry, failed_files). The loop's fall-through after dir_index was reached only by change/scan and is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Added 1c0e01c to this PR. It fixes a defect the promoted embed pass introduces. The window. The fix. The change/scan handling moves into Test.
Not reproduced end to end. It needs the file to be missing at the check while a follow-up was reserved during the promoted pass. That takes fault injection, so no end-to-end run was attempted. Run on Windows, Python 3.13, serially (
|
Two conflicts, both from chunkhound#508 landing on main while this branch moved the file-processing block into _process_file_mutation (its "end every active change in one place" commit): - chunkhound/services/realtime/pipeline.py: main changed the old inline block in _process_loop; this branch had removed that block. Kept this branch's structure and carried chunkhound#508's change into the helper: the event dedup entry is now cleared in the processing attempt's finally, whether or not processing succeeded, instead of only after a successful index. Same semantics as main; no other behaviour change. - tests/test_realtime_functional.py: both sides inserted tests at the same place. Kept all three: main's test_write_during_processing_inside_dedup_window_is_indexed and test_write_after_failed_processing_inside_dedup_window_is_indexed, and this branch's test_follow_up_reserved_before_missing_file_check_is_queued. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged
Upstream's CI matrix (Ubuntu, macOS, Windows) passed on this commit on my fork before I pushed it here. 🤖 Generated with Claude Code |
Brings in the 13 commits merged to main since this branch was last updated, including chunkhound#534's rust-checks fix. No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
No conflicts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
A chunk whose embedding is never written stays invisible to semantic search, while a regex search still finds it. Three gaps let that happen silently:
_MUTATION_PRIORITIES["embed"] = 2), so they run only when nochange/scan/dir_indexis queued. While files keep changing, that never happens. On a live server we observed embeds waiting over two hours, with ~530 chunks lacking vectors.chunkhound indexdoesn't fill them either: after a clean Rust run,DirectoryIndexingServiceskips the missing-embeddings pass, and the Rust pipeline embeds only files it (re)processes.daemon_statusreportsreadythroughout, with no coverage figure.Changes
fix(realtime)): once a pending embed has waited_EMBED_MAX_WAIT_SECONDS(60 s), the loop runs onegenerate_missing_embeddings()pass ahead of the next non-embed job. That pass covers every chunk missing a vector, so it settles all waiting embeds. Their queue entries are released and skipped as unowned when dequeued. A failed pass (compaction busy, provider error) leaves them pending and isn't retried until the interval passes again.fix(embeddings)):IndexingCoordinator.count_chunks_missing_embeddings()reuses the same anti-join thatgenerate_missing_embeddingsworks from, so the count and the repair can't disagree.realtime.embedding_coverage = {missing_chunks, checked_at}. If any chunks are missing and no embed is queued, it queues one. A check the database can't answer yet (Rust pipeline or compaction holds it) is retried after 30 s of idle. The check never raises, because an escaping error with the flag still set would spin the loop without yielding.DirectoryIndexingServicealways runs the missing-embeddings pass. When nothing is missing, it costs one query.Tests
test_overdue_embed_runs_ahead_of_queued_changes: an embed queued 5 minutes ago runs before a newer change, and its queue entry doesn't run again.test_idle_server_repairs_chunks_missing_vectors_and_reports_coverage: an idle server with 531 missing chunks fills them with no file event and reports 0.test_clean_rust_run_still_repairs_chunks_missing_vectors: a clean Rust run that skips every unchanged file still calls the repair pass.Each test fails when its change is removed. The realtime and directory-indexing unit tests (21) pass on this branch, which is based on
mainat e5f7e70.Live check
Run on a Windows box against a ~16k-chunk index with Voyage
voyage-code-4:chunkhound indexreported 16,139 chunks / 16,139 embeddings.daemon_statusshowedembedding_coverage.missing_chunks: 0.