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): find_callers collapses every row's target_file_path to the first row's, misattributing callers across same-named functions #1530
next(...) consumes only the first generator item, so the envelope gets row 0's value — but the surrounding loop still pops the field off all remaining rows, discarding their (different) values.
When context is not supplied, who_calls_function matches Function {name: $function_name} across all files, so rows legitimately carry different target_file_path values.
Reproduction
Two result rows targeting /repo/models/user.py and /repo/models/order.py produce:
{
"target_file_path": "/repo/models/user.py",
"callers": [ ...both callers, under the one path... ]
}
Impact
Ask for callers of any common method name — save, run, handle, get — that exists in several files, and every caller is reported as calling the definition in whichever file happened to sort first. An agent acting on that reads or edits the wrong file, with nothing in the response signalling ambiguity.
Suggested fix
Either keep target_file_path per row (drop the envelope hoist), or group results by target path and return a list of {target_file_path, callers} groups so genuine ambiguity is visible to the caller.
Environment
Commit
c0e0bed (main)
Python
3.12.3, Linux
Reproduced by driving the result-shaping code with two rows carrying distinct target paths.
target_file_path is now hoisted to the envelope only when every row agrees. When the rows genuinely disagree — which is what happens without context, since who_calls_function matches Function {name} across every file — the field stays on each row and the envelope carries a note:
"'save' is defined in 2 files; each result carries its own target_file_path.
Pass `context` to disambiguate."
The payload-slimming that motivated the original code is preserved for the unambiguous case. Regression test asserts both directions.
Activity
github-actions commentedon Aug 1, 2026
Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ
fix(query): five defects that returned wrong answers without erroring (…
Shashankss1205 commentedon Aug 5, 2026
Fixed in #1577 (merged).
target_file_pathis now hoisted to the envelope only when every row agrees. When the rows genuinely disagree — which is what happens withoutcontext, sincewho_calls_functionmatchesFunction {name}across every file — the field stays on each row and the envelope carries a note:The payload-slimming that motivated the original code is preserved for the unambiguous case. Regression test asserts both directions.