Update to Responses API compaction and telemetry#4931
Open
dileepyavan wants to merge 9 commits intomainfrom
Open
Update to Responses API compaction and telemetry#4931dileepyavan wants to merge 9 commits intomainfrom
dileepyavan wants to merge 9 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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_managementand WebSocket stateful-marker slicing. - Propagates the compaction threshold into Responses API stream processors (HTTP, WebSocket, and pass-through) and emits
responsesApi.compactionOutcometelemetry 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. |
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.
Summary
Details
createResponsesRequestBodynow computes the compaction threshold once and uses it to gate both requestcontext_managementand websocket stateful-marker slicing behaviorOpenAIResponsesProcessorcall sites now receive the request compaction threshold from the request bodyresponsesApi.compactionOutcomeemits only when compaction is enabled and reports the outcome, request IDs, model, threshold, and token countscompletionIdorcompactionMessageIdTesting
runTestsonsrc/platform/endpoint/node/test/responsesApi.spec.ts(16 passed)start-watch-tasksoutput showed no compile errors