Skip to content

The agent that grows with you

fix(cli): the gateway compress mutation carries its generation fence

Tekniumc94f9f61ecb1
diff --git a/hermes_cli/gateway_agent.py b/hermes_cli/gateway_agent.py
index bcf1b3fc30a..398c627ff39 100644
--- a/hermes_cli/gateway_agent.py
+++ b/hermes_cli/gateway_agent.py
@@ -249,6 +249,7 @@ class GatewayAgent:
snapshot = self.connection.call("session.resume", session_id=self.session_id)
self.connection.call("session.mutate", timeout=COMPRESS_RPC_TIMEOUT, session_id=self.session_id,
request_id=uuid.uuid4().hex, expected_revision=snapshot["revision"],
+ expected_generation=snapshot["execution_generation"],
operation="compress", payload=payload)
for row in verbatim_tail or ():
row[_DB_PERSISTED_MARKER] = True
diff --git a/tests/hermes_cli/test_gateway_agent.py b/tests/hermes_cli/test_gateway_agent.py
index 80adc675c57..1ecef470061 100644
--- a/tests/hermes_cli/test_gateway_agent.py
+++ b/tests/hermes_cli/test_gateway_agent.py
@@ -223,6 +223,7 @@ def test_manual_compress_is_the_gateway_compress_mutation(make_agent):
result = compress_now(agent, history, CompressRequest(), task_id=SID)
mutate = dict(client.calls)["session.mutate"]
assert mutate["operation"] == "compress" and mutate["expected_revision"] == 9 and mutate["payload"] == {}
+ assert mutate["expected_generation"] == 7
assert result.status == "compressed"
assert result.after_messages == [{"role": "user", "content": "summary"}, {"role": "assistant", "content": "ok"}]
assert result.summary["headline"] == "Compressed: 6 → 2 messages"