The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(relay): keep the empty_transcript class on its attempt mark
mnajafian-nvf0afd34a9d6f
diff --git a/agent/compaction_events.py b/agent/compaction_events.pyindex 44bad6925aa..54393f75cc4 100644--- a/agent/compaction_events.py+++ b/agent/compaction_events.py@@ -49,12 +49,13 @@ _SPLIT_STATUSES = frozenset({"not_applicable", "in_place_committed", "rotated_committed", "failed_not_indexed", "aborted",})_TOKEN_COUNT_METHODS = frozenset({"estimate_rough"})-# Attempt classes beyond the shared-metrics closed set: guards, Codex route exits, lease races, and the-# micro-compaction pass outcomes.+# Attempt classes beyond the shared-metrics closed set: guards, Codex route exits, lease races, an engine's+# empty transcript, and the micro-compaction pass outcomes._EXTRA_FAILURE_CLASSES = frozenset({"blocked:cooldown", "blocked:structural_backoff", "blocked:ineffective", "blocked:unknown","codex_auto_native", "codex_auto_off", "codex_no_thread", "codex_compaction_failed",- "session_ownership_lost", "session_ownership_unreadable", "cooldown_state_unreadable", "summary_model_benched",+ "session_ownership_lost", "session_ownership_unreadable", "cooldown_state_unreadable", "empty_transcript",+ "summary_model_benched","summarize_failed", "exchange_skipped", "defrag_failed", "stale_generation", "watermark_unavailable",})# An aborted attempt the compressor ran but deliberately did not commit; other aborts are failures.diff --git a/tests/agent/test_compaction_events.py b/tests/agent/test_compaction_events.pyindex fc2090d37f9..dad2e23ac70 100644--- a/tests/agent/test_compaction_events.py+++ b/tests/agent/test_compaction_events.py@@ -148,6 +148,18 @@ def test_failed_summary_is_an_attempt_mark_not_a_compaction(published):assert payload["cache_break"] is False and payload["in_place"] is None+def test_an_engine_that_returns_an_empty_transcript_publishes_one_failed_attempt_mark(published):+ agent = _Agent(_compressor())++ with patch.object(agent.context_compressor, "compress", return_value=[]):+ returned, _ = compress_context(agent, _messages(), "system prompt", approx_tokens=80_000, trigger="pre_api")++ assert returned == _messages()+ [(session_id, name, payload)] = published+ assert (session_id, name) == ("session-events-test", "compaction.attempt")+ assert (payload["outcome"], payload["failure_class"], payload["method"]) == ("failed", "empty_transcript", "none")++def test_a_raising_emitter_never_changes_the_compaction_result(monkeypatch, caplog):def explode(*_args, **_kwargs):raise RuntimeError("relay down")diff --git a/website/docs/developer-guide/relay-shared-metrics.md b/website/docs/developer-guide/relay-shared-metrics.mdindex f4062986b7b..909d6491d0a 100644--- a/website/docs/developer-guide/relay-shared-metrics.md+++ b/website/docs/developer-guide/relay-shared-metrics.md@@ -193,8 +193,8 @@ A value outside its set reads `other`. `failure_class` uses the`hermes.compression.count` classes plus the attempt-only classes (guard exitssuch as `blocked:cooldown`, Codex route exits such as `codex_auto_native`, thelease exits `session_ownership_lost`, `session_ownership_unreadable` and-`cooldown_state_unreadable`, `summary_model_benched`, and the micro-compaction-outcomes), `none` when there is no class, and `other` for anything else. An+`cooldown_state_unreadable`, `empty_transcript` (a context engine returned no+messages), `summary_model_benched`, and the micro-compaction outcomes), `none` when there is no class, and `other` for anything else. Anautomatic caller that passes no trigger label reads `trigger: unknown` with`trigger_class: auto`; a record with no trigger at all reads `unknown` forboth. `in_place` and `session_rotated` are set only when `split_status` is