Skip to content

[codex] Fix event store replay isolation - #4402

Merged
jlowin merged 1 commit into
mainfrom
codex/fix-event-store-session-replay
Jun 27, 2026
Merged

[codex] Fix event store replay isolation#4402
jlowin merged 1 commit into
mainfrom
codex/fix-event-store-session-replay

Conversation

@jlowin

@jlowin jlowin commented Jun 27, 2026

Copy link
Copy Markdown
Member

Streamable HTTP resumability stored events in one shared backend keyed only by the SDK stream id. Those ids are scoped to an SDK transport rather than globally unique, so separate client sessions could share _GET_stream or the same request id and allow reconnect replay to cross a session boundary.

This PR adds a session-scoped EventStore adapter and gives each Streamable HTTP transport its own adapter while preserving the shared storage backend. Replay now buffers events until it verifies that the resolved stream id belongs to the current session scope, then returns the original SDK stream id so transport behavior remains unchanged.

event_store = EventStore()
session_a = SessionScopedEventStore(event_store, "session-a")
session_b = SessionScopedEventStore(event_store, "session-b")

With overlapping stream ids, session_a.replay_events_after(...) now emits only events stored through session_a.

@marvin-context-protocol marvin-context-protocol Bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. server Related to FastMCP server implementation or server-side functionality. http Related to HTTP transport, networking, or web server functionality. high-priority security Security fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses. labels Jun 27, 2026
@jlowin
jlowin marked this pull request as ready for review June 27, 2026 16:44
@jlowin
jlowin merged commit feaae68 into main Jun 27, 2026
28 checks passed
@jlowin
jlowin deleted the codex/fix-event-store-session-replay branch June 27, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. http Related to HTTP transport, networking, or web server functionality. security Security fixes: input validation, SSRF/LFI prevention, auth hardening, injection defenses. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant