fix(context): raise max messages fallback cap

Treat max_messages as a last-resort replay guard now that consolidation and idle auto-compact own normal history reduction. Raising the default avoids frequent sliding-window prefix churn in moderate conversations without adding a new cache-policy knob.
This commit is contained in:
chengyongru
2026-06-29 14:23:55 +08:00
committed by Xubin Ren
parent 7dc45ff94e
commit c8638dee46
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -132,7 +132,7 @@ class Session:
def get_history(
self,
max_messages: int = 120,
max_messages: int = 500,
*,
max_tokens: int = 0,
extend_to_user: bool = False,
@@ -143,7 +143,7 @@ class Session:
token budget from the tail (``max_tokens``) when provided.
"""
unconsolidated = self.messages[self.last_consolidated:]
max_messages = max_messages if max_messages > 0 else 120
max_messages = max_messages if max_messages > 0 else 500
start_idx = recent_message_start_index(
unconsolidated,
max_messages,