Skip to content

Resend all messages when WebSocket's previous response id does not match#308872

Merged
chrmarti merged 1 commit intomainfrom
chrmarti/gross-lemming
Apr 9, 2026
Merged

Resend all messages when WebSocket's previous response id does not match#308872
chrmarti merged 1 commit intomainfrom
chrmarti/gross-lemming

Conversation

@chrmarti
Copy link
Copy Markdown
Collaborator

@chrmarti chrmarti commented Apr 9, 2026

@chrmarti chrmarti enabled auto-merge (rebase) April 9, 2026 20:58
@chrmarti chrmarti self-assigned this Apr 9, 2026
Copilot AI review requested due to automatic review settings April 9, 2026 20:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) to IChatWebSocketManager and 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

@chrmarti chrmarti merged commit 571a7d5 into main Apr 9, 2026
30 checks passed
@chrmarti chrmarti deleted the chrmarti/gross-lemming branch April 9, 2026 21:26
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants