fix: gracefully handle graph build failures in MCP and web endpoints
3 months ago
64ac478
Authored
asta-nguyen
- Wrap `ensureGraphReady` calls in try-catch to log errors instead of crashing MCP server
- Add `ensureGraphReadySafely` helper for `code_query` tool to prevent graph failures from blocking retrieval
- Use `Promise.allSettled` in `code_context` and `graph_neighbors` tools to continue with successful workspaces when some fail
- Return 500 error response from `/api/workspaces/:id/graph` endpoint on graph build failure instead of throwing
- Release graph build lease on CAS failure or error to prevent stale ownership locks