Description
In InMemorySessionService.append_event, there is no deduplication check before appending an Event to session.events. When an orchestrator or background task broadcasts shared state updates to multiple concurrent agent sessions, race conditions can cause the exact same event ID to be appended multiple times to a session's history.
Proposed Solution
Add a simple, universal deduplication check at the beginning of append_event:
async def append_event(self, session: Session, event: Event) -> Event:
if event.partial:
return event
if any(e.id == event.id for e in session.events):
return event
# ...
Description
In
InMemorySessionService.append_event, there is no deduplication check before appending anEventtosession.events. When an orchestrator or background task broadcasts shared state updates to multiple concurrent agent sessions, race conditions can cause the exact same event ID to be appended multiple times to a session's history.Proposed Solution
Add a simple, universal deduplication check at the beginning of
append_event: