Repository navigation
fix: resolve tool serializers per call, not at import - #122
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change is this?
Summary
Importing the plugin module called
_tool_result_helpers()at module level, which importedtools.registryat import time. pytest imports this repo'sconftest.pyasbuilder.conftest(the repo root is a package), sobuilder/__init__.pyexecutes before conftest can put Hermes core onsys.path— andtoolsbound to whichever hermes-agent was pip-installed rather than the pinned checkout CI and local runs are meant to exercise.model_toolsthen came from the pinned core whiletools.registrycame 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_ERRORconstants.Branch
fix/…Checklist
python3 -m pytest tests/ -qverify.pyis greenVerification
.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 passedHERMES_HOME, the provider test fails again — so this does not mask a real requirement.

Confidence Score: 5/5
The PR appears safe to merge.Summary
__init__.pynow resolves tool serializers when_success()or_error()runs, rather than when the plugin loads.Reviews (1) · Last reviewed commit: "fix: resolve tool serializers per call, ..." · Reviewed by Greptile