fix(ctx_search): label the BM25 fallback when the dense index is missing - #1261
Merged
Conversation
action=semantic (no mode) and ctx_compose resolve to BM25 ranking, but reported it as "Semantic search (BM25)" — a calling agent reads that as "semantic search ran", not "semantic search was unavailable". mode=dense already fails fast with an actionable build hint; the default path did not. When no mode was requested and embeddings.bin is absent (dense enabled but never built), the header now names the degradation and the fix: Lexical search (BM25 — dense index not built, run: lean-ctx index build-semantic) Explicit mode=bm25 is unchanged — that is not a degradation. The check is a file-existence test, no embedding-engine load on the search path. Fixes yvgude#1259 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1259
action=semantic(nomode) andctx_composeresolve to BM25 ranking, but reported it asSemantic search (BM25). A calling agent reads that as "semantic search ran", not "semantic search was unavailable".mode=densealready fails fast with an actionable build hint; the default path did not.Change
When no mode was requested and
embeddings.binis absent (dense enabled in config, never built), the header names the degradation and the one command that fixes it:Compact/TDD header gets
semantic_search(bm25,dense-not-built,K).mode=bm25is unchanged — that is a request, not a degradation.dense_enabled = false(doctor false positives for OpenCode: MCP config checks mcp.servers.lean-ctx but OpenCode uses mcp.lean-ctx; SKILL.md candidates omit OpenCode path #686) reports nothing — there is nothing to build.dense_index_missing()is a file-existence check, so no embedding-engine load lands on the search path.ctx_composepassesmode=None, so it is covered by the same fix.The BM25 fallback itself stays — it beats erroring out. Only the label was wrong.
Test
dense_availability_tests::missing_embeddings_bin_is_reported_as_degraded🤖 Generated with Claude Code