Skip to content

Update to Responses API compaction and telemetry#4931

Open
dileepyavan wants to merge 9 commits intomainfrom
DileepY/compaction_issue
Open

Update to Responses API compaction and telemetry#4931
dileepyavan wants to merge 9 commits intomainfrom
DileepY/compaction_issue

Conversation

@dileepyavan
Copy link
Copy Markdown
Member

@dileepyavan dileepyavan commented Apr 2, 2026

Summary

  • Ensure previous responseId is being passed when ignoreStatefulMarker is false.
  • add server-side compaction outcome telemetry and regression coverage for enabled and disabled compaction flows

Details

  • createResponsesRequestBody now computes the compaction threshold once and uses it to gate both request context_management and websocket stateful-marker slicing behavior
  • websocket and pass-through OpenAIResponsesProcessor call sites now receive the request compaction threshold from the request body
  • responsesApi.compactionOutcome emits only when compaction is enabled and reports the outcome, request IDs, model, threshold, and token counts
  • compaction telemetry intentionally does not include completionId or compactionMessageId

Testing

  • runTests on src/platform/endpoint/node/test/responsesApi.spec.ts (16 passed)
  • verified start-watch-tasks output showed no compile errors

Copilot AI review requested due to automatic review settings April 2, 2026 01:18
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 refines how the OpenAI Responses API “context-management compaction” feature is enabled and observed, ensuring compaction-specific behavior only runs when compaction is actually enabled and adding outcome telemetry plus regression coverage.

Changes:

  • Centralizes computation of the compaction threshold and uses it to gate request context_management and WebSocket stateful-marker slicing.
  • Propagates the compaction threshold into Responses API stream processors (HTTP, WebSocket, and pass-through) and emits responsesApi.compactionOutcome telemetry only when compaction is enabled.
  • Adds unit tests covering enabled/disabled compaction flows and telemetry emission behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/platform/networking/node/chatStream.ts Adds responsesApi.compactionOutcome telemetry emitter helper with GDPR annotation.
src/platform/endpoint/node/responsesApi.ts Computes compaction threshold once, adjusts marker/compaction slicing, plumbs threshold into processor, and emits compaction outcome telemetry.
src/platform/endpoint/node/chatEndpoint.ts Passes computed compaction threshold through to Responses API response processing.
src/extension/prompt/node/chatMLFetcher.ts Ensures WebSocket Responses API processing receives compaction threshold parsed from request body.
src/extension/externalAgents/node/oaiLanguageModelServer.ts Ensures pass-through Responses API processing receives compaction threshold parsed from request body.
src/platform/endpoint/node/test/responsesApi.spec.ts Adds tests for request-body threshold extraction, WebSocket slicing behavior, and compaction telemetry emission gating.
.vscode/settings.json Enables terminal tool sandbox in workspace settings.
.vscode/launch.json Adds preLaunchTask: "compile" to the primary extension launch configuration.

@dileepyavan dileepyavan changed the title Improve Responses API compaction gating and telemetry Update to Responses API compaction gating and telemetry Apr 2, 2026
@dileepyavan dileepyavan requested a review from chrmarti April 2, 2026 01:42
@dileepyavan dileepyavan changed the title Update to Responses API compaction gating and telemetry Update to Responses API compaction and telemetry Apr 2, 2026
@dileepyavan dileepyavan removed the request for review from chrmarti April 2, 2026 17:41
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.

2 participants