feat: Typed Hook Payloads (Phase 2) + Path Parity Tests (Phase 3)#29048
Open
zccyman wants to merge 1 commit into
Open
feat: Typed Hook Payloads (Phase 2) + Path Parity Tests (Phase 3)#29048zccyman wants to merge 1 commit into
zccyman wants to merge 1 commit into
Conversation
… FR NousResearch#28984 Phase 2 — Typed Hook Payloads: - New hermes_cli/hook_payloads.py: frozen dataclass payloads for 14 hooks (PreToolCall, PostToolCall, TransformToolResult, SessionStart/End/ Finalize/Reset, PreApproval, PostApproval, PreLlm, PostLlm, PreApi, PostApi, SubagentStop) - payload_to_kwargs() bridges dataclass→plain dict for cb(**kwargs) compat - HOOK_PAYLOAD_TYPES registry maps hook names to payload classes - 5 call sites migrated: get_pre_tool_call_block_message (plugins.py), on_session_start + pre_llm_call (conversation_loop.py), post_tool_call + transform_tool_result (model_tools.py) - 21 new tests in test_hook_payloads.py Phase 3 — Path Parity Tests: - New hermes_cli/path_parity.py: assert_field_parity() helper Verifies all execution paths consume the same config fields Turns silent divergence bugs into CI failures - 3 known divergences documented as failing tests (NousResearch#28753, NousResearch#28746, NousResearch#28637) - 13 new tests in test_path_parity.py Ref: FR NousResearch#28984 (Typed Config-Runtime Contract) Closes NousResearch#28961
This was referenced May 20, 2026
fix(gateway): recognize Windows drive-letter paths in extract_local_files() bare-path uploads
#28991
Closed
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.
Summary
Implements Phase 2 (Typed Hook Payloads) and Phase 3 (Path Parity Tests) of FR #28984.
Phase 1 was submitted separately as PR #28995.
Phase 2 — Typed Hook Payloads
New file:
hermes_cli/hook_payloads.py(276 lines)Defines frozen dataclass payloads for all 14 hook types:
pre_tool_callPreToolCallPayloadpost_tool_callPostToolCallPayloadtransform_tool_resultTransformToolResultPayloadon_session_startSessionStartPayloadon_session_endSessionEndPayloadon_session_finalizeSessionFinalizePayloadon_session_resetSessionResetPayloadpre_approval_requestPreApprovalRequestPayloadpost_approval_responsePostApprovalResponsePayloadpre_llm_callPreLlmCallPayloadpost_llm_callPostLlmCallPayloadpre_api_requestPreApiRequestPayloadpost_api_requestPostApiRequestPayloadsubagent_stopSubagentStopPayloadpayload_to_kwargs()converts dataclass → plain dict, preservingcb(**kwargs)compatibility for all existing plugin callbacks.5 call sites migrated (adds type safety, zero breaking changes):
hermes_cli/plugins.pyget_pre_tool_call_block_message()agent/conversation_loop.pyon_session_start,pre_llm_callmodel_tools.pypost_tool_call,transform_tool_resultNew tests:
tests/hermes_cli/test_hook_payloads.py— 21 tests covering all payloads, frozen immutability, round-trip, registry completeness.Phase 3 — Path Parity Tests
New file:
hermes_cli/path_parity.py(155 lines)When any path does not consume the field, raises
PathParityErrorwith a diff showing which paths are missing it.3 known divergences documented as failing tests:
#28753: TUI doesn't passfallback_modelto AIAgent#28746: idle-expiry path doesn't emitsession:endevent#28637:/modelswitch loses per-model token usageNew tests:
tests/hermes_cli/test_path_parity.py— 13 tests covering the helper functions and documented divergence patterns.What This Prevents
pre_tool_callfallback_modeladded to gateway but forgotten in TUIassert_field_parityfails in CIsession:endforgotten in one exit pathTest Results
Refs: FR #28984 | PR #28995 (Phase 1)