fix(agent): copy conversation_history to avoid mutating caller's list

This commit is contained in:
Farukest 2026-03-01 03:06:13 +03:00
parent 7b23dbfe68
commit e87859e82c
No known key found for this signature in database
GPG key ID: 73E2756B3FFF5241
2 changed files with 35 additions and 2 deletions

View file

@ -1842,8 +1842,8 @@ class AIAgent:
self._turns_since_memory = 0
self._iters_since_skill = 0
# Initialize conversation
messages = conversation_history or []
# Initialize conversation (copy to avoid mutating the caller's list)
messages = list(conversation_history) if conversation_history else []
# Hydrate todo store from conversation history (gateway creates a fresh
# AIAgent per message, so the in-memory store is empty -- we need to