Skip to content

InMemorySessionService allows duplicate events to be appended during concurrent state broadcasts #5723

Description

@chriskinzel

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
    # ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

request clarification[Status] The maintainer need clarification or more information from the authorservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions