Skip to content
TheChatArchiveThe Chat Archive
composer-2.5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

Untitled conversation

  1. User

    [BUG] @Tool methods not inherited from superclas @Tool methods not inherited from superclass. I think this is a bug as this is something that should work.

    I didn't 100% verify this, but my inherited tools weren't being called and the LLM was stating that it didn't know what tool to call. Once I put the tool methods back in the concrete class, things worked, so I'm assuming that this bug report is true.

    This should be done in LC4J too if it already doesn't work there.

    Interface

    No new interfaces are introduced.

  2. Assistant

    I'll investigate how @Tool methods are discovered in the codebase and whether superclass methods are included in that scan.

  3. Assistant

    Confirmed: tool discovery uses getDeclaredMethods() only, so superclass @Tool methods are skipped. I'll add hierarchy traversal and tests.

  4. Assistant

    Duplicate detection was broken by putIfAbsent silently dropping same-class overloads. I'll validate duplicates before deduplicating for inheritance.

  5. Assistant

    You were right — this was a bug. @Tool discovery only scanned getDeclaredMethods() on the concrete class, so tools defined in a superclass were never registered or executed.

    Root cause

    Three places only looked at methods declared on the runtime class:

    • ToolSpecifications.toolSpecificationsFrom() — tool specs sent to the LLM
    • ToolService.findTools() — tool registration in AI Services
    • DefaultToolExecutor.findMethod() — tool execution lookup

    Fix

    Added ToolSpecifications.toolMethodsFrom() which walks the class hierarchy (subclass → superclass) and collects all @Tool-annotated methods. Subclass methods take precedence when they override a superclass tool with the same name. Same-class duplicate tool names still fail validation as before.

    Updated all three call sites to use this shared logic.

    Tests added

    • Inherited tools are included in ToolSpecifications
    • Subclass overrides of superclass tools deduplicate correctly
    • ToolService.findTools() picks up inherited tools
    • DefaultToolExecutor can execute inherited tools

    This applies to both core LangChain4j and AI Services (and agentic, which builds on the same ToolService). You can now define @Tool methods in a base class and use them from subclasses without re-declaring them.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.