Skip to content

[Bug] Critical: _process_result always returns None for normal-sized results — silently breaks all code retrieval #724

@Siva141909

Description

@Siva141909

Summary

_process_result in GetCodeFromNodeIdTool has a missing return statement, causing it to return None for virtually all results. AI agents silently receive None instead of actual code.

File

app/modules/intelligence/tools/kg_based_tools/get_code_from_node_id_tool.py

Description

The method _process_result only has a return statement inside an if len(str(result)) > 80000: block. For any result under 80,000 characters (the overwhelming majority), the method falls off the end and implicitly returns None.

def _process_result(self, result):
    truncated_result = truncate_dict_response(result)
    if len(str(result)) > 80000:
        logger.warning(...)
        return truncated_result
    # ← Missing: return result
    # Method implicitly returns None here!

Impact

  • Any AI agent using get_code_from_node_id receives None instead of the actual code
  • Silently breaks code retrieval for the entire codebase — QnA, debugging, and test generation pipelines all affected
  • No error is raised, making this very hard to debug

Expected Behavior

The method should return the actual result when it's under the size limit.

Suggested Fix

Add return result as the final line of _process_result:

def _process_result(self, result):
    truncated_result = truncate_dict_response(result)
    if len(str(result)) > 80000:
        logger.warning(...)
        return truncated_result
    return result  # ← Add this line

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions