Skip to content

fix(graph): report k-hop relation and depth limitations - #3427

Merged
ruvnet merged 1 commit into
ruvnet:mainfrom
rudycelekli:fix/graph-query-contract-3202
Sep 26, 2026
Merged

ruvnet merged 1 commit into
ruvnet:mainfrom
rudycelekli:fix/graph-query-contract-3202

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

Problem

agentdb_graph-query accepts relation and advertises five-hop k-hop queries. The native backend ignores relation, while the SQL fallback executes at most three hops but reports the requested depth. A caller can treat an over-broad result or an incomplete cycle check as authoritative.

Change

Native graph-node now returns a machine-readable unsupported: "relation" error for filtered k-hop queries. Its kHopNeighbors API cannot filter, and the native and SQL stores are not an atomic mirror (agentdb_causal-edge writes SQL asynchronously), so silently switching to SQL could create a false negative. When native is unavailable, the SQL path still applies the relation predicate. Every successful k-hop response now reports appliedDepth; SQL responses set truncated: true when the existing three-hop bound clips the request. The tool description explains both limits.

Validation

  • Focused Vitest regression: 6/6 pass, covering native unfiltered, native filtered refusal, SQL filtered, missing backends, and SQL depth 5 versus 2.
  • The same test against origin/main fails 6/6 cases.
  • git diff --check: pass.

The tests mock backend availability and inspect the SQL sent to the query layer; they do not claim a real native/SQLite integration run. The existing SQL depth bound is preserved to avoid expanding recursive-query cost in this fix.

Fixes #3202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agentdb graph k-hop: native backend ignores relation; SQL fallback caps depth at 3 while callers ask for 5

2 participants