diff --git a/src/vuln_analysis/tools/transitive_code_search.py b/src/vuln_analysis/tools/transitive_code_search.py index c1beb334f..247f7516d 100644 --- a/src/vuln_analysis/tools/transitive_code_search.py +++ b/src/vuln_analysis/tools/transitive_code_search.py @@ -340,6 +340,16 @@ async def _arun(query: str) -> tuple: git_repo, ref, worker_search_and_summarize, store_key, validation_result, ) + # When the initial function was not found in the package at all + # (empty call_hierarchy_list), add a distinct message so the agent + # doesn't confuse "function not found" with "function not reachable." + if not found_path and not path_summary: + function_name = validation_result.split(",", 1)[1].strip() + pkg = validation_result.split(",")[0].strip() + path_summary.append( + f"INFO: Function '{function_name}' was not found in package '{pkg}'. " + f"No reachability analysis was performed." + ) package_name = validation_result.split(",")[0].strip() try: supported_packages, _ = await run_in_cpu_process(