Skip to content

Context manager bug #2992

@skallonis

Description

@skallonis
  1. In backend/core/agentpress/context_manager.py
    line 1380
    I believe
            # Recursive call - will handle its own last_usage update
            return await self.compress_messages(
                result, llm_model, max_tokens, 
                token_threshold // 2, max_iterations - 1, 
                compressed_total, system_prompt, thread_id=thread_id
            )

must change to

            # Recursive call - will handle its own last_usage update
            result = await self.compress_messages(
                result, llm_model, max_tokens, 
                token_threshold // 2, max_iterations - 1, 
                compressed_total, system_prompt, thread_id=thread_id
            )

in order to make possible compressed messages to be stored to db in each recursion beacause original_content_by_id is recalculated and loose previous original_content_by_id.

  1. Also in count_tokens, tool_calls and native tools desctiptions are not calculated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions