Files
crewAI/lib/crewai/tests
Joao Moura 8d2d6b18fe fix(flow): don't double-append the turn reply when a handler trims history
handle_turn() (and stream_turn) decided "did the handler append its
reply?" by snapshotting the assistant-message count before kickoff and
appending the stringified result when the count came back unchanged. A
handler that appends its reply and then trims state.messages to a cap —
a normal bounded-context pattern — left the count unchanged, so the
fallback appended the reply a second time on every turn once trimming
engaged, and the duplicates then crowded real turns out of the capped
window.

Replace the count heuristic with an explicit per-turn flag:
append_assistant_message() sets _assistant_reply_appended, handle_turn
and stream_turn clear it before kickoff and only fall back when no
assistant message was appended during the turn. The now-unused
_assistant_message_count() helper is removed.

Fixes EPD-181.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 23:59:24 -07:00
..
2025-10-20 14:10:19 -07:00
2025-12-04 16:53:19 -05:00
2026-06-14 04:19:48 -03:00
2026-07-09 15:30:16 -07:00
2026-06-18 14:14:54 -03:00
2026-06-14 04:19:48 -03:00
2026-02-13 21:34:37 -03:00
2025-10-20 14:10:19 -07:00
2025-10-20 14:10:19 -07:00
2026-06-14 04:19:48 -03:00
2025-10-20 14:10:19 -07:00