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.
This commit is contained in:
kshitijk4poor
2026-08-31 11:33:41 +05:30
committed by kshitij
parent 81ab11b821
commit dc71fb37e1

View File

@@ -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`