mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-06 05:17:15 +00:00
- plugin_host_wire: an error crossing the host now carries the nearest builtin base class, so a ValueError subclass (json.JSONDecodeError) raised by a hosted provider's write_config_fields is still a ValueError in core and the dashboard returns 400, not 500. - notify_memory_provider catches SystemExit as well as Exception: a provider hook that exits no longer skips rename's alias, active-profile and identity updates. - Docs and docstring: a key missing from the target profile's .env reads as unset; the hooks never fall back to the caller's environment. - Memory panel GET maps a provider read failure like PUT does (ValueError -> 400). - One helper for submitted secrets; the Honcho placeholder rule moves into its storage branch so the field loop no longer branches on storage kind. - Tests: wire round-trip of error classes, SystemExit hook, missing-secret fail-closed, and the failing-hook test now asserts both hooks ran.
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
"""Errors crossing the plugin-host wire keep the builtin class callers catch."""
|
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
from hermes_cli.plugin_host_wire import PluginHostError, error_payload, raise_remote
|
|
|
|
|
|
def _roundtrip(exc: BaseException):
|
|
raise_remote(json.loads(json.dumps(error_payload(exc))))
|
|
|
|
|
|
def test_a_value_error_subclass_is_still_a_value_error_on_the_other_side():
|
|
try:
|
|
json.loads("{not json")
|
|
except json.JSONDecodeError as exc:
|
|
original = exc
|
|
with pytest.raises(ValueError, match="Expecting property name"):
|
|
_roundtrip(original)
|
|
|
|
|
|
def test_an_exact_builtin_keeps_its_class():
|
|
with pytest.raises(KeyError):
|
|
_roundtrip(KeyError("k"))
|
|
|
|
|
|
def test_an_unmapped_error_is_a_plugin_host_error():
|
|
class Custom(Exception):
|
|
pass
|
|
|
|
with pytest.raises(PluginHostError) as info:
|
|
_roundtrip(Custom("x"))
|
|
assert info.value.type_name == "Custom"
|
|
|
|
|
|
def test_system_exit_is_not_mapped_to_a_builtin():
|
|
with pytest.raises(PluginHostError):
|
|
_roundtrip(SystemExit(3))
|