Resend all messages when WebSocket's previous response id does not match#308872
Merged
Resend all messages when WebSocket's previous response id does not match#308872
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Responses API WebSocket request construction by using the active WebSocket connection’s last completed response.id as the authoritative stateful marker, and falling back to sending full in-scope message history when that marker isn’t present in the current message list (avoiding invalid previous_response_id resumes). This aligns request slicing with WebSocket connection state for CAPI WebSocket support (#298236).
Changes:
- Add
getStatefulMarker(conversationId)toIChatWebSocketManagerand implement it for real and null managers. - Update Responses API request body creation to use the WebSocket manager’s marker when on WebSocket transport, and only resume (
previous_response_id+ post-marker slicing) when that marker exists in the current messages. - Extend unit tests to cover the “stale WebSocket marker” case and ensure WebSocket request slicing uses the connection marker.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/test/node/services.ts | Registers IChatWebSocketManager in platform test services so WebSocket-aware code paths can resolve the service. |
| extensions/copilot/src/platform/networking/node/chatWebSocketManager.ts | Extends the manager interface and implementations to expose the active connection’s statefulMarker. |
| extensions/copilot/src/platform/endpoint/node/test/responsesApi.spec.ts | Adds/updates tests to validate WebSocket marker-based slicing and the resend-all behavior when the marker is stale. |
| extensions/copilot/src/platform/endpoint/node/responsesApi.ts | Uses WebSocket connection marker when applicable; omits previous_response_id and avoids slicing if the marker isn’t found in messages. |
| extensions/copilot/src/platform/endpoint/common/statefulMarkerContainer.tsx | Adds getIndexOfStatefulMarker helper to locate a specific marker in message history. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 0
connor4312
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#298236