Skip to content

fix: resolve tool serializers per call, not at import - #122

Merged
iap merged 1 commit into
mainfrom
fix/lazy-tool-helpers
Oct 23, 2026
Merged

iap merged 1 commit into
mainfrom
fix/lazy-tool-helpers

Conversation

@iap

@iap iap commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

What kind of change is this?

  • bug fix + test

Summary

Importing the plugin module called _tool_result_helpers() at module level, which imported tools.registry at import time. pytest imports this repo's conftest.py as builder.conftest (the repo root is a package), so builder/__init__.py executes before conftest can put Hermes core on sys.path — and tools bound to whichever hermes-agent was pip-installed rather than the pinned checkout CI and local runs are meant to exercise.

model_tools then came from the pinned core while tools.registry came from the installed copy, so the chat-dispatch integration tests failed to import and skipped themselves instead of running.

Resolving per call removes the import-time dependency on core and restores the pinned checkout as the source of tools. This is also the shape used before the refactor that introduced the module-level constants. No test referenced the removed _TOOL_RESULT / _TOOL_ERROR constants.

Branch

  • fix/…

Checklist

  • Tests pass: python3 -m pytest tests/ -q
  • verify.py is green
  • No raw tokens/secrets in code, logs, or tool output
  • Adapter stays loopback-only unless an explicit guard is added
  • Updated docs/README if user-facing behavior changed

Verification

  • .venv/bin/python -m pytest -q → 264 passed, 1 skipped (was 263 passed / 1 failed / 1 skipped, with 5 integration tests skipping)
  • python verify.py → all checks passed
  • With no pinned checkout at HERMES_HOME, the provider test fails again — so this does not mask a real requirement.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

__init__.py now resolves tool serializers when _success() or _error() runs, rather than when the plugin loads.

  • Builder tool replies use the Hermes serializers available when each call runs.

Reviews (1) · Last reviewed commit: "fix: resolve tool serializers per call, ..." · Reviewed by Greptile

Importing this module called `_tool_result_helpers()` at module level, which
imported `tools.registry` at import time. pytest imports the repo's conftest.py
as `builder.conftest` (the repo root is a package), so `builder/__init__.py`
executes before conftest can put Hermes core on sys.path -- and `tools` bound to
whichever hermes-agent was pip-installed rather than the pinned checkout the
tests are meant to exercise. `model_tools` then came from the pinned core while
`tools.registry` came from the installed copy, so the chat-dispatch integration
tests failed to import and skipped themselves instead of running.

Resolving per call removes the import-time dependency on core and restores the
pinned checkout as the source of `tools`. No test referenced the removed
`_TOOL_RESULT` / `_TOOL_ERROR` module constants.

Verified: `.venv/bin/python -m pytest -q` -> 264 passed, 1 skipped (was 263
passed / 1 failed / 1 skipped with the integration tests skipping); verify.py
green. Without a pinned checkout at HERMES_HOME the provider test fails again,
so this does not mask a real requirement.
@github-actions github-actions Bot added the bug Something isn't working label Oct 23, 2026
@iap
iap merged commit 04d104c into main Oct 23, 2026
8 checks passed
@iap
iap deleted the fix/lazy-tool-helpers branch October 23, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant