Merge PR #229: fix(agent): copy conversation_history to avoid mutating caller's list

Authored by Farukest. Fixes #228.

# Conflicts:
#	tests/test_run_agent.py
This commit is contained in:
teknium1 2026-03-02 04:21:39 -08:00
commit 56b53bff6e
2 changed files with 35 additions and 2 deletions

View file

@ -2777,8 +2777,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