Skip to content

v2 connect streams stop after the current run and cannot follow future thread runs #3531

@0xTomDaniel

Description

@0xTomDaniel

Summary

Current v2 connect behavior does not remain attached to a thread across future runs.

Instead, it appears to replay history plus the currently active run, then complete when that run ends, or complete immediately if no run is active. In Intelligence mode, the connect stream explicitly completes on RUN_FINISHED / RUN_ERROR.

That means connect cannot function as a durable thread-follow stream for later runs on the same thread.

Relevant commits

  • Initial in-memory runner behavior: 7b83854
  • Initial Intelligence runner behavior: 764ec32
  • Later Intelligence support reference point: 5b3037a

Why this matters

There is an important class of agent systems where runs are not always initiated by the connected client.

Generically, these agents may:

  • continue operating in the background
  • emit periodic heartbeats
  • run on cron/schedulers
  • react to external triggers
  • update thread state/messages from server-initiated runs long after the original client-triggered run has finished

For those systems, connect is not just "replay the latest run". It needs to mean "stay attached to this thread and keep surfacing AG-UI events/state for future runs until the client disconnects."

Without that behavior, the UI can connect successfully, observe one run, and then silently stop receiving updates even though the same thread continues evolving on the server.

Current behavior across implementations

This does not appear to be limited to one implementation:

  • In-memory connect replays historic events, bridges only the currently active run, and completes otherwise.
  • Intelligence connect completes when it receives RUN_FINISHED or RUN_ERROR.

So this looks like a shared contract assumption rather than a single isolated bug.

Expected behavior

A connect stream for a thread should be able to remain open across future runs on that same thread until the client disconnects.

Specifically, connect should support thread-follow semantics for:

  • future runs started after the connect stream is opened
  • runs initiated by background schedulers, heartbeats, cron jobs, or other server-side automation
  • AG-UI state/message updates for runs that were never initiated directly from the current client session

Why this should be first-class

Long-lived/background agents are not an edge case for agent systems. They are a core pattern.

If CopilotKit wants AG-UI thread detail views to reflect real agent state over time, connect needs to support ongoing thread evolution rather than only the currently active run.

Request

Please make v2 connect support durable thread-follow semantics across future runs, instead of completing after the current run or after replay when no run is active.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions