streaming: collapse EventStreamClient fan-out#32459
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b81578dc7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let (stream, continuation) = AsyncStream<ServerMessage>.makeStream( | ||
| bufferingPolicy: .bufferingNewest(eventStreamSubscriberBufferLimit) | ||
| ) |
There was a problem hiding this comment.
Do not drop incremental chat stream events
When a chat subscriber falls more than 256 events behind (for example during a long response while the main actor is busy), .bufferingNewest silently discards the oldest unread ServerMessages. Several routed chat events such as assistantTextDelta, toolInputDelta, and toolOutputChunk are incremental rather than replace-by-latest snapshots, so losing an older chunk permanently truncates the transcript/tool input until a separate history reload happens. The previous unbounded stream did not drop these deltas, so chat streaming needs a lossless path or category-specific buffering for incremental events.
Useful? React with 👍 / 👎.
| .messageComplete, .messageQueued, .messageDequeued, .messageRequestComplete, | ||
| .messageQueuedDeleted, .messageSteered, .generationCancelled, .generationHandoff, | ||
| .userMessageEcho, .userMessagePersisted, .queuedMessageAcked, | ||
| .conversationInfo, .conversationError, .confirmationRequest, .confirmationStateChanged, |
There was a problem hiding this comment.
Route AppDelegate events to appDelegate subscribers
After the fan-out split, AppDelegate+ConnectionSetup.startEventSubscription() only reads subscribeAppDelegateEvents(), but this mapping sends confirmationRequest and conversationError only to .chat. That means the AppDelegate cases that auto-approve CU confirmations / show confirmation notifications and handle managed-assistant auth errors no longer run for those events. Include these AppDelegate-handled event types in the .appDelegate category as well as chat.
Useful? React with 👍 / 👎.
Summary
Part of plan: streaming-message-architecture.md (PR 5 of 6)