fix(stdio): short-circuit semantic_search when index is being rebuilt#163
Conversation
When a background indexer holds the index flock, ensureIndexed sets out.StaleWarning and returns immediately, but handleSemanticSearch then proceeded to call embedQuery. On a single-instance embedding backend (e.g. LM Studio) saturated by the indexer's 32-chunk batches, the query embed queues behind those batches and the MCP call hangs well past Claude Code's timeout — the user sees an infinite "loading" state and never receives the warning text telling them to use standard tools for the next 10 calls. Reproduced reliably with two parallel semantic_search calls into different subdirectories of a monorepo while a background lumen index of the monorepo root holds the flock. After the fix both responses return in ~0.4s with the StaleWarning text instead of timing out at 100s. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a short-circuit optimization to ChangesStale Warning Short-Circuit
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Reproduction
Two parallel `semantic_search` MCP calls into different subdirectories of a monorepo (`/cloud/kratos` and `/cloud/keto`) while a background `lumen index /cloud` holds the shared-effective-root flock.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit