Skip to content

fix(hermes-plugin): always advertise tool schemas so they are routable before initialize() - #898

Open
francialisomlimoeiro wants to merge 1 commit into
TencentCloud:feat/serverfrom
francialisomlimoeiro:pr/fix-tool-schema-routing
Open

fix(hermes-plugin): always advertise tool schemas so they are routable before initialize()#898
francialisomlimoeiro wants to merge 1 commit into
TencentCloud:feat/serverfrom
francialisomlimoeiro:pr/fix-tool-schema-routing

Conversation

@francialisomlimoeiro

Copy link
Copy Markdown

What it does

MemoryManager.add_provider() indexes get_tool_schemas() into the tool-routing table BEFORE initialize(). The old gateway-availability gate returned [] when the Gateway was not yet reachable and no Gateway env var was set, so the routing table stayed empty forever and every tool call failed with Unknown tool: memory_tencentdb_* — even after initialize() succeeded.

Changes:

  • get_tool_schemas() always returns both static schemas; Gateway health is enforced at call time (handle_tool_call / _ensure_alive_for_request).
  • src/core/hooks/auto-recall.ts: MEMORY_TOOLS_GUIDE + truncation suffix now reference the tool names the plugin actually registers (removes legacy tdai_* names from advertised guidance).
  • README troubleshooting entry updated.
  • New test tests/test_tool_schema_routing.py (4 tests).

Tests

PYTHONPATH=<hermes-agent checkout> python3 -m pytest tests/test_tool_schema_routing.py
# 4 passed

(schemas advertised while uninitialized and without Gateway env; advertised names dispatchable via stub client; unknown names rejected)

…e before initialize()

MemoryManager.add_provider() indexes get_tool_schemas() into the
tool-routing table BEFORE initialize() runs. The previous
gateway-availability gate made get_tool_schemas() return [] whenever
the Gateway was not yet reachable and no Gateway env var was set, so
the routing table stayed empty forever and every tool call failed with
"Unknown tool: memory_tencentdb_*" — even after initialize() succeeded.

The schemas are static; Gateway health is already enforced at call time
(handle_tool_call / _ensure_alive_for_request), so always advertise
both tools instead of hiding them.

Also align the auto-recall MEMORY_TOOLS_GUIDE and truncation suffix
with the tool names the plugin actually registers, and update the
README troubleshooting entry.

Adds tests/test_tool_schema_routing.py: schemas advertised while
uninitialized and without Gateway env, advertised names dispatchable,
unknown names still rejected (4 tests, mock client — no Gateway).
@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thanks for your contribution and attention! We will review this PR and get back to you as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants