Hermes Agent context engine: the main model writes the compaction handoff on its cached prompt prefix
fix: accept a Responses input item without a type
HopeValentine9c00dd1b58ef
diff --git a/tests/test_wc_responses.py b/tests/test_wc_responses.pyindex e50a4c0..da951b7 100644--- a/tests/test_wc_responses.py+++ b/tests/test_wc_responses.py@@ -47,6 +47,16 @@ class ResponsesSourceTest(unittest.TestCase):self.assertEqual(wire[1]["content"], [{"type": "output_text", "text": "a"}])self.assertEqual(wire[1]["phase"], "final_answer")+ def test_an_input_item_without_a_type_is_a_message(self):+ # The Responses API reads an input item that has a role and no "type" as a message.+ # Hermes sends that form, so the source check must accept it.+ rows = [user("u"), assistant("a")]+ wire = responses.wire_rows(rows, ROUTE[1], model=ROUTE[0])+ untyped = [{key: value for key, value in item.items() if key != "type"} for item in wire]+ self.assertEqual(untyped[0], {"role": "user", "content": "u"})+ responses.check_source({"model": ROUTE[0], "instructions": "Synthetic system text.",+ "store": False, "input": untyped}, rows)+def test_native_text_replay_keeps_phase_status_and_id(self):row = assistant("a", codex_message_items=[{"type": "message", "role": "assistant", "id": "msg_fake", "status": "completed",diff --git a/warm_compaction/responses.py b/warm_compaction/responses.pyindex eb2c2b3..b8a1dca 100644--- a/warm_compaction/responses.py+++ b/warm_compaction/responses.py@@ -254,7 +254,14 @@ def wire_rows(rows: list, base_url: Any = None, *, used_ids: set | None = None,def check_source(body: dict[str, Any], history: list, base_url: Any = None, native_type: Any = None) -> None:"""Require that the captured input is the supported form of the stored history."""check_settings(body, base_url)- if body.get("input") != wire_rows(history, base_url, model=body.get("model")):+ want = wire_rows(history, base_url, model=body.get("model"))+ got = body.get("input")+ # The Responses API treats an input item that has a role and no "type" as a message.+ # Hermes omits that default, so normalise it before the comparison.+ if isinstance(got, list):+ got = [({**item, "type": "message"} if isinstance(item, dict) and "type" not in item and "role" in item+ else item) for item in got]+ if got != want:raise WarmRefusal("source_transform_unsupported")