agentmemory icon indicating copy to clipboard operation
agentmemory copied to clipboard

Bug: /graph/query and /graph/stats still return "Invocation stopped" on v0.9.26 at large corpus, even with limit=10 (related to #753 / #309)

Open allandelmare opened this issue 6 months ago • 0 comments

The following was generated with the help of Claude Code. Apologies for any AI-slop — please let me know if there's problems so I can improve my prompting.

Summary

On v0.9.26, /graph/query and /graph/stats time out with {"error":"Invocation stopped"} on a large existing corpus, even with limit=10. The viewer-tab cosmetic fix from #753 / v0.9.25 loads (HTTP 200), but the underlying query/stats code paths still fail. Believe this is the same root cause #309 was closed for — that epic targeted the right layer but the actual SQLite migration of graph enumeration didn't land. PR #764 (sharded snapshots) is a different code path (search-index persistence, not graph node enumeration).

Environment

  • agentmemory v0.9.26 (fresh upgrade from 0.9.24)
  • macOS Darwin 25.2.0 arm64, Node 26 (Homebrew)
  • iii engine RSS: 1.14 GB (healthy)
  • LLM/embeddings: OpenRouter (gemini-2.5-flash-lite + openai/text-embedding-3-small)
  • Existing corpus: 680 sessions, 131 memories, ~75K graph nodes from prior usage

Reproduction

# All three fail with "Invocation stopped":
curl -s -X POST http://localhost:3111/agentmemory/graph/query \
  -H "Content-Type: application/json" -d '{}'
curl -s -X POST http://localhost:3111/agentmemory/graph/query \
  -H "Content-Type: application/json" -d '{"limit": 10}'
curl -s http://localhost:3111/agentmemory/graph/stats
# All return: {"error":"Invocation stopped","error_id":"..."}

What works

  • /agentmemory/health — full metrics (1099/1100 compress successes, 94.5 avg quality)
  • /agentmemory/sessions?limit=100000 — 680 sessions in <1s
  • /agentmemory/memories?count=true — 131/133
  • Viewer at :3113 — loads 200 OK (the v0.9.25 graceful empty-state)
  • Compression / summarization pipeline — running normally
  • Smart-search / recall (BM25 + vector) — responsive

Hypothesis

The v0.9.25 fix added pagination + a degree-ranked default cap to /graph/query, but the cap appears to still enumerate the full node set via state::list / kv.list before sorting/slicing. At 75K nodes, that enumeration trips the 180s timeout regardless of the requested limit.

The proper fix would be #309's architecture: graph state moved out of in-memory KV into SQLite with indexed degree/recency queries, so the "top N by degree" doesn't require a full enumeration. PR #764 sharded search-index snapshots — different concern.

Impact

Stable daemon (the crash loops are gone — thanks for that wave), but the graph dimension of the product is effectively unavailable to any user with > ~10K nodes. We previously reported related issues #544, #563, #474, #587, #753 (all now closed); this is the last remaining piece to unlock the graph layer.

Happy to test patches against this corpus.

allandelmare avatar Jun 03 '26 15:06 allandelmare