Fix: Auto-compression never fires in pure chat (no tool calls) path [#65959] - #66175
Fix: Auto-compression never fires in pure chat (no tool calls) path [#65959]#66175rajv2er wants to merge 1 commit into
Conversation
Duplicate of #65993 — the live diff is byte-identical: both wrap cron-only MCP discovery with |
Addresses NousResearch#65959 — long TUI sessions with only text responses never triggered auto-compression because the post-response should_compress() check only existed in the tool-call branch. Added identical logic to the no-tool-calls else branch.
7c21460 to
925f18d
Compare
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Fix extends post-response compression check to the pure-chat (no tool calls) path. The previous compression trigger only fired inside the tool-call branch, so long chat sessions without tool use could exceed the compression threshold unnoticed. Clear mirroring of the existing tool-call compression path. No security concerns.
Reviewed by Hermes Agent
|
Thanks for investigating the pure-chat compression report. This is an automated hermes-sweeper review. Current
The lone discussion comment references unrelated cron/MCP work in #65993; the actual diff for this PR was inspected separately. |
Summary
Fixes #65959 — Auto-compression did not fire after long TUI session crossed threshold.
Root Cause
In
agent/conversation_loop.py, the post-responseshould_compress()check (lines ~4956-4965) only existed in the tool-call branch (if assistant_message.tool_calls:). When the model returned a final text response with no tool calls, execution jumped to theelsebranch and skipped the compression check entirely, breaking out of the loop.A pure-chat TUI session (user text → assistant text, no
read_file,search_files, etc.) could grow past the ~200k token threshold with zeroconversation_compressionrecords persisted — exactly as reported for session20260716_112216_60220c.Fix
Added the identical compression logic to the no-tool-calls branch (after line 4982), mirroring the tool-call path:
last_prompt_tokenswhen availablecompression_enabledflag and cooldown guards viashould_compress()Testing
python3 -m py_compile)test_compress_focus.py,test_compressed_summary_metadata.py,test_compression_concurrent_fork.py)Notes