[![](https://img.shields.io/badge/OpenWebUI%20Community-Get%20Plugin-blue?style=for-the-badge)](https://openwebui.com/posts/async_context_compression_b1655bc8)

## Overview

This release focuses on improving the structural integrity of chat history when using function-calling models and enhancing task reliability through concurrent task management. It introduces "Atomic Message Grouping" to prevent chat context corruption and a session-based locking mechanism to ensure stable background operations.

**[📖 README](https://github.com/Fu-Jie/openwebui-extensions/blob/main/plugins/filters/async-context-compression/README.md)**

## New Features

- **Atomic Message Grouping**: A new structure-aware logic that identifies and groups `assistant-tool-tool-assistant` calling sequences. This ensures that tool results are never orphaned from their calls during compression.
- **Tail Boundary Alignment**: Automatically corrects truncation indices to ensure the recent context "tail" starts at a valid message boundary, preventing partial tool-calling sequences from being sent to the LLM.
- **Chat Session Locking**: Implements a per-chat-id asynchronous lock to prevent multiple summary tasks from running concurrently for the same session, reducing redundant LLM calls and race conditions.
- **Metadata Traceability**: Summarization inputs now include message IDs, participant names, and key metadata labels, allowing the summary model to maintain better traceability in its output.

## Bug Fixes

- **Fixed "No tool call found" Errors**: By enforcing atomic grouping, the filter no longer truncates the context in a way that separates tool calls from their results.
- **Improved Progress Calculation**: Fixed an issue where summarizing messages would cause the progress tracking to drift due to shifting list indices.
- **Prevented Duplicate Summary Tasks**: The new locking mechanism ensures that only one background summary process is active per session.

## Related Issues

- **[#56](https://github.com/Fu-Jie/openwebui-extensions/issues/56)**: Tool-Calling context corruption and concurrent summary tasks.
