mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-10 01:15:11 +00:00
Background memory saves from the final task could still be in flight when `CrewKickoffCompletedEvent`/`FlowFinishedEvent` fired, so telemetry listeners tore down before `MemorySaveCompletedEvent` arrived and the save span surfaced as "Span orphaned" errors in traces despite the record persisting. `Crew` now drains all pending saves — including per-agent `agent.memory` pools, which the old `finally`-only drain missed entirely — before emitting the completion event, with the same ordering applied to both `FlowFinishedEvent` emit paths in the flow runtime.