Bug Description
When context compression is triggered, the agent repeatedly inserts historical conversation content into the current conversation. This causes the conversation history to become duplicated and mixed in the active context.
Steps to Reproduce
- Have a conversation that exceeds the context window threshold
- Trigger context compression (e.g., by reaching 85% of max context length)
- Observe that historical messages are re-inserted into the current active conversation
Expected Behavior
After compression, the context should contain only the compressed summary and the most recent messages, without duplicating historical content.
Actual Behavior
Every time compression runs, the agent inserts the full historical conversation into the current context, leading to:
- Message duplication
- Inflated context size
- Degraded conversation quality
Additional Context
This appears to be related to the built-in context compression mechanism. The compression seems to work correctly in terms of counting tokens, but the output is being appended rather than replacing the original messages.
Bug Description
When context compression is triggered, the agent repeatedly inserts historical conversation content into the current conversation. This causes the conversation history to become duplicated and mixed in the active context.
Steps to Reproduce
Expected Behavior
After compression, the context should contain only the compressed summary and the most recent messages, without duplicating historical content.
Actual Behavior
Every time compression runs, the agent inserts the full historical conversation into the current context, leading to:
Additional Context
This appears to be related to the built-in context compression mechanism. The compression seems to work correctly in terms of counting tokens, but the output is being appended rather than replacing the original messages.