You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(cli/mcp): path → repo_path aliasing breaks calculate_cyclomatic_complexity — passing the documented disambiguation arg makes it return null #1532
The MCP dispatcher aliases path and repo_path in both directions. The path_means_file guard covers only the repo_path → path direction; the path → repo_path branch still fires for tools where path means a file.
calculate_cyclomatic_complexity documents path as "Optional file path to disambiguate the function", but the alias copies it into repo_path, which the handler uses as a repository prefix filter:
WHERE (f.pathENDSWITH $pathORf.path= $path)
ANDf.pathSTARTSWITH $repo_path
Reproduction
Captured params for calculate_cyclomatic_complexity(function_name="parse", path="src/foo.py"):
Stored f.path is absolute (per schema_contract.FILE_MERGE_KEYS), so STARTS WITH 'src/foo.py' is never true.
Impact
Passing path to disambiguate — exactly what the schema tells the agent to do — makes the tool return results: null for a function that exists. Omitting path works. So the documented disambiguation parameter is the thing that breaks it, which is a confusing failure for an agent to recover from.
Suggested fix
Add calculate_cyclomatic_complexity to the path_means_file set so the path → repo_path aliasing is skipped for it, as is already done for the reverse direction.
Environment
Commit
c0e0bed (main)
Python
3.12.3, Linux
Reproduced by capturing the dispatcher's outgoing params and running the resulting query shape.
I'd like to work on this issue under GSSoC'26. Please assign it to me.
Understanding
In server.py, path_means_file already protects the repo_path → path alias for calculate_cyclomatic_complexity, but the reverse path → repo_path branch still runs. So when an agent passes path="src/foo.py" for disambiguation, it also becomes repo_path, and the Cypher STARTS WITH $repo_path filter never matches absolute file paths — the tool returns null.
Approach
Reproduce with calculate_cyclomatic_complexity(function_name=..., path=...) and confirm outgoing args get repo_path copied from path.
Extend the path_means_file guard so the path → repo_path alias is also skipped for this tool (and audit if any other tools treat path as a file, not a repo).
Add a unit/regression test that passes path as a file disambiguator and asserts repo_path is not set / complexity results are returned.
Activity
github-actions commentedon Aug 1, 2026
Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ
ASHMEET555 commentedon Aug 6, 2026
Hi @Shashankss1205 👋
I'd like to work on this issue under GSSoC'26. Please assign it to me.
Understanding
In
server.py,path_means_filealready protects therepo_path → pathalias forcalculate_cyclomatic_complexity, but the reversepath → repo_pathbranch still runs. So when an agent passespath="src/foo.py"for disambiguation, it also becomesrepo_path, and the CypherSTARTS WITH $repo_pathfilter never matches absolute file paths — the tool returnsnull.Approach
calculate_cyclomatic_complexity(function_name=..., path=...)and confirm outgoing args getrepo_pathcopied frompath.path_means_fileguard so thepath → repo_pathalias is also skipped for this tool (and audit if any other tools treatpathas a file, not a repo).pathas a file disambiguator and assertsrepo_pathis not set / complexity results are returned.Thanks!
ASHMEET555 commentedon Aug 15, 2026
HI @Shashankss1205 i have fixed this issue in the PR #1638 , review and merge it.
Thanks