Skip to content

fix: remove 3 phantom lifecycle hooks from strray-hermes plugin#21

Merged
htafolla merged 1 commit intomasterfrom
fix/remove-phantom-hooks
Mar 30, 2026
Merged

fix: remove 3 phantom lifecycle hooks from strray-hermes plugin#21
htafolla merged 1 commit intomasterfrom
fix/remove-phantom-hooks

Conversation

@htafolla
Copy link
Copy Markdown
Owner

Problem

Plugin startup prints 3 warnings every session:

Plugin 'strray-hermes' registered unknown hook 'on_file_write' (valid: on_session_end, on_session_start, post_llm_call, post_tool_call, pre_llm_call, pre_tool_call)
Plugin 'strray-hermes' registered unknown hook 'on_validation_result'
Plugin 'strray-hermes' registered unknown hook 'on_error'

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:

  1. plugin.yaml still declared them in provides_hooks, triggering validation warnings at discovery time (before the try/except runs)
  2. The handlers were dead code — _modified_files and _validation_results were write-only (never consumed by anything)
  3. _on_error's bridge_errors increment was redundant with _call_bridge's own error counting

Fix

  • Remove 3 phantom hooks from plugin.yaml provides_hooks
  • Remove 3 handler functions + 3 tracking lists + registration loop from __init__.py
  • Remove TestLifecycleHooks test class (9 tests for dead code)
  • Update hook count in log messages and docs (5 → 2 hooks)
  • 120/120 tests pass

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)
@htafolla htafolla merged commit cdf4d20 into master Mar 30, 2026
14 of 17 checks passed
@htafolla htafolla deleted the fix/remove-phantom-hooks branch March 30, 2026 16:12
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.

1 participant