From dc71fb37e165289ac2e99d2740a93f9183d088ee Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 31 Aug 2026 11:33:41 +0530 Subject: [PATCH] fix(compression): guard the split-failure cooldown call like sibling strikes The cooldown is recorded inside the split-failure except handler; a raw call on a stub/partial compressor would replace the real split error with an AttributeError. Mirror the try/except-debug convention of the adjacent record_rejected_compaction call. --- agent/conversation_compression.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/agent/conversation_compression.py b/agent/conversation_compression.py index 074cd3255a..60c62e4bd0 100644 --- a/agent/conversation_compression.py +++ b/agent/conversation_compression.py @@ -4994,9 +4994,20 @@ def compress_context( ) else: logger.warning("Session DB compression split failed — new session will NOT be indexed: %s", e) - agent.context_compressor._record_compression_failure_cooldown( - 60, f"session_split_failed: {e}", - ) + # Arm the failure cooldown so the next turn cannot immediately + # re-run the identical doomed compression (#97948 symptom B). + # try/except mirrors the sibling record_rejected_compaction + # call above: this runs inside the split-failure handler, and + # a stub compressor must not mask the original error. + try: + agent.context_compressor._record_compression_failure_cooldown( + 60, f"session_split_failed: {e}", + ) + except Exception: + logger.debug( + "could not record split-failure cooldown", + exc_info=True, + ) # Compaction-boundary bookkeeping, computed once. `old_session_id` is only # bound in the rotation branch; in-place leaves it unset. `_boundary_parent`