Honor store: false when recording Responses API stateful markers in BYOK#325437
Open
Davixk wants to merge 2 commits into
Open
Honor store: false when recording Responses API stateful markers in BYOK#325437Davixk wants to merge 2 commits into
Davixk wants to merge 2 commits into
Conversation
Skip the stateful marker on response.completed when the response was not stored, so unchainable ids never enter the history. In the BYOK Responses branch, decide marker usability before conversion so a non-resp_ marker sends the full input instead of a truncated one with previous_response_id stripped by the late guard.
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents stateless BYOK Responses endpoints from producing truncated follow-up requests.
Changes:
- Suppresses stateful markers when
store: false. - Rejects non-
resp_markers before request conversion. - Adds regression coverage for both behaviors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
extensions/copilot/src/platform/endpoint/node/responsesApi.ts |
Honors the completed response’s store flag. |
extensions/copilot/src/platform/endpoint/node/test/responsesApi.spec.ts |
Tests marker emission across store values. |
extensions/copilot/src/extension/byok/node/openAIEndpoint.ts |
Validates markers before input truncation. |
extensions/copilot/src/extension/byok/node/test/openAIEndpoint.spec.ts |
Verifies foreign markers preserve full input. |
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.
Fixes #325436
Description
BYOK custom endpoints using the Responses API record a stateful marker from every
response.completed, even when the server answeredstore: false. The next request is then truncated to the items after the marker while a later guard strips the non-resp_previous_response_id, producing an unanswerable request (atool_resultwithout itstool_use, or no user message at all).Two changes:
OpenAIResponsesProcessoremits the stateful marker only whenresponse.store !== false, so a server that declares no persistence never gets a marker recorded and later requests carry the full input. Responses without astorefield keep today's behavior, so CAPI is unaffected.resp_...setsignoreStatefulMarker, keeping truncation andprevious_response_ida single decision. The late guard remains as an invariant. This also heals existing transcripts that already carry foreign markers.The
previous_response_not_foundretry flow is untouched and remains the fallback for expired server state.How to test
customendpointprovider with"apiType": "responses"against a server that echoesstore: false.previous_response_idand is rejected. After: the follow-up carries the full input and succeeds.Added spec coverage:
responsesApi.spec.ts(marker emitted forstore: trueand absent, not forstore: false) andopenAIEndpoint.spec.ts(a non-resp_marker in history yields full input and noprevious_response_id).