search_graph: when only semantic_query is given, the results field returns the entire graph unfiltered
Summary
Calling search_graph with only semantic_query populates semantic_results correctly, but sets results to an unfiltered dump of the whole graph.
Repro
search_graph(project=…, semantic_query="…") with no query, name_pattern, or label:
semantic_results— correct and relevant (activation/publish functions, ~0.93 score)results—total: 21143; the first five entries are YAML labels from.github/issue-labeler.yml
Expected
When no structural criteria are supplied, results should be empty or omitted. The schema describes the two modes as independent, but "independent" should not mean "unconstrained".
Impact
The irrelevant block is larger than the useful one. For an MCP client this is both token waste and a citation hazard — an agent may quote from the dump believing it was retrieved for a reason.
Environment
- Version: codebase-memory-mcp 0.9.0 (release binary, darwin-arm64)
- OS: macOS 26.5.2, Apple Silicon
- Repo under test: DeusData/codebase-memory-mcp @ af3ffbd2 (21,143 nodes / 123,103 edges)
- Verified identically through both the MCP server and
climode (outputs byte-identical)
Thanks for the precise semantic-only reproduction. This is fixed on current main by 0e24f84: semantic-only calls now skip the unfiltered structural search path (src/mcp/mcp.c:3463-3477) and emit only semantic results. The commit also added regression coverage for the semantic-only response contract.
I am closing this as fixed on main. It will ship in the next release candidate. Thank you for catching the silent “entire graph” payload; that report directly matches the fixed branch condition.
Reopening — this was closed too early, and that is our mistake rather than a change of assessment.
The close cited 0e24f84 as fixing it on main. That commit is real and it does fix the reported behaviour, but only for the default (tree) output format. The format:"json" path was never touched: on current main, src/mcp/mcp.c:3555 still calls cbm_store_search unconditionally, so a semantic-only query with no structural filters still matches the entire graph and still produces the unfiltered dump described here.
So if you were hitting this through format:"json", nothing changed for you, and a closed issue told you otherwise. Apologies for that.
The remaining half is fixed by PR #1319 (@JJordan0C), which hoists the structural-filter check into a shared has_structural_filters so the two output paths cannot drift apart again, and adds a regression test that is genuinely binding on the JSON path — it fails on today's main with total:1 and the unrelated node present. That PR needs a rebase (its CI ran against a mid-transition main on 28 July and picked up two unrelated Windows failures that have since been fixed), and it is a merge candidate once green.
Leaving this open until that lands, so the issue state matches reality.
Correction to my reopening comment: the commit SHA I cited was wrong.
I wrote that the close had cited 0e24f84 as fixing this. That SHA is not on main — it lives on a local review branch and is an earlier rebase of PR #938, which shares the same title. I should have verified it before repeating it.
The isolation that actually is on main came from 4843a34, and it is live today at src/mcp/mcp.c:3540.
The reason for reopening is unchanged and still correct: that fix covers only the default (tree) output path. The format:"json" path still calls cbm_store_search unconditionally, so a semantic-only query with no structural filters still returns the whole graph through that format. PR #1319 fixes the residual and is a merge candidate once rebased.
Sorry for the churn on the notification.