mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-08 08:53:43 +08:00
An unbounded whole-graph OPTIONAL MATCH or a GROUP BY that produces roughly one group per node does O(bindings x groups) work in execute_return_agg and can run for minutes on a large graph before emitting a single row. The 100k row ceiling never fires (no rows are produced), so query_graph just hangs with no partial result and no error (#601). Arm a monotonic wall-clock budget (default 30s) at query entry and check it (throttled, every 1024 iterations) in the scan, relationship-expansion and aggregation hot loops. On expiry the query aborts with a clear, actionable error instead of hanging. A thread-local test hook forces the budget so the guard is covered by a deterministic reproduce-first test; a companion test confirms the default budget does not false-positive on a normal query. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>