codebase-memory-mcp icon indicating copy to clipboard operation
codebase-memory-mcp copied to clipboard

search_graph: an empty result says the label has no nodes when another filter emptied it

Open nefayran opened this issue 2 months ago • 1 comments

Written with Claude Code (Claude Opus 5.5).

Version

codebase-memory-mcp 0.11.0

Platform

macOS (Apple Silicon)

Install channel

GitHub release archive / install.sh / install.ps1

Binary variant

standard

What happened, and what did you expect?

An empty search_graph page that has a label always carries the hint No nodes have this label; inspect get_graph_schema., whatever emptied it.

An agent that reads this hint concludes the project has no functions, which is the wrong answer to a dead-code question. In src/mcp/mcp.c the hint is picked from label alone (} else if (label) {), without looking at the other filters.

I have a fix with a test: when another filter is set, check the label on its own with a one-row search, and blame the label only if it matches nothing; otherwise say to relax the other filters. I'll open it as a PR that references this issue.

Reproduction

A repo with one file, app.py:

def helper():
    return 1


def used():
    return helper()


def unused():
    return 2


class Foo:
    def method(self):
        return used()

Indexed with mode: full. search_graph {"label": "Function"} returns five Function nodes. Each of these returns zero rows and the same hint:

{"project":"traps","label":"Function","relationship":"CALLS","max_degree":0}
{"project":"traps","label":"Function","file_pattern":"no/such/*"}
{"project":"traps","label":"Function","relationship":"IMPORTS"}

results: 0  (cols: qn label file lines in out)
hint: "No nodes have this label; inspect get_graph_schema."

Logs

No response

Diagnostics trajectory (memory / performance / leak issues)

No response

Project scale (if relevant)

No response

Confirmations

  • [X] I searched existing issues and this is not a duplicate.
  • [X] My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.

nefayran avatar Oct 01 '26 10:10 nefayran

Thank you for the clear reproduction and for following up with #2456. I checked the hint selection on current main: the empty-result branch selects the label explanation without checking which other filter removed the matches. That supports the distinction you describe. This is now tagged as a bug and linked here to the proposed fix; it stays open until the fix is reviewed and landed.

DeusData avatar Oct 01 '26 17:10 DeusData