Skip to content

Handle streamed Responses API compaction items#309740

Merged
dileepyavan merged 1 commit intomainfrom
DileepY/compaction_issue
Apr 14, 2026
Merged

Handle streamed Responses API compaction items#309740
dileepyavan merged 1 commit intomainfrom
DileepY/compaction_issue

Conversation

@dileepyavan
Copy link
Copy Markdown
Member

Summary

  • Detect compaction items at the top of OpenAIResponsesProcessor.push across stream events that carry either item or response.output.
  • Capture and emit compaction items from intermediate events such as response.output_item.added, not only response.output_item.done/response.completed.
  • Preserve final response.completed reconciliation so the latest final compaction item is still used when it differs from an earlier streamed item.
  • Add regression coverage that an early/intermediate compaction item is round-tripped into the next Responses API request.

Validation

  • cd extensions/copilot && npm run test:unit -- src/platform/endpoint/node/test/responsesApi.spec.ts
  • Result: 26 passed

Notes

  • Debug logging added during investigation was removed before this PR.
  • Untracked local dotfiles in the workspace were not included in the commit.

Copilot AI review requested due to automatic review settings April 14, 2026 06:27
@dileepyavan dileepyavan enabled auto-merge (squash) April 14, 2026 06:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Screenshot Changes

Base: 182bcf49 Current: 782dc850

Changed (3)

editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Light
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Dark
Before After
before after

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 updates the Copilot extension’s OpenAI Responses API stream processing to detect and emit context-compaction items earlier in the stream (e.g. response.output_item.added), ensuring those items can be round-tripped into the next request even when they arrive before output_item.done/response.completed.

Changes:

  • Detect compaction items from both streamed item events and events containing response.output, emitting compaction deltas as soon as they appear.
  • Preserve response.completed reconciliation so the final compaction item still wins when it differs from earlier streamed items.
  • Add regression tests ensuring early/intermediate compaction items are captured and included in the next request body.
Show a summary per file
File Description
extensions/copilot/src/platform/endpoint/node/responsesApi.ts Adds compaction extraction from additional stream shapes and emits compaction deltas earlier while keeping final reconciliation.
extensions/copilot/src/platform/endpoint/node/test/responsesApi.spec.ts Adds coverage for compaction items arriving before output_item.done and updates an existing reconciliation test to include output_item.added.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

@dileepyavan dileepyavan force-pushed the DileepY/compaction_issue branch from 6dd6684 to a75e406 Compare April 14, 2026 06:46
@dileepyavan dileepyavan merged commit f29d89a into main Apr 14, 2026
26 checks passed
@dileepyavan dileepyavan deleted the DileepY/compaction_issue branch April 14, 2026 07:15
@vs-code-engineering vs-code-engineering bot added this to the 1.117.0 milestone Apr 14, 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