fix: remove 3 phantom lifecycle hooks from strray-hermes plugin#21
Merged
fix: remove 3 phantom lifecycle hooks from strray-hermes plugin#21
Conversation
The Hermes plugin declared on_file_write, on_validation_result, and on_error as provides_hooks in plugin.yaml, but the OpenCode host only supports: on_session_end, on_session_start, post_llm_call, post_tool_call, pre_llm_call, pre_tool_call. This caused 'registered unknown hook' warnings on every plugin load. The three handlers were dead code — _modified_files and _validation_results were write-only (never consumed), and _on_error's bridge_errors increment was redundant with _call_bridge's own error counting. Removes: - 3 phantom hooks from plugin.yaml provides_hooks - 3 handler functions (_on_file_write, _on_validation_result, _on_error) - 3 tracking lists (_modified_files, _validation_results, _errors) - registration loop in register() - TestLifecycleHooks test class (9 tests) - hook count claims in docs and log messages (5 hooks → 2 hooks)
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.
Problem
Plugin startup prints 3 warnings every session:
The host only supports 6 hooks. The plugin declared 5 (2 real + 3 phantom).
Root cause
The three hooks (
on_file_write,on_validation_result,on_error) were aspirational — the framework never added them as dispatchable hook types. The Python code wrapped their registration in try/except so it didn't crash, but:provides_hooks, triggering validation warnings at discovery time (before the try/except runs)_modified_filesand_validation_resultswere write-only (never consumed by anything)_on_error'sbridge_errorsincrement was redundant with_call_bridge's own error countingFix
plugin.yamlprovides_hooks__init__.pyTestLifecycleHookstest class (9 tests for dead code)