Repository navigation
InMemorySessionService allows duplicate events to be appended during concurrent state broadcasts #5723
Description
Activity
- addedservices[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc
on May 18, 2026 @chriskinzel A possible resolution would be to add event ID deduplication in
append_event(), and potentially add synchronization/locking to avoid concurrent race conditions during appends.
Could you also confirm which ADK version you're using and whether this still reproduces on the latest release? If not please use latest version ofADKand also share more details to help us work on this.
Thanks!- added a commit that references this issue
on May 22, 2026 - addedrequest clarification[Status] The maintainer need clarification or more information from the author[Status] The maintainer need clarification or more information from the author
on May 27, 2026 @chriskinzel Thanks for the detailed report and for linking PR #5727 — looks like this caught some good community traction, with he-yufeng's PR #5743 and devteamaegis's PR #5815 (which already has a committed fix) both targeting the same append_event deduplication gap.
Since the fix is actively being tracked across those PRs and we haven't heard back in 2 weeks since @klateefa's question about your ADK version, going ahead and closing this out — the bug itself is being handled on the PR side.
Keep an eye on PR #5815 for the merge; once that lands, the deduplication check will be in the main branch.
Feel free to reopen if there's additional context you wanted to share or if the merged fix doesn't fully cover your concurrent broadcast scenario!
- added a commit that references this issue
on Aug 14, 2026 Following up after an architectural review of ADK's session lifecycle:
ADK does not broadcast the same
Eventinstance (or duplicateevent.id) across multiple concurrentSessionreferences for the samesession_id:- Within a single invocation (including
ParallelAgentand parallel workflow branches), all branches share oneInvocationContext.sessionobject and serializeappend_eventcalls through the runner's event queue. - Across separate invocations, concurrent writes from stale
Sessionsnapshots are rejected withStaleSessionErroron persistent backends (DatabaseSessionService,SqliteSessionService,FirestoreSessionService), and duplicateevent.idvalues violate storage uniqueness constraints. - To share state across concurrent sessions, use
app:oruser:scoped state keys (State.APP_PREFIX/State.USER_PREFIX), and callget_session()when a fresh session snapshot is needed.
Marking this issue as
not_plannedfor clarity so future contributors are not misled by the concurrent-broadcast premise.- Within a single invocation (including
- added a commit that references this issue
on Oct 9, 2026
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: