CLEAN-100: bound every LightRAG call, say so when it hangs - #92
Open
mykyta-torbynskyi wants to merge 2 commits into
Open
mykyta-torbynskyi wants to merge 2 commits into
mykyta-torbynskyi wants to merge 2 commits into
Conversation
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Jira: CLEAN-100. Two commits.
Incident (Mazda dev, 2026-09-18 12:32 UTC). LightRAG's Postgres pod was moved to another node. The data survived (PVC), Postgres was back within a minute, but LightRAG kept a pool of connections to the pod that was gone:
/healthand/documents/pipeline_statusanswered in 0.5 s, everything that touches the database hung (/documentsdid not answer in 120 s), its log went silent. It did not recover on its own; deleting the LightRAG pod fixed it (a query went from "never" to 17 s). For an hour everyquery_knowledgehung until the MCP client's own 60 s limit and surfaced asMCP error -32001: Request timed out, which sent people looking at MCP. The API log had no line of ours about it.Gaps. None of
LightragHttpClient's calls except/healthhad a timeout. The index reconciler awaits them inside itsrunninglock, so one hunglistDocumentsand no pass would ever run again until the API restarted. An Index run against such an instance would upload source after source into the same hang.Change.
bounded): 30 s for status reads, 50 s for a query (under the MCP client's 60 s on purpose), 60 s for the graph, two minutes for an upload, five for a delete. A cut-short exchange is aLightragTimeoutError(aLightragClientError, status 504, names the path and the wait); anything else passes through untouched. The message reads... timed out after N s, which the retry classifier from CLEAN-96 already treats as transient.query_knowledge: a base that does not answer is reported to the agent in words ("is not answering right now ... most likely restarting ... try again in a few minutes") instead of a transport error, and the per-base failure is now logged (query_knowledge failed for agent=... knowledge=...). It used to be folded into a normal result without a log line./healthonce and logs one error line naming the state:answers /health but /documents timed out after 30 s: its database connections are most likely stuck ... Restart the LightRAG pod. That is the line to alert on. Any other listing failure stays non-fatal, as before.Out of scope: restarting LightRAG from Ranch; a liveness probe that touches the database in the chart (gitops).
Verified:
bun run build,generate:swaggerboots,bunx jest src/slices/reins: 20 suites, 225 tests. New specs: the client against a fetch that never resolves on fake timers (gives up at 50 s and not at 49, bounds the reads, aborts the socket, leaves no timer behind, passes other failures through), the tool's wording, the gateway stepping aside in an index run, a reconcile pass and a retry pass.