Skip to content

fix(compressor): skip non-string tool content in dedup pass to prevent AttributeError - #19398

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 3, 2026
Merged

fix(compressor): skip non-string tool content in dedup pass to prevent AttributeError#19398
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1

@teknium1 teknium1 commented May 3, 2026

Copy link
Copy Markdown
Contributor

Salvage of #19373 by @sprmn24 onto current main.

Summary

_prune_old_tool_results skips list content (multimodal blocks) but then calls content.encode() directly. If a tool result has non-string content (dict, int, bool), this raises AttributeError and breaks context compression entirely. Add an isinstance(content, str) guard before the length/hash path.

Changes

  • agent/context_compressor.py: isinstance guard before .encode() (+2/-0)

Validation

scripts/run_tests.sh tests/agent/ -k compress → 91 passed

Original PR: #19373

@teknium1
teknium1 merged commit 408dd8a into main May 3, 2026
9 of 10 checks passed
@teknium1
teknium1 deleted the hermes/hermes-8c54fd4a branch May 3, 2026 22:28
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants