Fix BYOK invalid stateful marker retries - #317292
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
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
|
I built and tested it locally and it works without any problems. |
- add missing ChatResponse success fields - keep makeChatRequest2 regression tests typed
93d5f13
|
Fixed two type checks in the tests. |
|
All tests have passed, and there are no conflicts at the moment, so all that's left is the approval review. |
|
|
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