fix(mcp): add grep timeout, error logging, and fs fallback on VikingDB failure - #2854
fix(mcp): add grep timeout, error logging, and fs fallback on VikingDB failure#2854lg320531124 wants to merge 1 commit into
Conversation
…B failure Three improvements to the grep tool's VikingDB query handling: 1. **Timeout**: Add OPENVIKING_GREP_TIMEOUT_SEC env var (default 10s). VikingDB BM25 queries that exceed this timeout are cancelled and logged as warnings instead of hanging indefinitely. 2. **Error logging**: VikingDB query failures are now logged as warnings instead of being silently swallowed (previously — no log, no retry). 3. **Fs grep fallback**: When OPENVIKING_GREP_FALLBACK_ON_EMPTY=1 (default), patterns that failed in VikingDB are retried with the filesystem grep engine. This handles the common case where VikingDB returns empty due to index staleness or query timeout, but the content exists on disk. Environment variables: - OPENVIKING_GREP_TIMEOUT_SEC: query timeout in seconds (default: 10) - OPENVIKING_GREP_FALLBACK_ON_EMPTY: enable fs fallback (default: 1) Fixes volcengine#2850
|
看了一下,这个 PR 先不合入,主要是当前实现没有真正解决 #2850 的问题。 现有 另外,issue 里更关键的场景是“VikingDB 返回空结果,但内容实际存在”。当前改动只在 timeout/exception 时标记 建议后续把修复收敛到 |
|
Thanks for the precise review — all three points are addressed in the redo, #2900 (storage layer only, MCP untouched):
No Closing this one in favor of #2900 as you suggested. |
Problem
The grep tool silently swallows VikingDB query failures —
except Exception: return (p, [])returns empty results with no logging, no retry, and no fallback. On large corpora (10K+ resources), VikingDB BM25 queries can timeout or return empty even when matching content exists.Fix
Three improvements:
OPENVIKING_GREP_TIMEOUT_SEC, default 10s): VikingDB queries that exceed this are cancelled and logged as warningsOPENVIKING_GREP_FALLBACK_ON_EMPTY, default enabled): When VikingDB queries fail, retry with filesystem grep engineBefore
After
Environment Variables
OPENVIKING_GREP_TIMEOUT_SEC10OPENVIKING_GREP_FALLBACK_ON_EMPTY1Fixes #2850