Fix BYOK invalid stateful marker retries#317292
Open
PenguinDOOM wants to merge 4 commits into
Open
Conversation
- add BYOK Responses retry regression for ignored stateful marker - preserve non-ZDR initial request and ZDR guard coverage
- keep explicit ignoreStatefulMarker on non-ZDR retries - retain existing ZDR and shared Responses behavior
- clarify initial-request default vs retry override - point retry-time override at parent retry flow
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets a BYOK (OpenAI-compatible) Responses API retry regression where InvalidStatefulMarker retries are supposed to re-send the request without previous_response_id, but the BYOK endpoint path can overwrite the retry’s ignoreStatefulMarker: true.
Changes:
- Preserve an explicit
ignoreStatefulMarker: trueinOpenAIEndpoint.createRequestBody()while still enforcing ZDR behavior. - Add BYOK unit tests asserting
previous_response_idinclusion/omission behavior andstoresemantics for ZDR vs non-ZDR.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extensions/copilot/src/extension/byok/node/openAIEndpoint.ts | Adjusts how ignoreStatefulMarker is derived for Responses bodies; updates comment around initial-request defaults in makeChatRequest2. |
| extensions/copilot/src/extension/byok/node/test/openAIEndpoint.spec.ts | Adds regression coverage for previous_response_id suppression/preservation and ZDR store behavior. |
- keep caller-supplied ignoreStatefulMarker values - add makeChatRequest2 regression coverage
Author
|
I built and tested it locally and it works without any problems. |
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.
This fixes the BYOK Responses retry path for InvalidStatefulMarker errors.
When the shared retry flow retries with ignoreStatefulMarker=true, the BYOK OpenAI endpoint now preserves that explicit suppression instead of overwriting it back to false. This keeps retry requests from re-sending a stale previous_response_id while preserving the existing non-ZDR initial-request behavior and ZDR semantics.
Tests added and verified:
Fixes #316747