From a7417f8a4a413196dac350e357dec43b8f8eb3e0 Mon Sep 17 00:00:00 2001 From: JasonOA888 Date: Mon, 4 May 2026 13:01:28 +0800 Subject: [PATCH] fix(compressor): skip non-string tool content in summarization pass to prevent AttributeError Commit 408dd8aa added a non-string guard for Pass 1 (dedup), but the same pattern exists in Pass 2 (summarization/pruning) where content.startswith() and len() are called on potentially non-string tool content. When a provider returns tool results with non-string content (e.g. dict or int from llama.cpp or similar), the pruning pass crashes with AttributeError. Add the same isinstance(content, str) guard to Pass 2 for consistency. --- agent/context_compressor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent/context_compressor.py b/agent/context_compressor.py index 69151a117a..f9111f9600 100644 --- a/agent/context_compressor.py +++ b/agent/context_compressor.py @@ -600,6 +600,8 @@ class ContextCompressor(ContextEngine): # Skip multimodal content (list of content blocks) if isinstance(content, list): continue + if not isinstance(content, str): + continue if not content or content == _PRUNED_TOOL_PLACEHOLDER: continue # Skip already-deduplicated or previously-summarized results