Skip to content

bug(agents): SSE seq/cursor drift when NO_REPLY messages are suppressed mid-stream #61816

Closed

Description

@100yenadmin

Description

When the SSE streaming layer suppresses NO_REPLY messages (or other filtered content), the sequence number and cursor used for client-side event ordering can drift out of sync. Clients that reconnect or use the cursor for resumption may miss messages or receive duplicates.

Root cause

The SSE event emitter increments seq for every internal message but then suppresses some from the wire. The client cursor tracks the last received seq, which no longer matches the server-side counter. On reconnection with Last-Event-ID, the server resumes from the wrong offset.

Impact

  • Clients reconnecting after a suppressed NO_REPLY block may miss the next real message
  • In high-suppression scenarios (heartbeat sessions, cron runs), cursor drift accumulates
  • Affects all SSE-based consumers (Control UI, webchat, external integrations)

Proposed fix

Either:

  1. Do not increment seq for suppressed messages, or
  2. Track a separate "wire seq" that only increments for actually-sent events

Related

Activity

  1. steipete commented on Apr 6, 2026

    @steipete
    Contributor

    Closing as fixed by #61829, which merged in bbd0702.

    That merged change updates the SSE/history sanitization flow and raw transcript sequence tracking specifically to avoid cursor/seq drift when filtered messages are suppressed from the wire.

  2. locked as resolved and limited conversation to collaborators on Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions